summaryrefslogtreecommitdiffstats
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
parent86bff6214df36816abf760b3ec742dfdb4d62566 (diff)
downloadrockbox-c5e1539c74.tar.gz
rockbox-c5e1539c74.zip
talk: When mangling paths, use PATH_SEPCH/SEPSTR
Strictly speaking all of our paths need to work this way.. Change-Id: Id30d26cccdb80eceb7daf9ad04dfd53591b1921f
-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)
talk_id(VOICE_DOT, true);
else if (c == ' ')
talk_id(VOICE_PAUSE, true);
- else if (c == '/')
+ else if (c == PATH_SEPCH)
talk_id(VOICE_CHAR_SLASH, true);
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,
{
char buf[MAX_PATH];
const char *fmt = "%s%s%s%s%s";
- /* Does root end with a slash */
- if(root && root[0] && root[strlen(root)-1] != '/')
- fmt = "%s/%s%s%s%s";
+ /* Does root end with a slash? */
+ if(root && root[0] && root[strlen(root)-1] != PATH_SEPCH)
+ fmt = "%s" PATH_SEPSTR "%s%s%s%s";
snprintf(buf, MAX_PATH, fmt,
root ? root : "",
- dir ? dir : "", dir ? "/" : "",
+ dir ? dir : "", dir ? PATH_SEPSTR : "",
file ? file : "",
ext ? ext : "");
return _talk_file(buf, prefix_ids, enqueue);
@@ -1207,14 +1207,14 @@ int talk_fullpath(const char* path, bool enqueue)
{
do_enqueue(enqueue); /* cut off all the pending stuff */
- if(path[0] != '/')
+ if(path[0] != PATH_SEPCH)
/* path ought to start with /... */
return talk_spell(path, true);
talk_id(VOICE_CHAR_SLASH, true);
char buf[MAX_PATH];
strmemccpy(buf, path, MAX_PATH);
char *start = buf+1; /* start of current component */
- char *ptr = strchr(start, '/'); /* end of current component */
+ char *ptr = strchr(start, PATH_SEPCH); /* end of current component */
while(ptr) { /* There are more slashes ahead */
/* temporarily poke a NULL at end of component to truncate string */
*ptr = '\0';
@@ -1226,10 +1226,10 @@ int talk_fullpath(const char* path, bool enqueue)
} else
#endif
talk_dir_or_spell(buf, NULL, true);
- *ptr = '/'; /* restore string */
+ *ptr = PATH_SEPCH; /* restore string */
talk_id(VOICE_CHAR_SLASH, true);
start = ptr+1; /* setup for next component */
- ptr = strchr(start, '/');
+ ptr = strchr(start, PATH_SEPCH);
}
/* no more slashes, final component is a filename */