Barnabás Pőcze
934ab3036e
treewide: use SPDX tags to specify copyright information
...
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.
See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
dedbf39ab5
tests: whitespace is not allowed in number either
2022-07-11 12:15:40 +02:00
Wim Taymans
302bad96a0
tests: add json float check unit test
2022-07-11 12:05:42 +02:00
Wim Taymans
cbbc4baa3f
json: avoid converting random string to floats
...
Only allow the json float characters when converting to float.
This avoids NAN, INF, 0xffe4 etc to be seen as a json float.
2022-07-11 11:50:58 +02:00
Wim Taymans
92e2b7dd0d
json: improve unicode parsing
...
Make sure don't overread the strings.
Don't use sscanf but use a custom hex read function.
Fixes #2340
2022-04-27 08:37:32 +02:00
Wim Taymans
5137015c33
json: convert utf16 to utf8
...
We work with utf8 string so convert the unicode escape sequences to
utf8.
Fixes #2337
2022-04-26 15:38:22 +02:00
Wim Taymans
f2cdb15e0c
json: fix \uXXXX parsing
...
We need exactly 4 hex characters, everything else is refused. We
also copy those characters directly to the output string without
assuming any encoding.
See #2337
2022-04-26 11:01:33 +02:00
Wim Taymans
2b16df4e89
spa: add locale independent spa_dtoa
...
And use this in spa_json_format_float() where we also avoid invalid
json floats.
Use json float format in some places where we serialize json floats.
Add a unit test.
See #2223
2022-03-21 10:41:44 +01:00
Wim Taymans
93b5d440bc
json: add locale independent parse and format functions
...
Use them in pw-dump.
Add some unit tests.
See #2223
2022-03-20 21:04:33 +01:00
Wim Taymans
947d15a60a
json: empty string should not give a valid number
2022-03-20 20:37:26 +01:00
Wim Taymans
611591d0fc
json: add spa_json_parse_stringn()
...
It also checks the destination size.
2022-01-04 12:37:00 +01:00
Peter Hutterer
7909c99ead
test: convert two spa tests to pwtest
2021-06-09 18:00:39 +10:00