diff --git a/ChangeLog b/ChangeLog index 2d68c853e..c8eac34e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-12-06 Emmanuele Bassi + + * 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. + 2007-12-06 Emmanuele Bassi * clutter/pango/pangoclutter-render.c: Hush a compiler warning diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c index 3577693ac..259811234 100644 --- a/clutter/clutter-script.c +++ b/clutter/clutter-script.c @@ -1602,7 +1602,7 @@ clutter_script_load_from_file (ClutterScript *script, guint clutter_script_load_from_data (ClutterScript *script, const gchar *data, - gsize length, + gssize length, GError **error) { ClutterScriptPrivate *priv; @@ -1611,6 +1611,9 @@ clutter_script_load_from_data (ClutterScript *script, g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), 0); g_return_val_if_fail (data != NULL, 0); + if (length < 0) + length = strlen (data); + priv = script->priv; g_free (priv->filename); diff --git a/clutter/clutter-script.h b/clutter/clutter-script.h index ac73d47a4..00d2c3ca4 100644 --- a/clutter/clutter-script.h +++ b/clutter/clutter-script.h @@ -120,7 +120,7 @@ guint clutter_script_load_from_file (ClutterScript *script, GError **error); guint clutter_script_load_from_data (ClutterScript *script, const gchar *data, - gsize length, + gssize length, GError **error); GObject * clutter_script_get_object (ClutterScript *script, const gchar *name); diff --git a/clutter/json/json-parser.c b/clutter/json/json-parser.c index d7c960cf9..8a5f26900 100644 --- a/clutter/json/json-parser.c +++ b/clutter/json/json-parser.c @@ -888,7 +888,7 @@ json_parser_load_from_file (JsonParser *parser, gboolean json_parser_load_from_data (JsonParser *parser, const gchar *data, - gsize length, + gssize length, GError **error) { GScanner *scanner; @@ -909,7 +909,7 @@ json_parser_load_from_data (JsonParser *parser, } scanner = json_scanner_new (parser); - g_scanner_input_text (scanner, data, strlen (data)); + g_scanner_input_text (scanner, data, length); for (i = 0; i < n_symbols; i++) { diff --git a/clutter/json/json-parser.h b/clutter/json/json-parser.h index 71a17cbfb..11638a634 100644 --- a/clutter/json/json-parser.h +++ b/clutter/json/json-parser.h @@ -135,7 +135,7 @@ gboolean json_parser_load_from_file (JsonParser *parser, GError **error); gboolean json_parser_load_from_data (JsonParser *parser, const gchar *data, - gsize length, + gssize length, GError **error); JsonNode * json_parser_get_root (JsonParser *parser);