summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-06-02 20:41:38 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2020-06-14 20:02:36 +0200
commit85d822b2e8ed48526313ad9b8c131c1827368ae9 (patch)
treecfff13f09bab1f528ede3f1edc149db57ddd6325 /gdk
parent4e5689abebae13ef96811e0565bfecb173b5e628 (diff)
downloadgtk+-85d822b2e8ed48526313ad9b8c131c1827368ae9.tar.gz
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.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkclipdrop-win32.c8
-rw-r--r--gdk/win32/gdkdevicemanager-win32.c2
-rw-r--r--gdk/win32/gdkdrop-win32.c4
-rw-r--r--gdk/win32/gdkevents-win32.c6
-rw-r--r--gdk/win32/gdkhdataoutputstream-win32.c4
5 files changed, 14 insertions, 10 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);
}