summaryrefslogtreecommitdiff
path: root/apps/radio/presets.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-11-14 11:32:34 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-11-14 23:56:16 -0500
commitf6c719d7ec71cc7771c46d3daa390924a3871ba3 (patch)
treee6209f23565db01809f75067247e667963092ff6 /apps/radio/presets.c
parentb25a9d8f99b75570d18ea64602de7fe48da612d6 (diff)
downloadrockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.tar.gz
rockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.zip
replace strlcpy with strmemccpy
replace applicable calls to strlcpy with calls to strmemccpy which null terminates on truncation in theory the strmemccpy calls should be slightly faster since they don't traverse the rest of the source string on truncation but I seriously doubt there is too much of that going on in the code base Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2
Diffstat (limited to 'apps/radio/presets.c')
-rw-r--r--apps/radio/presets.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/radio/presets.c b/apps/radio/presets.c
index 6966f7e591..1cd85637e8 100644
--- a/apps/radio/presets.c
+++ b/apps/radio/presets.c
@@ -225,7 +225,7 @@ void radio_load_presets(char *filename)
225 } 225 }
226 /* Temporary preset, loaded until player shuts down. */ 226 /* Temporary preset, loaded until player shuts down. */
227 else if(filename[0] == '/') 227 else if(filename[0] == '/')
228 strlcpy(filepreset, filename, sizeof(filepreset)); 228 strmemccpy(filepreset, filename, sizeof(filepreset));
229 /* Preset from default directory. */ 229 /* Preset from default directory. */
230 else 230 else
231 snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", 231 snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr",
@@ -246,7 +246,7 @@ void radio_load_presets(char *filename)
246 { 246 {
247 struct fmstation * const fms = &presets[num_presets]; 247 struct fmstation * const fms = &presets[num_presets];
248 fms->frequency = f; 248 fms->frequency = f;
249 strlcpy(fms->name, name, MAX_FMPRESET_LEN+1); 249 strmemccpy(fms->name, name, MAX_FMPRESET_LEN+1);
250 num_presets++; 250 num_presets++;
251 } 251 }
252 } 252 }