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

Re: [libvirt] [PATCH] msg_buf_size is unsigned long not size_t



On 06/09/2012 01:12 PM, Guido Günther wrote:
> This fixes the build on 32bit systems which otherwise fails with:
> 
> virnetmessagetest.c: In function 'testMessageHeaderEncode':
> virnetmessagetest.c:75:9: error: format '%zu' expects argument of type 'size_t', but argument 7 has type 'long unsigned int' [-Werror=format]
> ---
> Probably o.k. to push under the build breaker rule but I'd rather check.
> Cheers,
>  -- Guido
> 
>  tests/virnetmessagetest.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
> index 6c294ca..0408b5b 100644
> --- a/tests/virnetmessagetest.c
> +++ b/tests/virnetmessagetest.c
> @@ -72,7 +72,7 @@ static int testMessageHeaderEncode(const void *args ATTRIBUTE_UNUSED)
>      }
>  
>      if (msg->bufferLength != msg_buf_size) {
> -        VIR_DEBUG("Expect message offset %zu got %zu",
> +        VIR_DEBUG("Expect message offset %lu got %zu",
>                    msg_buf_size, msg->bufferLength);

That's one possible fix, but I think the more correct fix would be:

diff --git i/tests/virnetmessagetest.c w/tests/virnetmessagetest.c
index 6c294ca..ac3a40b 100644
--- i/tests/virnetmessagetest.c
+++ w/tests/virnetmessagetest.c
@@ -47,7 +47,7 @@ static int testMessageHeaderEncode(const void *args
ATTRIBUTE_UNUSED)
     };
     /* According to doc to virNetMessageEncodeHeader(&msg):
      * msg->buffer will be this long */
-    unsigned long msg_buf_size = VIR_NET_MESSAGE_MAX +
VIR_NET_MESSAGE_LEN_MAX;
+    size_t msg_buf_size = VIR_NET_MESSAGE_MAX + VIR_NET_MESSAGE_LEN_MAX;
     int ret = -1;

     if (!msg) {

At any rate, ACK to pushing either version at your choice.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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