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
Petri Lehtinen [Fri, 13 Aug 2010 19:19:20 +0000 (22:19 +0300)]
Add a flags parameter to all decoding functions for future needs
As of now, the parameter is unused, but may be needed in the future.
I'm adding it now so that in the future both API and ABI remain
backwards compatible as long as possible.
This is a backwards incompatible change.
Petri Lehtinen [Fri, 13 Aug 2010 19:11:04 +0000 (22:11 +0300)]
Change the maximum indentation size to 32 spaces in encoder
This is to free up bits from the flags parameter of json_dump
functions. I'm pretty sure no-one needs 256 spaces of indentation when
pretty-printing JSON values...
This is a backwards incompatible change.
Petri Lehtinen [Fri, 13 Aug 2010 19:06:01 +0000 (22:06 +0300)]
Change the underlying type of JSON integer from long to json_int_t
json_int_t is typedef'd to long long if it's supported, or long
otherwise. There's also some supporting things, like the
JSON_INTEGER_FORMAT macro that expands to the printf() conversion
specifier that corresponds to json_int_t's actual type.
This is a backwards incompatible change.
Petri Lehtinen [Thu, 12 Aug 2010 18:35:19 +0000 (21:35 +0300)]
Make object_key_t portable
A flexible array member is unportable. Use a table of length 1
instead. This needs some adjustment to the memory allocatio, too.
Petri Lehtinen [Thu, 12 Aug 2010 18:34:02 +0000 (21:34 +0300)]
Beautify the container_of macro
Use offsetof instead of zero pointer dereference trickery.
Petri Lehtinen [Thu, 12 Aug 2010 18:10:12 +0000 (21:10 +0300)]
Replace inline with JSON_INLINE in json_object_iter_set() declaration
Petri Lehtinen [Thu, 12 Aug 2010 17:59:48 +0000 (20:59 +0300)]
Check for gcc before setting gcc specific CFLAGS
Petri Lehtinen [Tue, 10 Aug 2010 19:14:37 +0000 (22:14 +0300)]
Move site configuration to jansson_config.h
This way, more site configuration can be more easily added later.
Petri Lehtinen [Tue, 10 Aug 2010 18:45:18 +0000 (21:45 +0300)]
Change JSON integer's underlying type from int to long
This is a backwards incompatible change.
Petri Lehtinen [Wed, 16 Jun 2010 18:34:10 +0000 (21:34 +0300)]
Clarify the documentation
Couple some string and number information from the RFC conformance
chapter in the API reference, and refer to the RFC conformance chapter
from API reference for more information.
Also, state more clearly that a JSON text must have an array or object
as the top-level value, and better document the string comparison
performed by json_equal().
Petri Lehtinen [Tue, 15 Jun 2010 12:27:35 +0000 (15:27 +0300)]
Unify unsigned integer usage in the API
Replace all occurences of unsigned int and unsigned long with size_t.
This is a backwards incompatible change, as the signature of many API
functions changes.
Petri Lehtinen [Mon, 14 Jun 2010 19:30:15 +0000 (22:30 +0300)]
configure.ac: Remove unneeded AC_PROG_CXX
Petri Lehtinen [Mon, 14 Jun 2010 11:33:44 +0000 (14:33 +0300)]
Add a few missing changes to CHANGES for v1.3
These were forgotten when releasing.
Petri Lehtinen [Sun, 13 Jun 2010 17:37:33 +0000 (20:37 +0300)]
jansson 1.3
Petri Lehtinen [Sat, 12 Jun 2010 17:45:19 +0000 (20:45 +0300)]
Remove the C++ interface
Petri Lehtinen [Sat, 12 Jun 2010 19:44:21 +0000 (22:44 +0300)]
Merge branch '1.2'
Petri Lehtinen [Thu, 10 Jun 2010 18:15:43 +0000 (21:15 +0300)]
Fix a few memory leaks in tests
No changes to the actual library code.
Petri Lehtinen [Thu, 20 May 2010 15:47:30 +0000 (18:47 +0300)]
Merge branch '1.2'
Petri Lehtinen [Thu, 20 May 2010 15:45:06 +0000 (18:45 +0300)]
Clarify the documentation on reference stealing
Provide an example usage pattern for reference stealing functions.
This way the user (hopely) sees more clearly how the reference
stealing functions are meant to be used.
Petri Lehtinen [Fri, 14 May 2010 05:47:24 +0000 (08:47 +0300)]
Zero the visited flag after an encoding error
When encoding an array or object ends in an error, the visited flag
wasn't zeroed, causing subsequent encoding attempts to fail. This
patch fixes the problem by always zeroing the visited flag.
Petri Lehtinen [Wed, 12 May 2010 12:41:09 +0000 (15:41 +0300)]
Zero the visited flag after encoding an empty array or object
Encoding an empty array or object worked, but encoding it again
(possibly after adding some items) failed, because the visited flag
(used for detecting circular references) wasn't zeroed.
Petri Lehtinen [Fri, 7 May 2010 04:36:01 +0000 (07:36 +0300)]
Merge branch '1.2'
Petri Lehtinen [Fri, 7 May 2010 04:35:11 +0000 (07:35 +0300)]
load.c: Make stream_init() static
Petri Lehtinen [Sat, 3 Apr 2010 11:00:59 +0000 (14:00 +0300)]
Merge branch '1.2'
Conflicts:
CHANGES
configure.ac
doc/conf.py
Petri Lehtinen [Sat, 3 Apr 2010 10:39:16 +0000 (13:39 +0300)]
jansson 1.2.1
Petri Lehtinen [Sat, 3 Apr 2010 10:49:38 +0000 (13:49 +0300)]
doc: Distribute conformance.rst
Petri Lehtinen [Sun, 28 Mar 2010 18:44:41 +0000 (21:44 +0300)]
Merge branch '1.2'
Conflicts:
configure.ac
Petri Lehtinen [Sun, 28 Mar 2010 18:16:21 +0000 (21:16 +0300)]
Require autoconf 2.60
The AC_TYPE_INT32_T macro first appeared in autoconf 2.60.
Petri Lehtinen [Sun, 28 Mar 2010 18:14:08 +0000 (21:14 +0300)]
Support compilers that don't have the "inline" keyword
Use AC_C_INLINE autoconf macro, include config.h where needed, and add
a define of JSON_INLINE to jansson.h that has the correct "inline"
keyword.
Petri Lehtinen [Fri, 26 Mar 2010 20:00:41 +0000 (22:00 +0200)]
doc: Add chapter on RFC conformance
Thanks to Deron Meranda for providing the initial text.
Petri Lehtinen [Fri, 26 Mar 2010 19:59:53 +0000 (21:59 +0200)]
Estimate real number underflows with 0.0
Earlier it was a decoding error.
Petri Lehtinen [Fri, 26 Mar 2010 19:29:31 +0000 (21:29 +0200)]
Enhance tests for null byte
Petri Lehtinen [Tue, 23 Mar 2010 06:15:19 +0000 (08:15 +0200)]
Merge branch '1.2'
Petri Lehtinen [Tue, 23 Mar 2010 06:08:57 +0000 (08:08 +0200)]
Fix reference counting on true, false and null
Initialize their reference counts to (unsigned int)-1 to disable
reference counting on them. It already was meant to work like this,
but the reference counts were just initialized to 1 instead of -1.
Thanks to Andrew Thompson for reporting this issue.
Petri Lehtinen [Fri, 19 Mar 2010 06:11:48 +0000 (08:11 +0200)]
Ignore temporary files *~
Andres Freund [Thu, 18 Mar 2010 13:35:09 +0000 (14:35 +0100)]
c++ wrapper: add missing 'inline' statements to various constructors
the missing 'inline' leads to duplicated symbols if the header is
included into two separately compiled files.
Petri Lehtinen [Thu, 18 Mar 2010 05:18:43 +0000 (07:18 +0200)]
Don't include stdint.h anywhere
This should have fixed by commit
28682322, but there was one #include
left in utf.c. It now includes utf.h instead of stdint.h.
Petri Lehtinen [Thu, 11 Feb 2010 19:17:19 +0000 (21:17 +0200)]
hashtable: Fix typo in comment
Petri Lehtinen [Thu, 11 Feb 2010 19:06:19 +0000 (21:06 +0200)]
Merge branch 'c++-enhance-proxies'
Petri Lehtinen [Thu, 11 Feb 2010 18:55:56 +0000 (20:55 +0200)]
Update CHANGES, change version to 1.2+
Petri Lehtinen [Tue, 9 Feb 2010 19:29:33 +0000 (21:29 +0200)]
Implement JSON_PRESERVE_ORDER encoding flag
With this encoding flag, the object key-value pairs in output are in
the same order in which they were first inserted into the object.
To make this possible, a key of an object is now a serial number plus
a string. An object keeps an increasing counter which is used to
assign serial number to the keys. Hashing, comparison and public API
functions were changed to act only on the string part, i.e. the serial
number is ignored everywhere else but in the encoder, where it's used
to order object keys if JSON_PRESERVE_ORDER flag is used.
Petri Lehtinen [Tue, 9 Feb 2010 18:51:25 +0000 (20:51 +0200)]
Optimize hashtable_set()
If a key already exists in the hashtable, use the existing pair
changing its value instead of removing the old one and allocating a
new pair.
Petri Lehtinen [Mon, 8 Feb 2010 18:51:09 +0000 (20:51 +0200)]
C++: Optimize PropertyProxy
When the property already exists in the object, we can store an
iterator pointing to that property, instead of duplicating the key.
When the property (key) is not present in the object, we still have to
duplicate the key.
Petri Lehtinen [Sun, 7 Feb 2010 12:08:54 +0000 (14:08 +0200)]
C++: Make proxies safer
If a user happens to store an ElementProxy or a PropertyProxy
instance, we need to take a reference to the JSON value they point to.
With PropertyProxy, the key needs to be copied as well.
Petri Lehtinen [Sat, 6 Feb 2010 19:08:56 +0000 (21:08 +0200)]
Make int32_t available on all systems
Use AC_TYPE_INT32_T and include inttypes.h (if it exists) instead of
stdint.h for maximum portability.
Petri Lehtinen [Thu, 4 Feb 2010 19:13:57 +0000 (21:13 +0200)]
Merge branch '1.2'
Conflicts:
LICENSE
Petri Lehtinen [Thu, 4 Feb 2010 19:12:36 +0000 (21:12 +0200)]
Merge branch 'cleanup-c++-code'
Petri Lehtinen [Thu, 4 Feb 2010 19:10:04 +0000 (21:10 +0200)]
C++: Fix test_cpp.cpp to work with VPATH builds
It reads an input file, and the file location is different with VPATH
builds. Read top_srcdir from environment and use it to find the file.
Petri Lehtinen [Thu, 4 Feb 2010 19:07:02 +0000 (21:07 +0200)]
C++: Add Value::dump_file(), load_file() and loads() that take an std::string