diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-14 11:32:34 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-14 23:56:16 -0500 |
commit | f6c719d7ec71cc7771c46d3daa390924a3871ba3 (patch) | |
tree | e6209f23565db01809f75067247e667963092ff6 /apps/radio | |
parent | b25a9d8f99b75570d18ea64602de7fe48da612d6 (diff) | |
download | rockbox-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')
-rw-r--r-- | apps/radio/presets.c | 4 | ||||
-rw-r--r-- | apps/radio/radioart.c | 2 |
2 files changed, 3 insertions, 3 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 | } |
diff --git a/apps/radio/radioart.c b/apps/radio/radioart.c index 34efdea0da..230948c051 100644 --- a/apps/radio/radioart.c +++ b/apps/radio/radioart.c | |||
@@ -82,7 +82,7 @@ static int load_radioart_image(struct radioart *ra, const char* preset_name, | |||
82 | #endif | 82 | #endif |
83 | return -1; | 83 | return -1; |
84 | } | 84 | } |
85 | strlcpy(ra->name, preset_name, MAX_FMPRESET_LEN+1); | 85 | strmemccpy(ra->name, preset_name, MAX_FMPRESET_LEN+1); |
86 | ra->dim.height = dim->height; | 86 | ra->dim.height = dim->height; |
87 | ra->dim.width = dim->width; | 87 | ra->dim.width = dim->width; |
88 | ra->last_tick = current_tick; | 88 | ra->last_tick = current_tick; |