summaryrefslogtreecommitdiffstats
path: root/apps/tagtree.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-07-14 13:57:45 +0000
committerNils Wallménius <nils@rockbox.org>2009-07-14 13:57:45 +0000
commit3d4701a6e41616cf581a297bab1451cf2db70249 (patch)
treef845837c96ffbed7d59ddf8308f3b3e7c40cb8c9 /apps/tagtree.c
parentc2900a1bacd5d98b57a0d15ea2add1bc08764057 (diff)
downloadrockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.gz
rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.tar.bz2
rockbox-3d4701a6e41616cf581a297bab1451cf2db70249.zip
FS#10080
* Move strncpy() from core to the pluginlib * Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins * Drop strncpy() from the codec api as no codec used it * Bump codec and plugin api versions git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tagtree.c')
-rw-r--r--apps/tagtree.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 691b2273de..5d61589eab 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -593,7 +593,7 @@ static bool parse_search(struct menu_entry *entry, const char *str)
menus[menu_count] = buffer_alloc(sizeof(struct menu_root));
new_menu = menus[menu_count];
memset(new_menu, 0, sizeof(struct menu_root));
- strncpy(new_menu->id, buf, MAX_MENU_ID_SIZE-1);
+ strlcpy(new_menu->id, buf, MAX_MENU_ID_SIZE);
entry->link = menu_count;
++menu_count;
@@ -839,7 +839,7 @@ static int parse_line(int n, const char *buf, void *parameters)
menu = menus[menu_count];
++menu_count;
memset(menu, 0, sizeof(struct menu_root));
- strncpy(menu->id, data, MAX_MENU_ID_SIZE-1);
+ strlcpy(menu->id, data, MAX_MENU_ID_SIZE);
}
if (get_token_str(menu->title, sizeof(menu->title)) < 0)
@@ -1442,8 +1442,8 @@ int tagtree_enter(struct tree_context* c)
csi = menu->items[seek]->si;
c->currextra = 0;
- strncpy(current_title[c->currextra], dptr->name,
- sizeof(current_title[0]) - 1);
+ strlcpy(current_title[c->currextra], dptr->name,
+ sizeof(current_title[0]));
/* Read input as necessary. */
for (i = 0; i < csi->tagorder_count; i++)
@@ -1464,7 +1464,7 @@ int tagtree_enter(struct tree_context* c)
if (source == source_current_path && id3)
{
char *e;
- strncpy(searchstring, id3->path, SEARCHSTR_SIZE);
+ strlcpy(searchstring, id3->path, SEARCHSTR_SIZE);
e = strrchr(searchstring, '/');
if (e)
*e = '\0';
@@ -1477,8 +1477,7 @@ int tagtree_enter(struct tree_context* c)
char **src = (char**)((char*)id3 + offset);
if (*src)
{
- strncpy(searchstring, *src, SEARCHSTR_SIZE);
- searchstring[SEARCHSTR_SIZE-1] = '\0';
+ strlcpy(searchstring, *src, SEARCHSTR_SIZE);
}
}
else
@@ -1528,8 +1527,8 @@ int tagtree_enter(struct tree_context* c)
c->dirlevel--;
/* Update the statusbar title */
- strncpy(current_title[c->currextra], dptr->name,
- sizeof(current_title[0]) - 1);
+ strlcpy(current_title[c->currextra], dptr->name,
+ sizeof(current_title[0]));
break;
default: