Commit Graph

310 Commits

Author SHA1 Message Date
nmlgc
98610bfcec Check for key == NULL in json_object_get and json_object_del 2013-12-28 06:11:49 +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
30a4c88843 Fix an off-by-one error 2013-10-15 08:49:40 +03:00
Petri Lehtinen
08be94e8e6 Don't call strlen twice
Oops.
2013-10-15 08:46:17 +03:00
Petri Lehtinen
d544852ff6 Avoid integer overflows with very long strings 2013-10-15 08:44:04 +03:00
Chip Salzenberg
a76dc45512 paper bag bug: json_string_set* functions should set the length too 2013-10-03 19:07:20 -07:00
Chip Salzenberg
6ebd0bc7a6 fix type mismatch anywhere int != int32 (Vorne) 2013-09-30 16:56:01 -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
Petri Lehtinen
78a80b8899 load.c: Change an error message 2013-09-30 09:24:36 +03:00
Chip Salzenberg
6c1ce27095 add new public functions to jansson.def 2013-09-29 16:57:23 -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
641002da37 jansson 2.5 2013-09-19 21:26:46 +03:00
Olivier Langlois
21599b95f8 Replace strcpy with memcpy
Since len is known, the copy function does not need to check byte by byte
the end of the string.

Signed-off-by: Olivier Langlois <olivier@olivierlanglois.net>
2013-08-27 22:47:18 -04: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
Petri Lehtinen
11d45b0090 Fix integer overflow in jsonp_strdup()
Fixes #129.
2013-07-21 13:00:32 +03:00
Petri Lehtinen
8490e377c0 Make the argument of json_deep_copy() const
Fixes #126.
2013-07-08 12:36:56 +03:00
Joakim Soderberg
6fe231757e BUGFIX: Compilation error with -DNDEBUG defined.
When building a "MinSizeRel" with CMake I get a compilation error in lex_unget_unsave. This is because assertions are turned off using -DNDEBUG:

```
/usr/bin/gcc  -DHAVE_CONFIG_H -fPIC -Os -DNDEBUG -Ijansson/build/include -Ijansson/build/private_include    -Wall -Wextra -Wdeclaration-after-statement -Werror -o CMakeFiles/jansson.dir/src/load.c.o   -c jansson/src/load.c
jansson/src/load.c: In function âx_unget_unsaveâjansson/src/load.c:256:14: error: variable â set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
```

This will then remove the insert, which makes the "d" variable unused, which is treated as an error since we have -Wall set. We can't simply get rid of the variable either and put the strbuffer_pop call in the assert call, since it's a macro and would remove the call entirely. So I simply added a check for NDEBUG to fix it.
2013-06-26 09:50:46 +00:00
Petri Lehtinen
8d439710cd Merge pull request #123 from jjwchoy/decode-ignore-int
Implemented a decode option to only decode numbers to reals
2013-06-11 22:23:40 -07: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
9e7f11a847 Implemented a decode option to only decode numbers to reals and never integers 2013-06-09 15:14:47 +01:00
Paul Harris
2fd66fab1a Adjust CMakeLists.txt and .def: add _d postfix onto jansson_d.lib/dll
Had to remove the "LIBRARY" line from jansson.def, which was optional,
and was overriding CMake's desire for a specific name.
2013-06-02 22:00:32 +08:00
Petri Lehtinen
5cc594c9e8 Don't shadow the stdlib function index() with arg names
Fixes #119.
2013-05-21 08:54:27 +03:00
Daniel Griscom
6950cd203b Add json_array_foreach() #define, parallelling json_object_foreach() 2013-05-12 15:03:26 -04: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
6281d1c549 Merge pull request #108 from Zillode/1edff47af38a2335f88300ee6dc437118f5a20ff
Fixes redefined warnings ("_GNU_SOURCE")
2013-04-02 05:40:49 -07:00
Lode Hoste
1edff47af3 Do not define _GNU_SOURCE is already defined 2013-03-14 21:34:11 +01:00
Joakim Soderberg
650707fccc Moved *config.h.cmake to the cmake directory. 2013-03-07 18:38:47 +01:00
Joakim Soderberg
e40d52c550 Consolidated the CMake project.
- Moved everything to one CMakeLists.txt
- Added support for the json_process test suites (instead of just the API
  tests).
- Changed to use the modified json_process version that does away with the
  environment variables (originally written by DanielT).
- Had to exclude "test_memory_funcs" on MSVC, since void pointer
  arithmetics are not allowed as it is done in secure_malloc and
  secure_free.
- Had to add a check for "ssize_t". This is not available on Windows and
  maybe on some other platforms (used in test_pack.c)
- Result from running ctest (The failure seems unrelated to CMake, it's
  just that the expected result is in a different order):
99% tests passed, 1 tests failed out of 121

Total Test time (real) =   1.31 sec

The following tests FAILED:
         24 - valid__complex-array (Failed)
2013-03-07 16:11:07 +01:00
Paul Harris
3e03b07831 Add CMake build system.
Added multiple CMake-related files to project.
Supports building the library and the tests.
See CMakeLists.txt for notes on how it works.

I had to adjust 3 existing files in order to disable some configuration
that should be taken care of by cmake/automake anyway.

I also added jansson.def from a future jansson version,
to test cmake's support for .def files (which works fine).
2013-03-07 16:06:01 +01:00
Petri Lehtinen
b9967fdbcf Merge branch '2.4' 2013-02-04 09:52:31 +02:00
Petri Lehtinen
93a3c7f663 Enable gcc specific flags in tests correctly
... and fix issues found.
2013-02-04 09:49:58 +02:00
Petri Lehtinen
40c2e532b9 Merge branch '2.4' 2013-01-03 10:46:46 +02:00
Petri Lehtinen
02beb90db3 Make it possible to forward declare struct json_t
This allows e.g. to use json_t in a header file that doesn't include
jansson.h:

    struct json_t;
    typedef struct json_t json_t;

    json_t *foo(json_t *bar);
2013-01-03 10:45:38 +02:00
Petri Lehtinen
08c5ec8f01 Merge branch '2.4' 2012-12-28 14:11:59 +02:00
Petri Lehtinen
e9cb9dbf60 Fix // -> /* */ 2012-12-28 14:11:43 +02:00
Petri Lehtinen
b98be1f18d Merge branch '2.4' 2012-12-10 08:47:11 +02:00
Jacob Potter
872f847655 Change const pointer to array
Closes #95.
2012-12-10 08:47:00 +02:00
Jacob Potter
f86bb0377f Mark some constant data as const.
Issue #95.
2012-12-10 08:47:00 +02:00
Attie Grande
c82cea9d32 fixed l_isxdigit() macro
Closes #97.
2012-12-10 08:47:00 +02:00
Petri Lehtinen
67c002f7c9 Merge branch '2.4' 2012-12-04 21:23:33 +02:00
Petri Lehtinen
e0a7f81b39 Really fix the off-by-one error in json_array_remove()
It didn't affect only the last element but all of them. One item too
much was always moved.
2012-12-04 21:20:59 +02:00
Petri Lehtinen
7b35a18ac0 Merge branch '2.4' 2012-12-04 09:33:48 +02:00
Petri Lehtinen
54d59c743c Fix an off-by-one error in json_array_remove()
Uninitialized memory was read when the last item of a "full" array was
removed.
2012-12-04 09:32:45 +02:00
Petri Lehtinen
5804e9de9b Set master for 2.5 development mode 2012-09-23 13:41:40 +03:00
Petri Lehtinen
3279aacdee jansson 2.4 2012-09-23 12:52:41 +03:00