qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qga/commands-posix.c: Use correct types with g_


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] qga/commands-posix.c: Use correct types with g_base64_decode()
Date: Tue, 14 Apr 2015 14:45:00 +0100

On 14 April 2015 at 14:42, Paolo Bonzini <address@hidden> wrote:
>
>
> On 08/04/2015 22:02, Peter Maydell wrote:
>> The second argument of g_base64_decode() is a 'gsize *', not a
>> 'size_t *'. Some compilation environments (like building 32-bit PPC
>> binaries on a PPC64 system) will complain about the mismatch:
>>
>>   CC    qga/commands-posix.o
>> qga/commands-posix.c: In function 'qmp_guest_set_user_password':
>> qga/commands-posix.c:1908:5: error: passing argument 2 of 'g_base64_decode' 
>> from incompatible pointer type [-Werror]
>> In file included from /usr/include/glib-2.0/glib.h:37:0,
>>                  from qga/commands-posix.c:14:
>> /usr/include/glib-2.0/glib/gbase64.h:49:9: note: expected ‘gsize *’ but 
>> argument is of type ‘size_t *’
>>
>> (We previously fixed errors of this type in commit 3d1bba20.)
>>
>> Signed-off-by: Peter Maydell <address@hidden>
>
> I think this patch is wrong.  Considering what Thomas was doing
> ("playing around with --extra-cflags=-m32" on x86) this looks like
> you're using the 64-bit glib headers while doing a 32-bit compilation.

I sort of agree, but I don't think the patch is wrong as such.
The API of the function we're calling demands a pointer to a
'gsize', so we should do that, not rely implicitly on 'gsize'
and 'size_t' being interchangeable.

(I have no idea why glib sees fit to define its own versions
of the standard types, but given that it does we should get
the interfacing to them right...)

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]