From 43b9555929360a4549c4230894e9399e957921d3 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 9 Aug 2005 11:36:06 +0000 Subject: [PATCH] fixed signedness warnings. 2005-08-09 Sven Neumann * app/config/gimpxmlparser.c: fixed signedness warnings. * plug-ins/imagemap/imap_browse.c (handle_drop): UTF-8 validate the dropped text before setting it on the entry. --- ChangeLog | 7 +++++++ app/config/gimpxmlparser.c | 9 +++++++-- plug-ins/imagemap/imap_browse.c | 15 ++++++++------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c0cbeb1e3..8e91bbe2f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-09 Sven Neumann + + * app/config/gimpxmlparser.c: fixed signedness warnings. + + * plug-ins/imagemap/imap_browse.c (handle_drop): UTF-8 validate + the dropped text before setting it on the entry. + 2005-08-08 Manish Singh * plug-ins/common/psd.c: Generate valid names for aux channels that diff --git a/app/config/gimpxmlparser.c b/app/config/gimpxmlparser.c index c2515c4267..2b2ae22abc 100644 --- a/app/config/gimpxmlparser.c +++ b/app/config/gimpxmlparser.c @@ -157,7 +157,7 @@ gimp_xml_parser_parse_io_channel (GimpXmlParser *parser, GError **error) { GIOStatus status; - guchar buffer[4096]; + gchar buffer[4096]; gsize len = 0; gsize bytes; const gchar *io_encoding; @@ -259,12 +259,17 @@ gimp_xml_parser_parse_buffer (GimpXmlParser *parser, if (g_ascii_strcasecmp (encoding, "UTF-8") && g_ascii_strcasecmp (encoding, "UTF8")) { - conv = g_convert (buffer, len, "UTF-8", encoding, NULL, &len, error); + gsize written; + + conv = g_convert (buffer, len, + "UTF-8", encoding, NULL, &written, error); if (! conv) { g_free (encoding); return FALSE; } + + len = written; } g_free (encoding); diff --git a/plug-ins/imagemap/imap_browse.c b/plug-ins/imagemap/imap_browse.c index ceece9a09f..d79c55b7fb 100644 --- a/plug-ins/imagemap/imap_browse.c +++ b/plug-ins/imagemap/imap_browse.c @@ -96,16 +96,17 @@ static void handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time) { - gboolean success; + gboolean success = FALSE; if (data->length >= 0 && data->format == 8) { - gtk_entry_set_text(GTK_ENTRY(widget), data->data); - success = TRUE; - } - else - { - success = FALSE; + const gchar *text = (const gchar *) data->data; + + if (g_utf8_validate (text, -1, NULL)) + { + gtk_entry_set_text (GTK_ENTRY (widget), text); + success = TRUE; + } } gtk_drag_finish(context, success, FALSE, time);