Skip to content

Commit

Permalink
Merge pull request marcinbor85#17 from polluks/main
Browse files Browse the repository at this point in the history
Fixed typos
  • Loading branch information
marcinbor85 authored Jun 20, 2024
2 parents 20b9bd1 + 2004ae9 commit fdf40d0
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion examples/DemoAdvanced/node_bin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void set_exec_callback(struct ush_object *self, struct ush_file_descripto
// bin directory files descriptor
static const struct ush_file_descriptor bin_files[] = {
{
.name = "toggle", // toogle file name
.name = "toggle", // toggle file name
.description = "toggle led", // optional file description
.help = "usage: toggle\r\n", // optional help manual
.exec = toggle_exec_callback, // optional execute callback
Expand Down
2 changes: 1 addition & 1 deletion examples/DemoBasic/DemoBasic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static const struct ush_file_descriptor root_files[] = {
// bin directory files descriptor
static const struct ush_file_descriptor bin_files[] = {
{
.name = "toggle", // toogle file name
.name = "toggle", // toggle file name
.description = "toggle led", // optional file description
.help = "usage: toggle\r\n", // optional help manual
.exec = toggle_exec_callback, // optional execute callback
Expand Down
4 changes: 2 additions & 2 deletions src/inc/ush_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern const size_t g_ush_buildin_commands_num;
* @param file_list - pointer to added commands files array
* @param file_list_size - added commands files array size
*
* @return ush_status_t - USH_STATUS_OK when successfull, otherwise error
* @return ush_status_t - USH_STATUS_OK when successful, otherwise error
*/
ush_status_t ush_commands_add(struct ush_object *self, struct ush_node_object *node, const struct ush_file_descriptor *file_list, size_t file_list_size);

Expand All @@ -60,7 +60,7 @@ ush_status_t ush_commands_add(struct ush_object *self, struct ush_node_object *n
* @param self - pointer to master ush object
* @param node - pointer to removed ush node object supervisor of commands file array
*
* @return USH_STATUS_OK when successfull, otherwise error
* @return USH_STATUS_OK when successful, otherwise error
*/
ush_status_t ush_commands_remove(struct ush_object *self, struct ush_node_object *node);

Expand Down
2 changes: 1 addition & 1 deletion src/inc/ush_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extern "C" {
* @param self - pointer to master ush object
* @param name - pointer to file name to search
*
* @return pointer to ush file descriptor when successfull, otherwise NULL
* @return pointer to ush file descriptor when successful, otherwise NULL
*/
struct ush_file_descriptor const* ush_file_find_by_name(struct ush_object *self, const char *name);

Expand Down
12 changes: 6 additions & 6 deletions src/inc/ush_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
* @param file_list - pointer to mounted path files array
* @param file_list_size - mounted path files array size
*
* @return ush_status_t - USH_STATUS_OK when successfull, otherwise error
* @return ush_status_t - USH_STATUS_OK when successful, otherwise error
*/
ush_status_t ush_node_mount(struct ush_object *self, const char *path, struct ush_node_object *node, const struct ush_file_descriptor *file_list, size_t file_list_size);

Expand All @@ -58,7 +58,7 @@ ush_status_t ush_node_mount(struct ush_object *self, const char *path, struct us
* @param self - pointer to master ush object
* @param node - pointer to unmounted ush node object supervisor of path
*
* @return ush_status_t - USH_STATUS_OK when successfull, otherwise error
* @return ush_status_t - USH_STATUS_OK when successful, otherwise error
*/
ush_status_t ush_node_unmount(struct ush_object *self, const char *path);

Expand All @@ -70,7 +70,7 @@ ush_status_t ush_node_unmount(struct ush_object *self, const char *path);
* @param self - pointer to master ush object
* @param path - pointer to absolute path name to set
*
* @return ush_status_t - USH_STATUS_OK when successfull, otherwise error
* @return ush_status_t - USH_STATUS_OK when successful, otherwise error
*/
ush_status_t ush_node_set_current_dir(struct ush_object *self, const char *path);

Expand Down Expand Up @@ -102,15 +102,15 @@ void ush_node_deinit_recursive(struct ush_object *self, struct ush_node_object *
* @brief Get parent node by path.
*
* Function is used to search parent node by path.
* Searching is performed by modifing path to 1-level upper.
* Searching is performed by modifying path to 1-level upper.
* It checks whetever the path name have parent node or not.
* It doesn't operate on the mounted paths, so paths may not be exist at all.
* Path must be absolute.
*
* @param self - pointer to master ush object
* @param path - pointer to path name
*
* @return pointer to ush node object when successfull, otherwise NULL
* @return pointer to ush node object when successful, otherwise NULL
*/
struct ush_node_object* ush_node_get_parent_by_path(struct ush_object *self, const char *path);

Expand All @@ -124,7 +124,7 @@ struct ush_node_object* ush_node_get_parent_by_path(struct ush_object *self, con
* @param self - pointer to master ush object
* @param path - pointer to path name
*
* @return pointer to ush node object when successfull, otherwise NULL
* @return pointer to ush node object when successful, otherwise NULL
*/
struct ush_node_object* ush_node_get_by_path(struct ush_object *self, const char *path);

Expand Down
8 changes: 4 additions & 4 deletions src/inc/ush_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ extern "C" {

/** State values enumerators for return values. */
typedef enum {
USH_STATUS_OK, /**< Successfull operation */
USH_STATUS_OK, /**< Successful operation */
USH_STATUS_ERROR_NODE_NOT_FOUND, /**< Node not found nor exists */
USH_STATUS_ERROR_NODE_WITH_CHILDS, /**< Cannot unmount node with childs */
USH_STATUS_ERROR_NODE_WITH_CHILDS, /**< Cannot unmount node with children */
USH_STATUS_ERROR_NODE_WITHOUT_PARENT, /**< Cannot mount node because there is no parent */
USH_STATUS_ERROR_NODE_ALREADY_MOUNTED, /**< Mount point already exists */
USH_STATUS_ERROR_COMMAND_SYNTAX_ERROR, /**< Syntax error or unknown command */
Expand Down Expand Up @@ -187,7 +187,7 @@ struct ush_node_object {
char const *path; /**< Node path, set after node mount */

struct ush_node_object *parent; /**< Pointer to parent node if not root */
struct ush_node_object *childs; /**< Pointer to childs node (1-level down) */
struct ush_node_object *children; /**< Pointer to children node (1-level down) */
struct ush_node_object *next; /**< Pointer to next node (on the same parent) */
};

Expand All @@ -202,7 +202,7 @@ struct ush_node_object {
* @param self - pointer to master ush object
* @param ch - pointer to char variable where read byte should be placed
*
* @return should return 1 on read successful, otherwise 0 when no data avaialble
* @return should return 1 on read successful, otherwise 0 when no data available
*/
typedef int (*ush_io_interface_read_char)(struct ush_object *self, char *ch);

Expand Down
10 changes: 5 additions & 5 deletions src/inc/ush_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ char* ush_utils_path_last(const char *in_path);
*
* Function used to get path with specified level.
* It based on the input path.
* It doesn't modify source path, because it is common to use this funciton in loops.
* Output path will be always shorter than input, so user have to ensure that output buffer will be long enought.
* It doesn't modify source path, because it is common to use this function in loops.
* Output path will be always shorter than input, so user have to ensure that output buffer will be long enough.
* Path must be be absolute.
*
* @param level - level of path
Expand All @@ -99,7 +99,7 @@ void ush_utils_get_path_level(size_t level, const char *in_path, char *out_path)
* @brief Join path and file name.
*
* Function used to join path and file name.
* User have to ensure that output buffer will be long enought to join them.
* User have to ensure that output buffer will be long enough to join them.
* Path could be relative or absolute.
*
* @param in_path - pointer to input path string
Expand Down Expand Up @@ -151,13 +151,13 @@ bool ush_utils_is_printable(uint8_t ch);
* Function used to convert ASCII text string to binary.
* It used "\" escape character followed by "x" to encode byte hex numbers.
* It accept lower and upper hex chars.
* When hex char is invalid, it is overrided by 0.
* When hex char is invalid, it is overridden by 0.
*
* @param input - pointer to input string (null-terminated)
* @param output - pointer to place where will be placed binary data
* @param max_size - output buffer maximum size
*
* @return number of bytes successfully writed to output buffer
* @return number of bytes successfully written to output buffer
*/
size_t ush_utils_decode_ascii(char *input, uint8_t *output, size_t max_size);

Expand Down
2 changes: 1 addition & 1 deletion src/src/commands/ush_cmd_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool ush_buildin_cmd_ls_service(struct ush_object *self, struct ush_file_descrip
USH_STATE_PROCESS_SERVICE
);
}
self->process_child_node = self->process_node->childs;
self->process_child_node = self->process_node->children;
self->process_index = 0;
break;
case USH_STATE_PROCESS_SERVICE:
Expand Down
2 changes: 1 addition & 1 deletion src/src/ush_autocomp_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void ush_autocomp_check_for_finish(struct ush_object *self)
self->process_node = self->current_node;
}

self->process_node = self->process_node->childs;
self->process_node = self->process_node->children;
self->process_index = 0;
self->process_index_item = 0;
self->process_stage = 2;
Expand Down
8 changes: 4 additions & 4 deletions src/src/ush_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct ush_node_object* ush_node_get_by_path(struct ush_object *self, const char
if (self->root == NULL)
return NULL;

struct ush_node_object *curr = self->root->childs;
struct ush_node_object *curr = self->root->children;
for (size_t i = 1; i <= levels; i++) {
ush_utils_get_path_level(i, path, level_path);

Expand All @@ -60,7 +60,7 @@ struct ush_node_object* ush_node_get_by_path(struct ush_object *self, const char
if (i == levels)
return curr;

curr = curr->childs;
curr = curr->children;
}


Expand Down Expand Up @@ -98,8 +98,8 @@ void ush_node_deinit_recursive(struct ush_object *self, struct ush_node_object *
struct ush_node_object *curr = node;

while (curr != NULL) {
if (curr->childs != NULL)
ush_node_deinit_recursive(self, curr->childs);
if (curr->children != NULL)
ush_node_deinit_recursive(self, curr->children);

struct ush_node_object *tmp = curr->next;
memset((uint8_t*)curr, 0, sizeof(struct ush_node_object));
Expand Down
10 changes: 5 additions & 5 deletions src/src/ush_node_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ ush_status_t ush_node_mount(struct ush_object *self, const char *path, struct us

struct ush_node_object *node_parent = ush_node_get_parent_by_path(self, path);
if (node_parent != NULL) {
node->next = node_parent->childs;
node_parent->childs = node;
node->next = node_parent->children;
node_parent->children = node;
node->parent = node_parent;
return USH_STATUS_OK;
}
Expand All @@ -75,7 +75,7 @@ ush_status_t ush_node_unmount(struct ush_object *self, const char *path)
if ((node == NULL) || ((node != self->root) && (parent_node == NULL)))
return USH_STATUS_ERROR_NODE_NOT_FOUND;

if (node->childs != NULL)
if (node->children != NULL)
return USH_STATUS_ERROR_NODE_WITH_CHILDS;

if (parent_node == NULL) {
Expand All @@ -84,7 +84,7 @@ ush_status_t ush_node_unmount(struct ush_object *self, const char *path)
}

struct ush_node_object *prev = NULL;
struct ush_node_object *curr = parent_node->childs;
struct ush_node_object *curr = parent_node->children;

while (curr != NULL) {
if (curr != node) {
Expand All @@ -93,7 +93,7 @@ ush_status_t ush_node_unmount(struct ush_object *self, const char *path)
continue;
}
if (prev == NULL) {
parent_node->childs = node->next;
parent_node->children = node->next;
} else {
prev->next = node->next;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/func_tests/test_func_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void test_printf_long(void)

void test_printf_format_error(void)
{
/* Test simple string and and then concatentate invalid formatting options */
/* Test simple string and and then concatenate invalid formatting options */
ush_printf(&g_ush, "string0");
ush_printf(&g_ush, "%lc", 0xffffffff);
test_func_read_all();
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/test_unit_autocomp_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void test_ush_autocomp_check_for_finish(void)
ush.process_stage = i;

struct ush_node_object node = {0};
node.childs = (struct ush_node_object*)1234;
node.children = (struct ush_node_object*)1234;

ush.process_index = 10;
ush.process_index_item = 20;
Expand All @@ -261,7 +261,7 @@ void test_ush_autocomp_check_for_finish(void)
ush.process_stage = i;

struct ush_node_object node_current = {0};
node_current.childs = (struct ush_node_object*)5678;
node_current.children = (struct ush_node_object*)5678;

ush.process_index = 10;
ush.process_index_item = 20;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/test_unit_cmd_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void test_ush_buildin_cmd_ls_service_start(void)
ush.process_node = &node;
ush.process_index = 10;
node.parent = NULL;
node.childs = (struct ush_node_object*)1234;
node.children = (struct ush_node_object*)1234;
ush_write_pointer_text = "d---- " USH_SHELL_FONT_COLOR_GREEN "." USH_SHELL_FONT_STYLE_RESET "\r\n";
ush_write_pointer_state = USH_STATE_PROCESS_SERVICE;
TEST_ASSERT_TRUE(ush_buildin_cmd_ls_service(&ush, &file));
Expand All @@ -233,7 +233,7 @@ void test_ush_buildin_cmd_ls_service_start(void)
ush.process_node = &node;
ush.process_index = 10;
node.parent = (struct ush_node_object*)5678;
node.childs = (struct ush_node_object*)1234;
node.children = (struct ush_node_object*)1234;
ush_write_pointer_text =
"d---- " USH_SHELL_FONT_COLOR_GREEN "." USH_SHELL_FONT_STYLE_RESET "\r\n"
"d---- " USH_SHELL_FONT_COLOR_GREEN ".." USH_SHELL_FONT_STYLE_RESET "\r\n";
Expand Down
20 changes: 10 additions & 10 deletions tests/unit_tests/test_unit_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void setUp(void)
ush.desc = &ush_desc;
root.path = "/";

root.childs = &node1;
root.children = &node1;
node1.next = &node2;
node1.parent = &root;
node1.path = "/1";
Expand All @@ -76,26 +76,26 @@ void setUp(void)
node3.parent = &root;
node3.path = "/3";

node1.childs = &node11;
node1.children = &node11;
node11.next = &node12;
node11.parent = &node1;
node11.path = "/1/1";

node12.childs = &node121;
node12.children = &node121;
node12.path = "/1/2";
node121.parent = &node12;
node121.path = "/1/2/1";

node2.childs = &node21;
node2.children = &node21;
node2.path = "/2";
node21.parent = &node2;
node21.path = "/2/1";

node3.childs = &node31;
node3.children = &node31;
node3.path = "/3";
node31.parent = &node3;
node31.path = "/3/1";
node31.childs = &node311;
node31.children = &node311;
node311.parent = &node31;
node311.path = "/3/1/1";
}
Expand All @@ -115,7 +115,7 @@ void test_ush_node_get_by_path_null(void)

setUp();
ush.root = &node;
node.childs = NULL;
node.children = NULL;
TEST_ASSERT_NULL(ush_node_get_by_path(&ush, "/1"));
}

Expand Down Expand Up @@ -221,13 +221,13 @@ void test_ush_node_deinit_recursive(void)
struct ush_node_object node3 = {0};

memset((uint8_t*)&node, 0xFF, sizeof(struct ush_node_object));
node.childs = NULL;
node.children = NULL;
node.next = &node2;
memset((uint8_t*)&node2, 0xFF, sizeof(struct ush_node_object));
node2.childs = &node3;
node2.children = &node3;
node2.next = NULL;
memset((uint8_t*)&node3, 0xFF, sizeof(struct ush_node_object));
node3.childs = NULL;
node3.children = NULL;
node3.next = NULL;

ush_node_deinit_recursive(&ush, &node);
Expand Down
Loading

0 comments on commit fdf40d0

Please sign in to comment.