[libvirt] [PATCH] msg_buf_size is unsigned long not size_t
Guido Günther
agx at sigxcpu.org
Sun Jun 10 19:02:56 UTC 2012
On Sat, Jun 09, 2012 at 07:07:01PM -0600, Eric Blake wrote:
> 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:
I aggree that probably both types should be size_t but I wonder why
unsigned long was picked in the first place so I went for the above
version for now.
Cheers,
-- Guido
>
> 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.
More information about the libvir-list
mailing list