Deprecate rsvg_init and rsvg_term

rsvg_init() should be replaced by g_type_init(); we now call xmlInitParser()
in RsvgHandleClass::init.

rsvg_term() was dangerous to call, so just make it a no-op and add a new
rsvg_cleanup() that calls xmlCleanupParser(), for use only when you know
what you're doing.

https://bugzilla.gnome.org/show_bug.cgi?id=614157
parent be4898f3
......@@ -9,8 +9,7 @@ RsvgHandlePrivate
RsvgHandleClass
RsvgDimensionData
RsvgPositionData
rsvg_init
rsvg_term
rsvg_cleanup
rsvg_set_default_dpi
rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi
......@@ -34,6 +33,8 @@ rsvg_error_get_type
RSVG_TYPE_ERROR
<SUBSECTION Deprecated>
rsvg_init
rsvg_term
rsvg_handle_free
RsvgSizeFunc
rsvg_handle_set_size_callback
......
......@@ -178,9 +178,6 @@ gdk_pixbuf__svg_image_stop_load (gpointer data, GError **error)
void
fill_vtable (GdkPixbufModule *module)
{
/*todo: call this somewhere to make sure the gnome-vfs et. al. are initialized */
/*rsvg_init ();*/
module->begin_load = gdk_pixbuf__svg_image_begin_load;
module->stop_load = gdk_pixbuf__svg_image_stop_load;
module->load_increment = gdk_pixbuf__svg_image_load_increment;
......
......@@ -2,6 +2,7 @@ rsvg_error_quark
rsvg_error_get_type
rsvg_init
rsvg_term
rsvg_cleanup
rsvg_set_default_dpi
rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi
......
......@@ -1949,23 +1949,37 @@ rsvg_handle_new_from_stream_sync (GInputStream *stream,
*
* Initializes librsvg
* Since: 2.9
* Deprecated: 2.36: Use g_type_init()
**/
void
rsvg_init (void)
{
g_type_init ();
xmlInitParser ();
}
/**
* rsvg_term:
*
* De-initializes librsvg
* This function does nothing.
*
* Since: 2.9
* Deprecated: 2.36
**/
void
rsvg_term (void)
{
}
/**
* rsvg_cleanup:
*
* This function should not be called from normal programs.
* See xmlCleanupParser() for more information.
*
* Since: 2.36
**/
void
rsvg_cleanup (void)
{
xmlCleanupParser ();
}
......
......@@ -221,7 +221,6 @@ main (int argc, char **argv)
if (zoom != 1.0)
x_zoom = y_zoom = zoom;
rsvg_init ();
rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
for (i = 0; i < n_args; i++) {
......@@ -359,7 +358,7 @@ main (int argc, char **argv)
fclose (output_file);
rsvg_term ();
rsvg_cleanup ();
return 0;
}
......@@ -319,6 +319,8 @@ class_init (RsvgHandleClass * klass)
g_type_class_add_private (klass, sizeof (RsvgHandlePrivate));
xmlInitParser ();
rsvg_SAX_handler_struct_init ();
}
......
......@@ -118,8 +118,7 @@ struct _RsvgPositionData {
int y;
};
void rsvg_init (void);
void rsvg_term (void);
void rsvg_cleanup (void);
void rsvg_set_default_dpi (double dpi);
void rsvg_set_default_dpi_x_y (double dpi_x, double dpi_y);
......@@ -183,6 +182,11 @@ RsvgHandle *rsvg_handle_new_from_file (const gchar * file_name, GError ** error)
/* BEGIN deprecated APIs. Do not use! */
RSVG_DEPRECATED_FOR(g_type_init)
void rsvg_init (void);
RSVG_DEPRECATED
void rsvg_term (void);
RSVG_DEPRECATED_FOR(g_object_unref)
void rsvg_handle_free (RsvgHandle * handle);
......
......@@ -805,9 +805,6 @@ main (int argc, char **argv)
return 1;
}
/* initialize gtk+ and rsvg */
rsvg_init ();
rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
/* if both are unspecified, assume user wants to zoom the pixbuf in at least 1 dimension */
......@@ -915,7 +912,8 @@ main (int argc, char **argv)
done:
g_byte_array_free (info.svg_bytes, TRUE);
g_strfreev (args);
rsvg_term ();
rsvg_cleanup ();
return retval;
}
......@@ -39,14 +39,15 @@ main (int argc, char *argv[])
gint i;
int result;
rsvg_init ();
g_type_init ();
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_crash);
result = g_test_run ();
rsvg_term ();
rsvg_cleanup ();
return result;
}
......@@ -54,14 +54,15 @@ main (int argc, char *argv[])
gint i;
int result;
rsvg_init ();
g_type_init ();
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_dimensions);
result = g_test_run ();
rsvg_term ();
rsvg_cleanup ();
return result;
}
......@@ -348,6 +348,8 @@ main (int argc, char **argv)
int i, j;
gsize length;
g_type_init ();
printf ("===============\n"
"Rendering tests\n"
"===============\n");
......@@ -367,8 +369,6 @@ main (int argc, char **argv)
rsvg_test_html ("<html>\n");
rsvg_test_html ("<table>\n");
rsvg_init ();
if (g_file_get_contents (TEST_LIST_FILENAME, &list_content, &length, NULL)) {
rsvg_set_default_dpi_x_y (72, 72);
......@@ -403,8 +403,6 @@ main (int argc, char **argv)
} else
fprintf (stderr, "Error opening test list file "TEST_LIST_FILENAME"\n");
rsvg_term ();
rsvg_test_html ("</table>\n");
rsvg_test_html ("</html>\n");
......@@ -414,6 +412,8 @@ main (int argc, char **argv)
if (rsvg_test_log_file != NULL)
fclose (rsvg_test_log_file);
rsvg_cleanup ();
return status;
}
......@@ -114,7 +114,7 @@ main (int argc, char *argv[])
gint i;
int result;
rsvg_init ();
g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id=");
......@@ -122,7 +122,8 @@ main (int argc, char *argv[])
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_value);
result = g_test_run ();
rsvg_term ();
rsvg_cleanup ();
return result;
}
......@@ -40,7 +40,7 @@ main (int argc,
{ NULL }
};
rsvg_init ();
g_type_init ();
context = NULL;
fragment = NULL;
......@@ -128,7 +128,8 @@ bail:
g_option_context_free (context), context = NULL;
if (error)
g_error_free (error), error = NULL;
rsvg_term ();
rsvg_cleanup ();
return exit_code;
}
......@@ -128,7 +128,7 @@ rsvg_tools_main (int *argc, char ***argv)
exit (EXIT_FAILURE);
}
rsvg_init ();
g_type_init ();
for (j = 0; j < n_args; j++) {
if (!read_contents (args[j], &contents, &length))
......@@ -178,7 +178,7 @@ rsvg_tools_main (int *argc, char ***argv)
cairo_destroy (cr);
}
rsvg_term ();
rsvg_cleanup ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment