diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-13 00:43:43 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-13 01:14:49 -0500 |
commit | a634557a881b59b8be1dc156f9822c6d20bd8741 (patch) | |
tree | fd953a0ea1d9a02a8d73a15f1aead27b59c5ffaa /apps | |
parent | ffe2df2e92cbdeb507a49279a85ac88cac2fbe4f (diff) | |
download | rockbox-a634557a881b59b8be1dc156f9822c6d20bd8741.tar.gz rockbox-a634557a881b59b8be1dc156f9822c6d20bd8741.zip |
fix strptokspn, add strcspn, fix splash.c
fix off by 1 error in strptokspn, add strcspn, fix fallout in splash.c
Change-Id: I61475d9633fc35db5a8ae30cbe588f69f2f7fabc
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/splash.c | 11 | ||||
-rw-r--r-- | apps/playback.c | 10 |
2 files changed, 8 insertions, 13 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 65c3ad8c13..d0f1fbb67c 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -73,11 +73,11 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap, | |||
73 | if (!next) | 73 | if (!next) |
74 | return false; /* nothing to display */ | 74 | return false; /* nothing to display */ |
75 | 75 | ||
76 | lines[line].len = next_len + 1; | 76 | lines[line].len = next_len; |
77 | lines[line].str = next; | 77 | lines[line].str = next; |
78 | while (true) | 78 | while (true) |
79 | { | 79 | { |
80 | w = font_getstringnsize(next, next_len + 1, NULL, NULL, fontnum); | 80 | w = font_getstringnsize(next, next_len, NULL, NULL, fontnum); |
81 | if (lastbreak) | 81 | if (lastbreak) |
82 | { | 82 | { |
83 | len = next - lastbreak; | 83 | len = next - lastbreak; |
@@ -90,18 +90,19 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap, | |||
90 | break; /* screen full or out of lines */ | 90 | break; /* screen full or out of lines */ |
91 | x = 0; | 91 | x = 0; |
92 | y += chr_h; | 92 | y += chr_h; |
93 | lines[++line].len = next_len + len; | 93 | lines[++line].len = next_len; |
94 | lines[line].str = next; | 94 | lines[line].str = next; |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | /* restore & calculate spacing */ | 98 | /* restore & calculate spacing */ |
99 | lines[line].len += next_len + len + 1; | 99 | lines[line].len += next_len + 1; |
100 | x += next_w; | 100 | x += next_w; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | x += w; | 103 | x += w; |
104 | lastbreak = next + next_len + 1; | 104 | |
105 | lastbreak = next + next_len; | ||
105 | lastbrkchr = *lastbreak; | 106 | lastbrkchr = *lastbreak; |
106 | 107 | ||
107 | next = strptokspn_r(NULL, matchstr, &next_len, &store); | 108 | next = strptokspn_r(NULL, matchstr, &next_len, &store); |
diff --git a/apps/playback.c b/apps/playback.c index c425e14baf..7eaa149f2c 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1483,7 +1483,7 @@ static bool audio_init_codec(struct track_info *track_infop, | |||
1483 | enum { AUTORESUMABLE_UNKNOWN = 0, AUTORESUMABLE_TRUE, AUTORESUMABLE_FALSE }; | 1483 | enum { AUTORESUMABLE_UNKNOWN = 0, AUTORESUMABLE_TRUE, AUTORESUMABLE_FALSE }; |
1484 | static bool autoresumable(struct mp3entry *id3) | 1484 | static bool autoresumable(struct mp3entry *id3) |
1485 | { | 1485 | { |
1486 | char *endp, *path; | 1486 | char *path; |
1487 | size_t len; | 1487 | size_t len; |
1488 | bool is_resumable; | 1488 | bool is_resumable; |
1489 | 1489 | ||
@@ -1501,13 +1501,7 @@ static bool autoresumable(struct mp3entry *id3) | |||
1501 | if (*path == ':') /* Skip empty search patterns */ | 1501 | if (*path == ':') /* Skip empty search patterns */ |
1502 | continue; | 1502 | continue; |
1503 | 1503 | ||
1504 | /* FIXME: As soon as strcspn or strchrnul are made available in | 1504 | len = strcspn(path, ":"); |
1505 | the core, the following can be made more efficient. */ | ||
1506 | endp = strchr(path, ':'); | ||
1507 | if (endp) | ||
1508 | len = endp - path; | ||
1509 | else | ||
1510 | len = strlen(path); | ||
1511 | 1505 | ||
1512 | /* Note: At this point, len is always > 0 */ | 1506 | /* Note: At this point, len is always > 0 */ |
1513 | 1507 | ||