Commit Graph

194 Commits

Author SHA1 Message Date
Petri Lehtinen
890760b2fb Increase test coverage 2014-12-19 08:35:46 +02:00
Petri Lehtinen
15653c47dd Add a test case for \u0000 2014-12-19 07:57:33 +02:00
Petri Lehtinen
5508ab403d Honor JSON_DECODE_INT_AS_REAL at lexical stage
This has the consequence that numbers are never converted to integers
when JSON_DECODE_INT_AS_REAL is set, and thus it works correctly all
integers that are representable as double.

Fixes #212.
2014-12-18 15:16:14 +02:00
Petri Lehtinen
5c1d87592a wip: add tests 2014-12-15 08:30:59 +02:00
Petri Lehtinen
d7a6269a17 Use expr instead of $((...)) in shell scripts
For Solaris 10 compatibility.
2014-10-03 08:49:08 +03:00
Petri Lehtinen
7fbe7c3960 Don't use the nonstandard __FUNCTION__ macro 2014-10-03 08:38:57 +03:00
Petri Lehtinen
fa20e80860 Parse subnormal numbers correctly
Fixes #202.
2014-08-27 07:59:52 +03:00
Ian T. Jacobsen
4f1238af71 Fix whitespace issues 2014-07-16 00:21:16 +01:00
Ian T. Jacobsen
122a1e2af9 Fixed cases where file would be opened, but not closed. And small realloc memory issue. 2014-07-16 00:16:32 +01:00
Petri Lehtinen
4debe8e567 Add missing tests for JSON_REAL_PRECISION 2014-05-07 08:19:39 +03:00
Petri Lehtinen
17b5fdd94b Add JSON_REAL_PRECISION
Fixes #178.
2014-04-30 12:46:34 +03:00
Vincent Bernat
7a0b9af662 Allow to mix JSON_STRICT with optional keys
On unpack, one may want to mix `JSON_STRICT` and optional keys by using
a format like `{s:i,s?o!}`. Unfortunately, this fails the stric test
with `-1 object item(s) left unpacked` error when the second key is not
specified.

To fix that, we iter on each key and we check if we have successfully
unpacked them. This is less efficient than the previous method but it
brings correctness.
2014-02-15 17:40:22 +01:00
Petri Lehtinen
17ec22f514 Merge branch '2.6' 2014-02-11 14:49:15 +02:00
Petri Lehtinen
8f80c2d838 CVE-2013-6401: Change hash function, randomize hashes
Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing
and testing.
2014-02-11 08:41:30 +02:00
Chip Salzenberg
b9c588de3d expect "export" in test configs 2014-02-11 08:41:14 +02:00
Petri Lehtinen
30fdf6067e Update copyrights for 2014 2014-01-28 09:16:05 +02:00
Joakim Soderberg
3fe8f74e7f Renamed config.h -> jansson_private_config.h
This is because it's really easy to get a name collission if compiling
Jansson as a subproject in a larger CMake project. If one project includes
several subprojects each having their own config.h, this will cause the
wrong file to be loaded.
2014-01-27 12:48:52 +01:00
Petri Lehtinen
05f7d30e5a Add json_boolean_value as alias for json_is_true
Fixes #146.
2013-12-04 09:14:19 +02:00
Petri Lehtinen
34d8b92dce Merge branch '2.5' 2013-11-14 08:49:24 +02:00
Petri Lehtinen
67a7bc7376 doc: Set all memory to zero in secure_free 2013-11-14 08:49:16 +02:00
Chip Salzenberg
c7d479c740 in simple string tests, always check lengths too 2013-10-03 19:07:50 -07:00
Petri Lehtinen
1bfc33362e Add JSON_ALLOW_NUL decoding flag for enabling NUL byte support 2013-09-30 10:45:02 +03:00
Petri Lehtinen
4d5aead31c Fix NUL byte check for object keys 2013-09-30 10:45:02 +03:00
Chip Salzenberg
face43929d expect "export" in test configs 2013-09-27 17:32:25 -07:00
Chip Salzenberg
dcaa90d21e dump \u sequences as upper case for readability (just like error messages) 2013-09-27 17:32:25 -07:00
Chip Salzenberg
9c259c07aa Support \u0000 - add size_t string lengths to API, load and dump \u000, etc.
Also:
  Steal strings during parsing for half the mallocs!
  Change all input-caused assertions to errors.  No crashes please, we're programmers.
2013-09-27 17:32:06 -07:00
Petri Lehtinen
3196ad48ed pack: Add format specifiers s#, + and +# 2013-08-14 21:54:11 +03:00
Petri Lehtinen
2489ea90b1 Update copyrights for 2013 2013-07-23 13:20:06 +03:00
Jason Choy
62531bd012 Prevent unused-variable warning 2013-06-13 11:37:07 +01:00
Petri Lehtinen
f639fbd2c3 Tweak the JSON_DECODE_INT_AS_REAL test introduced in #123
Only run the imprecision part if json_int_t is long long, otherwise
the imprecision cannot be tested against json_int_t.

Also, convert the double value to json_int_t before checking the
imprecision, because otherwise the json_int_t is converted to double
and the imprecision happens in the "wrong direction".
2013-06-12 08:36:53 +03:00
Jason Choy
120a90a155 Using jsonp_strtod instead of casting to double to catch double overflow 2013-06-11 15:09:08 +01:00
Jason Choy
02a3829363 Renamed flag to JSON_DECODE_INT_AS_REAL and added documentation 2013-06-11 12:24:28 +01:00
Jason Choy
e6bd0aba9d Added a simple test for the JSON_DECODE_NO_INT option 2013-06-09 15:34:30 +01:00
Jason Choy
ddd10b5e0b Added missing rv check - caught by clang 2013-06-07 13:08:22 +01:00
Daniel Griscom
b49280be72 Fixed "comparison between signed and unsigned" warning 2013-05-12 15:45:33 -04:00
Daniel Griscom
7121134abd Removed (non-functioning) printfs from test code 2013-05-12 15:36:09 -04:00
Daniel Griscom
e8c812b500 Added test cases and documentation for json_array_foreach() 2013-05-12 15:34:26 -04:00
Andrei Epure
5793142861 test:suites:api: modified error message
In the "/* perform the same update again */" area the error
message should be "unable to update an non-empty object"
instead of "unable to update an empty object".

Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
2013-04-29 15:32:52 +03:00
Petri Lehtinen
70232676f7 Merge branch '2.4' 2013-04-15 09:15:35 +03:00
Petri Lehtinen
257a716073 Fix the signature again, and also rest of the errors
Next time, remember to check with -Werror first...
2013-04-15 09:15:03 +03:00
Petri Lehtinen
0ccd2c7715 Merge branch '2.4' 2013-04-15 09:09:01 +03:00
Petri Lehtinen
42e307b3c5 Fix the signature of a test function 2013-04-15 09:08:47 +03:00
Petri Lehtinen
61cba2ae50 Merge branch '2.4' 2013-04-15 08:49:47 +03:00
Petri Lehtinen
867079c820 json_dump*(): Don't crash if json is NULL and JSON_ENCODE_ANY is set 2013-04-15 08:49:09 +03:00
Petri Lehtinen
dc2d54d9c6 Fix a refleak in test/bin/json_process.c 2013-03-14 22:24:57 +02:00
Petri Lehtinen
263fd0c9d3 Remove trailing whitespace 2013-03-14 22:18:21 +02:00
Joakim Söderberg
59bc1f42e4 Got rid of some warnings for unused variables. 2013-03-13 00:15:37 +01:00
Joakim Söderberg
b1b4f307d5 Add back the old ENV variabe approach to json_process.
Enable using the old envrionment variable passing of settings for json_process
so that the current autoconf test suite scripts can run nicely.

json_process now takes an optional command line parameter --env which
causes it to use the old method of reading the settings from
environment variables instead of directly from the "env" file.

Also added a --strip command line option, this will be used to
run the stripped tests with CMake as well.
2013-03-13 00:09:08 +01:00
Joakim Soderberg
33b0855b27 Get rid of type warning on MSVC.
We should use json_int_t instead of int, since this can be different
depending on platform. Also MSVC warns that this can cause "loss of
information" since it's converting long long to int.
2013-03-07 16:27:41 +01:00
Joakim Söderberg
344d2b00ea Fix incorrect cast to ssize_t.
gcc 4.2.1 warns about a possible incorrect cast to ssize_t when comparing against refcount, which is of type size_t. signed vs unsigned comparison.

Sinc warnings are treated as errors (as in the autoconf project) this would cause a compile error.
2013-03-07 16:13:40 +01:00