summaryrefslogtreecommitdiff
path: root/apps/screens.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/screens.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/screens.c')
-rw-r--r--apps/screens.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 9191922c31..db24e534c1 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -20,7 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23#include <string.h> 23#include <string-extra.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#include "backlight.h" 26#include "backlight.h"
@@ -562,8 +562,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
562 if (!id3->comment) 562 if (!id3->comment)
563 return NULL; 563 return NULL;
564 564
565 if (!memccpy (buffer, id3->comment, '\0', buffer_len)) 565 strmemccpy(buffer, id3->comment, buffer_len);
566 buffer[buffer_len - 1] = '\0';
567 566
568 val=buffer; 567 val=buffer;
569 if(say_it && val) 568 if(say_it && val)
@@ -612,8 +611,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
612 if (id3->codectype >= AFMT_NUM_CODECS) 611 if (id3->codectype >= AFMT_NUM_CODECS)
613 return NULL; 612 return NULL;
614 613
615 if (!memccpy (buffer, audio_formats[id3->codectype].label, '\0', buffer_len)) 614 strmemccpy(buffer, audio_formats[id3->codectype].label, buffer_len);
616 buffer[buffer_len - 1] = '\0';
617 615
618 val=buffer; 616 val=buffer;
619 if(say_it) 617 if(say_it)