[gtk: 1/3] Fix various compiler warnings with the 64bit mingw build
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/3] Fix various compiler warnings with the 64bit mingw build
- Date: Mon, 15 Jun 2020 01:27:28 +0000 (UTC)
commit 85d822b2e8ed48526313ad9b8c131c1827368ae9
Author: Christoph Reiter <reiter christoph gmail com>
Date: Tue Jun 2 20:41:38 2020 +0200
Fix various compiler warnings with the 64bit mingw build
Use better matching format modifiers/specifiers, initialise some things
which in theory wont be written to because of getters using g_return_if_fail(),
a cast, and gsize as input for malloc because gsize!=glong on 64bit Windows.
gdk/win32/gdkclipdrop-win32.c | 8 +++++---
gdk/win32/gdkdevicemanager-win32.c | 2 +-
gdk/win32/gdkdrop-win32.c | 4 +++-
gdk/win32/gdkevents-win32.c | 6 +++---
gdk/win32/gdkhdataoutputstream-win32.c | 4 ++--
gtk/gtkiconview.c | 4 ++--
6 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c
index 74eb2500a8..0755876d65 100644
--- a/gdk/win32/gdkclipdrop-win32.c
+++ b/gdk/win32/gdkclipdrop-win32.c
@@ -889,10 +889,12 @@ grab_data_from_hdata (GdkWin32ClipboardThreadRetrieve *retr,
if (data == NULL)
{
+ gchar *length_str = g_strdup_printf ("%" G_GSIZE_FORMAT, length);
send_response (retr->parent.item_type,
retr->parent.opaque_task,
g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Cannot get clipboard data. Failed to allocate %lu bytes to store the
data."), length));
+ _("Cannot get clipboard data. Failed to allocate %s bytes to store the
data."), length_str));
+ g_free (length_str);
GlobalUnlock (hdata);
return NULL;
}
@@ -1536,7 +1538,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
thread_wakeup_message = RegisterWindowMessage ("GDK_WORKER_THREAD_WEAKEUP");
user32 = LoadLibrary ("user32.dll");
- win32_clipdrop->GetUpdatedClipboardFormats = GetProcAddress (user32, "GetUpdatedClipboardFormats");
+ win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32,
"GetUpdatedClipboardFormats");
FreeLibrary (user32);
atoms = g_array_sized_new (FALSE, TRUE, sizeof (const char *), GDK_WIN32_ATOM_INDEX_LAST);
@@ -2193,7 +2195,7 @@ transmute_utf8_string_to_cf_text (const guchar *data,
{
glong rlen;
GError *err = NULL;
- glong size;
+ gsize size;
gint i;
char *strptr, *p;
wchar_t *wcptr;
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c
index a55864c895..74d9aa1847 100644
--- a/gdk/win32/gdkdevicemanager-win32.c
+++ b/gdk/win32/gdkdevicemanager-win32.c
@@ -883,7 +883,7 @@ gdk_input_other_event (GdkDisplay *display,
guint translated_buttons, button_diff, button_mask;
GdkEventType event_type;
- int event_button;
+ int event_button = 0;
GdkModifierType event_state;
double event_x, event_y;
double *axes;
diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c
index ff6035dc4f..8d4af3b420 100644
--- a/gdk/win32/gdkdrop-win32.c
+++ b/gdk/win32/gdkdrop-win32.c
@@ -1225,8 +1225,10 @@ grab_data_from_hdata (GTask *task,
if (data == NULL)
{
+ gchar *length_str = g_strdup_printf ("%" G_GSIZE_FORMAT, length);
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Cannot get DnD data. Failed to allocate %lu bytes to store the data."),
length);
+ _("Cannot get DnD data. Failed to allocate %s bytes to store the data."),
length_str);
+ g_free (length_str);
GlobalUnlock (hdata);
return NULL;
}
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 409f03dfd2..377f4afbdf 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -287,7 +287,7 @@ _gdk_win32_surface_procedure (HWND hwnd,
{
LRESULT retval;
- GDK_NOTE (EVENTS, g_print ("%s%*s%s %p %#x %#lx",
+ GDK_NOTE (EVENTS, g_print ("%s%*s%s %p %#" G_GINTPTR_MODIFIER "x %#" G_GINTPTR_MODIFIER "x",
(debug_indent > 0 ? "\n" : ""),
debug_indent, "",
_gdk_win32_message_to_string (message), hwnd,
@@ -1876,7 +1876,7 @@ handle_wm_sysmenu (GdkSurface *window, MSG *msg, gint *ret_valp)
* FALSE later) or set *ret_valp to 0 and return TRUE.
*/
tmp_style = style | additional_styles;
- GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%lx -> 0x%lx\n", style, tmp_style));
+ GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%" G_GINTPTR_MODIFIER "x -> 0x%"
G_GINTPTR_MODIFIER "x\n", style, tmp_style));
impl->have_temp_styles = TRUE;
impl->temp_styles = additional_styles;
SetWindowLongPtr (msg->hwnd, GWL_STYLE, tmp_style);
@@ -1886,7 +1886,7 @@ handle_wm_sysmenu (GdkSurface *window, MSG *msg, gint *ret_valp)
tmp_style = GetWindowLongPtr (msg->hwnd, GWL_STYLE);
style = tmp_style & ~additional_styles;
- GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%lx <- 0x%lx\n", style, tmp_style));
+ GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%" G_GINTPTR_MODIFIER "x <- 0x%"
G_GINTPTR_MODIFIER "x\n", style, tmp_style));
SetWindowLongPtr (msg->hwnd, GWL_STYLE, style);
impl->have_temp_styles = FALSE;
diff --git a/gdk/win32/gdkhdataoutputstream-win32.c b/gdk/win32/gdkhdataoutputstream-win32.c
index aa10ab415f..95a57981f0 100644
--- a/gdk/win32/gdkhdataoutputstream-win32.c
+++ b/gdk/win32/gdkhdataoutputstream-win32.c
@@ -129,7 +129,7 @@ gdk_win32_hdata_output_stream_write (GOutputStream *output_stream,
gssize result = write_stream (stream, priv, buffer, count, error);
if (result != -1)
- GDK_NOTE(SELECTION, g_printerr ("CLIPBOARD: wrote %zd bytes, %u total now\n",
+ GDK_NOTE(SELECTION, g_printerr ("CLIPBOARD: wrote %zd bytes, %" G_GSIZE_FORMAT " total now\n",
result, priv->data_length));
return result;
@@ -158,7 +158,7 @@ gdk_win32_hdata_output_stream_write_async (GOutputStream *output_stream,
if (result != -1)
{
- GDK_NOTE (SELECTION, g_printerr ("CLIPBOARD async wrote %zd bytes, %u total now\n",
+ GDK_NOTE (SELECTION, g_printerr ("CLIPBOARD async wrote %zd bytes, %" G_GSIZE_FORMAT " total now\n",
result, priv->data_length));
g_task_return_int (task, result);
}
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 1cff081002..2fc1123c07 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1560,7 +1560,7 @@ gtk_icon_view_measure (GtkWidget *widget,
GtkIconViewPrivate *priv = icon_view->priv;
GtkOrientation other_orientation = orientation == GTK_ORIENTATION_HORIZONTAL ?
GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL;
- int item_min, item_nat, items, item_size, n_items;
+ int item_min, item_nat, items = 0, item_size = 0, n_items;
if (gtk_icon_view_is_empty (icon_view))
{
@@ -2715,7 +2715,7 @@ gtk_icon_view_layout (GtkIconView *icon_view)
GtkIconViewPrivate *priv = icon_view->priv;
GtkWidget *widget = GTK_WIDGET (icon_view);
GList *items;
- gint item_width; /* this doesn't include item_padding */
+ gint item_width = 0; /* this doesn't include item_padding */
gint n_columns, n_rows, n_items;
gint col, row;
GtkRequestedSize *sizes;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]