forked from AuroraMiddleware/gtk
Free return value from gdk_atom_name().
2005-09-21 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkselection-win32.c (gdk_selection_convert, gdk_text_property_to_text_list_for_display, gdk_text_property_to_utf8_list_for_display, gdk_win32_selection_add_targets, _gdk_win32_selection_convert_to_dib): Free return value from gdk_atom_name(). (gdk_text_property_to_text_list_for_display): Drop GError variable that isn't actually used after being set.
This commit is contained in:
parent
a8a097c08f
commit
67a0d5df3d
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2005-09-21 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* gdk/win32/gdkselection-win32.c (gdk_selection_convert,
|
||||||
|
gdk_text_property_to_text_list_for_display,
|
||||||
|
gdk_text_property_to_utf8_list_for_display,
|
||||||
|
gdk_win32_selection_add_targets,
|
||||||
|
_gdk_win32_selection_convert_to_dib): Free return value from
|
||||||
|
gdk_atom_name().
|
||||||
|
(gdk_text_property_to_text_list_for_display): Drop GError variable
|
||||||
|
that isn't actually used after being set.
|
||||||
|
|
||||||
2005-09-20 Johan Dahlin <jdahlin@async.com.br>
|
2005-09-20 Johan Dahlin <jdahlin@async.com.br>
|
||||||
|
|
||||||
* gtk/gtkentry.c (gtk_entry_set_completion): Mention NULL in
|
* gtk/gtkentry.c (gtk_entry_set_completion): Mention NULL in
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2005-09-21 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* gdk/win32/gdkselection-win32.c (gdk_selection_convert,
|
||||||
|
gdk_text_property_to_text_list_for_display,
|
||||||
|
gdk_text_property_to_utf8_list_for_display,
|
||||||
|
gdk_win32_selection_add_targets,
|
||||||
|
_gdk_win32_selection_convert_to_dib): Free return value from
|
||||||
|
gdk_atom_name().
|
||||||
|
(gdk_text_property_to_text_list_for_display): Drop GError variable
|
||||||
|
that isn't actually used after being set.
|
||||||
|
|
||||||
2005-09-20 Johan Dahlin <jdahlin@async.com.br>
|
2005-09-20 Johan Dahlin <jdahlin@async.com.br>
|
||||||
|
|
||||||
* gtk/gtkentry.c (gtk_entry_set_completion): Mention NULL in
|
* gtk/gtkentry.c (gtk_entry_set_completion): Mention NULL in
|
||||||
|
@ -614,11 +614,14 @@ gdk_selection_convert (GdkWindow *requestor,
|
|||||||
}
|
}
|
||||||
else if (selection == GDK_SELECTION_CLIPBOARD)
|
else if (selection == GDK_SELECTION_CLIPBOARD)
|
||||||
{
|
{
|
||||||
const char *targetname = gdk_atom_name (target);
|
char *target_name;
|
||||||
UINT fmt = 0;
|
UINT fmt = 0;
|
||||||
|
|
||||||
if (!API_CALL (OpenClipboard, (GDK_WINDOW_HWND (requestor))))
|
if (!API_CALL (OpenClipboard, (GDK_WINDOW_HWND (requestor))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
target_name = gdk_atom_name (target);
|
||||||
|
|
||||||
/* Check if it's available. In fact, we can simply call
|
/* Check if it's available. In fact, we can simply call
|
||||||
* GetClipboardData (RegisterClipboardFormat (targetname)), but
|
* GetClipboardData (RegisterClipboardFormat (targetname)), but
|
||||||
* the global custom format ID space is limited,
|
* the global custom format ID space is limited,
|
||||||
@ -630,7 +633,7 @@ gdk_selection_convert (GdkWindow *requestor,
|
|||||||
char sFormat[80];
|
char sFormat[80];
|
||||||
|
|
||||||
if (GetClipboardFormatName (fmt, sFormat, 80) > 0 &&
|
if (GetClipboardFormatName (fmt, sFormat, 80) > 0 &&
|
||||||
strcmp (sFormat, targetname) == 0)
|
strcmp (sFormat, target_name) == 0)
|
||||||
{
|
{
|
||||||
if ((hdata = GetClipboardData (fmt)) != NULL)
|
if ((hdata = GetClipboardData (fmt)) != NULL)
|
||||||
{
|
{
|
||||||
@ -642,7 +645,7 @@ gdk_selection_convert (GdkWindow *requestor,
|
|||||||
{
|
{
|
||||||
length = GlobalSize (hdata);
|
length = GlobalSize (hdata);
|
||||||
|
|
||||||
GDK_NOTE (DND, g_print ("... %s: %d bytes\n", targetname, length));
|
GDK_NOTE (DND, g_print ("... %s: %d bytes\n", target_name, length));
|
||||||
|
|
||||||
_gdk_selection_property_store (requestor, target, 8,
|
_gdk_selection_property_store (requestor, target, 8,
|
||||||
g_memdup (ptr, length), length);
|
g_memdup (ptr, length), length);
|
||||||
@ -652,6 +655,7 @@ gdk_selection_convert (GdkWindow *requestor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_free (target_name);
|
||||||
API_CALL (CloseClipboard, ());
|
API_CALL (CloseClipboard, ());
|
||||||
}
|
}
|
||||||
else if (selection == _gdk_win32_dropfiles)
|
else if (selection == _gdk_win32_dropfiles)
|
||||||
@ -779,16 +783,15 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
|||||||
gint length,
|
gint length,
|
||||||
gchar ***list)
|
gchar ***list)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
|
||||||
gchar *enc_name;
|
gchar *enc_name;
|
||||||
gchar *result;
|
gchar *result;
|
||||||
const gchar *charset;
|
const gchar *charset;
|
||||||
const gchar *source_charset = NULL;
|
gchar *source_charset;
|
||||||
|
|
||||||
g_return_val_if_fail (display == _gdk_display, 0);
|
g_return_val_if_fail (display == _gdk_display, 0);
|
||||||
|
|
||||||
GDK_NOTE (DND, (enc_name = gdk_atom_name (encoding),
|
GDK_NOTE (DND, (enc_name = gdk_atom_name (encoding),
|
||||||
g_print ("gdk_text_property_to_text_list: %s %d %.20s %d\n",
|
g_print ("gdk_text_property_to_text_list_for_display: %s %d %.20s %d\n",
|
||||||
enc_name, format, text, length),
|
enc_name, format, text, length),
|
||||||
g_free (enc_name)));
|
g_free (enc_name)));
|
||||||
|
|
||||||
@ -796,21 +799,20 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (encoding == GDK_TARGET_STRING)
|
if (encoding == GDK_TARGET_STRING)
|
||||||
source_charset = "ISO-8859-1";
|
source_charset = g_strdup ("ISO-8859-1");
|
||||||
else if (encoding == _utf8_string)
|
else if (encoding == _utf8_string)
|
||||||
source_charset = "UTF-8";
|
source_charset = g_strdup ("UTF-8");
|
||||||
else
|
else
|
||||||
source_charset = gdk_atom_name (encoding);
|
source_charset = gdk_atom_name (encoding);
|
||||||
|
|
||||||
g_get_charset (&charset);
|
g_get_charset (&charset);
|
||||||
|
|
||||||
result = g_convert (text, length, charset, source_charset,
|
result = g_convert (text, length, charset, source_charset,
|
||||||
NULL, NULL, &error);
|
NULL, NULL, NULL);
|
||||||
|
g_free (source_charset);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
return 0;
|
||||||
g_error_free (error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*list = g_new (gchar *, 1);
|
*list = g_new (gchar *, 1);
|
||||||
**list = result;
|
**list = result;
|
||||||
@ -918,7 +920,10 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", gdk_atom_name (encoding));
|
gchar *enc_name = gdk_atom_name (encoding);
|
||||||
|
|
||||||
|
g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);
|
||||||
|
g_free (enc_name);
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
*list = NULL;
|
*list = NULL;
|
||||||
@ -1011,7 +1016,6 @@ gdk_win32_selection_add_targets (GdkWindow *owner,
|
|||||||
GdkAtom *targets)
|
GdkAtom *targets)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
const gchar *target_name;
|
|
||||||
guint formatid;
|
guint formatid;
|
||||||
gint i;
|
gint i;
|
||||||
GSList *convertable_formats, *format;
|
GSList *convertable_formats, *format;
|
||||||
@ -1033,6 +1037,8 @@ gdk_win32_selection_add_targets (GdkWindow *owner,
|
|||||||
convertable_formats = gdk_pixbuf_get_formats ();
|
convertable_formats = gdk_pixbuf_get_formats ();
|
||||||
for (i = 0; i < n_targets; ++i)
|
for (i = 0; i < n_targets; ++i)
|
||||||
{
|
{
|
||||||
|
gchar *target_name;
|
||||||
|
|
||||||
if (targets[i] == _utf8_string)
|
if (targets[i] == _utf8_string)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1040,6 +1046,7 @@ gdk_win32_selection_add_targets (GdkWindow *owner,
|
|||||||
if (!(formatid = RegisterClipboardFormat (target_name))) {
|
if (!(formatid = RegisterClipboardFormat (target_name))) {
|
||||||
WIN32_API_FAILED ("RegisterClipboardFormat");
|
WIN32_API_FAILED ("RegisterClipboardFormat");
|
||||||
API_CALL (CloseClipboard, ());
|
API_CALL (CloseClipboard, ());
|
||||||
|
g_free (target_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_hash_table_replace (_format_atom_table, GINT_TO_POINTER (formatid), targets[i]);
|
g_hash_table_replace (_format_atom_table, GINT_TO_POINTER (formatid), targets[i]);
|
||||||
@ -1062,6 +1069,7 @@ gdk_win32_selection_add_targets (GdkWindow *owner,
|
|||||||
has_set_dib = TRUE;
|
has_set_dib = TRUE;
|
||||||
}
|
}
|
||||||
has_real_dib = TRUE;
|
has_real_dib = TRUE;
|
||||||
|
g_free (target_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,6 +1091,7 @@ gdk_win32_selection_add_targets (GdkWindow *owner,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_free (target_name);
|
||||||
}
|
}
|
||||||
g_slist_free (convertable_formats);
|
g_slist_free (convertable_formats);
|
||||||
|
|
||||||
@ -1099,7 +1108,7 @@ _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
|
|||||||
{
|
{
|
||||||
GdkPixbufLoader *loader;
|
GdkPixbufLoader *loader;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
const gchar *target_name;
|
gchar *target_name;
|
||||||
guchar *ptr;
|
guchar *ptr;
|
||||||
gchar *bmp_buf;
|
gchar *bmp_buf;
|
||||||
gsize size;
|
gsize size;
|
||||||
@ -1118,6 +1127,7 @@ _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
|
|||||||
/* No conversion is needed, just strip the BITMAPFILEHEADER */
|
/* No conversion is needed, just strip the BITMAPFILEHEADER */
|
||||||
HGLOBAL hdatanew;
|
HGLOBAL hdatanew;
|
||||||
|
|
||||||
|
g_free (target_name);
|
||||||
size = GlobalSize (hdata) - 1 - sizeof (BITMAPFILEHEADER);
|
size = GlobalSize (hdata) - 1 - sizeof (BITMAPFILEHEADER);
|
||||||
ptr = GlobalLock (hdata);
|
ptr = GlobalLock (hdata);
|
||||||
memmove (ptr, ptr + sizeof (BITMAPFILEHEADER), size);
|
memmove (ptr, ptr + sizeof (BITMAPFILEHEADER), size);
|
||||||
@ -1136,8 +1146,10 @@ _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
|
|||||||
if (!(loader = gdk_pixbuf_loader_new_with_mime_type (target_name, NULL)))
|
if (!(loader = gdk_pixbuf_loader_new_with_mime_type (target_name, NULL)))
|
||||||
{
|
{
|
||||||
GlobalFree (hdata);
|
GlobalFree (hdata);
|
||||||
|
g_free (target_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
g_free (target_name);
|
||||||
|
|
||||||
ptr = GlobalLock (hdata);
|
ptr = GlobalLock (hdata);
|
||||||
ok = gdk_pixbuf_loader_write (loader, ptr, GlobalSize (hdata) - 1, NULL) &&
|
ok = gdk_pixbuf_loader_write (loader, ptr, GlobalSize (hdata) - 1, NULL) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user