[Spice-devel] [PATCH spice-gtk 10/34] win-usb-dev: fix snprintf warnings
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Mon Jan 7 08:00:39 UTC 2019
From: Marc-André Lureau <marcandre.lureau at redhat.com>
[1/14] Compiling C object 'src/25a6634@@spice-client-glib-2.0 at sha/win-usb-dev.c.obj'.
../src/win-usb-dev.c: In function 'get_usb_dev_info':
../src/win-usb-dev.c:376:5: warning: implicit declaration of function 'snprintf' [-Wimplicit-function-declaration]
snprintf(udevinfo->sclass, sizeof(udevinfo->sclass), "%d", udevinfo->class);
^~~~~~~~
../src/win-usb-dev.c:376:5: warning: incompatible implicit declaration of built-in function 'snprintf'
../src/win-usb-dev.c:376:5: note: include '<stdio.h>' or provide a declaration of 'snprintf'
../src/win-usb-dev.c:31:1:
+#include <stdio.h>
../src/win-usb-dev.c:376:5:
snprintf(udevinfo->sclass, sizeof(udevinfo->sclass), "%d", udevinfo->class);
^~~~~~~~
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/win-usb-dev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index 9a130a3..327976d 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -373,11 +373,11 @@ static gboolean get_usb_dev_info(libusb_device *dev, GUdevDeviceInfo *udevinfo)
udevinfo->class = desc.bDeviceClass;
udevinfo->vid = desc.idVendor;
udevinfo->pid = desc.idProduct;
- snprintf(udevinfo->sclass, sizeof(udevinfo->sclass), "%d", udevinfo->class);
- snprintf(udevinfo->sbus, sizeof(udevinfo->sbus), "%d", udevinfo->bus);
- snprintf(udevinfo->saddr, sizeof(udevinfo->saddr), "%d", udevinfo->addr);
- snprintf(udevinfo->svid, sizeof(udevinfo->svid), "%d", udevinfo->vid);
- snprintf(udevinfo->spid, sizeof(udevinfo->spid), "%d", udevinfo->pid);
+ g_snprintf(udevinfo->sclass, sizeof(udevinfo->sclass), "%d", udevinfo->class);
+ g_snprintf(udevinfo->sbus, sizeof(udevinfo->sbus), "%d", udevinfo->bus);
+ g_snprintf(udevinfo->saddr, sizeof(udevinfo->saddr), "%d", udevinfo->addr);
+ g_snprintf(udevinfo->svid, sizeof(udevinfo->svid), "%d", udevinfo->vid);
+ g_snprintf(udevinfo->spid, sizeof(udevinfo->spid), "%d", udevinfo->pid);
return TRUE;
}
--
2.20.1.2.gb21ebb671b
More information about the Spice-devel
mailing list