summaryrefslogtreecommitdiff
path: root/apps/tree.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/tree.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/tree.c')
-rw-r--r--apps/tree.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 1939c7ee05..23a909281d 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -383,7 +383,7 @@ static int update_dir(void)
383 { 383 {
384 if (ft_load(&tc, NULL) < 0) 384 if (ft_load(&tc, NULL) < 0)
385 return -1; 385 return -1;
386 strlcpy(lastdir, tc.currdir, MAX_PATH); 386 strmemccpy(lastdir, tc.currdir, MAX_PATH);
387 changed = true; 387 changed = true;
388 } 388 }
389 } 389 }
@@ -573,7 +573,7 @@ void set_current_file(const char *path)
573 name = strrchr(path+1,'/'); 573 name = strrchr(path+1,'/');
574 if (name) 574 if (name)
575 { 575 {
576 strlcpy(tc.currdir, path, name - path + 1); 576 strmemccpy(tc.currdir, path, name - path + 1);
577 name++; 577 name++;
578 } 578 }
579 else 579 else
@@ -582,7 +582,7 @@ void set_current_file(const char *path)
582 name = path+1; 582 name = path+1;
583 } 583 }
584 584
585 strlcpy(lastfile, name, MAX_PATH); 585 strmemccpy(lastfile, name, MAX_PATH);
586 586
587 587
588 /* If we changed dir we must recalculate the dirlevel 588 /* If we changed dir we must recalculate the dirlevel
@@ -1007,7 +1007,7 @@ int rockbox_browse(struct browse_context *browse)
1007 tc.selected_item = 0; 1007 tc.selected_item = 0;
1008 tc.dirlevel = 0; 1008 tc.dirlevel = 0;
1009 1009
1010 strlcpy(tc.currdir, browse->root, sizeof(tc.currdir)); 1010 strmemccpy(tc.currdir, browse->root, sizeof(tc.currdir));
1011 } 1011 }
1012 1012
1013 start_wps = false; 1013 start_wps = false;
@@ -1030,7 +1030,7 @@ int rockbox_browse(struct browse_context *browse)
1030 if (dirfilter != SHOW_ID3DB) 1030 if (dirfilter != SHOW_ID3DB)
1031 tc.dirfilter = &global_settings.dirfilter; 1031 tc.dirfilter = &global_settings.dirfilter;
1032 tc.browse = browse; 1032 tc.browse = browse;
1033 strlcpy(current, browse->root, MAX_PATH); 1033 strmemccpy(current, browse->root, MAX_PATH);
1034 set_current_file(current); 1034 set_current_file(current);
1035 if (browse->flags&BROWSE_RUNFILE) 1035 if (browse->flags&BROWSE_RUNFILE)
1036 ret_val = ft_enter(&tc); 1036 ret_val = ft_enter(&tc);