| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| |
| |
| |
| | |
scanner: Fix crash on malformed surrogate pairs
Closes #26
See merge request GNOME/json-glib!34
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 reproducibility
See merge request GNOME/json-glib!33
|
|/
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Do not use source_root()/build_root(), as they prevent building
json-glib as a sub-project.
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Bug squashing
Closes #46, #45, and #41
See merge request GNOME/json-glib!30
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| | |
We're leaking a bunch of strings in error paths, as well as the stream
for the input file.
|
| |
| |
| |
| |
| | |
The Meson port silently dropped the ability to enable debugging messages
at run time. Let's bring it back.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
The iteration order is the insertion order, and has been for a long
time.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
Both g_object_newv() and GParameter have been deprecated for a long
time.
|
| |
| |
| |
| | |
Require a non-ancient version of GLib.
|
| | |
|
|/
|
|
|
| |
The configure_file() function does not need an `install` argument with
an unconditional value.
|
|\
| |
| |
| |
| | |
Unbreak build with Clang 11
See merge request GNOME/json-glib!29
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| | |
|
|/ |
|
|\
| |
| |
| |
| |
| |
| | |
build: Add a symbol version to all exported symbols
Closes #33
See merge request GNOME/json-glib!28
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The --default-symver linker option attaches a default version definition
(the SONAME) to every exported symbol. It is supported since at least
GNU binutils 2.22 in 2011 (older versions not tested).
With this version definition, newly-linked binaries that depend on the
json-glib shared library will refer to its symbols in a versioned form,
preventing their references from being resolved to a symbol of the same
name exported by json-c or libjansson if those libraries appear in
dependency search order before json-glib, which will usually result in
a crash. This is necessary because ELF symbol resolution normally uses
a single flat namespace, not a tree like Windows symbol resolution.
At least one symbol (json_object_iter_next()) is exported by all three
JSON libraries.
Linking with -Bsymbolic is not enough to have this effect in all cases,
because -Bsymbolic only affects symbol lookup within a shared object,
for example when json_from_string() calls json_parser_new(). It does
not affect symbol lookup when external code calls into json-glib,
for example when libedataserver calls json_parser_new().
This change will also not prevent code that depends on json-c or
libjansson from finding json-glib's symbols and crashing; to prevent
that, a corresponding change in json-c or libjansson would be needed.
Adding a symbol-version is a backwards-compatible change, but once
added, removing or changing the symbol-version would be an incompatible
change that requires a SONAME bump.
Partially resolves https://gitlab.gnome.org/GNOME/json-glib/-/issues/33
and https://gitlab.gnome.org/GNOME/glib/-/issues/2147.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\
| |
| |
| |
| | |
json-parser: Support loading files via memory mapping
See merge request GNOME/json-glib!27
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| | |
ci: Update the base CI image
See merge request GNOME/json-glib!25
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
json-gvariant: Fix poorly written patch in 212f925
See merge request GNOME/json-glib!23
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
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 errno changes
See merge request GNOME/json-glib!22
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
| |
|
| |
|