summaryrefslogtreecommitdiff
path: root/apps/cuesheet.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/cuesheet.c
parentc2900a1bacd5d98b57a0d15ea2add1bc08764057 (diff)
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/cuesheet.c')
-rw-r--r--apps/cuesheet.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index aace64a8fc..fa1d93f334 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -84,7 +84,7 @@ bool look_for_cuesheet_file(const char *trackpath, char *found_cue_path)
return false;
}
- strncpy(cuepath, trackpath, MAX_PATH);
+ strlcpy(cuepath, trackpath, MAX_PATH);
dot = strrchr(cuepath, '.');
strcpy(dot, ".cue");
@@ -103,7 +103,7 @@ bool look_for_cuesheet_file(const char *trackpath, char *found_cue_path)
}
if (found_cue_path)
- strncpy(found_cue_path, cuepath, MAX_PATH);
+ strlcpy(found_cue_path, cuepath, MAX_PATH);
return true;
}
@@ -205,8 +205,7 @@ bool parse_cuesheet(char *file, struct cuesheet *cue)
}
else
{
- strncpy(dest, string, MAX_NAME*3);
- dest[MAX_NAME*3] = '\0';
+ strlcpy(dest, string, MAX_NAME*3 + 1);
}
}
}
@@ -218,10 +217,10 @@ bool parse_cuesheet(char *file, struct cuesheet *cue)
for (i = 0; i < cue->track_count; i++)
{
if (*(cue->tracks[i].performer) == '\0')
- strncpy(cue->tracks[i].performer, cue->performer, MAX_NAME*3);
+ strlcpy(cue->tracks[i].performer, cue->performer, MAX_NAME*3);
if (*(cue->tracks[i].songwriter) == '\0')
- strncpy(cue->tracks[i].songwriter, cue->songwriter, MAX_NAME*3);
+ strlcpy(cue->tracks[i].songwriter, cue->songwriter, MAX_NAME*3);
}
return true;
@@ -271,7 +270,7 @@ static char *list_get_name_cb(int selected_item,
struct cuesheet *cue = (struct cuesheet *)data;
if (selected_item & 1)
- strncpy(buffer, cue->tracks[selected_item/2].title, buffer_len);
+ strlcpy(buffer, cue->tracks[selected_item/2].title, buffer_len);
else
snprintf(buffer, buffer_len, "%02d. %s", selected_item/2+1,
cue->tracks[selected_item/2].performer);