[virt-tools-list] [virt-viewer] win: Use correct format string for intptr_t

Fabiano Fidêncio fabiano at fidencio.org
Fri Jan 2 12:50:05 UTC 2015


On Tue, Dec 23, 2014 at 2:25 PM, Fabiano Fidêncio <fidencio at redhat.com> wrote:
> On Tue, 2014-12-23 at 11:21 +0100, Christophe Fergeau wrote:
>> Using %d as a format-specifier for intptr_t causes a warning with
>> mingw64:
>> virt-viewer-events.c: In function 'virt_viewer_events_add_handle':
>> virt-viewer-events.c:103:5: warning: format '%d' expects argument of
>> type 'int', but argument 5 has type 'intptr_t' [-Wformat=]
>>      g_debug("Converted fd %d to handle %d", fd, _get_osfhandle(fd));
>> ---
>>  src/virt-viewer-events.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/virt-viewer-events.c b/src/virt-viewer-events.c
>> index f7ad3a7..3b5a136 100644
>> --- a/src/virt-viewer-events.c
>> +++ b/src/virt-viewer-events.c
>> @@ -22,6 +22,7 @@
>>
>>  #include <config.h>
>>
>> +#include <inttypes.h>
>>  #include <stdio.h>
>>  #include <string.h>
>>  #include <stdlib.h>
>> @@ -100,7 +101,7 @@ int virt_viewer_events_add_handle(int fd,
>>      data->cb = cb;
>>      data->opaque = opaque;
>>  #ifdef G_OS_WIN32
>> -    g_debug("Converted fd %d to handle %d", fd, _get_osfhandle(fd));
>> +    g_debug("Converted fd %d to handle %"PRIiPTR, fd, _get_osfhandle(fd));
>>      data->channel = g_io_channel_win32_new_socket(_get_osfhandle(fd));
>>  #else
>>      data->channel = g_io_channel_unix_new(fd);
>
> ACK!
>
> Best Regards,
> --
> Fabiano Fidêncio
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list


Pushed as 719352e6087e9fc0233f98466a079bc8b86d24ef
Thanks for the patch!
-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list