From 3d4701a6e41616cf581a297bab1451cf2db70249 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Tue, 14 Jul 2009 13:57:45 +0000 Subject: 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 --- apps/gui/gwps-common.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'apps/gui/gwps-common.c') diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index f480f616a2..c0923a9ab5 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -659,8 +659,7 @@ static char* get_dir(char* buf, int buf_size, const char* path, int level) return NULL; len = MIN(last_sep - sep, buf_size - 1); - strncpy(buf, sep + 1, len); - buf[len] = 0; + strlcpy(buf, sep + 1, len + 1); return buf; } @@ -1183,12 +1182,12 @@ static const char *get_token_value(struct gui_wps *gwps, { /* we need 11 characters (full line) for progress-bar */ - strncpy(buf, " ", buf_size); + strlcpy(buf, " ", buf_size); } else { /* Tell the user if we have an OldPlayer */ - strncpy(buf, " ", buf_size); + strlcpy(buf, " ", buf_size); } return buf; #endif @@ -1254,11 +1253,11 @@ static const char *get_token_value(struct gui_wps *gwps, break; case 2: case 4: - strncpy(buf, id3->track_gain_string, buf_size); + strlcpy(buf, id3->track_gain_string, buf_size); break; case 3: case 5: - strncpy(buf, id3->album_gain_string, buf_size); + strlcpy(buf, id3->album_gain_string, buf_size); break; } return buf; -- cgit v1.2.3