Backport of the upstream JSON-GLib commit that improved the strictness
of JsonParser.
The original upstream commit is:
29881f03468db08bfb404cfcd5b61b4cdc419a87
There have been changes in JSON-GLib upstream to clean up the
data structures, and facilitate introspection.
We still not use the updated JsonParser with the (private) JsonScanner
code, since it's a fork of GLib's GScanner.
Bug 1476 - JSON Parser memory leak
Static analysis of the code showed that the in-tree copy of
the JsonParser object leaks objects and arrays on parse errors.
Thanks to Gordon Williams <gordon.williams@collabora.co.uk>
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.
The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".
http://bugzilla.openedhand.com/show_bug.cgi?id=1452
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/json/json-parser.[ch]: Use gssize, size we allow -1
as a length (meaning "use the whole string").
(json_parser_load_from_data): Use the passed length instead of
using strlen() all the time.
* clutter/clutter-script.[ch]: Ditto as above.
* clutter/json/json-parser.c:
(json_scanner_msg_handler): Set the GError to be returned by
the parsing functions into the GScanner error message handler.
(json_parser_object): Return the symbol token in case we have
a parse error after the member name.
(json_parser_load_from_data): Propagate the error set in the
message handler, if any.
* clutter/json/json-node.c (json_node_free): Unref the objects
only if are set, to avoid a couple of needless criticals we
get on error.
* tests/test-script.json: More properties.
* clutter/json/json-parser.c: Use the commodity JsonNode API
and accept bare values as root nodes.
* clutter/clutter-script-private.h:
* clutter/clutter-script.c: Unreference the created objects
only if they are top-levels, like ClutterBehaviour and
ClutterTimelines. Actors have floating references, so we
just transfer ownership to their containers, and the stage
is owned by the backend. Add the "type_func" key to the
object definition, so the user can supply its own GType
function if the class name doesn't follow the GObject rules.
Document the ClutterScript public API.
Initial implementation of the UI definition files. (#424)
* clutter/json/Makefile.am:
* clutter/json/*.[ch]: In-tree copy of JSON-GLib, a GLib-based
JSON parser/generator library. We use it in-tree because we might
need to change the API. Ideally, we'd depend on it.
* clutter/clutter.h:
* clutter/clutter-script-private.h:
* clutter/clutter-script.[ch]: ClutterScript, the scenegraph
generator class. It parses JSON streams in form of buffers and
files and builds the scene.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a "script" debug flag
* clutter/Makefile.am: Build glue.
* tests/Makefile.am:
* tests/test-script.c: Add a test case for the ClutterScript.
* configure.ac: Depend on GLib 2.14, so we can use the
g_hash_table_get_key() and g_hash_table_get_values() functions
for the time being; we can probably reimplement those, but we
are going to need 2.14 anyway if we are going to implement a
list model using GSequence.