diff --git a/gdk/gdkdmabufformats.c b/gdk/gdkdmabufformats.c index 3e45e22ff9..5b7b19ef48 100644 --- a/gdk/gdkdmabufformats.c +++ b/gdk/gdkdmabufformats.c @@ -207,7 +207,8 @@ gdk_dmabuf_formats_new (GdkDmabufFormat *formats, self->n_formats = n_formats; self->formats = g_new (GdkDmabufFormat, n_formats); - memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat)); + if (n_formats != 0) + memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat)); return self; } diff --git a/gtk/gtkcssnodedeclaration.c b/gtk/gtkcssnodedeclaration.c index f170efc02b..3ea0d5219f 100644 --- a/gtk/gtkcssnodedeclaration.c +++ b/gtk/gtkcssnodedeclaration.c @@ -446,9 +446,9 @@ gtk_css_node_declaration_print (const GtkCssNodeDeclaration *decl, for (i = 0; i < sizeof (GtkStateFlags) * 8; i++) { - if (decl->state & (1 << i)) + if (decl->state & (1u << i)) { - const char *name = gtk_css_pseudoclass_name (1 << i); + const char *name = gtk_css_pseudoclass_name (1u << i); g_assert (name); g_string_append_c (string, ':'); g_string_append (string, name); diff --git a/gtk/gtksymbolicpaintable.c b/gtk/gtksymbolicpaintable.c index 057be29742..0509eb5d9c 100644 --- a/gtk/gtksymbolicpaintable.c +++ b/gtk/gtksymbolicpaintable.c @@ -110,7 +110,8 @@ gtk_symbolic_paintable_snapshot_symbolic (GtkSymbolicPaintable *paintable, [GTK_SYMBOLIC_COLOR_SUCCESS] = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0 } }; - memcpy (real_colors, colors, sizeof (GdkRGBA) * n_colors); + if (n_colors != 0) + memcpy (real_colors, colors, sizeof (GdkRGBA) * n_colors); iface->snapshot_symbolic (paintable, snapshot, width, height, real_colors, 4); } diff --git a/gtk/timsort/gtktimsort.c b/gtk/timsort/gtktimsort.c index 67846674e2..daa7c113db 100644 --- a/gtk/timsort/gtktimsort.c +++ b/gtk/timsort/gtktimsort.c @@ -157,8 +157,9 @@ gtk_tim_sort_ensure_capacity (GtkTimSort *self, new_size |= new_size >> 4; new_size |= new_size >> 8; new_size |= new_size >> 16; - if (sizeof(new_size) > 4) - new_size |= new_size >> 32; +#if GLIB_SIZEOF_SIZE_T > 4 + new_size |= new_size >> 32; +#endif new_size++; if (new_size == 0) /* (overflow) Not bloody likely! */