summaryrefslogtreecommitdiff
path: root/json-glib
Commit message (Collapse)AuthorAgeFilesLines
* parser: Don't use thread to read async from streamwip/sadiq/parser-read-asyncMohammed Sadiq2022-09-161-21/+32
| | | | | | | | | Some GInputStream may not support reading from a different thread (eg: libsoup3[0]). So instead of reading the stream in the task thread, use the async read API of GInputStream. Since read_async is optional (as GLib handles it if not implemented) This shouldn't be an issue for users. [0] https://libsoup.org/libsoup-3.0/client-thread-safety.html
* json-glib/json-builder.c:Farzin2022-02-151-1/+1
| | | | | | Delete an extra word Line: 55 Word: root
* Merge branch 'safe-node-init' into 'master'Emmanuele Bassi2021-10-092-6/+20
|\ | | | | | | | | set node->data pointer to null when unset See merge request GNOME/json-glib!37
| * applied suggest changetallua2021-10-101-2/+0
| |
| * Apply 2 suggestion(s) to 1 file(s)Emmanuele Bassi2021-10-091-6/+2
| |
| * Apply 1 suggestion(s) to 1 file(s)Emmanuele Bassi2021-10-091-1/+1
| |
| * remove/add whitespace for coding conventiontallua2021-10-101-2/+1
| |
| * uncomment codetallua2021-04-061-1/+1
| |
| * set node->data pointer to null when unsettallua2021-04-062-0/+21
| |
* | doc: Add missing symbolEmmanuele Bassi2021-06-111-0/+9
| |
* | Update the JSON/GObject API documentationEmmanuele Bassi2021-06-101-11/+13
| |
* | Update the node documentationEmmanuele Bassi2021-06-103-182/+199
| |
* | Update the JSON/GVariant API documentationEmmanuele Bassi2021-06-101-3/+3
| |
* | Update the JsonObject documentationEmmanuele Bassi2021-06-101-83/+86
| |
* | Update the JsonArray documentationEmmanuele Bassi2021-06-101-23/+23
| |
* | Update the documentation of the utility APIEmmanuele Bassi2021-06-101-7/+6
| |
* | Update the JsonParser documentationEmmanuele Bassi2021-06-102-78/+111
| |
* | Update the documentation for the GObject integration APIEmmanuele Bassi2021-06-101-41/+41
| |
* | Update the documentation of the versioning macrosEmmanuele Bassi2021-06-102-13/+34
| |
* | Update the JsonSerializable documentationEmmanuele Bassi2021-06-101-62/+69
| |
* | Update the JsonPath documentationEmmanuele Bassi2021-06-102-46/+45
| |
* | Update the JsonReader documentationEmmanuele Bassi2021-06-102-101/+156
| |
* | Update the JsonGenerator documentationEmmanuele Bassi2021-06-101-34/+35
| |
* | Update the documentation for the GBoxed APIEmmanuele Bassi2021-06-082-30/+74
| |
* | Update JsonBuilder documentationEmmanuele Bassi2021-06-081-78/+114
| | | | | | | | Use gi-docgen links, and drop gtk-doc'isms.
* | Merge branch 'gidocgen' into 'master'Emmanuele Bassi2021-06-0822-861/+734
|\ \ | | | | | | | | | | | | Use gi-docgen to build the API reference See merge request GNOME/json-glib!41
| * | Remove `volatile` from enum registration templateEmmanuele Bassi2021-06-081-1/+1
| | | | | | | | | | | | The `volatile` was dropped from the GLib API, as it's useless.
| * | build: Be strict when generating introspectionEmmanuele Bassi2021-06-081-1/+2
| | | | | | | | | | | | We want all warnings, and we want warnings to be fatal.
| * | docs: Initial, rough port away from gtk-docEmmanuele Bassi2021-06-0820-859/+731
| |/ | | | | | | | | | | | | | | | | | | Drop `SECTION` blurbs. Use gi-docgen syntax for internal links. Use summary lines for gi-docgen indices. Use Markdown syntax for code fragments.
* | trivial: Return the correct type in g_return_val_if_fail()wip/hughsie/typecheckRichard Hughes2021-05-162-5/+5
|/
* Do not leak memory for duplicate var assignmentRichard Hughes2021-02-201-0/+2
| | | | Fixes https://gitlab.gnome.org/GNOME/json-glib/-/issues/58
* parser: Ignore UTF-8 BOM if necessaryhandle-utf8-bomJan-Michael Brummer2020-12-314-1/+46
| | | | | | | | | According to JSON spec BOM shouldn't be part of the JSON data, but also recommends to tolerate files with a BOM marker. As this is common in several Windows JSON generators, handle it graceful in json-glib and skip it for UTF-8 BOM. Fixes: https://gitlab.gnome.org/GNOME/json-glib/-/issues/56
* tests: Add surrogate pair testsJames Westman2020-11-301-0/+3
|
* scanner: Fix crash on malformed surrogate pairsJames Westman2020-11-301-4/+24
| | | | | | | | | | | JSON-GLib would crash when trying to decode escaped Unicode characters, if a character of a surrogate pair was detected but it was in the wrong range, or if the following character was not in the correct range. Fixed by emitting an error ("Parse error: scanner: malformed surrogate pair") before the assertion is run. Fixes #26.
* Fix build reproducibilityAlexander Kanavin2020-11-011-2/+2
| | | | | | | | | Changes the comment and include to reference the file basename instead of the full path. This ensures that the generated file is reproducible when it is included in source packages meant for debugging. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* Gracefully handle empty arrays and objectsEmmanuele Bassi2020-08-242-11/+14
| | | | | | Don't pretty print newlines. This requires a change in the generator test, but the pretty printing format is not stable anyway, so we can get away with it.
* build: Maintain Autotools compatibility on DarwinEmmanuele Bassi2020-08-241-0/+1
| | | | | | | | | | | | | JSON-GLib 1.2 was the last release using Autotools on Darwin, which means we cannot use "1" as the compatibility version argument. We should also use the `darwin_versions` argument for `library()` to let Meson do the right thing depending on the platform, instead of passing linker flags ourselves. Original patch by: Tom Schoonjans Fixes: #41
* Properly detect multiple top level statementsEmmanuele Bassi2020-08-242-15/+13
| | | | | | | | JSON can only have one top level statement. If we get multiple statements, we should error out appropriately, and we should also avoid leaking the node for the previously parsed statement. Fixes: #45
* Plug leaks in json-glib-formatEmmanuele Bassi2020-08-241-3/+14
| | | | | We're leaking a bunch of strings in error paths, as well as the stream for the input file.
* Document json_from_string() nullabilityEmmanuele Bassi2020-08-241-2/+2
| | | | | | | | The function can return NULL even without setting an error, so we need to add a `nullable` annotation. While at it, document the handling of empty strings more explicitly. Fixes: #46
* Assert that foreach_member() won't mutate the objectEmmanuele Bassi2020-08-241-0/+5
| | | | | | | We document that it's not safe, but we kind of rely on GHashTable to do that for us. Instead, let's use the newly added age field to protect against accidental mutations during iteration, just like we do for the iterator API.
* Document the iteration order for foreach_member()Emmanuele Bassi2020-08-241-0/+3
| | | | | The iteration order is the insertion order, and has been for a long time.
* Add ordered iterator for JsonObjectEmmanuele Bassi2020-08-244-10/+183
| | | | | | | | | The current iterator API does not guarantee the iteration order, as it's based off of the hash table iterator. JsonObject, though, can guarantee the iteration order—we do that for json_object_foreach_member(). Instead of changing the behaviour of json_object_iter_next(), we can add API to initialize and iterate a JsonObjectIter in insertion order.
* Use non-deprecated GObject constructor and typesEmmanuele Bassi2020-08-241-28/+23
| | | | | Both g_object_newv() and GParameter have been deprecated for a long time.
* build: Remove unnecessary argumentEmmanuele Bassi2020-08-241-1/+0
| | | | | The configure_file() function does not need an `install` argument with an unconditional value.
* scanner: use macro instead of cast to convert pointer to integerDimitry Andric2020-08-191-1/+1
| | | | | | | | | Clang 11 build failed due to a new warning (part of -Werror=pointer-to-int-cast): ../json-glib/json-scanner.c:928:13: error: cast to smaller integer type 'GTokenType' from 'gpointer' (aka 'void *') [-Werror,-Wvoid-pointer-to-enum-cast] *token_p = (GTokenType) value_p->v_symbol; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
* json-parser: Support loading files via memory mappingPhilip Withnall2020-06-095-0/+120
| | | | | | | | | | | | | | | Add a new `json_parser_load_from_mapped_file()` to load JSON from files via memory mapping. It’s otherwise similar to `json_parser_load_from_file()`. It’s in the right position to be able to memory map the file it’s reading from: it reads the input once before building a `JsonNode` structure to represent it, doesn’t write to the file, and often deals with large input files. This should speed things up slightly due to reducing time spent allocating a large chunk of heap memory to load the file into, if a caller can support that. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* tests: Factor out a helper functionPhilip Withnall2020-06-091-9/+17
| | | | | | | This introduces no functional changes, but will allow that code to be reused in the following commit. Signed-off-by: Philip Withnall <withnall@endlessm.com>
* json-gvariant: Fix poorly written patch in 212f925Robert Ancell2020-04-071-6/+9
| | | | | | | | Don't double do the integer conversion. Catch errors in double conversion. Do correct unsiged conversion. Friends don't let friends do end-of-day last minute MRs.
* json-gvariant: Stop string to GVariant conversion failing due to unrelated ↵Robert Ancell2020-04-061-7/+26
| | | | | | | | | | errno changes This was observed as failing due to some codepath inside g_variant_new_string setting errno to EAGAIN. Json Glib was erroneously detecting this in the checks designed to catch string to integer conversions. Solved by making errno only checked after the integer conversions.