Re: [spice-gtk] mingw64: Fix gssize printf-format warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ack

----- Original Message -----
> When building with mingw64, several warnings about using the wrong format
> specifier for gssize/gsize occur similar to:
> 
> win-usb-dev.c: In function 'g_udev_client_list_devices':
> win-usb-dev.c:145:21: error: format '%i' expects argument of type 'int', but
> argument 7 has type 'gssize' [-Werror=format=]
>                      name, errstr, rc);
> 
> This commit makes use of the G_GSIZE_FORMAT/G_GSSIZE_FORMAT macros provided
> by glib to silence these warnings.
> 
> I've checked that this does not introduce new warnings on linux and mingw32
> builds.
> ---
>  gtk/win-usb-dev.c            | 5 +++--
>  gtk/win-usb-driver-install.c | 8 +++++---
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c
> index 0f57e40..7e82fb9 100644
> --- a/gtk/win-usb-dev.c
> +++ b/gtk/win-usb-dev.c
> @@ -141,7 +141,7 @@ g_udev_client_list_devices(GUdevClient *self, GList
> **devs,
>          const char *errstr = spice_usbutil_libusb_strerror(rc);
>          g_warning("%s: libusb_get_device_list failed", name);
>          g_set_error(err, G_UDEV_CLIENT_ERROR, G_UDEV_CLIENT_LIBUSB_FAILED,
> -                    "%s: Error getting device list from libusb: %s [%i]",
> +                    "%s: Error getting device list from libusb: %s
> [%"G_GSSIZE_FORMAT"]",
>                      name, errstr, rc);
>          return -4;
>      }
> @@ -354,7 +354,8 @@ static void handle_dev_change(GUdevClient *self)
>                                             __FUNCTION__);
>      g_return_if_fail(dev_count >= 0);
>  
> -    SPICE_DEBUG("number of current devices %d, I know about %d devices",
> +    SPICE_DEBUG("number of current devices %"G_GSSIZE_FORMAT
> +                ", I know about %"G_GSSIZE_FORMAT" devices",
>                  dev_count, priv->udev_list_size);
>  
>      is_dev_change = dev_count - priv->udev_list_size;
> diff --git a/gtk/win-usb-driver-install.c b/gtk/win-usb-driver-install.c
> index 1d68296..928b38f 100644
> --- a/gtk/win-usb-driver-install.c
> +++ b/gtk/win-usb-driver-install.c
> @@ -130,7 +130,8 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>      }
>  
>      if (bytes != sizeof(priv->reply)) {
> -        g_warning("usbclerk size mismatch: read %d bytes, expected %d
> (header %d, size in header %d)",
> +        g_warning("usbclerk size mismatch: read %"G_GSSIZE_FORMAT"
> bytes,expected "
> +                  "%"G_GSSIZE_FORMAT" (header %"G_GSSIZE_FORMAT", size in
> header %d)",
>                    bytes, sizeof(priv->reply), sizeof(priv->reply.hdr),
>                    priv->reply.hdr.size);
>          /* For now just warn, do not fail */
>      }
> @@ -165,7 +166,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>      }
>  
>      if (priv->reply.hdr.size != bytes) {
> -        g_warning("usbclerk message size mismatch: read %d bytes
> hdr.size=%d",
> +        g_warning("usbclerk message size mismatch: read %"G_GSSIZE_FORMAT"
> bytes  hdr.size=%d",
>                    bytes, priv->reply.hdr.size);
>          g_simple_async_result_set_error(priv->result,
>                                          SPICE_WIN_USB_DRIVER_ERROR,
> @@ -211,7 +212,8 @@ gboolean
> spice_win_usb_driver_send_request(SpiceWinUsbDriver *self, guint16 op,
>      ret = g_output_stream_write_all(ostream, &req, sizeof(req), &bytes,
>      NULL, err);
>      g_warn_if_fail(g_output_stream_close(ostream, NULL, NULL));
>      g_object_unref(ostream);
> -    SPICE_DEBUG("write_all request returned %d written bytes %u expecting
> %u",
> +    SPICE_DEBUG("write_all request returned %d written bytes
> %"G_GSIZE_FORMAT
> +                " expecting %"G_GSIZE_FORMAT,
>                  ret, bytes, sizeof(req));
>      return ret;
>  }
> --
> 1.8.5.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]