Petri Lehtinen [Mon, 8 Aug 2011 18:00:47 +0000 (21:00 +0300)]
Merge branch '2.1'
Petri Lehtinen [Mon, 8 Aug 2011 17:59:10 +0000 (20:59 +0300)]
doc: Explain the non-constness of the first parameter of json_unpack() et al
Fixes GH-30.
Petri Lehtinen [Thu, 30 Jun 2011 18:48:51 +0000 (21:48 +0300)]
Merge branch '2.1'
Petri Lehtinen [Thu, 30 Jun 2011 18:48:09 +0000 (21:48 +0300)]
Merge branch 'issue-29'
Fixes GH-29.
Petri Lehtinen [Thu, 30 Jun 2011 18:45:25 +0000 (21:45 +0300)]
doc: Add documentation for json_dump_callback()
JKL [Fri, 24 Jun 2011 17:40:20 +0000 (10:40 -0700)]
test file for new json_dump_callback function
JKL [Fri, 24 Jun 2011 17:00:53 +0000 (10:00 -0700)]
new typedef json_dump_callback_t, function json_dump_callback
Petri Lehtinen [Thu, 30 Jun 2011 18:04:45 +0000 (21:04 +0300)]
doc: Fix several typos and other little errors
JKL [Fri, 24 Jun 2011 16:57:20 +0000 (09:57 -0700)]
use size_t for strbuffer writes, and avoid integer overflow
Petri Lehtinen [Fri, 17 Jun 2011 18:42:11 +0000 (21:42 +0300)]
Check that target is string and value is not NULL in json_string_set()
Petri Lehtinen [Fri, 17 Jun 2011 17:53:28 +0000 (20:53 +0300)]
doc: Clarify that removing from containers decrements the refcount
While at it, reword the object iteration protocol description a bit.
Petri Lehtinen [Fri, 10 Jun 2011 18:53:14 +0000 (21:53 +0300)]
CHANGES: Fix v2.1 release date
Petri Lehtinen [Fri, 10 Jun 2011 18:30:11 +0000 (21:30 +0300)]
jansson 2.1
Petri Lehtinen [Tue, 7 Jun 2011 18:39:55 +0000 (21:39 +0300)]
Use ``literal`` syntax with macro and flag names in CHANGES
Petri Lehtinen [Tue, 7 Jun 2011 18:33:59 +0000 (21:33 +0300)]
Prepare for relase: Add CHANGES entry for v2.1
Petri Lehtinen [Sun, 29 May 2011 18:19:28 +0000 (21:19 +0300)]
Add JSON_DISABLE_EOF_CHECK decoding flag
With this flag enabled, the decoder stops after a valid JSON input and
thus allows extra data after it.
Fixes GH-25.
Petri Lehtinen [Sun, 29 May 2011 09:53:25 +0000 (12:53 +0300)]
Reduce code duplication in the decoder
Petri Lehtinen [Tue, 24 May 2011 06:59:39 +0000 (09:59 +0300)]
Clear errno before calling strtod()
Fixes GH-27.
Petri Lehtinen [Sun, 15 May 2011 10:57:48 +0000 (13:57 +0300)]
Add JSON_REJECT_DUPLICATES decoding flag
With this flag, a decoding error is issued if any JSON object in the
input contains duplicate keys.
Fixes GH-3.
Petri Lehtinen [Sat, 14 May 2011 18:08:02 +0000 (21:08 +0300)]
doc: Clarify that Unicode normalization or comparison algorithms are not used
Petri Lehtinen [Sat, 14 May 2011 17:46:13 +0000 (20:46 +0300)]
doc: Add "New in version 2.1" notes to new features
Petri Lehtinen [Sat, 14 May 2011 10:04:35 +0000 (13:04 +0300)]
docs: Add a note that object iteration doesn't give any particular order
Closes GH-15.
Petri Lehtinen [Sat, 14 May 2011 09:56:14 +0000 (12:56 +0300)]
Add JSON_ENCODE_ANY flag to allow encoding any JSON value
Closes GH-19.
Petri Lehtinen [Thu, 21 Apr 2011 10:15:58 +0000 (13:15 +0300)]
Merge branch '2.0'
Petri Lehtinen [Thu, 21 Apr 2011 10:15:01 +0000 (13:15 +0300)]
Fix a leak when memory allocation fails in json_object_set() & friends
Petri Lehtinen [Sun, 10 Apr 2011 17:54:52 +0000 (20:54 +0300)]
Add json_loadb() for decoding possibly non null-terminated strings
Thanks to Jonathan Landis for the initial patch.
Petri Lehtinen [Tue, 5 Apr 2011 12:38:37 +0000 (15:38 +0300)]
Merge branch '2.0'
Jim Meyering [Tue, 5 Apr 2011 12:04:16 +0000 (14:04 +0200)]
Avoid set-but-not-used warning/error in a test
Closes GH-20.
Petri Lehtinen [Thu, 31 Mar 2011 18:26:19 +0000 (21:26 +0300)]
Merge branch '2.0'
Conflicts:
doc/conf.py
src/jansson.h
Petri Lehtinen [Thu, 31 Mar 2011 13:59:26 +0000 (16:59 +0300)]
jansson 2.0.1
Petri Lehtinen [Thu, 31 Mar 2011 13:39:33 +0000 (16:39 +0300)]
Merge branch '2.0'
Petri Lehtinen [Thu, 31 Mar 2011 13:37:41 +0000 (16:37 +0300)]
Fix a few malloc() and free() calls
Replace them with jsonp_malloc() and jsonp_free() to support the
custom memory allocation.
Petri Lehtinen [Wed, 30 Mar 2011 09:57:24 +0000 (12:57 +0300)]
Fix invalid object key hashing in json_unpack() strict checking mode
The keys which are stored temporarily to a hashtable to make sure that
all object keys are unpacked, were hashed with the object key hashing
function. It is meant to compute hashes for object_key_t values, and
it works incorrectly for plain strings.
Fixed by introducing suitable functions for hashing and comparing
strings for string-keyed hashtables.
Petri Lehtinen [Sun, 27 Mar 2011 18:04:29 +0000 (21:04 +0300)]
Merge branch '2.0'
Petri Lehtinen [Sun, 27 Mar 2011 10:40:25 +0000 (13:40 +0300)]
Set JANSSON_MICRO_VERSION to 255 (0xFF) for git master
Also, set documentation release to "2.0+git". This shows up in the
automatically built HTML documentation.
These changes makes it easier for library users to know that this
version is under development.
Closes GH-14.
Petri Lehtinen [Wed, 23 Mar 2011 06:25:50 +0000 (08:25 +0200)]
Use the correct number of parens in JANSSON_VERSION_HEX macro
Petri Lehtinen [Sun, 27 Mar 2011 10:34:43 +0000 (13:34 +0300)]
Test framework enhancements, fix the check_exports test
* Use "printf" instead of "echo -n" as it's more portable
* Treat a test as skipped if it exits with exit status of 77
* Skip the check_exports test if "nm -D" doesn't work
Petri Lehtinen [Wed, 23 Mar 2011 06:25:50 +0000 (08:25 +0200)]
Use the correct number of parens in JANSSON_VERSION_HEX macro
Petri Lehtinen [Mon, 21 Mar 2011 07:27:51 +0000 (09:27 +0200)]
ANSI C requires struct initializers to be constant expressions
Closes GH-17.
Petri Lehtinen [Mon, 21 Mar 2011 06:22:32 +0000 (08:22 +0200)]
Fix json_object_size() return value
Return 0 as documented if the argument is not a JSON object.
Closes GH-18.
Petri Lehtinen [Sun, 20 Mar 2011 19:15:39 +0000 (21:15 +0200)]
Enhance portability of va_copy()
va_copy() is a C99 feature. In C89 implementations, it's sometimes
available as __va_copy(). If not, memcpy() should do the trick.
Petri Lehtinen [Thu, 10 Mar 2011 19:28:44 +0000 (21:28 +0200)]
Fix a declaration after statement
While at it, add -Wdeclaration-after-statement to AM_CFLAGS to catch
these in the future.
Petri Lehtinen [Thu, 10 Mar 2011 19:25:43 +0000 (21:25 +0200)]
Distribute doc/upgrading.rst
Closes GH-16.
Petri Lehtinen [Thu, 10 Mar 2011 19:24:44 +0000 (21:24 +0200)]
Check documentation in make distcheck
It seems that the only way to do this is to use the dvi make target,
as it's built in make distcheck after running configure.
Petri Lehtinen [Mon, 28 Feb 2011 18:46:14 +0000 (20:46 +0200)]
jansson 2.0
Petri Lehtinen [Sun, 27 Feb 2011 19:34:12 +0000 (21:34 +0200)]
Fix packing of invalid UTF-8 strings
Petri Lehtinen [Sun, 27 Feb 2011 19:09:55 +0000 (21:09 +0200)]
Update README
Petri Lehtinen [Fri, 25 Feb 2011 20:24:12 +0000 (22:24 +0200)]
tests: Add missing json_decref() calls to suites/api/test_unpack.c
Petri Lehtinen [Fri, 25 Feb 2011 19:08:49 +0000 (21:08 +0200)]
Remove invalid subdirs from test/suites/Makefile.am
Petri Lehtinen [Fri, 25 Feb 2011 19:01:13 +0000 (21:01 +0200)]
doc: Change the title of the upgrading section
Petri Lehtinen [Thu, 24 Feb 2011 20:30:46 +0000 (22:30 +0200)]
Small documentation tweaks
- Capitalize section titles correctly
- Rename "Building on Windows" to "Building on non-Unix systems" and
tweak the text accordingly.
- Remove the "Installing Prebuilt Binaries" section. This info is
better in the web instead, as it may change.
- Mention that Sphinx 1.0 or newer is required.
Petri Lehtinen [Thu, 24 Feb 2011 20:15:13 +0000 (22:15 +0200)]
Add "Upgrading from older releases" to docs, tweak CHANGES a bit
Petri Lehtinen [Tue, 22 Feb 2011 19:12:45 +0000 (21:12 +0200)]
Add a CHANGES entry for version 2.0
Wow, lots of stuff. And it's been a long while after the last release.
Petri Lehtinen [Tue, 22 Feb 2011 17:08:41 +0000 (19:08 +0200)]
Add lots of tests for pack/unpack code, fix bugs found
Closes GH-12.
Petri Lehtinen [Tue, 22 Feb 2011 11:53:58 +0000 (13:53 +0200)]
Move json_error_t documentation to its own section
json_error_t is used in the decoder and in the pack and unpack API's,
so it's better to have a separate section for it.
Petri Lehtinen [Tue, 22 Feb 2011 11:24:15 +0000 (13:24 +0200)]
Truncate error source from start, not end, if it's too long to fit
It's more helpful to see "...bar/baz.json" instead of "/long/path/to".
Petri Lehtinen [Tue, 22 Feb 2011 08:47:02 +0000 (10:47 +0200)]
Refactor decoder input stream
- Add a new field position to the json_error_t structure. This is the
position in bytes from the beginning of the input.
- Keep track of line, column and input position in the stream level.
Previously, only line was tracked, and it was in the lexer level, so
this info was not available for UTF-8 decoding errors.
- While at it, refactor tests so that no separate "stripped" tests are
required. json_process is now able to strip whitespace from its
input, and the "valid" and "invalid" test suites now use this to
test both non-stripped and stripped input.
Closes GH-9.
Petri Lehtinen [Sat, 19 Feb 2011 10:15:16 +0000 (12:15 +0200)]
tests: Use "make STOP=1 check" to stop on first failure
Petri Lehtinen [Thu, 17 Feb 2011 08:10:53 +0000 (10:10 +0200)]
Add custom memory allocation
Thanks to Basile Starynkevitch for the suggestion and initial patch.
Thanks to Jonathan Landis and Deron Meranda for showing how this can
be utilized for implementing secure memory operations.
Graeme Smecher [Thu, 3 Feb 2011 15:51:26 +0000 (07:51 -0800)]
Resolve __va_list_tag ** -> va_list * type errors with clang and future GCCs
Functions taking va_args are munged to receive arguments of type
'__va_list_tag *'. This patch uses va_copy to coerce them to the expected type
so we don't get compiler errors.
Tested on x86_64, both 32-bit and 64-bit compiles.
Reported-By: Basile Starynkevitch <basile@starynkevitch.net>
Petri Lehtinen [Sun, 30 Jan 2011 10:53:52 +0000 (12:53 +0200)]
Fix an unpack example in the docs
Petri Lehtinen [Sat, 29 Jan 2011 19:38:07 +0000 (21:38 +0200)]
Tweak the default validation behaviour of the unpack API
Now, by default, unpacking doesn't check that all array and object
items are accessed. The check can be enabled globally by using the
JSON_STRICT flag (formerly JSON_UNPACK_ONLY), or on a per-value basis
by using the new '!' format character. The '*' format character is
still available to disable the global check on a per-value basis.
Petri Lehtinen [Tue, 25 Jan 2011 19:43:23 +0000 (21:43 +0200)]
Use the Sphinx default theme again for documentation
The "haiku" theme doesn't show chapter contents in sidebar.
Petri Lehtinen [Tue, 25 Jan 2011 19:41:52 +0000 (21:41 +0200)]
Documentation for pack and unpack functions
Petri Lehtinen [Tue, 25 Jan 2011 19:41:35 +0000 (21:41 +0200)]
Add the 'I' format for both pack and unpack
Petri Lehtinen [Tue, 25 Jan 2011 18:42:41 +0000 (20:42 +0200)]
Use 'f' for real and 'F' for number (real or integer) in unpack
Petri Lehtinen [Tue, 25 Jan 2011 18:37:53 +0000 (20:37 +0200)]
unpack: Unify and enhance error messages
Give the type name instead of its enum index in the error message when
an unexpected value is encountered while unpacking.
Petri Lehtinen [Tue, 25 Jan 2011 07:36:43 +0000 (09:36 +0200)]
Expand the pack/unpack API, implement unpack flags
Expand the pack/unpack API: json_(un)pack is the simple version with
no error output, json_(un)pack_ex has error output and flags,
json_v(un)pack_ex is a va_list version of json_(un)pack_ex.
Implement unpacking flags:
- JSON_UNPACK_ONLY turns off extra validation, i.e. array and object
unpacking doesn't check that all items are unpacked. This is really
just convenience for not adding '*' after each object and array.
- JSON_VALIDATE_ONLY turns off unpacking, i.e. no varargs are expected
and nothing is unpacked.
Petri Lehtinen [Mon, 24 Jan 2011 19:45:54 +0000 (21:45 +0200)]
Add validation features to json_unpack()
* By default, json_unpack() now checks that all items of arrays and
objects are unpacked. This is useful for validation.
* Add format specifier '*' to suppress this check for individual
arrays and objects. '*' must appear as the last format specifier
before the closing ']' or '}'.
Petri Lehtinen [Mon, 24 Jan 2011 19:44:28 +0000 (21:44 +0200)]
Rename variadic.c to pack_unpack.c
Petri Lehtinen [Mon, 24 Jan 2011 19:20:56 +0000 (21:20 +0200)]
Refactor json_unpack()
* Use the format string scanner from the previous commit (with the
simpler separator skipping semantics)
* Split json_vnunpack() to three separate functions for unpacking
objects, arrays and "simple" values
* Always return 0 on success, 1 on error
This shaves around 100 more lines from the original implementation.
Petri Lehtinen [Sun, 23 Jan 2011 19:14:19 +0000 (21:14 +0200)]
Refactor json_pack()
* Implement a "scanner" that reads the format string, maintaining state
* Split json_vnpack() to three separate functions for packing objects,
arrays and simple values. This makes it more clear what is being
packed, and the object and array structures become more evident.
* Make the skipping of ignored character simpler, i.e. skip ':' and
',' independent of their context
This patch shaves around 80 lines of code from the original
implementation.
Petri Lehtinen [Thu, 20 Jan 2011 19:09:14 +0000 (21:09 +0200)]
Unify style
Petri Lehtinen [Thu, 20 Jan 2011 19:28:54 +0000 (21:28 +0200)]
Update copyright notices for 2011
Petri Lehtinen [Mon, 17 Jan 2011 13:51:29 +0000 (15:51 +0200)]
Build cleanly with gcc's -Werror=declaration-after-statement flag
Graeme Smecher [Fri, 14 Jan 2011 23:11:54 +0000 (15:11 -0800)]
Remove debugging printf
Graeme Smecher [Fri, 14 Jan 2011 17:18:42 +0000 (09:18 -0800)]
Make json_pack/json_unpack() recursive
Note that we pass va_list pointers around instead of just va_lists, which
would seem more intuitive. This is necessary since the behaviour of va_lists
passed as function parameters is finicky. Quoth stdarg(3):
If ap is passed to a function that uses va_arg(ap,type) then the value
of ap is undefined after the return of that function.
The pointer-passing strategy is used by Python's Py_BuildValue() for the same
purpose.
Petri Lehtinen [Mon, 20 Dec 2010 19:08:04 +0000 (21:08 +0200)]
Emphasize the constness of the return value of json_string_value()
Closes GH-7.
Petri Lehtinen [Sun, 19 Dec 2010 19:55:00 +0000 (21:55 +0200)]
Document the version info constants
Petri Lehtinen [Sat, 18 Dec 2010 20:58:40 +0000 (22:58 +0200)]
Make int32_t available when the configure script is not used
Petri Lehtinen [Tue, 14 Dec 2010 18:57:32 +0000 (20:57 +0200)]
Add version info to jansson.h
Petri Lehtinen [Tue, 26 Oct 2010 20:36:24 +0000 (23:36 +0300)]
Enhance error reporting
This patch adds two new fields to the json_error_t struct: column and
source. It also adds functions to populate json_error_t internally.
The column field is not currently used, but it will be utilized in the
decoder and pack/unpack functions.
Petri Lehtinen [Tue, 26 Oct 2010 18:17:50 +0000 (21:17 +0300)]
Move and enhance documentation on json_error_t
Petri Lehtinen [Tue, 26 Oct 2010 18:05:40 +0000 (21:05 +0300)]
Make json_error_t transparent again
After looking at the new code for a few days, I didn't like it
anymore. To prepare for the future, a few fields will be added to the
json_error_t struct later.
This reverts commit
23dd078c8dcb17fd29d3b69f082b5b93f5f13b8f. Some
adjustments were needed because of newer commits.
Graeme Smecher [Mon, 25 Oct 2010 23:36:29 +0000 (16:36 -0700)]
Adds json_pack / json_unpack variadic functions.
Petri Lehtinen [Thu, 14 Oct 2010 18:05:22 +0000 (21:05 +0300)]
Remove all "Added in version 1.x" info from documentation
As 2.0 will be backwards incompatible anyway, there's no need to
record which features were new in which 1.x releases.
Petri Lehtinen [Thu, 14 Oct 2010 17:57:55 +0000 (20:57 +0300)]
Make json_error_t opaque
All decoding functions now accept a json_error_t** parameter and set
it to point to a heap-allocated json_error_t structure if an error
occurs. The contents of json_error_t are no longer exposed directly, a
few functions to do it have been added instead. If an error occurs,
the user must free the json_error_t value.
This makes it possible to enhance the error reporting facilities in
the future without breaking ABI compatibility with older versions.
This is a backwards incompatible change.
Petri Lehtinen [Mon, 6 Sep 2010 17:48:25 +0000 (20:48 +0300)]
Merge branch '1.3'
Petri Lehtinen [Mon, 6 Sep 2010 17:46:14 +0000 (20:46 +0300)]
Run Sphinx without the -W flag when building documentation
In "make html", don't use the -W flag with Sphinx. This makes it
possible to create the documentation with Sphinx 1.0 without errors,
as the warning about using old-style C markup isn't turned to an
error.
Don't build documentation in "make check". Instead, add a new make
target "check-doc" to build the documentation with the -W flag.
Petri Lehtinen [Sun, 5 Sep 2010 19:00:47 +0000 (22:00 +0300)]
Use Sphinx 1.0, change the HTML theme
Petri Lehtinen [Sun, 5 Sep 2010 18:38:06 +0000 (21:38 +0300)]
Add a section describing how to build on Windows
Petri Lehtinen [Sun, 5 Sep 2010 18:29:04 +0000 (21:29 +0300)]
On Windows, typedef int to int32_t
There's no inttypes.h or stdint.h in the stdlib on Windows.
Petri Lehtinen [Sun, 5 Sep 2010 18:21:36 +0000 (21:21 +0300)]
Add jansson_config.h.win32
As the configure script cannot be run on Windows, give the users a
jansson_config.h that they can use directly.
Petri Lehtinen [Sun, 5 Sep 2010 17:54:37 +0000 (20:54 +0300)]
Move max() to jansson_private.h, define only if not already defined
On some platforms (Visual C++ for one) the standard library already
defines max() as a macro.
Petri Lehtinen [Sun, 5 Sep 2010 14:21:36 +0000 (17:21 +0300)]
Don't use designated struct initializers
It's a C99 feature and not available on all compilers (Visual C++, for
example).
Petri Lehtinen [Sun, 5 Sep 2010 14:16:47 +0000 (17:16 +0300)]
Use config.h only if it exists
This makes it easier to compile without the configure script (e.g. on
Windows).
Petri Lehtinen [Sun, 5 Sep 2010 14:13:21 +0000 (17:13 +0300)]
Replace all occurences of inline with JSON_INLINE
This makes it easier to compile without the configure script (e.g. on
Windows).
Petri Lehtinen [Sat, 14 Aug 2010 18:02:08 +0000 (21:02 +0300)]
Merge branch '1.3'
Conflicts:
doc/apiref.rst
src/jansson_private.h
Petri Lehtinen [Sat, 14 Aug 2010 17:47:08 +0000 (20:47 +0300)]
Set the version number to 2.0pre
Petri Lehtinen [Sat, 14 Aug 2010 17:37:50 +0000 (20:37 +0300)]
Clarify and document the integer type configuration