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