Internally use 'char *' for string data

There was a mixture of guint8*, guchar*, gchar*, etc.  Use char* because that's
about as sane as we can get, and only cast where we can't change the public API
or where we must interface with other libraries.  *Cough* xmlChar *cough*.

This removes a metric assload of compiler warnings, and I'm fine with that.
parent 24ca2ec6
...@@ -207,10 +207,10 @@ fill_info (GdkPixbufFormat *info) ...@@ -207,10 +207,10 @@ fill_info (GdkPixbufFormat *info)
}; };
info->name = "svg"; info->name = "svg";
info->signature = signature; info->signature = (GdkPixbufModulePattern *) signature;
info->description = _("Scalable Vector Graphics"); info->description = _("Scalable Vector Graphics");
info->mime_types = mime_types; info->mime_types = (gchar **) mime_types;
info->extensions = extensions; info->extensions = (gchar **) extensions;
info->flags = GDK_PIXBUF_FORMAT_SCALABLE | GDK_PIXBUF_FORMAT_THREADSAFE; info->flags = GDK_PIXBUF_FORMAT_SCALABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
info->license = "LGPL"; info->license = "LGPL";
} }
...@@ -31,14 +31,14 @@ ...@@ -31,14 +31,14 @@
static gboolean static gboolean
rsvg_handle_fill_with_data (RsvgHandle * handle, rsvg_handle_fill_with_data (RsvgHandle * handle,
const guint8 * data, gsize data_len, GError ** error) const char * data, gsize data_len, GError ** error)
{ {
gboolean rv; gboolean rv;
rsvg_return_val_if_fail (data != NULL, FALSE, error); rsvg_return_val_if_fail (data != NULL, FALSE, error);
rsvg_return_val_if_fail (data_len != 0, FALSE, error); rsvg_return_val_if_fail (data_len != 0, FALSE, error);
rv = rsvg_handle_write (handle, data, data_len, error); rv = rsvg_handle_write (handle, (guchar *) data, data_len, error);
return rsvg_handle_close (handle, rv ? error : NULL) && rv; return rsvg_handle_close (handle, rv ? error : NULL) && rv;
} }
...@@ -62,7 +62,7 @@ rsvg_handle_new_from_data (const guint8 * data, gsize data_len, GError ** error) ...@@ -62,7 +62,7 @@ rsvg_handle_new_from_data (const guint8 * data, gsize data_len, GError ** error)
handle = rsvg_handle_new (); handle = rsvg_handle_new ();
if (handle) { if (handle) {
if (!rsvg_handle_fill_with_data (handle, data, data_len, error)) { if (!rsvg_handle_fill_with_data (handle, (char *) data, data_len, error)) {
g_object_unref (handle); g_object_unref (handle);
handle = NULL; handle = NULL;
} }
...@@ -85,7 +85,7 @@ RsvgHandle * ...@@ -85,7 +85,7 @@ RsvgHandle *
rsvg_handle_new_from_file (const gchar * file_name, GError ** error) rsvg_handle_new_from_file (const gchar * file_name, GError ** error)
{ {
gchar *base_uri; gchar *base_uri;
guint8 *data; char *data;
gsize data_len; gsize data_len;
RsvgHandle *handle = NULL; RsvgHandle *handle = NULL;
......
...@@ -563,7 +563,7 @@ rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts) ...@@ -563,7 +563,7 @@ rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts)
parse = rsvg_property_bag_lookup (atts, "parse"); parse = rsvg_property_bag_lookup (atts, "parse");
if (parse && !strcmp (parse, "text")) { if (parse && !strcmp (parse, "text")) {
guint8 *data; char *data;
gsize data_len; gsize data_len;
const char *encoding; const char *encoding;
...@@ -584,7 +584,7 @@ rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts) ...@@ -584,7 +584,7 @@ rsvg_start_xinclude (RsvgHandle * ctx, RsvgPropertyBag * atts)
data_len = text_data_len; data_len = text_data_len;
} }
rsvg_characters_impl (ctx, (const xmlChar *) data, data_len); rsvg_characters_impl (ctx, (xmlChar *) data, data_len);
g_free (data); g_free (data);
} else { } else {
...@@ -830,7 +830,7 @@ rsvg_entity_decl (void *data, const xmlChar * name, int type, ...@@ -830,7 +830,7 @@ rsvg_entity_decl (void *data, const xmlChar * name, int type,
resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx)); resolvedPublicId = xmlBuildRelativeURI (publicId, (xmlChar*) rsvg_handle_get_base_uri (ctx));
if (type == XML_EXTERNAL_PARAMETER_ENTITY && !content) { if (type == XML_EXTERNAL_PARAMETER_ENTITY && !content) {
guint8 *entity_data; char *entity_data;
gsize entity_data_len; gsize entity_data_len;
if (systemId) if (systemId)
...@@ -916,7 +916,7 @@ rsvg_processing_instruction (void *ctx, const xmlChar * target, const xmlChar * ...@@ -916,7 +916,7 @@ rsvg_processing_instruction (void *ctx, const xmlChar * target, const xmlChar *
if (value && strcmp (value, "text/css") == 0) { if (value && strcmp (value, "text/css") == 0) {
value = rsvg_property_bag_lookup (atts, "href"); value = rsvg_property_bag_lookup (atts, "href");
if (value && value[0]) { if (value && value[0]) {
guint8 *style_data; char *style_data;
gsize style_data_len; gsize style_data_len;
char *mime_type = NULL; char *mime_type = NULL;
...@@ -928,7 +928,7 @@ rsvg_processing_instruction (void *ctx, const xmlChar * target, const xmlChar * ...@@ -928,7 +928,7 @@ rsvg_processing_instruction (void *ctx, const xmlChar * target, const xmlChar *
if (style_data && if (style_data &&
mime_type && mime_type &&
strcmp (mime_type, "text/css") == 0) { strcmp (mime_type, "text/css") == 0) {
rsvg_parse_cssbuffer (handle, (char *) style_data, style_data_len); rsvg_parse_cssbuffer (handle, style_data, style_data_len);
} }
g_free (mime_type); g_free (mime_type);
...@@ -1671,7 +1671,7 @@ rsvg_handle_set_size_callback (RsvgHandle * handle, ...@@ -1671,7 +1671,7 @@ rsvg_handle_set_size_callback (RsvgHandle * handle,
/** /**
* rsvg_handle_write: * rsvg_handle_write:
* @handle: an #RsvgHandle * @handle: an #RsvgHandle
* @buf: (array length=count) (element-type guint8): pointer to svg data * @buf: (array length=count) (element-type guchar): pointer to svg data
* @count: length of the @buf buffer in bytes * @count: length of the @buf buffer in bytes
* @error: (allow-none): a location to store a #GError, or %NULL * @error: (allow-none): a location to store a #GError, or %NULL
* *
...@@ -2286,7 +2286,7 @@ _rsvg_handle_resolve_uri (RsvgHandle *handle, ...@@ -2286,7 +2286,7 @@ _rsvg_handle_resolve_uri (RsvgHandle *handle,
return resolved_uri; return resolved_uri;
} }
guint8* char *
_rsvg_handle_acquire_data (RsvgHandle *handle, _rsvg_handle_acquire_data (RsvgHandle *handle,
const char *url, const char *url,
char **content_type, char **content_type,
...@@ -2294,7 +2294,7 @@ _rsvg_handle_acquire_data (RsvgHandle *handle, ...@@ -2294,7 +2294,7 @@ _rsvg_handle_acquire_data (RsvgHandle *handle,
GError **error) GError **error)
{ {
char *uri; char *uri;
guint8 *data; char *data;
uri = _rsvg_handle_resolve_uri (handle, url); uri = _rsvg_handle_resolve_uri (handle, url);
......
...@@ -848,7 +848,7 @@ rsvg_css_parse_xml_attribute_string (const char *attribute_string) ...@@ -848,7 +848,7 @@ rsvg_css_parse_xml_attribute_string (const char *attribute_string)
if ((doc = parser->myDoc) == NULL || if ((doc = parser->myDoc) == NULL ||
(node = doc->children) == NULL || (node = doc->children) == NULL ||
strcmp (node->name, "rsvg-hack") != 0 || strcmp ((const char *) node->name, "rsvg-hack") != 0 ||
node->next != NULL || node->next != NULL ||
node->properties == NULL) node->properties == NULL)
goto done; goto done;
......
...@@ -66,7 +66,7 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name) ...@@ -66,7 +66,7 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name)
{ {
RsvgHandle *handle; RsvgHandle *handle;
gchar *filename, *base_uri; gchar *filename, *base_uri;
guint8 *data; char *data;
gsize data_len; gsize data_len;
gboolean rv; gboolean rv;
...@@ -81,7 +81,7 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name) ...@@ -81,7 +81,7 @@ rsvg_defs_load_extern (const RsvgDefs * defs, const char *name)
rsvg_handle_set_base_uri (handle, base_uri); rsvg_handle_set_base_uri (handle, base_uri);
g_free (base_uri); g_free (base_uri);
rv = rsvg_handle_write (handle, data, data_len, NULL); rv = rsvg_handle_write (handle, (guchar *) data, data_len, NULL);
rv = rsvg_handle_close (handle, NULL) && rv; rv = rsvg_handle_close (handle, NULL) && rv;
if (rv) { if (rv) {
g_hash_table_insert (defs->externs, g_strdup (name), handle); g_hash_table_insert (defs->externs, g_strdup (name), handle);
......
...@@ -83,7 +83,7 @@ rsvg_pixbuf_from_data_with_size_data (const guchar * buff, ...@@ -83,7 +83,7 @@ rsvg_pixbuf_from_data_with_size_data (const guchar * buff,
} }
static GdkPixbuf * static GdkPixbuf *
rsvg_pixbuf_from_stdio_file_with_size_data (guint8 *data, rsvg_pixbuf_from_stdio_file_with_size_data (const char *data,
gsize data_len, gsize data_len,
struct RsvgSizeCallbackData *cb_data, struct RsvgSizeCallbackData *cb_data,
gchar * base_uri, gchar * base_uri,
...@@ -102,7 +102,7 @@ rsvg_pixbuf_from_stdio_file_with_size_data (guint8 *data, ...@@ -102,7 +102,7 @@ rsvg_pixbuf_from_stdio_file_with_size_data (guint8 *data,
rsvg_handle_set_size_callback (handle, _rsvg_size_callback, cb_data, NULL); rsvg_handle_set_size_callback (handle, _rsvg_size_callback, cb_data, NULL);
rsvg_handle_set_base_uri (handle, base_uri); rsvg_handle_set_base_uri (handle, base_uri);
if (!rsvg_handle_write (handle, data, data_len, error)) { if (!rsvg_handle_write (handle, (guchar *) data, data_len, error)) {
(void) rsvg_handle_close (handle, NULL); (void) rsvg_handle_close (handle, NULL);
g_object_unref (handle); g_object_unref (handle);
return NULL; return NULL;
...@@ -125,7 +125,7 @@ rsvg_pixbuf_from_file_with_size_data (const gchar * file_name, ...@@ -125,7 +125,7 @@ rsvg_pixbuf_from_file_with_size_data (const gchar * file_name,
GError ** error) GError ** error)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
guint8 *data; char *data;
gsize data_len; gsize data_len;
GString *base_uri = g_string_new (file_name); GString *base_uri = g_string_new (file_name);
......
...@@ -41,7 +41,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle, ...@@ -41,7 +41,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle,
const char *href, const char *href,
GError **error) GError **error)
{ {
guint8 *data; char *data;
gsize data_len; gsize data_len;
char *mime_type = NULL; char *mime_type = NULL;
GdkPixbufLoader *loader = NULL; GdkPixbufLoader *loader = NULL;
...@@ -61,7 +61,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle, ...@@ -61,7 +61,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle,
if (loader == NULL) if (loader == NULL)
goto out; goto out;
if (!gdk_pixbuf_loader_write (loader, data, data_len, error)) { if (!gdk_pixbuf_loader_write (loader, (guchar *) data, data_len, error)) {
gdk_pixbuf_loader_close (loader, NULL); gdk_pixbuf_loader_close (loader, NULL);
goto out; goto out;
} }
...@@ -98,7 +98,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle, ...@@ -98,7 +98,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle,
if ((handle->priv->flags & RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA) != 0 && if ((handle->priv->flags & RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA) != 0 &&
mime_type != NULL && mime_type != NULL &&
cairo_surface_set_mime_data (surface, mime_type, data, cairo_surface_set_mime_data (surface, mime_type, (guchar *) data,
data_len, g_free, data) == CAIRO_STATUS_SUCCESS) { data_len, g_free, data) == CAIRO_STATUS_SUCCESS) {
data = NULL; /* transferred to the surface */ data = NULL; /* transferred to the surface */
} }
......
...@@ -65,7 +65,7 @@ uri_decoded_copy (const char *part, ...@@ -65,7 +65,7 @@ uri_decoded_copy (const char *part,
#define BASE64_INDICATOR ";base64" #define BASE64_INDICATOR ";base64"
#define BASE64_INDICATOR_LEN (sizeof (";base64") - 1) #define BASE64_INDICATOR_LEN (sizeof (";base64") - 1)
static guint8 * static char *
rsvg_acquire_data_data (const char *uri, rsvg_acquire_data_data (const char *uri,
const char *base_uri, const char *base_uri,
char **out_mime_type, char **out_mime_type,
...@@ -104,12 +104,12 @@ rsvg_acquire_data_data (const char *uri, ...@@ -104,12 +104,12 @@ rsvg_acquire_data_data (const char *uri,
start = comma + 1; start = comma + 1;
if (*start) { if (*start) {
data = uri_decoded_copy (start, strlen (start)); data = uri_decoded_copy (start, strlen (start));
if (base64) if (base64)
data = g_base64_decode_inplace ((char*) data, &data_len); data = (char *) g_base64_decode_inplace (data, &data_len);
else else
data_len = strlen ((const char *) data); data_len = strlen (data);
} else { } else {
data = NULL; data = NULL;
data_len = 0; data_len = 0;
...@@ -153,7 +153,7 @@ _rsvg_io_get_file_path (const gchar * filename, ...@@ -153,7 +153,7 @@ _rsvg_io_get_file_path (const gchar * filename,
return absolute_filename; return absolute_filename;
} }
static guint8 * static char *
rsvg_acquire_file_data (const char *filename, rsvg_acquire_file_data (const char *filename,
const char *base_uri, const char *base_uri,
char **out_mime_type, char **out_mime_type,
...@@ -178,7 +178,7 @@ rsvg_acquire_file_data (const char *filename, ...@@ -178,7 +178,7 @@ rsvg_acquire_file_data (const char *filename,
} }
if (out_mime_type && if (out_mime_type &&
(content_type = g_content_type_guess (path, data, len, NULL))) { (content_type = g_content_type_guess (path, (guchar *) data, len, NULL))) {
*out_mime_type = g_content_type_get_mime_type (content_type); *out_mime_type = g_content_type_get_mime_type (content_type);
g_free (content_type); g_free (content_type);
} }
...@@ -243,7 +243,7 @@ rsvg_acquire_gvfs_stream (const char *uri, ...@@ -243,7 +243,7 @@ rsvg_acquire_gvfs_stream (const char *uri,
return G_INPUT_STREAM (stream); return G_INPUT_STREAM (stream);
} }
static guint8 * static char *
rsvg_acquire_gvfs_data (const char *uri, rsvg_acquire_gvfs_data (const char *uri,
const char *base_uri, const char *base_uri,
char **out_mime_type, char **out_mime_type,
...@@ -253,7 +253,7 @@ rsvg_acquire_gvfs_data (const char *uri, ...@@ -253,7 +253,7 @@ rsvg_acquire_gvfs_data (const char *uri,
{ {
GFile *base, *file; GFile *base, *file;
GError *err; GError *err;
gchar *data; char *data;
gsize len; gsize len;
char *content_type; char *content_type;
gboolean res; gboolean res;
...@@ -283,7 +283,7 @@ rsvg_acquire_gvfs_data (const char *uri, ...@@ -283,7 +283,7 @@ rsvg_acquire_gvfs_data (const char *uri,
} }
if (out_mime_type && if (out_mime_type &&
(content_type = g_content_type_guess (uri, data, len, NULL))) { (content_type = g_content_type_guess (uri, (guchar *) data, len, NULL))) {
*out_mime_type = g_content_type_get_mime_type (content_type); *out_mime_type = g_content_type_get_mime_type (content_type);
g_free (content_type); g_free (content_type);
} }
...@@ -292,7 +292,7 @@ rsvg_acquire_gvfs_data (const char *uri, ...@@ -292,7 +292,7 @@ rsvg_acquire_gvfs_data (const char *uri,
return data; return data;
} }
guint8 * char *
_rsvg_io_acquire_data (const char *href, _rsvg_io_acquire_data (const char *href,
const char *base_uri, const char *base_uri,
char **mime_type, char **mime_type,
...@@ -300,7 +300,7 @@ _rsvg_io_acquire_data (const char *href, ...@@ -300,7 +300,7 @@ _rsvg_io_acquire_data (const char *href,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
guint8 *data; char *data;
gsize llen; gsize llen;
if (!(href && *href)) { if (!(href && *href)) {
...@@ -332,7 +332,7 @@ _rsvg_io_acquire_stream (const char *href, ...@@ -332,7 +332,7 @@ _rsvg_io_acquire_stream (const char *href,
GError **error) GError **error)
{ {
GInputStream *stream; GInputStream *stream;
guint8 *data; char *data;
gsize len; gsize len;
if (!(href && *href)) { if (!(href && *href)) {
......
...@@ -30,12 +30,12 @@ G_GNUC_INTERNAL ...@@ -30,12 +30,12 @@ G_GNUC_INTERNAL
gchar *_rsvg_io_get_file_path (const gchar *filename, gchar *_rsvg_io_get_file_path (const gchar *filename,
const gchar *basedir); const gchar *basedir);
guint8* _rsvg_io_acquire_data (const char *uri, char *_rsvg_io_acquire_data (const char *uri,
const char *base_uri, const char *base_uri,
char **mime_type, char **mime_type,
gsize *len, gsize *len,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
GInputStream *_rsvg_io_acquire_stream (const char *uri, GInputStream *_rsvg_io_acquire_stream (const char *uri,
const char *base_uri, const char *base_uri,
......
...@@ -405,11 +405,11 @@ void rsvg_return_if_fail_warning (const char *pretty_function, ...@@ -405,11 +405,11 @@ void rsvg_return_if_fail_warning (const char *pretty_function,
const char *expression, GError ** error); const char *expression, GError ** error);
G_GNUC_INTERNAL G_GNUC_INTERNAL
guint8* _rsvg_handle_acquire_data (RsvgHandle *handle, char *_rsvg_handle_acquire_data (RsvgHandle *handle,
const char *uri, const char *uri,
char **content_type, char **content_type,
gsize *len, gsize *len,
GError **error); GError **error);
G_GNUC_INTERNAL G_GNUC_INTERNAL
GInputStream *_rsvg_handle_acquire_stream (RsvgHandle *handle, GInputStream *_rsvg_handle_acquire_stream (RsvgHandle *handle,
const char *uri, const char *uri,
......
...@@ -1164,7 +1164,7 @@ ccss_import_style (CRDocHandler * a_this, ...@@ -1164,7 +1164,7 @@ ccss_import_style (CRDocHandler * a_this,
CRString * a_uri, CRString * a_uri_default_ns, CRParsingLocation * a_location) CRString * a_uri, CRString * a_uri_default_ns, CRParsingLocation * a_location)
{ {
CSSUserData *user_data = (CSSUserData *) a_this->app_data; CSSUserData *user_data = (CSSUserData *) a_this->app_data;
guint8 *stylesheet_data; char *stylesheet_data;
gsize stylesheet_data_len; gsize stylesheet_data_len;
char *mime_type = NULL; char *mime_type = NULL;
...@@ -1172,7 +1172,7 @@ ccss_import_style (CRDocHandler * a_this, ...@@ -1172,7 +1172,7 @@ ccss_import_style (CRDocHandler * a_this,
return; return;
stylesheet_data = _rsvg_handle_acquire_data (user_data->ctx, stylesheet_data = _rsvg_handle_acquire_data (user_data->ctx,
(gchar *) cr_string_peek_raw_str (a_uri), cr_string_peek_raw_str (a_uri),
&mime_type, &mime_type,
&stylesheet_data_len, &stylesheet_data_len,
NULL); NULL);
...@@ -1184,8 +1184,7 @@ ccss_import_style (CRDocHandler * a_this, ...@@ -1184,8 +1184,7 @@ ccss_import_style (CRDocHandler * a_this,
return; return;
} }
rsvg_parse_cssbuffer (user_data->ctx, (const char *) stylesheet_data, rsvg_parse_cssbuffer (user_data->ctx, stylesheet_data, stylesheet_data_len);
stylesheet_data_len);
g_free (stylesheet_data); g_free (stylesheet_data);
g_free (mime_type); g_free (mime_type);
} }
......
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