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.
This commit is contained in:
Christoph Reiter 2020-06-02 20:41:38 +02:00
parent 4e5689abeb
commit 85d822b2e8
6 changed files with 16 additions and 12 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;