profile/ivi/jansson.git
15 years agoDon't include stdint.h in jansson.h
Petri Lehtinen [Sat, 7 Nov 2009 12:45:45 +0000 (14:45 +0200)]
Don't include stdint.h in jansson.h

It's not needed

15 years agoload: Parse a badly put - sign correctly
Petri Lehtinen [Thu, 29 Oct 2009 13:42:05 +0000 (15:42 +0200)]
load: Parse a badly put - sign correctly

Thanks to Manolis Delakis for reporting.

15 years agojson_load_file: Initialize the error struct properly
Petri Lehtinen [Tue, 27 Oct 2009 15:46:57 +0000 (17:46 +0200)]
json_load_file: Initialize the error struct properly

Failing to do this has the effect that the error message is not
returned when the input file cannot be opened (e.g. if it doesn't
exist).

Thanks to Martin Vopatek for reporting.

15 years agojansson 1.1.1
Petri Lehtinen [Mon, 26 Oct 2009 19:27:10 +0000 (21:27 +0200)]
jansson 1.1.1

15 years agoBuild documentation in distcheck-hook
Petri Lehtinen [Sat, 24 Oct 2009 21:18:03 +0000 (00:18 +0300)]
Build documentation in distcheck-hook

This is to check that all the documentation files are distributed
before releasing.

15 years agoReally distribute all the docs
Petri Lehtinen [Sat, 24 Oct 2009 21:17:16 +0000 (00:17 +0300)]
Really distribute all the docs

The tutorial example github_commits.c was still left out.

15 years agoDistribute all the docs
Petri Lehtinen [Sat, 24 Oct 2009 10:41:39 +0000 (13:41 +0300)]
Distribute all the docs

15 years agoFix version 1.1 release date in CHANGES
Petri Lehtinen [Wed, 21 Oct 2009 05:52:34 +0000 (08:52 +0300)]
Fix version 1.1 release date in CHANGES

15 years agojansson 1.1
Petri Lehtinen [Tue, 20 Oct 2009 18:29:16 +0000 (21:29 +0300)]
jansson 1.1

15 years agoDistribute stripped unit test data
Petri Lehtinen [Tue, 20 Oct 2009 18:23:06 +0000 (21:23 +0300)]
Distribute stripped unit test data

Apparently, it was forgotten to add these files to
test/testdata/Makefile.am in commit
04d550b02e8eadc0c9fb1966fe42fe9fc25f89e0.

15 years agoEnhance documentation
Petri Lehtinen [Mon, 19 Oct 2009 18:55:21 +0000 (21:55 +0300)]
Enhance documentation

- Add more information to the documentation front page
- Document how to build the documentation
- Clarify the tutorial a bit and remove some quirks
- Bring README.rst up-to-date
- Small enhancements here and there

15 years agoAdd C++ guards to jansson.h
raoulh [Mon, 19 Oct 2009 09:14:38 +0000 (02:14 -0700)]
Add C++ guards to jansson.h

Signed-off-by: Petri Lehtinen <petri@digip.org>
15 years agodoc: Add tutorial
Petri Lehtinen [Sat, 17 Oct 2009 11:18:40 +0000 (14:18 +0300)]
doc: Add tutorial

15 years agoFix indentation
Petri Lehtinen [Fri, 16 Oct 2009 18:20:38 +0000 (21:20 +0300)]
Fix indentation

No functional changes.

15 years agojson_dumpf: Document the output shortage on error
Petri Lehtinen [Thu, 15 Oct 2009 18:06:59 +0000 (21:06 +0300)]
json_dumpf: Document the output shortage on error

15 years agoEnhance handling of circular references
Petri Lehtinen [Thu, 15 Oct 2009 18:02:27 +0000 (21:02 +0300)]
Enhance handling of circular references

It's now an error to try to add an object or array to itself. The
encoder checks for circular references and fails with an error status
if one is detected.

15 years agojson_dumps: Close the strbuffer if dumping fails
Petri Lehtinen [Thu, 15 Oct 2009 17:54:32 +0000 (20:54 +0300)]
json_dumps: Close the strbuffer if dumping fails

15 years agodoc: Fix a small typo in apiref
Petri Lehtinen [Thu, 15 Oct 2009 14:39:49 +0000 (17:39 +0300)]
doc: Fix a small typo in apiref

15 years agodoc/Makefile.am: Remove *.pyc in clean
Petri Lehtinen [Wed, 14 Oct 2009 19:09:14 +0000 (22:09 +0300)]
doc/Makefile.am: Remove *.pyc in clean

15 years agoMake integer, real and string mutable
Petri Lehtinen [Tue, 13 Oct 2009 19:51:04 +0000 (22:51 +0300)]
Make integer, real and string mutable

Added functions:

  json_string_set
  json_integer_set
  json_real_set

While at it, clarify the documentation and parameter naming of
json_{string,integer,real}_value() a bit.

15 years agoDon't use non-portable asprintf()
Petri Lehtinen [Tue, 13 Oct 2009 12:40:26 +0000 (15:40 +0300)]
Don't use non-portable asprintf()

Thanks to Adam Strzelecki for reporting.

15 years agoMerge branch '1.0'
Petri Lehtinen [Sun, 11 Oct 2009 18:51:54 +0000 (21:51 +0300)]
Merge branch '1.0'

Conflicts:
configure.ac
doc/conf.py

15 years agojansson 1.0.4
Petri Lehtinen [Sun, 11 Oct 2009 18:30:12 +0000 (21:30 +0300)]
jansson 1.0.4

15 years agoFix API tests for object
Petri Lehtinen [Sat, 10 Oct 2009 19:54:05 +0000 (22:54 +0300)]
Fix API tests for object

Because of a typo in test/testprogs/Makefile.am, the tests for object
were never compiled or run.

15 years agoRemove config.h.in
Petri Lehtinen [Sat, 10 Oct 2009 18:16:13 +0000 (21:16 +0300)]
Remove config.h.in

It doesn't have to be in version control.

15 years agoExtend object API
Petri Lehtinen [Sun, 11 Oct 2009 17:42:43 +0000 (20:42 +0300)]
Extend object API

Added functions:

  json_object_size
  json_object_clear
  json_object_update

15 years agoFix API tests for object
Petri Lehtinen [Sat, 10 Oct 2009 19:54:05 +0000 (22:54 +0300)]
Fix API tests for object

Because of a typo in test/testprogs/Makefile.am, the tests for object
were never compiled or run.

15 years agoCheck json_object_set_new arguments
Petri Lehtinen [Sat, 10 Oct 2009 19:53:36 +0000 (22:53 +0300)]
Check json_object_set_new arguments

A segfault was caused by NULL key.

15 years agoRemove config.h.in
Petri Lehtinen [Sat, 10 Oct 2009 18:16:13 +0000 (21:16 +0300)]
Remove config.h.in

It doesn't have to be in version control.

15 years agoFix a few more compilation issues
Petri Lehtinen [Tue, 6 Oct 2009 10:22:26 +0000 (13:22 +0300)]
Fix a few more compilation issues

These were left out from the previous commit.

15 years agoMake it compile on platforms where char is unsigned
Petri Lehtinen [Thu, 1 Oct 2009 18:52:12 +0000 (21:52 +0300)]
Make it compile on platforms where char is unsigned

Linux on powerpc seems to be one such platform.

15 years agoRelax Autoconf version prereq
Petri Lehtinen [Thu, 1 Oct 2009 17:59:59 +0000 (20:59 +0300)]
Relax Autoconf version prereq

From 2.63 to 2.59, which is more widely supported.

15 years agoExtend array API
Petri Lehtinen [Tue, 29 Sep 2009 18:19:55 +0000 (21:19 +0300)]
Extend array API

Added functions:

  json_array_insert
  json_array_insert_new
  json_array_remove
  json_array_clear
  json_array_extend

15 years agodoc: Add getting started guide
Petri Lehtinen [Sun, 13 Sep 2009 18:56:19 +0000 (21:56 +0300)]
doc: Add getting started guide

15 years agoMerge branch '1.0'
Petri Lehtinen [Mon, 14 Sep 2009 12:06:06 +0000 (15:06 +0300)]
Merge branch '1.0'

Conflicts:
configure.ac
doc/conf.py

15 years agojansson 1.0.3
Petri Lehtinen [Mon, 14 Sep 2009 11:32:41 +0000 (14:32 +0300)]
jansson 1.0.3

15 years agoload: Check for integer and real overlfows and underflows
Petri Lehtinen [Sun, 13 Sep 2009 10:15:34 +0000 (13:15 +0300)]
load: Check for integer and real overlfows and underflows

Backported from master, commit 5406c2b3d347505149d382213b6f318f8c35de6a:
  * deleted test/testdata/invalid-stripped because the stripped tests
    don't exist in 1.0

15 years agotest/json-compare.py: Use json module from Python >=2.6 or simplejson
Petri Lehtinen [Fri, 11 Sep 2009 19:22:34 +0000 (22:22 +0300)]
test/json-compare.py: Use json module from Python >=2.6 or simplejson

Backported from master, commit 9d16ec755c9754fe1f79fe55ab719a7f8578ce37

15 years agoload: Check for integer and real overlfows and underflows
Petri Lehtinen [Sun, 13 Sep 2009 10:15:34 +0000 (13:15 +0300)]
load: Check for integer and real overlfows and underflows

15 years agoUse unsigned long instead of uint32_t
Petri Lehtinen [Sat, 12 Sep 2009 09:49:17 +0000 (12:49 +0300)]
Use unsigned long instead of uint32_t

Some day we will have ANSI C compatibility... This change doesn't make
the API backwards incompatible because uint32_t was only used in flags
to json_dump*() and the flags are meant to be used only by ORing
constants and macro output, and actually currently only JSON_INDENT
can be used.

15 years agotest/json-compare.py: Use json module from Python >=2.6 or simplejson
Petri Lehtinen [Fri, 11 Sep 2009 19:22:34 +0000 (22:22 +0300)]
test/json-compare.py: Use json module from Python >=2.6 or simplejson

15 years agoAdd stripped unit tests for decoder
Petri Lehtinen [Tue, 8 Sep 2009 13:32:47 +0000 (16:32 +0300)]
Add stripped unit tests for decoder

That is, test cases where there's no newline or other whitespace at
the beginning or end of input. This was implemented by adding a
--strip option to split-testfile to strip the input file after writing
it.

The actual test JSON texts are the same as testdata/invalid and
testdata/valid. The expected output of the invalid cases had to be
adjusted a bit: because there's no newline at the end, some of the
line numbers needed to be changed.

15 years agoMerge branch '1.0' into HEAD
Petri Lehtinen [Tue, 8 Sep 2009 14:02:39 +0000 (17:02 +0300)]
Merge branch '1.0' into HEAD

Conflicts:
configure.ac
doc/conf.py

15 years agoDistribute CHANGES
Petri Lehtinen [Tue, 8 Sep 2009 13:57:45 +0000 (16:57 +0300)]
Distribute CHANGES

15 years agojansson 1.0.2
Petri Lehtinen [Tue, 8 Sep 2009 13:48:26 +0000 (16:48 +0300)]
jansson 1.0.2

15 years agoload: Handle EOF correctly
Petri Lehtinen [Tue, 8 Sep 2009 13:22:16 +0000 (16:22 +0300)]
load: Handle EOF correctly

In stream_get(), EOF never got it to stream->buffer and because of
this, stream_unget() failed on some situations. This patch makes
stream_get() handle EOF just like any other byte.

As a "side effect", lex_scan_string() now needs to unget the EOF, or
otherwise it ends up in error message on premature end of input.

15 years agoDon't perform reference counting on true, false and null
Petri Lehtinen [Mon, 7 Sep 2009 18:40:14 +0000 (21:40 +0300)]
Don't perform reference counting on true, false and null

This makes their constructors thread safe. A special reference count
-1 is used to test whether to perform reference counting on a value or
not.

15 years agotest/.gitignore: Add testprogs/test_simple
Petri Lehtinen [Mon, 7 Sep 2009 18:25:22 +0000 (21:25 +0300)]
test/.gitignore: Add testprogs/test_simple

15 years agodoc apiref: Enhancements
Petri Lehtinen [Mon, 7 Sep 2009 18:07:49 +0000 (21:07 +0300)]
doc apiref: Enhancements

Constructors are described more clearly and return values on error
situations more compehensively. Also add an example of the object
iteration protocol.

15 years agoBetter argument validation
Petri Lehtinen [Sun, 6 Sep 2009 19:24:55 +0000 (22:24 +0300)]
Better argument validation

All pointer arguments are now tested for NULL. json_string() now also
tests that strdup() succeeds. This is to ensure that no NULL values
end up in data structures.

Also desribe the different sources of errors in documentation.

15 years agoDon't include unistd.h
Petri Lehtinen [Sun, 6 Sep 2009 19:24:22 +0000 (22:24 +0300)]
Don't include unistd.h

It's not needed.

15 years agodoc apiref: json_incref() returns its argument
Petri Lehtinen [Sun, 6 Sep 2009 19:16:32 +0000 (22:16 +0300)]
doc apiref: json_incref() returns its argument

15 years agoExpand test coverage
Petri Lehtinen [Sun, 6 Sep 2009 11:06:02 +0000 (14:06 +0300)]
Expand test coverage

Now all public API functions are tested (at least on some level) in
the test-api suite.

15 years agoMerge branch '1.0'
Petri Lehtinen [Sun, 6 Sep 2009 09:53:38 +0000 (12:53 +0300)]
Merge branch '1.0'

Conflicts:
configure.ac
doc/conf.py

15 years agoAdd CHANGES
Petri Lehtinen [Sun, 6 Sep 2009 09:45:47 +0000 (12:45 +0300)]
Add CHANGES

15 years agojansson 1.0.1
Petri Lehtinen [Fri, 4 Sep 2009 17:58:55 +0000 (20:58 +0300)]
jansson 1.0.1

15 years agojansson.h: Fix typo
Petri Lehtinen [Fri, 4 Sep 2009 12:21:00 +0000 (15:21 +0300)]
jansson.h: Fix typo

json_is_true was spelled jsin_is_true. Quite fatal.

15 years agodump: Optimize indenting
Petri Lehtinen [Thu, 3 Sep 2009 19:00:33 +0000 (22:00 +0300)]
dump: Optimize indenting

Don't alloca() a whitespace buffer and fill it with spaces in each
call to dump_indent. Instead, use a static whitespace buffer.

As a bonus, this saves the use of poorly portable alloca().

15 years agoload: Factor out an unneeded strdup
Petri Lehtinen [Thu, 3 Sep 2009 18:30:36 +0000 (21:30 +0300)]
load: Factor out an unneeded strdup

By "stealing" the string parsed out in lexer, one strdup can be saved.

15 years agoDon't define -std=c99 in AM_CFLAGS
Petri Lehtinen [Thu, 3 Sep 2009 18:20:51 +0000 (21:20 +0300)]
Don't define -std=c99 in AM_CFLAGS

It is not needed.

15 years agodoc: Fix typo
Petri Lehtinen [Thu, 3 Sep 2009 14:58:05 +0000 (17:58 +0300)]
doc: Fix typo

15 years agoAdd reference stealing functions for inserting values to objects and arrays
Petri Lehtinen [Thu, 3 Sep 2009 14:56:00 +0000 (17:56 +0300)]
Add reference stealing functions for inserting values to objects and arrays

The non-stealing functions are now just simple wrappers around these.

15 years agoChange the version to 1.0+
Petri Lehtinen [Wed, 2 Sep 2009 20:10:46 +0000 (23:10 +0300)]
Change the version to 1.0+

15 years agojansson 1.0
Petri Lehtinen [Tue, 25 Aug 2009 18:50:47 +0000 (21:50 +0300)]
jansson 1.0

15 years agoDistribute appropriate files
Petri Lehtinen [Tue, 25 Aug 2009 18:24:07 +0000 (21:24 +0300)]
Distribute appropriate files

15 years agotest: Add Makefile.am to test/testprogs
Petri Lehtinen [Tue, 25 Aug 2009 18:23:16 +0000 (21:23 +0300)]
test: Add Makefile.am to test/testprogs

This way it's an individual subdirectory and things go easier.

15 years agoAdd some missing copyright notices
Petri Lehtinen [Tue, 25 Aug 2009 14:50:41 +0000 (17:50 +0300)]
Add some missing copyright notices

15 years agoDetect garbage near EOF in json_loadf() and json_load_file()
Petri Lehtinen [Mon, 24 Aug 2009 17:58:59 +0000 (20:58 +0300)]
Detect garbage near EOF in json_loadf() and json_load_file()

15 years agoAdd test for numbers
Petri Lehtinen [Mon, 24 Aug 2009 17:54:40 +0000 (20:54 +0300)]
Add test for numbers

15 years agoExpand value test coverage
Petri Lehtinen [Tue, 18 Aug 2009 18:33:45 +0000 (21:33 +0300)]
Expand value test coverage

15 years agoarray: Fix a few checks and a leak
Petri Lehtinen [Sun, 23 Aug 2009 10:32:10 +0000 (13:32 +0300)]
array: Fix a few checks and a leak

15 years agorun-test: Don't remove all testlogs when starting a new test suite
Petri Lehtinen [Sun, 23 Aug 2009 10:00:22 +0000 (13:00 +0300)]
run-test: Don't remove all testlogs when starting a new test suite

15 years agoAdd README and API reference
Petri Lehtinen [Sun, 2 Aug 2009 18:26:37 +0000 (21:26 +0300)]
Add README and API reference

15 years agoRefuse to dump other types than array and object as the root value
Petri Lehtinen [Tue, 4 Aug 2009 17:54:47 +0000 (20:54 +0300)]
Refuse to dump other types than array and object as the root value

15 years agoRemove unimplemented json_clone()
Petri Lehtinen [Tue, 28 Jul 2009 08:37:06 +0000 (11:37 +0300)]
Remove unimplemented json_clone()

15 years agoAdd macro json_is_boolean
Petri Lehtinen [Tue, 28 Jul 2009 08:36:53 +0000 (11:36 +0300)]
Add macro json_is_boolean

15 years agoAdd LICENSE and a copyright note to all sources
Petri Lehtinen [Tue, 28 Jul 2009 08:01:52 +0000 (11:01 +0300)]
Add LICENSE and a copyright note to all sources

15 years agoRename json_{load,dump} to json_{load,dump}_file
Petri Lehtinen [Tue, 28 Jul 2009 07:57:17 +0000 (10:57 +0300)]
Rename json_{load,dump} to json_{load,dump}_file

15 years agoFix some memory leaks and invalid memory references
Petri Lehtinen [Tue, 28 Jul 2009 07:37:52 +0000 (10:37 +0300)]
Fix some memory leaks and invalid memory references

15 years agoEnhance test system
Petri Lehtinen [Sun, 26 Jul 2009 19:44:11 +0000 (22:44 +0300)]
Enhance test system

- Tests are now named
- Testlogs are preserved between runs
- Tests can be run through Valgrind Memcheck tool

15 years agoExpand encoder test coverage
Petri Lehtinen [Sun, 26 Jul 2009 18:51:45 +0000 (21:51 +0300)]
Expand encoder test coverage

15 years agoExpand parser and Unicode test coverage
Petri Lehtinen [Sat, 18 Jul 2009 12:59:55 +0000 (15:59 +0300)]
Expand parser and Unicode test coverage

15 years agoImplement support for \u escapes
Petri Lehtinen [Tue, 14 Jul 2009 17:47:57 +0000 (20:47 +0300)]
Implement support for \u escapes

15 years agoShow the whole UTF-8 sequence in error message, not just the first byte
Petri Lehtinen [Tue, 14 Jul 2009 17:45:28 +0000 (20:45 +0300)]
Show the whole UTF-8 sequence in error message, not just the first byte

15 years agoRemove TODO
Petri Lehtinen [Tue, 14 Jul 2009 08:12:31 +0000 (11:12 +0300)]
Remove TODO

15 years agoReport errors from lexical and stream level in parser
Petri Lehtinen [Mon, 13 Jul 2009 20:34:31 +0000 (23:34 +0300)]
Report errors from lexical and stream level in parser

Before, only the syntax level (parse_*) was able to set the error
string. This patch fixes the situation so that lexical (lex_*) and
stream (stream_*) levels can report detailed error messages.

Also, instead of 0, EOF is now returned by stream on error.

15 years agoGet rid of JSON_SORT_KEYS dump flag
Petri Lehtinen [Mon, 13 Jul 2009 18:39:51 +0000 (21:39 +0300)]
Get rid of JSON_SORT_KEYS dump flag

Object sorting will be implemented later.

15 years agoDecode and check for correct UTF-8
Petri Lehtinen [Mon, 13 Jul 2009 18:03:09 +0000 (21:03 +0300)]
Decode and check for correct UTF-8

All strings (decoded JSON text, the argument of json_string(), the key
argument of json_object_set()) are checked for valid UTF-8.

15 years agoStreamify the loader
Petri Lehtinen [Mon, 13 Jul 2009 08:01:20 +0000 (11:01 +0300)]
Streamify the loader

It's no longer needed to load the whole input into a string and then
parse from the string. Instead, the input is read as needed from
a string or file.

15 years agoGet rid of json_dumpfd and json_loadfd
Petri Lehtinen [Mon, 13 Jul 2009 07:31:42 +0000 (10:31 +0300)]
Get rid of json_dumpfd and json_loadfd

fdopen() makes supporting separate API for file descriptors useless.
Supporting fd's also makes Jansson less portable.

15 years agoLittle clean-up in parser
Petri Lehtinen [Sat, 11 Jul 2009 08:16:14 +0000 (11:16 +0300)]
Little clean-up in parser

Before, json_loads checked for '[' or '{' at the beginning. Now
there's a dedicated function for that: parse_json(). Also rename
parse() to parse_value().

15 years agoUnify naming in parser
Petri Lehtinen [Sat, 11 Jul 2009 07:52:57 +0000 (10:52 +0300)]
Unify naming in parser

No functional changes.

15 years agoMake the lexer not depend on locale
Petri Lehtinen [Thu, 9 Jul 2009 18:48:04 +0000 (21:48 +0300)]
Make the lexer not depend on locale

... by not using isalpha() and isspace(). While at it, fix some other
minor things.

15 years agoDon't dump extra spaces when indenting
Petri Lehtinen [Thu, 9 Jul 2009 17:54:29 +0000 (20:54 +0300)]
Don't dump extra spaces when indenting

15 years agoAdd some tests
Petri Lehtinen [Thu, 9 Jul 2009 18:01:40 +0000 (21:01 +0300)]
Add some tests

15 years agoFix dumping of Unicode control codes
Petri Lehtinen [Sat, 4 Jul 2009 19:02:16 +0000 (22:02 +0300)]
Fix dumping of Unicode control codes

Inside strings, All UTF-8 characters except for \, " and Unicode
control codes are dumped as-is. The control codes that have a special
one-character escape use that escape, and other control codes are
dumped using the \uXXXX escape.

15 years agoFix number tokenizer
Petri Lehtinen [Sat, 4 Jul 2009 10:18:49 +0000 (13:18 +0300)]
Fix number tokenizer

15 years agoFix empty array dumping
Petri Lehtinen [Fri, 3 Jul 2009 20:22:47 +0000 (23:22 +0300)]
Fix empty array dumping

15 years agostrbuffer: Optimize string termination
Petri Lehtinen [Tue, 30 Jun 2009 11:39:55 +0000 (14:39 +0300)]
strbuffer: Optimize string termination

Do not zero all of the memory, just the first unused byte to make the
string null terminated.

15 years agoSeparate integers and real numbers
Petri Lehtinen [Mon, 22 Jun 2009 21:14:28 +0000 (00:14 +0300)]
Separate integers and real numbers