Commit Graph

71 Commits

Author SHA1 Message Date
Petri Lehtinen
afc9c1a23a Relax Autoconf version prereq
From 2.63 to 2.59, which is more widely supported.
2009-10-01 21:54:29 +03:00
Petri Lehtinen
b7bf96996f jansson 1.0.3 2009-09-14 14:32:41 +03:00
Petri Lehtinen
6d8c287032 load: Check for integer and real overlfows and underflows
Backported from master, commit 5406c2b3d3:
  * deleted test/testdata/invalid-stripped because the stripped tests
    don't exist in 1.0
2009-09-14 10:28:03 +03:00
Petri Lehtinen
ab3764ed0a test/json-compare.py: Use json module from Python >=2.6 or simplejson
Backported from master, commit 9d16ec755c
2009-09-14 10:27:51 +03:00
Petri Lehtinen
9cc6fbe580 Distribute CHANGES 2009-09-08 16:57:45 +03:00
Petri Lehtinen
827a01937f jansson 1.0.2 2009-09-08 16:48:26 +03:00
Petri Lehtinen
0f62dac627 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.
2009-09-08 16:41:07 +03:00
Petri Lehtinen
ab2d93b724 Add CHANGES 2009-09-06 12:45:47 +03:00
Petri Lehtinen
e4be4a4a28 jansson 1.0.1 2009-09-04 20:58:55 +03:00
Petri Lehtinen
78eda92908 jansson.h: Fix typo
json_is_true was spelled jsin_is_true. Quite fatal.
2009-09-04 15:21:00 +03:00
Petri Lehtinen
6b70406bf4 jansson 1.0 2009-08-25 21:50:47 +03:00
Petri Lehtinen
390b0ba633 Distribute appropriate files 2009-08-25 21:48:34 +03:00
Petri Lehtinen
bf0d383961 test: Add Makefile.am to test/testprogs
This way it's an individual subdirectory and things go easier.
2009-08-25 21:23:26 +03:00
Petri Lehtinen
6e17271fa9 Add some missing copyright notices 2009-08-25 17:50:41 +03:00
Petri Lehtinen
ee2d164025 Detect garbage near EOF in json_loadf() and json_load_file() 2009-08-24 20:58:59 +03:00
Petri Lehtinen
b3e265eb84 Add test for numbers 2009-08-24 20:54:40 +03:00
Petri Lehtinen
0565988d12 Expand value test coverage 2009-08-23 13:34:12 +03:00
Petri Lehtinen
114fc96f76 array: Fix a few checks and a leak 2009-08-23 13:34:12 +03:00
Petri Lehtinen
c21ade41e0 run-test: Don't remove all testlogs when starting a new test suite 2009-08-23 13:34:12 +03:00
Petri Lehtinen
251722d499 Add README and API reference 2009-08-13 18:38:03 +03:00
Petri Lehtinen
0428f48d19 Refuse to dump other types than array and object as the root value 2009-08-04 20:58:02 +03:00
Petri Lehtinen
36530d8c25 Remove unimplemented json_clone() 2009-07-30 11:32:27 +03:00
Petri Lehtinen
08d712d038 Add macro json_is_boolean 2009-07-30 11:32:27 +03:00
Petri Lehtinen
2f4d6f8ae7 Add LICENSE and a copyright note to all sources 2009-07-30 11:32:24 +03:00
Petri Lehtinen
f41e380984 Rename json_{load,dump} to json_{load,dump}_file 2009-07-28 10:58:13 +03:00
Petri Lehtinen
b348519e96 Fix some memory leaks and invalid memory references 2009-07-28 10:38:21 +03:00
Petri Lehtinen
f60c563bab Enhance test system
- Tests are now named
- Testlogs are preserved between runs
- Tests can be run through Valgrind Memcheck tool
2009-07-28 10:36:16 +03:00
Petri Lehtinen
d3b3055a34 Expand encoder test coverage 2009-07-26 21:51:45 +03:00
Petri Lehtinen
20efe4aa26 Expand parser and Unicode test coverage 2009-07-26 11:31:25 +03:00
Petri Lehtinen
9240146c10 Implement support for \u escapes 2009-07-16 09:58:23 +03:00
Petri Lehtinen
a0435e3061 Show the whole UTF-8 sequence in error message, not just the first byte 2009-07-16 09:57:08 +03:00
Petri Lehtinen
7b702e8ad7 Remove TODO 2009-07-16 09:57:08 +03:00
Petri Lehtinen
df307f1bc3 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.
2009-07-14 00:24:39 +03:00
Petri Lehtinen
1f65a3cae7 Get rid of JSON_SORT_KEYS dump flag
Object sorting will be implemented later.
2009-07-13 23:38:04 +03:00
Petri Lehtinen
902bcdaa5e 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.
2009-07-13 23:38:01 +03:00
Petri Lehtinen
625f50f916 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.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
4c414bdd6d 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.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
1b67edb54d 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().
2009-07-13 21:45:16 +03:00
Petri Lehtinen
287ec3f9da Unify naming in parser
No functional changes.
2009-07-13 21:45:16 +03:00
Petri Lehtinen
13c7ad3219 Make the lexer not depend on locale
... by not using isalpha() and isspace(). While at it, fix some other
minor things.
2009-07-13 21:45:11 +03:00
Petri Lehtinen
68e948f567 Don't dump extra spaces when indenting 2009-07-09 21:01:43 +03:00
Petri Lehtinen
8ef778c843 Add some tests 2009-07-09 21:01:40 +03:00
Petri Lehtinen
6b14df13cc 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.
2009-07-09 20:59:52 +03:00
Petri Lehtinen
f9c2a113bb Fix number tokenizer 2009-07-04 22:04:32 +03:00
Petri Lehtinen
4384776776 Fix empty array dumping 2009-07-04 13:19:41 +03:00
Petri Lehtinen
55af26f05a strbuffer: Optimize string termination
Do not zero all of the memory, just the first unused byte to make the
string null terminated.
2009-07-04 13:19:41 +03:00
Petri Lehtinen
b724c2b122 Separate integers and real numbers 2009-07-04 13:19:25 +03:00
Petri Lehtinen
39802813f4 Use -Werror 2009-06-30 13:55:20 +03:00
Petri Lehtinen
b1fe723a7f Fix json_loadf and json_loadfd with empty input
Nothing was appended to strbuffer, so the buffer was left empty. An
empty strbuffer is not an empty string but NULL, so the result was a
segfault.

This patch fixes the problem by initializing strbuffer to an empty
string.
2009-06-30 13:55:20 +03:00
Petri Lehtinen
dc9b954b62 Print correct error message on premature end of array 2009-06-30 13:55:20 +03:00