mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-19 07:00:10 -05:00
json: Move past the end char of a symbol
So that we can put a \0 there and continue parsing the rest of the string. This allows us to in-place parse_string.
This commit is contained in:
parent
762663e74e
commit
2d1f84fd7d
1 changed files with 4 additions and 4 deletions
|
|
@ -112,7 +112,7 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
|
|||
iter->state = __STRUCT;
|
||||
if (iter->depth > 0)
|
||||
goto again;
|
||||
return iter->cur - *value;
|
||||
return iter->cur++ - *value;
|
||||
}
|
||||
continue;
|
||||
case __STRING:
|
||||
|
|
@ -124,8 +124,7 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
|
|||
iter->state = __STRUCT;
|
||||
if (iter->depth > 0)
|
||||
continue;
|
||||
iter->cur++;
|
||||
return iter->cur - *value;
|
||||
return ++iter->cur - *value;
|
||||
case 240 ... 247:
|
||||
utf8_remain++;
|
||||
SPA_FALLTHROUGH;
|
||||
|
|
@ -308,6 +307,7 @@ static inline int spa_json_parse_string(const char *val, int len, char *result)
|
|||
{
|
||||
const char *p;
|
||||
if (!spa_json_is_string(val, len)) {
|
||||
if (result != val)
|
||||
strncpy(result, val, len);
|
||||
result += len;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue