Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/FFstrbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static inline bool ffStrbufInitJsonVal(FFstrbuf* strbuf, yyjson_val* jsonVal) {

// Not `pure`: the caller-supplied `fn` may have side effects
[[gnu::nonnull(1, 2), nodiscard]] static inline bool ffStrbufEndsWithFn(const FFstrbuf* strbuf, int (*const fn)(int)) {
return strbuf->length == 0 ? false : fn(strbuf->chars[strbuf->length - 1]);
return strbuf->length == 0 ? false : fn((unsigned char)strbuf->chars[strbuf->length - 1]);
}

[[gnu::nonnull(1, 2), gnu::pure, nodiscard]] static inline bool ffStrbufEndsWith(const FFstrbuf* strbuf, const FFstrbuf* end) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/impl/FFstrbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void ffStrbufTrimLeftSpace(FFstrbuf* strbuf) {
}

uint32_t index = 0;
while (index < strbuf->length && isspace(strbuf->chars[index])) {
while (index < strbuf->length && isspace((unsigned char)strbuf->chars[index])) {
++index;
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/strutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static inline bool ffStrSet(const char* str) {
return false;
}

while (isspace(*str)) {
while (isspace((unsigned char)*str)) {
str++;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/strutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ int main(void) {
VERIFY(ffStrSet("a"));
VERIFY(ffStrSet(" a"));
VERIFY(ffStrSet("a "));
VERIFY(ffStrSet("\x80"));
VERIFY(ffStrSet("\xff"));
}

{
Expand Down