summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-07-28 16:35:11 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-07-28 17:02:28 -0400
commitc5e1539c74f55a94655c5b06749c94227dd7fd38 (patch)
tree26ad420fb18b90ed28662983f152f80b8514bdc2 /apps
parent86bff6214df36816abf760b3ec742dfdb4d62566 (diff)
downloadrockbox-c5e1539c74f55a94655c5b06749c94227dd7fd38.tar.gz
rockbox-c5e1539c74f55a94655c5b06749c94227dd7fd38.zip
talk: When mangling paths, use PATH_SEPCH/SEPSTR
Strictly speaking all of our paths need to work this way.. Change-Id: Id30d26cccdb80eceb7daf9ad04dfd53591b1921f
Diffstat (limited to 'apps')
-rw-r--r--apps/talk.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/talk.c b/apps/talk.c
index ab4a97397c..c590c5db1b 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -777,7 +777,7 @@ static int _talk_spell(const char* spell, size_t len, bool enqueue)
777 talk_id(VOICE_DOT, true); 777 talk_id(VOICE_DOT, true);
778 else if (c == ' ') 778 else if (c == ' ')
779 talk_id(VOICE_PAUSE, true); 779 talk_id(VOICE_PAUSE, true);
780 else if (c == '/') 780 else if (c == PATH_SEPCH)
781 talk_id(VOICE_CHAR_SLASH, true); 781 talk_id(VOICE_CHAR_SLASH, true);
782 782
783 while (QUEUE_LEVEL == QUEUE_SIZE - 1) /* queue full - busy loop */ 783 while (QUEUE_LEVEL == QUEUE_SIZE - 1) /* queue full - busy loop */
@@ -1140,12 +1140,12 @@ int talk_file(const char *root, const char *dir, const char *file,
1140{ 1140{
1141 char buf[MAX_PATH]; 1141 char buf[MAX_PATH];
1142 const char *fmt = "%s%s%s%s%s"; 1142 const char *fmt = "%s%s%s%s%s";
1143 /* Does root end with a slash */ 1143 /* Does root end with a slash? */
1144 if(root && root[0] && root[strlen(root)-1] != '/') 1144 if(root && root[0] && root[strlen(root)-1] != PATH_SEPCH)
1145 fmt = "%s/%s%s%s%s"; 1145 fmt = "%s" PATH_SEPSTR "%s%s%s%s";
1146 snprintf(buf, MAX_PATH, fmt, 1146 snprintf(buf, MAX_PATH, fmt,
1147 root ? root : "", 1147 root ? root : "",
1148 dir ? dir : "", dir ? "/" : "", 1148 dir ? dir : "", dir ? PATH_SEPSTR : "",
1149 file ? file : "", 1149 file ? file : "",
1150 ext ? ext : ""); 1150 ext ? ext : "");
1151 return _talk_file(buf, prefix_ids, enqueue); 1151 return _talk_file(buf, prefix_ids, enqueue);
@@ -1207,14 +1207,14 @@ int talk_fullpath(const char* path, bool enqueue)
1207{ 1207{
1208 do_enqueue(enqueue); /* cut off all the pending stuff */ 1208 do_enqueue(enqueue); /* cut off all the pending stuff */
1209 1209
1210 if(path[0] != '/') 1210 if(path[0] != PATH_SEPCH)
1211 /* path ought to start with /... */ 1211 /* path ought to start with /... */
1212 return talk_spell(path, true); 1212 return talk_spell(path, true);
1213 talk_id(VOICE_CHAR_SLASH, true); 1213 talk_id(VOICE_CHAR_SLASH, true);
1214 char buf[MAX_PATH]; 1214 char buf[MAX_PATH];
1215 strmemccpy(buf, path, MAX_PATH); 1215 strmemccpy(buf, path, MAX_PATH);
1216 char *start = buf+1; /* start of current component */ 1216 char *start = buf+1; /* start of current component */
1217 char *ptr = strchr(start, '/'); /* end of current component */ 1217 char *ptr = strchr(start, PATH_SEPCH); /* end of current component */
1218 while(ptr) { /* There are more slashes ahead */ 1218 while(ptr) { /* There are more slashes ahead */
1219 /* temporarily poke a NULL at end of component to truncate string */ 1219 /* temporarily poke a NULL at end of component to truncate string */
1220 *ptr = '\0'; 1220 *ptr = '\0';
@@ -1226,10 +1226,10 @@ int talk_fullpath(const char* path, bool enqueue)
1226 } else 1226 } else
1227#endif 1227#endif
1228 talk_dir_or_spell(buf, NULL, true); 1228 talk_dir_or_spell(buf, NULL, true);
1229 *ptr = '/'; /* restore string */ 1229 *ptr = PATH_SEPCH; /* restore string */
1230 talk_id(VOICE_CHAR_SLASH, true); 1230 talk_id(VOICE_CHAR_SLASH, true);
1231 start = ptr+1; /* setup for next component */ 1231 start = ptr+1; /* setup for next component */
1232 ptr = strchr(start, '/'); 1232 ptr = strchr(start, PATH_SEPCH);
1233 } 1233 }
1234 1234
1235 /* no more slashes, final component is a filename */ 1235 /* no more slashes, final component is a filename */