diff options
author | Federico Mena Quintero <federico@gnome.org> | 2015-04-16 14:56:44 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2015-04-16 15:08:10 -0500 |
commit | 91bbe3456934bf071379977d00bde571338ba5aa (patch) | |
tree | de408d4c72786f61305d45f5b931c0eea3e4f713 | |
parent | 9db05c8e736ade8c2d37249d01e4bdc20650f24c (diff) | |
download | librsvg-91bbe3456934bf071379977d00bde571338ba5aa.tar.gz |
Handle the deprecation of g_type_init() to avoid compiler warnings
Maybe we should increment the glib version requirement one of these days...
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | gdk-pixbuf-loader/test.c | 4 | ||||
-rw-r--r-- | rsvg-base.c | 3 | ||||
-rw-r--r-- | rsvg-compat.h | 13 | ||||
-rw-r--r-- | rsvg-convert.c | 3 | ||||
-rw-r--r-- | test-display.c | 5 | ||||
-rw-r--r-- | tests/crash.c | 3 | ||||
-rw-r--r-- | tests/dimensions.c | 3 | ||||
-rw-r--r-- | tests/rsvg-test.c | 3 | ||||
-rw-r--r-- | tests/styles.c | 3 | ||||
-rw-r--r-- | tools/rsvg-dimensions.c | 3 | ||||
-rw-r--r-- | tools/rsvg-tools-main.c | 3 |
12 files changed, 36 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index 361fecc5..341b5570 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ librsvg_@RSVG_API_MAJOR_VERSION@_la_SOURCES = \ librsvg-features.c \ rsvg-css.c \ rsvg-css.h \ + rsvg-compat.h \ rsvg-defs.c \ rsvg-defs.h \ rsvg-image.c \ diff --git a/gdk-pixbuf-loader/test.c b/gdk-pixbuf-loader/test.c index efb69495..06784d5d 100644 --- a/gdk-pixbuf-loader/test.c +++ b/gdk-pixbuf-loader/test.c @@ -24,6 +24,8 @@ #include <glib.h> #include <gdk-pixbuf/gdk-pixbuf.h> +#include "rsvg-compat.h" + int main (int argc, char **argv) { @@ -49,7 +51,7 @@ main (int argc, char **argv) /* Use the locally built rsvg loader, not the system one */ g_setenv ("GDK_PIXBUF_MODULE_FILE", "./gdk-pixbuf.loaders", TRUE); - g_type_init (); + RSVG_G_TYPE_INIT; context = g_option_context_new ("- Pixbuf Test Loader"); g_option_context_add_main_entries (context, options_table, NULL); diff --git a/rsvg-base.c b/rsvg-base.c index 62340cfa..5eab09df 100644 --- a/rsvg-base.c +++ b/rsvg-base.c @@ -28,6 +28,7 @@ #define _GNU_SOURCE 1 #include "rsvg.h" +#include "rsvg-compat.h" #include "rsvg-private.h" #include "rsvg-css.h" #include "rsvg-styles.h" @@ -1969,7 +1970,7 @@ rsvg_handle_new_from_stream_sync (GInputStream *input_stream, void rsvg_init (void) { - g_type_init (); + RSVG_G_TYPE_INIT; } /** diff --git a/rsvg-compat.h b/rsvg-compat.h new file mode 100644 index 00000000..897e4c27 --- /dev/null +++ b/rsvg-compat.h @@ -0,0 +1,13 @@ +/* rsvg-compat.h: miscellaneous compatibility functions to deal with deprecations in the platform */ + +#ifndef RSVG_COMPAT_H +#define RSVG_COMPAT_H + +/* g_type_init() was deprecated in glib 2.36.0 */ +#if !GLIB_CHECK_VERSION (2, 36, 0) +# define RSVG_G_TYPE_INIT g_type_init () +#else +# define RSVG_G_TYPE_INIT {} +#endif + +#endif /* RSVG_COMPAT_H */ diff --git a/rsvg-convert.c b/rsvg-convert.c index c752c0a5..76862d15 100644 --- a/rsvg-convert.c +++ b/rsvg-convert.c @@ -50,6 +50,7 @@ #include "rsvg-css.h" #include "rsvg.h" +#include "rsvg-compat.h" #include "rsvg-size-callback.h" #ifdef CAIRO_HAS_PS_SURFACE @@ -164,7 +165,7 @@ main (int argc, char **argv) /* Set the locale so that UTF-8 filenames work */ setlocale(LC_ALL, ""); - g_type_init (); + RSVG_G_TYPE_INIT; g_option_context = g_option_context_new (_("- SVG Converter")); g_option_context_add_main_entries (g_option_context, options_table, NULL); diff --git a/test-display.c b/test-display.c index e16414d5..cc91f402 100644 --- a/test-display.c +++ b/test-display.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "rsvg.h" #include "rsvg-private.h" #include "rsvg-size-callback.h" @@ -30,6 +29,8 @@ #include <gtk/gtk.h> #include <gdk/gdk.h> +#include "rsvg-compat.h" + #if 0 // defined (G_OS_UNIX) #include <gio/gunixinputstream.h> #endif @@ -659,7 +660,7 @@ main (int argc, char **argv) /* Set the locale so that UTF-8 filenames work */ setlocale(LC_ALL, ""); - g_type_init (); + RSVG_G_TYPE_INIT; info.window = NULL; info.popup_menu = NULL; diff --git a/tests/crash.c b/tests/crash.c index 43be8cbc..101ad9d2 100644 --- a/tests/crash.c +++ b/tests/crash.c @@ -2,6 +2,7 @@ #include <glib.h> #include "rsvg.h" +#include "rsvg-compat.h" #include "test-utils.h" typedef struct _FixtureData @@ -39,7 +40,7 @@ main (int argc, char *argv[]) gint i; int result; - g_type_init (); + RSVG_G_TYPE_INIT; g_test_init (&argc, &argv, NULL); for (i = 0; i < n_fixtures; i++) diff --git a/tests/dimensions.c b/tests/dimensions.c index 1eda4fc9..da40f6d7 100644 --- a/tests/dimensions.c +++ b/tests/dimensions.c @@ -2,6 +2,7 @@ #include <glib.h> #include "rsvg.h" +#include "rsvg-compat.h" #include "test-utils.h" typedef struct _FixtureData @@ -54,7 +55,7 @@ main (int argc, char *argv[]) gint i; int result; - g_type_init (); + RSVG_G_TYPE_INIT; g_test_init (&argc, &argv, NULL); for (i = 0; i < n_fixtures; i++) diff --git a/tests/rsvg-test.c b/tests/rsvg-test.c index 32da57d4..63aba490 100644 --- a/tests/rsvg-test.c +++ b/tests/rsvg-test.c @@ -42,6 +42,7 @@ #include "rsvg.h" #include "rsvg-private.h" #include "rsvg-size-callback.h" +#include "rsvg-compat.h" #include "pdiff.h" @@ -348,7 +349,7 @@ main (int argc, char **argv) int i, j; gsize length; - g_type_init (); + RSVG_G_TYPE_INIT; printf ("===============\n" "Rendering tests\n" diff --git a/tests/styles.c b/tests/styles.c index 837fca67..d09b1f24 100644 --- a/tests/styles.c +++ b/tests/styles.c @@ -2,6 +2,7 @@ #include <glib.h> #include "rsvg.h" +#include "rsvg-compat.h" #include "rsvg-private.h" #include "rsvg-defs.h" #include "rsvg-styles.h" @@ -114,7 +115,7 @@ main (int argc, char *argv[]) gint i; int result; - g_type_init (); + RSVG_G_TYPE_INIT; g_test_init (&argc, &argv, NULL); g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id="); diff --git a/tools/rsvg-dimensions.c b/tools/rsvg-dimensions.c index 8727b1fd..0733ef2e 100644 --- a/tools/rsvg-dimensions.c +++ b/tools/rsvg-dimensions.c @@ -9,6 +9,7 @@ #include <stdlib.h> #include <glib.h> #include <rsvg.h> +#include "rsvg-compat.h" static void show_help (GOptionContext *context) @@ -40,7 +41,7 @@ main (int argc, { NULL } }; - g_type_init (); + RSVG_G_TYPE_INIT; context = NULL; fragment = NULL; diff --git a/tools/rsvg-tools-main.c b/tools/rsvg-tools-main.c index a38944f7..bac7085c 100644 --- a/tools/rsvg-tools-main.c +++ b/tools/rsvg-tools-main.c @@ -32,6 +32,7 @@ #include "rsvg.h" #include "rsvg-private.h" #include "rsvg-tools-main.h" +#include "rsvg-compat.h" static gboolean read_contents (const gchar *file_name, guint8 **contents, gsize *length) @@ -127,7 +128,7 @@ rsvg_tools_main (int *argc, char ***argv) exit (EXIT_FAILURE); } - g_type_init (); + RSVG_G_TYPE_INIT; for (j = 0; j < n_args; j++) { if (!read_contents (args[j], &contents, &length)) |