summaryrefslogtreecommitdiff
path: root/json-glib
Commit message (Collapse)AuthorAgeFilesLines
...
* lib: Trivial documentation clarificationsPhilip Withnall2015-09-012-3/+7
| | | | | | | Clarify the documentation for json_node_set_object() and json_object_get_array_member(). https://bugzilla.gnome.org/show_bug.cgi?id=754384
* reader: Clarify use of json_reader_end_[element|member]() with errorsPhilip Withnall2015-08-181-2/+29
| | | | | | | | Include an example showing that the end function must be called on both code paths (success and failure) if the reader object is to be used afterwards. https://bugzilla.gnome.org/show_bug.cgi?id=744100
* array: Do not create a null node for empty stringsEmmanuele Bassi2015-08-181-1/+1
| | | | | | The two are fairly different, and JsonObject does not behave this way. https://bugzilla.gnome.org/show_bug.cgi?id=730803
* parser: Port to GTaskEmmanuele Bassi2015-06-091-118/+62
| | | | | GSimpleAsyncResult is deprecated in GLib 2.46, so we should drop its use, and simplify the code in the process.
* Add simple JSON/string utilitiesEmmanuele Bassi2015-06-095-0/+162
| | | | | Wrap JsonParser and JsonGenerator in simple, easy to call functions that manage the objects for you.
* build: Enable subdir-objectsEmmanuele Bassi2015-03-151-35/+35
| | | | | | | We need to remove the path specification inside the sources listing, and modify the enumeration type and marshallers generation rules to cope with it (by adding the $(srcdir) when needed). This is similar to the changes there were made to Clutter.
* docs: Add missing annotationsEmmanuele Bassi2015-03-131-2/+26
|
* json-gvariant: Parse json doubles that are whole numbersStef Walter2015-01-262-1/+9
| | | | | | | | | The json gvariant serializer encodes whole number doubles without a dot. The deserializer needs to be able to parse these as well. Fix problem, and add test cases. https://bugzilla.gnome.org/show_bug.cgi?id=724319
* builder: Add missing (transfer) annotation to json_builder_add_value()Philip Withnall2015-01-251-1/+3
| | | | | | | Document and annotate the fact that json_builder_add_value() takes ownership of the JsonNode passed in to it. https://bugzilla.gnome.org/show_bug.cgi?id=743475
* reader: Maintain a stack of member namesPhilip Withnall2015-01-252-13/+29
| | | | | | | | | | | | | | | | | | | | | This fixes the case where, with nested objects, we call: json_reader_read_member (reader, "outer"); // json_reader_get_member_name (reader) == "outer" json_reader_read_member (reader, "inner"); // json_reader_get_member_name (reader) == "inner" // do something useful json_reader_end_member (reader); but at the end, the following assertion no longer holds: // json_reader_get_member_name (reader) == "outer" even though the JsonReader state should have been reset after ending the inner node. Fix it by maintaining a stack of member names. This works with both json_reader_read_member() and json_reader_read_element(). Updates to the unit tests are included. https://bugzilla.gnome.org/show_bug.cgi?id=741824
* Handle serialization/deserialization of glong gulong and guint64Tristan Van Berkom2014-12-301-0/+28
| | | | | | | | Long and unsigned long was properly serialized but not deserialized, guint64 handling is not ideal as the type is cast into a gint64, however this is better than not handling the fundamental type at all. https://bugzilla.gnome.org/show_bug.cgi?id=725972
* Drop unnecessary '_' prefix from json_marshalEmmanuele Bassi2014-12-302-10/+10
| | | | | It's not public API anyway, and we use annotations instead of the '_' prefix.
* Clean up the enumeration type templateEmmanuele Bassi2014-07-251-3/+3
|
* Include "config.h" in the enum types templateEmmanuele Bassi2014-07-251-0/+1
| | | | Expands the symbol annotation correctly.
* build: Include enum-types.[ch] in the introspection sourcesEmmanuele Bassi2014-05-291-1/+8
| | | | | | | Otherwise g-ir-scanner won't pick the types up, and will not notice that the error enumerations have an associated error domain. https://bugzilla.gnome.org/show_bug.cgi?id=730917
* generator: Add tests for updated string escaping routineStef Walter2014-05-211-0/+47
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=730425
* generator: Escape the control characters correctlyStef Walter2014-05-211-26/+47
| | | | | | | Escaping these as octals is out of the JSON spec completely, so roll our own string encoder. https://bugzilla.gnome.org/show_bug.cgi?id=730425
* generator: Escape Object key names correctlyStef Walter2014-05-201-8/+11
| | | | | | Also fix empty keys, which are now encoded properly. https://bugzilla.gnome.org/show_bug.cgi?id=727593
* json-parser: use length parameter when validating utf-8djcb2014-04-171-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=727755
* tests: Add more checks to the parser stream unitEmmanuele Bassi2014-04-171-6/+16
|
* parser: Use the right length for parsing the stream contentsEmmanuele Bassi2014-04-171-2/+2
| | | | | | | The ByteArray we use to buffer the contents of a stream in order to pass them to the parser may have a bigger length. We should use the cursor position that we use to put a '\0' in the buffer instead. We could also use -1, but this saves us a strlen() later on.
* build: Include $(top_builddir)Emmanuele Bassi2014-03-181-0/+2
| | | | Fixes compilation in cases where builddir != srcdir.
* Remove conditional inclusion of config.hEmmanuele Bassi2014-03-1818-39/+0
| | | | All the platforms and build system we support have a config.h header.
* Add version constants to introspectionEmmanuele Bassi2014-03-181-1/+1
| | | | We need to let g-ir-scanner parse json-version.h.
* Reimplement JSON_VERSION_HEX as a macro callEmmanuele Bassi2014-03-181-5/+7
| | | | Add a JSON_ENCODE_VERSION macro and use it in JSON_VERSION_HEX.
* Use compiler annotations to determine symbol visibilityEmmanuele Bassi2014-03-1814-240/+344
| | | | | | | | | | | | | | | | | Instead of relying on a separate file that requires being update every time we add a new public function we should use compiler annotations to let the linker know which symbols are public and exported. In order to achieve this we have to: * check for the visibility=hidden attribute * add -fvisibility=hidden to the linker flags * add a macro to annotate all public symbols While we're at it, we should copy the versioned symbols macro layout already used by GLib, GTK+, and other G* libraries, including the ability to express the range of allowed versions of JSON-GLib that third party code can compile against.
* docs: Port to MarkDownEmmanuele Bassi2014-03-1815-248/+181
| | | | | Drop the DocBook documentation, and move everything to the MarkDown format used by modern gtk-doc.
* scanner: Clean up the UTF-16 surrogate pairs decodingEmmanuele Bassi2014-03-181-6/+36
| | | | | | We over-assert() our pre-conditions, and the conversion is a bit obfuscated. We should use a proper function, and de-obfuscate the code so that the intent is clear.
* Add missing annotationsEmmanuele Bassi2014-02-143-9/+9
| | | | | JsonNode, JsonObject, and JsonArray have various constructors, so we need to annotate them.
* tools: Fix build on Visual StudioChun-wei Fan2014-02-072-1/+12
| | | | | | | | | As unistd.h is not universally available, don't include it unconditionally and include the corresponding Windows headers where necessary. Also, use gssize in place of ssize_t and define STDOUT_FILENO on Windows when we don't have unistd.h, which is a constant that is defined in unistd.h. https://bugzilla.gnome.org/show_bug.cgi?id=723813
* reader: When a read() fails, don't track back on end()Bastien Nocera2014-02-031-4/+12
| | | | | | | | | | | | | | When a call to json_reader_read_element() fails if the element doesn't exist, we need to call json_reader_end_element() to clear out any errors. But the _end_element() call will backtrack to the parent node, when the _read_element() call did not set the child node. To fix this, leave early from _end_*() calls when an error has been set. https://bugzilla.gnome.org/show_bug.cgi?id=723428
* tests: Add new test for reader level bugBastien Nocera2014-02-031-0/+43
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=723428
* reader: Fix example code for json_reader_read_member()Bastien Nocera2014-02-031-3/+3
| | | | | | Fix cut'n'paste error. https://bugzilla.gnome.org/show_bug.cgi?id=721137
* Updated FSF's addressDaniel Mustieles2014-01-312-6/+2
|
* Make json-gvariant.h conform to the other headersEmmanuele Bassi2013-12-042-2/+10
| | | | | Only include the necessary headers, and use a single-header inclusion guard to prevent people from including only json-gvariant.h.
* Move the single include guard after multiple inclusion oneEmmanuele Bassi2013-12-048-24/+24
| | | | | | | | | | | | | | GCC (and other compilers) can optimise multiple inclusion of headers if they find the: #ifndef FOO #define FOO #endif pattern as the first thing inside a header. The single-header inclusion guard was preventing that from happening, so we need to move it inside the multiple inclusion guard.
* tests/gvariant: Use G_N_ELEMENTSEmmanuele Bassi2013-12-021-5/+5
| | | | Instead of sizeof(array)/sizeof(type).
* Make JSON to GVariant conversion handle some string to number conversions.Joseph Artsimovich2013-12-022-7/+54
| | | | | | | | | Consider the following JSON: ["123"] Trying to convert it to GVariant with signature "(i)" would previously fail, as string-to-number conversions weren't implemented. This patch implements string-to-number and string-to-boolean conversions. https://bugzilla.gnome.org/show_bug.cgi?id=707382
* Add tests for json paths (2 invalids, 1 valid)bi2013-12-021-0/+24
| | | | | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> Conflicts: json-glib/tests/path.c
* Handle invalid path: invalid first characterbi2013-12-021-1/+9
| | | | | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> Conflicts: json-glib/json-path.c
* path: compile and query path '$' to retrieve root nodebi2013-12-021-2/+5
| | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Handle invalid path : missing member name after .bi2013-12-021-0/+8
| | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* build: Move the pkg-config file under json-glibEmmanuele Bassi2013-12-022-0/+21
| | | | | The pkg-config file for a library is tied to the source, so it should not be in the top-level of the project.
* build: Drop unnecessary linker flagsEmmanuele Bassi2013-12-021-1/+1
| | | | | | | | | The -no-undefined linker flag is needed only when compiling for Windows, and it's added conditionally. Except that we also add it unconditionally in the LDFLAGS used for the libjson-glib-1.0 shared object. Whoopsie. We should also drop the unneeded -rpath: distributions will go out of their way to patch it out in any case.
* build: Clean up unnecessary complicationsEmmanuele Bassi2013-12-021-2/+0
| | | | | | | | We don't need a custom Makefile for quiet rules: AM_V_GEN is pretty much all we use anyway. The Makefile.am.gtest file is not included any longer, since we switched to TAP and GLib's own rules for unit testing.
* Improve consistency in error messagesEmmanuele Bassi2013-10-282-3/+3
| | | | Use the same spacing and formatting rules.
* Add format toolEmmanuele Bassi2013-10-272-1/+215
| | | | | A simple command line utility to format JSON data; it allows prettifying and unprettifying JSON.
* Add validation toolEmmanuele Bassi2013-10-272-0/+178
| | | | | The json-glib-validate tool is a small utility that validates the data found at the URIs passed on its command line.
* parser: Always perform UTF-8 validationEmmanuele Bassi2013-10-272-0/+11
| | | | | | JSON is defined to be encoded using UTF-8, so we should not rely on the documentation saying so when parsing, but validate the input and eventually provide a recoverable parsing error.
* parser: Always use a valid GError internallyEmmanuele Bassi2013-10-261-2/+15
| | | | | Do not just pass the GError through from the public-facing arguments: we may want to perform error checking internally at any later date.