diff options
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rw-r--r-- | json-glib/json-array.c | 4 | ||||
-rw-r--r-- | json-glib/json-generator.c | 4 | ||||
-rw-r--r-- | json-glib/json-gobject.c | 16 | ||||
-rw-r--r-- | json-glib/json-gvariant.c | 19 | ||||
-rw-r--r-- | json-glib/json-parser.c | 12 | ||||
-rw-r--r-- | json-glib/json-path.c | 8 | ||||
-rw-r--r-- | json-glib/json-scanner.c | 75 | ||||
-rw-r--r-- | json-glib/json-serializable.c | 8 | ||||
-rw-r--r-- | json-glib/json-version-macros.h | 32 | ||||
-rw-r--r-- | json-glib/tests/array.c | 2 | ||||
-rw-r--r-- | json-glib/tests/generator.c | 13 | ||||
-rw-r--r-- | json-glib/tests/gvariant.c | 22 | ||||
-rw-r--r-- | json-glib/tests/invalid.c | 4 | ||||
-rw-r--r-- | json-glib/tests/object.c | 6 | ||||
-rw-r--r-- | json-glib/tests/parser.c | 21 | ||||
-rw-r--r-- | json-glib/tests/path.c | 19 | ||||
-rw-r--r-- | json-glib/tests/serialize-full.c | 2 | ||||
-rw-r--r-- | meson.build | 18 |
19 files changed, 159 insertions, 130 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d0b19a..0b7c477 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,7 +59,7 @@ fedora-x86_64: python3-pip python3-wheel redhat-rpm-config - MESON_VERSION: "0.55.3" + MESON_VERSION: "0.62" MESON_EXTRA_FLAGS: "--buildtype=debug --default-library=both -Dwerror=true -Dglib:werror=false -Dintrospection=enabled" reference: @@ -74,7 +74,7 @@ reference: git glib2-devel libxslt - MESON_VERSION: "0.55.3" + MESON_VERSION: "0.62" MESON_EXTRA_FLAGS: "-Dman=true -Dintrospection=enabled" DOCS_FLAGS: -Dgtk_doc=enabled DOCS_PATH: doc/json-glib-1.0 diff --git a/json-glib/json-array.c b/json-glib/json-array.c index b242ce7..200cd92 100644 --- a/json-glib/json-array.c +++ b/json-glib/json-array.c @@ -731,12 +731,10 @@ json_array_foreach_element (JsonArray *array, JsonArrayForeach func, gpointer data) { - gint i; - g_return_if_fail (array != NULL); g_return_if_fail (func != NULL); - for (i = 0; i < array->elements->len; i++) + for (guint i = 0; i < array->elements->len; i++) { JsonNode *element_node; diff --git a/json-glib/json-generator.c b/json-glib/json-generator.c index fc8dcfc..40e9b02 100644 --- a/json-glib/json-generator.c +++ b/json-glib/json-generator.c @@ -61,7 +61,6 @@ enum }; static void dump_value (GString *buffer, - gint level, JsonNode *node); static void dump_array (JsonGenerator *generator, GString *buffer, @@ -316,7 +315,7 @@ dump_node (JsonGenerator *generator, break; case JSON_NODE_VALUE: - dump_value (buffer, level, node); + dump_value (buffer, node); break; case JSON_NODE_ARRAY: @@ -333,7 +332,6 @@ dump_node (JsonGenerator *generator, static void dump_value (GString *buffer, - gint level, JsonNode *node) { const JsonValue *value; diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c index 5b7331c..f783209 100644 --- a/json-glib/json-gobject.c +++ b/json-glib/json-gobject.c @@ -406,7 +406,7 @@ json_gobject_dump (GObject *gobject) gboolean json_deserialize_pspec (GValue *value, - GParamSpec *pspec, + GParamSpec *pspec G_GNUC_UNUSED, JsonNode *node) { GValue node_value = { 0, }; @@ -655,7 +655,7 @@ json_deserialize_pspec (GValue *value, JsonNode * json_serialize_pspec (const GValue *real_value, - GParamSpec *pspec) + GParamSpec *pspec G_GNUC_UNUSED) { JsonNode *retval = NULL; JsonNodeType node_type; @@ -838,11 +838,11 @@ json_gobject_serialize (GObject *gobject) * json_construct_gobject: * @gtype: the type of the object to construct * @data: a JSON data stream - * @length: length of the data stream + * @length: length of the data stream (unused) * @error: return location for a #GError, or %NULL * * Deserializes a JSON data stream and creates an instance of the given - * type + * type. * * If the given type implements the [iface@Json.Serializable] interface, it * will be asked to deserialize all the JSON members into their respective @@ -851,7 +851,11 @@ json_gobject_serialize (GObject *gobject) * * **Note**: the JSON data stream must be an object. * - * Return value: (transfer full) (nullable): a new object instance of the given type + * For historical reasons, the `length` argument is unused. The given `data` + * must be a `NUL`-terminated string. + * + * Returns: (transfer full) (nullable): a new object instance of the given + * type * * Since: 0.4 * @@ -860,7 +864,7 @@ json_gobject_serialize (GObject *gobject) GObject * json_construct_gobject (GType gtype, const gchar *data, - gsize length, + gsize length G_GNUC_UNUSED, GError **error) { return json_gobject_from_data (gtype, data, strlen (data), error); diff --git a/json-glib/json-gvariant.c b/json-glib/json-gvariant.c index 15f03f5..2af98e7 100644 --- a/json-glib/json-gvariant.c +++ b/json-glib/json-gvariant.c @@ -490,24 +490,27 @@ json_node_assert_type (JsonNode *json_node, } static void -json_to_gvariant_foreach_add (gpointer data, gpointer user_data) +json_to_gvariant_foreach_add (gpointer data, + gpointer user_data) { - GVariantBuilder *builder = (GVariantBuilder *) user_data; - GVariant *child = (GVariant *) data; + GVariantBuilder *builder = user_data; + GVariant *child = data; g_variant_builder_add_value (builder, child); } static void -json_to_gvariant_foreach_free (gpointer data, gpointer user_data) +json_to_gvariant_foreach_free (gpointer data, + gpointer user_data G_GNUC_UNUSED) { - GVariant *child = (GVariant *) data; + GVariant *child = data; g_variant_unref (child); } static GVariant * -json_to_gvariant_build_from_glist (GList *list, const gchar *signature) +json_to_gvariant_build_from_glist (GList *list, + const char *signature) { GVariantBuilder *builder; GVariant *result; @@ -529,7 +532,7 @@ json_to_gvariant_tuple (JsonNode *json_node, { GVariant *variant = NULL; JsonArray *array; - gint i; + guint i; GList *children = NULL; gboolean roll_back = FALSE; const gchar *initial_signature; @@ -737,7 +740,7 @@ json_to_gvariant_array (JsonNode *json_node, if (json_array_get_length (array) > 0) { - gint i; + guint i; guint len; len = json_array_get_length (array); diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c index c5e58f4..3024a25 100644 --- a/json-glib/json-parser.c +++ b/json-glib/json-parser.c @@ -950,7 +950,6 @@ static JsonScanner * json_scanner_create (JsonParser *parser) { JsonScanner *scanner; - gint i; scanner = json_scanner_new (); scanner->msg_handler = json_scanner_msg_handler; @@ -960,7 +959,7 @@ json_scanner_create (JsonParser *parser) * we cannot move them into JsonScanner without moving a bunch of code * as well */ - for (i = 0; i < n_symbols; i++) + for (guint i = 0; i < n_symbols; i++) { json_scanner_scope_add_symbol (scanner, 0, symbol_names + symbols[i].name_offset, @@ -1011,7 +1010,6 @@ json_parser_load (JsonParser *parser, JsonScanner *scanner; gboolean done; gboolean retval = TRUE; - gint i; gchar *data = input_data; json_parser_clear (parser); @@ -1053,7 +1051,7 @@ json_parser_load (JsonParser *parser, else { guint expected_token; - gint cur_token; + guint cur_token; /* we try to show the expected token, if possible */ expected_token = json_parse_statement (parser, scanner); @@ -1071,7 +1069,7 @@ json_parser_load (JsonParser *parser, if (expected_token > JSON_TOKEN_INVALID && expected_token < JSON_TOKEN_LAST) { - for (i = 0; i < n_symbols; i++) + for (guint i = 0; i < n_symbols; i++) if (symbols[i].token == expected_token) symbol_name = symbol_names + symbols[i].name_offset; @@ -1084,7 +1082,7 @@ json_parser_load (JsonParser *parser, { symbol_name = "???"; - for (i = 0; i < n_symbols; i++) + for (guint i = 0; i < n_symbols; i++) if (symbols[i].token == cur_token) symbol_name = symbol_names + symbols[i].name_offset; } @@ -1558,7 +1556,7 @@ json_parser_load_from_stream_finish (JsonParser *parser, static void read_from_stream (GTask *task, - gpointer source_obj, + gpointer source_obj G_GNUC_UNUSED, gpointer task_data, GCancellable *cancellable) { diff --git a/json-glib/json-path.c b/json-glib/json-path.c index 86fe97f..5e4c0ef 100644 --- a/json-glib/json-path.c +++ b/json-glib/json-path.c @@ -199,7 +199,7 @@ struct _PathNode union { /* JSON_PATH_NODE_CHILD_ELEMENT */ - int element_index; + guint element_index; /* JSON_PATH_NODE_CHILD_MEMBER */ char *member_name; @@ -258,7 +258,7 @@ json_path_class_init (JsonPathClass *klass) } static void -json_path_init (JsonPath *self) +json_path_init (JsonPath *self G_GNUC_UNUSED) { } @@ -302,7 +302,7 @@ json_path_foreach_print (gpointer data, break; case JSON_PATH_NODE_CHILD_ELEMENT: - g_string_append_printf (buf, "<element '%d'", cur_node->data.element_index); + g_string_append_printf (buf, "<element '%u'", cur_node->data.element_index); break; case JSON_PATH_NODE_RECURSIVE_DESCENT: @@ -781,7 +781,7 @@ walk_path_node (GList *path, { JsonArray *array = json_node_get_array (root); GList *members, *l; - int i; + guint i; members = json_array_get_elements (array); for (l = members, i = 0; l != NULL; l = l->next, i += 1) diff --git a/json-glib/json-scanner.c b/json-glib/json-scanner.c index e9a58be..73a510e 100644 --- a/json-glib/json-scanner.c +++ b/json-glib/json-scanner.c @@ -85,41 +85,42 @@ struct _JsonScannerConfig static JsonScannerConfig json_scanner_config_template = { - ( " \t\r\n" ) /* cset_skip_characters */, - ( - "_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_first */, - ( - G_CSET_DIGITS - "-_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_nth */, - ( "//\n" ) /* cpair_comment_single */, - TRUE /* case_sensitive */, - TRUE /* skip_comment_multi */, - TRUE /* skip_comment_single */, - FALSE /* scan_comment_multi */, - TRUE /* scan_identifier */, - TRUE /* scan_identifier_1char */, - FALSE /* scan_identifier_NULL */, - TRUE /* scan_symbols */, - TRUE /* scan_binary */, - TRUE /* scan_octal */, - TRUE /* scan_float */, - TRUE /* scan_hex */, - TRUE /* scan_hex_dollar */, - TRUE /* scan_string_sq */, - TRUE /* scan_string_dq */, - TRUE /* numbers_2_int */, - FALSE /* int_2_float */, - FALSE /* identifier_2_string */, - TRUE /* char_2_token */, - TRUE /* symbol_2_token */, - FALSE /* scope_0_fallback */, - TRUE /* store_int64 */ + .cset_skip_characters = ( " \t\r\n" ), + .cset_identifier_first = ( + "_" + G_CSET_a_2_z + G_CSET_A_2_Z + ), + .cset_identifier_nth = ( + G_CSET_DIGITS + "-_" + G_CSET_a_2_z + G_CSET_A_2_Z + ), + .cpair_comment_single = ( "//\n" ), + .case_sensitive = TRUE, + .skip_comment_multi = TRUE, + .skip_comment_single = TRUE, + .scan_comment_multi = FALSE, + .scan_identifier = TRUE, + .scan_identifier_1char = TRUE, + .scan_identifier_NULL = FALSE, + .scan_symbols = TRUE, + .scan_binary = TRUE, + .scan_octal = TRUE, + .scan_float = TRUE, + .scan_hex = TRUE, + .scan_hex_dollar = TRUE, + .scan_string_sq = TRUE, + .scan_string_dq = TRUE, + .numbers_2_int = TRUE, + .int_2_float = FALSE, + .identifier_2_string = FALSE, + .char_2_token = TRUE, + .symbol_2_token = TRUE, + .scope_0_fallback = FALSE, + .store_int64 = TRUE, + .padding_dummy = 0, }; /* --- defines --- */ @@ -282,8 +283,8 @@ json_scanner_free_value (GTokenType *token_p, static void json_scanner_destroy_symbol_table_entry (gpointer _key, - gpointer _value, - gpointer _data) + gpointer _value G_GNUC_UNUSED, + gpointer _data G_GNUC_UNUSED) { JsonScannerKey *key = _key; diff --git a/json-glib/json-serializable.c b/json-glib/json-serializable.c index de6c1c4..e19670b 100644 --- a/json-glib/json-serializable.c +++ b/json-glib/json-serializable.c @@ -113,8 +113,8 @@ json_serializable_deserialize_property (JsonSerializable *serializable, } static gboolean -json_serializable_real_deserialize (JsonSerializable *serializable, - const gchar *name, +json_serializable_real_deserialize (JsonSerializable *serializable G_GNUC_UNUSED, + const gchar *name G_GNUC_UNUSED, GValue *value, GParamSpec *pspec, JsonNode *node) @@ -128,8 +128,8 @@ json_serializable_real_deserialize (JsonSerializable *serializable, } static JsonNode * -json_serializable_real_serialize (JsonSerializable *serializable, - const gchar *name, +json_serializable_real_serialize (JsonSerializable *serializable G_GNUC_UNUSED, + const gchar *name G_GNUC_UNUSED, const GValue *value, GParamSpec *pspec) { diff --git a/json-glib/json-version-macros.h b/json-glib/json-version-macros.h index 75ac770..a961be3 100644 --- a/json-glib/json-version-macros.h +++ b/json-glib/json-version-macros.h @@ -45,6 +45,8 @@ * JSON_VERSION_1_0: * * The encoded representation of JSON-GLib version "1.0". + * + * Since: 1.0 */ #define JSON_VERSION_1_0 (G_ENCODE_VERSION (1, 0)) @@ -52,6 +54,8 @@ * JSON_VERSION_1_2: * * The encoded representation of JSON-GLib version "1.2". + * + * Since: 1.2 */ #define JSON_VERSION_1_2 (G_ENCODE_VERSION (1, 2)) @@ -59,6 +63,8 @@ * JSON_VERSION_1_4: * * The encoded representation of JSON-GLib version "1.4". + * + * Since: 1.4 */ #define JSON_VERSION_1_4 (G_ENCODE_VERSION (1, 4)) @@ -66,9 +72,20 @@ * JSON_VERSION_1_6: * * The encoded representation of JSON-GLib version "1.6". + * + * Since: 1.6 */ #define JSON_VERSION_1_6 (G_ENCODE_VERSION (1, 6)) +/** + * JSON_VERSION_1_8: + * + * The encoded representation of JSON-GLib version "1.8". + * + * Since: 1.8 + */ +#define JSON_VERSION_1_8 (G_ENCODE_VERSION (1, 8)) + /* evaluates to the current stable version; for development cycles, * this means the next stable target */ @@ -205,4 +222,19 @@ # define JSON_AVAILABLE_IN_1_6 _JSON_EXTERN #endif +/* 1.8 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_8 +# define JSON_DEPRECATED_IN_1_8 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_8_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_8 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_8_FOR(f) _JSON_EXTERN +#endif + +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_8 +# define JSON_AVAILABLE_IN_1_8 JSON_UNAVAILABLE(1, 8) +#else +# define JSON_AVAILABLE_IN_1_8 _JSON_EXTERN +#endif + #endif /* __JSON_VERSION_MACROS_H__ */ diff --git a/json-glib/tests/array.c b/json-glib/tests/array.c index 5406916..421d333 100644 --- a/json-glib/tests/array.c +++ b/json-glib/tests/array.c @@ -94,7 +94,7 @@ static const struct { }; static void -verify_foreach (JsonArray *array, +verify_foreach (JsonArray *array G_GNUC_UNUSED, guint index_, JsonNode *element_node, gpointer user_data) diff --git a/json-glib/tests/generator.c b/json-glib/tests/generator.c index 833d8fc..f6ac0f1 100644 --- a/json-glib/tests/generator.c +++ b/json-glib/tests/generator.c @@ -297,7 +297,6 @@ test_decimal_separator (void) JsonNode *node = json_node_new (JSON_NODE_VALUE); JsonGenerator *generator = json_generator_new (); gchar *old_locale; - gint i; json_node_set_double (node, 3.14); @@ -305,7 +304,7 @@ test_decimal_separator (void) old_locale = setlocale (LC_NUMERIC, NULL); - for (i = 0; i < G_N_ELEMENTS (decimal_separator); i++) + for (guint i = 0; i < G_N_ELEMENTS (decimal_separator); i++) { gchar *str, *expected; @@ -434,10 +433,6 @@ int main (int argc, char *argv[]) { - gchar *escaped; - gchar *name; - gint i; - g_test_init (&argc, &argv, NULL); g_test_add_func ("/generator/empty-array", test_empty_array); @@ -450,10 +445,10 @@ main (int argc, g_test_add_func ("/generator/double-stays-double", test_double_stays_double); g_test_add_func ("/generator/pretty", test_pretty); - for (i = 0; i < G_N_ELEMENTS (string_fixtures); i++) + for (guint i = 0; i < G_N_ELEMENTS (string_fixtures); i++) { - escaped = g_strescape (string_fixtures[i].str, NULL); - name = g_strdup_printf ("/generator/string/%s", escaped); + char *escaped = g_strescape (string_fixtures[i].str, NULL); + char *name = g_strdup_printf ("/generator/string/%s", escaped); g_test_add_data_func (name, string_fixtures + i, test_string_encode); g_free (escaped); g_free (name); diff --git a/json-glib/tests/gvariant.c b/json-glib/tests/gvariant.c index 3f2bc13..805da00 100644 --- a/json-glib/tests/gvariant.c +++ b/json-glib/tests/gvariant.c @@ -216,17 +216,13 @@ test_json_to_gvariant (gconstpointer test_data) gint main (gint argc, gchar *argv[]) { - gint i; - TestCase test_case; - gchar *test_name; - g_test_init (&argc, &argv, NULL); /* GVariant to JSON */ - for (i = 0; i < G_N_ELEMENTS (two_way_test_cases); i++) + for (guint i = 0; i < G_N_ELEMENTS (two_way_test_cases); i++) { - test_case = two_way_test_cases[i]; - test_name = g_strdup_printf ("/gvariant/to-json/%s", test_case.test_name); + TestCase test_case = two_way_test_cases[i]; + char *test_name = g_strdup_printf ("/gvariant/to-json/%s", test_case.test_name); g_test_add_data_func (test_name, &two_way_test_cases[i], test_gvariant_to_json); @@ -234,10 +230,10 @@ main (gint argc, gchar *argv[]) } /* JSON to GVariant */ - for (i = 0; i < G_N_ELEMENTS (two_way_test_cases); i++) + for (guint i = 0; i < G_N_ELEMENTS (two_way_test_cases); i++) { - test_case = two_way_test_cases[i]; - test_name = g_strdup_printf ("/gvariant/from-json/%s", test_case.test_name); + TestCase test_case = two_way_test_cases[i]; + char *test_name = g_strdup_printf ("/gvariant/from-json/%s", test_case.test_name); g_test_add_data_func (test_name, &two_way_test_cases[i], test_json_to_gvariant); @@ -245,10 +241,10 @@ main (gint argc, gchar *argv[]) } /* JSON to GVariant one way tests */ - for (i = 0; i < G_N_ELEMENTS (json_to_gvariant_test_cases); i++) + for (guint i = 0; i < G_N_ELEMENTS (json_to_gvariant_test_cases); i++) { - test_case = json_to_gvariant_test_cases[i]; - test_name = g_strdup_printf ("/gvariant/from-json/%s", test_case.test_name); + TestCase test_case = json_to_gvariant_test_cases[i]; + char *test_name = g_strdup_printf ("/gvariant/from-json/%s", test_case.test_name); g_test_add_data_func (test_name, &json_to_gvariant_test_cases[i], test_json_to_gvariant); diff --git a/json-glib/tests/invalid.c b/json-glib/tests/invalid.c index 5197e9f..3cab2c2 100644 --- a/json-glib/tests/invalid.c +++ b/json-glib/tests/invalid.c @@ -252,11 +252,9 @@ int main (int argc, char *argv[]) { - int i; - g_test_init (&argc, &argv, NULL); - for (i = 0; i < n_test_invalid; i++) + for (guint i = 0; i < n_test_invalid; i++) { char *test_path = g_strconcat ("/invalid/json/", test_invalid[i].path, NULL); diff --git a/json-glib/tests/object.c b/json-glib/tests/object.c index b5cab1a..bc30841 100644 --- a/json-glib/tests/object.c +++ b/json-glib/tests/object.c @@ -123,7 +123,7 @@ static const struct { }; static void -verify_foreach (JsonObject *object, +verify_foreach (JsonObject *object G_GNUC_UNUSED, const gchar *member_name, JsonNode *member_node, gpointer user_data) @@ -140,9 +140,7 @@ verify_foreach (JsonObject *object, } else { - int i; - - for (i = 0; i < G_N_ELEMENTS (type_verify); i++) + for (guint i = 0; i < G_N_ELEMENTS (type_verify); i++) { if (strcmp (member_name, type_verify[i].member_name) == 0) { diff --git a/json-glib/tests/parser.c b/json-glib/tests/parser.c index c6ee421..bd23798 100644 --- a/json-glib/tests/parser.c +++ b/json-glib/tests/parser.c @@ -189,7 +189,6 @@ test_empty (void) static void test_base_value (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -198,7 +197,7 @@ test_base_value (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with base-values...\n"); - for (i = 0; i < n_test_base_values; i++) + for (guint i = 0; i < n_test_base_values; i++) { GError *error = NULL; @@ -283,7 +282,6 @@ test_empty_array (void) static void test_simple_array (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -292,7 +290,7 @@ test_simple_array (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with simple arrays...\n"); - for (i = 0; i < n_test_simple_arrays; i++) + for (guint i = 0; i < n_test_simple_arrays; i++) { GError *error = NULL; @@ -347,7 +345,6 @@ test_simple_array (void) static void test_nested_array (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -356,7 +353,7 @@ test_nested_array (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with nested arrays...\n"); - for (i = 0; i < n_test_nested_arrays; i++) + for (guint i = 0; i < n_test_nested_arrays; i++) { GError *error = NULL; @@ -442,7 +439,6 @@ test_empty_object (void) static void test_simple_object (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -451,7 +447,7 @@ test_simple_object (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with simple objects...\n"); - for (i = 0; i < n_test_simple_objects; i++) + for (guint i = 0; i < n_test_simple_objects; i++) { GError *error = NULL; @@ -503,7 +499,6 @@ test_simple_object (void) static void test_nested_object (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -512,7 +507,7 @@ test_nested_object (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with nested objects...\n"); - for (i = 0; i < n_test_nested_objects; i++) + for (guint i = 0; i < n_test_nested_objects; i++) { GError *error = NULL; @@ -553,7 +548,6 @@ test_nested_object (void) static void test_assignment (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -562,7 +556,7 @@ test_assignment (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with assignments...\n"); - for (i = 0; i < n_test_assignments; i++) + for (guint i = 0; i < n_test_assignments; i++) { GError *error = NULL; @@ -595,7 +589,6 @@ test_assignment (void) static void test_unicode_escape (void) { - gint i; JsonParser *parser; parser = json_parser_new (); @@ -604,7 +597,7 @@ test_unicode_escape (void) if (g_test_verbose ()) g_print ("checking json_parser_load_from_data with unicode escape...\n"); - for (i = 0; i < n_test_unicode; i++) + for (guint i = 0; i < n_test_unicode; i++) { GError *error = NULL; diff --git a/json-glib/tests/path.c b/json-glib/tests/path.c index d674da3..864e84a 100644 --- a/json-glib/tests/path.c +++ b/json-glib/tests/path.c @@ -98,72 +98,84 @@ static const struct { "$.store.book[0].title", "[\"Sayings of the Century\"]", TRUE, + 0, }, { "Title of the first book in the store, using array notation.", "$['store']['book'][0]['title']", "[\"Sayings of the Century\"]", TRUE, + 0, }, { "All the authors from the every book.", "$.store.book[*].author", "[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]", TRUE, + 0, }, { "All the authors.", "$..author", "[\"Nigel Rees\",\"Evelyn Waugh\",\"Herman Melville\",\"J. R. R. Tolkien\"]", TRUE, + 0, }, { "Everything inside the store.", "$.store.*", NULL, TRUE, + 0, }, { "All the prices in the store.", "$.store..price", "[\"8.95\",\"12.99\",\"8.99\",\"22.99\",\"19.95\"]", TRUE, + 0, }, { "The third book.", "$..book[2]", "[{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":\"8.99\"}]", TRUE, + 0, }, { "The last book.", "$..book[-1:]", "[{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]", TRUE, + 0, }, { "The first two books.", "$..book[0,1]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"}]", TRUE, + 0, }, { "The first two books, using a slice.", "$..book[:2]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"}]", TRUE, + 0, }, { "All the books.", "$['store']['book'][*]", "[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":\"8.99\"},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]", TRUE, + 0, }, { "All the members of the bicycle object.", "$.store.bicycle.*", "[\"red\",\"19.95\"]", TRUE, + 0, }, { "The root node.", @@ -174,7 +186,8 @@ static const struct { "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]," "\"bicycle\":{\"color\":\"red\",\"price\":\"19.95\"}}}]", TRUE, - } + 0, + }, }; static void @@ -212,7 +225,7 @@ path_expressions_invalid (gconstpointer data) g_assert_false (json_path_compile (path, expr, &error)); - g_assert_error (error, JSON_PATH_ERROR, code); + g_assert_error (error, JSON_PATH_ERROR, (int) code); g_object_unref (path); g_clear_error (&error); @@ -268,7 +281,7 @@ int main (int argc, char *argv[]) { - int i, j; + guint i, j; g_test_init (&argc, &argv, NULL); g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id="); diff --git a/json-glib/tests/serialize-full.c b/json-glib/tests/serialize-full.c index 42f189d..9e8d512 100644 --- a/json-glib/tests/serialize-full.c +++ b/json-glib/tests/serialize-full.c @@ -158,7 +158,7 @@ G_DEFINE_TYPE_WITH_CODE (TestObject, test_object, G_TYPE_OBJECT, json_serializable_iface_init)); static JsonNode * -test_object_serialize_property (JsonSerializable *serializable, +test_object_serialize_property (JsonSerializable *serializable G_GNUC_UNUSED, const gchar *name, const GValue *value, GParamSpec *pspec) diff --git a/meson.build b/meson.build index aeea9cf..7d156bb 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,13 @@ -project('json-glib', 'c', version: '1.6.7', - license: 'LGPLv2.1+', - default_options: [ - 'warning_level=1', - 'buildtype=debugoptimized', - 'c_std=c99', - ], - meson_version: '>= 0.55.3') +project('json-glib', 'c', + version: '1.7.1', + license: 'LGPL-2.1-or-later', + default_options: [ + 'warning_level=2', + 'buildtype=debugoptimized', + 'c_std=gnu99', + ], + meson_version: '>= 0.62.0', +) # Versioning json_version = meson.project_version() |