On Mon, May 23, 2011 at 07:36:09PM +0200, Matthias Bolte wrote:
In most cases this affects flags parameters that are unsigned in the
public and driver API but signed in the XDR protocol. Switch the
XDR protocol to unsigned for those.
A counterexample is virNWFilterGetXMLDesc. Its flags parameter is signed
in the public API and XDR protocol, but unsigned in the driver API.
For the record, the XDR code confirms this is ok. Compare the xdr_int32
with xdr_uint32 functions:
bool_t
xdr_int32_t (XDR *xdrs, int32_t *lp)
{
switch (xdrs->x_op)
{
case XDR_ENCODE:
return XDR_PUTINT32 (xdrs, lp);
case XDR_DECODE:
return XDR_GETINT32 (xdrs, lp);
case XDR_FREE:
return TRUE;
default:
return FALSE;
}
}
/* XDR 32bit unsigned integers */
bool_t
xdr_uint32_t (XDR *xdrs, uint32_t *ulp)
{
switch (xdrs->x_op)
{
case XDR_ENCODE:
return XDR_PUTINT32 (xdrs, (int32_t *) ulp);
case XDR_DECODE:
return XDR_GETINT32 (xdrs, (int32_t *) ulp);
case XDR_FREE:
return TRUE;
default:
return FALSE;
}
}
So the uint32 function just casts to an int32 and put
that on the wire. So there's no difference at all.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|