summaryrefslogtreecommitdiff
path: root/libc/inet/rpc/xdr.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-01 08:37:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-01 08:37:27 +0000
commit1a21daadde12abfbb148b0bf07b26fbb56aa410a (patch)
tree021b76d0c325ece24f3668e2c7a0fed83df4de53 /libc/inet/rpc/xdr.c
parent7c640bbb18a519ed003d5fa80bad96eb204ed693 (diff)
rpc: ifdef out xdrrec_{get,put}long if int32 == long,
otherwise use xdrrec_{get,put}int32 + trivial transform. eliminate warnings. des: small shrink + eliminate a warning
Diffstat (limited to 'libc/inet/rpc/xdr.c')
-rw-r--r--libc/inet/rpc/xdr.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c
index 11e52136d..f76cc6a88 100644
--- a/libc/inet/rpc/xdr.c
+++ b/libc/inet/rpc/xdr.c
@@ -104,7 +104,6 @@ libc_hidden_def(xdr_void)
bool_t
xdr_long (XDR *xdrs, long *lp)
{
-
if (xdrs->x_op == XDR_ENCODE
&& (sizeof (int32_t) == sizeof (long)
|| (int32_t) *lp == *lp))
@@ -237,10 +236,10 @@ xdr_u_int (XDR *xdrs, u_int *up)
{
case XDR_ENCODE:
l = (u_long) * up;
- return XDR_PUTLONG (xdrs, &l);
+ return XDR_PUTLONG (xdrs, (long *) &l);
case XDR_DECODE:
- if (!XDR_GETLONG (xdrs, &l))
+ if (!XDR_GETLONG (xdrs, (long *) &l))
{
return FALSE;
}
@@ -268,19 +267,20 @@ bool_t
xdr_hyper (XDR *xdrs, quad_t *llp)
{
long t1;
- unsigned long int t2;
+ unsigned long t2;
if (xdrs->x_op == XDR_ENCODE)
{
t1 = (long) ((*llp) >> 32);
t2 = (long) (*llp);
- return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+ return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
}
if (xdrs->x_op == XDR_DECODE)
{
- if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+ if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
return FALSE;
+ /* t2 must be unsigned for this to work */
*llp = ((quad_t) t1) << 32;
*llp |= t2;
return TRUE;
@@ -309,12 +309,12 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
{
t1 = (unsigned long) ((*ullp) >> 32);
t2 = (unsigned long) (*ullp);
- return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+ return (XDR_PUTLONG(xdrs, (long *) &t1) && XDR_PUTLONG(xdrs, (long *) &t2));
}
if (xdrs->x_op == XDR_DECODE)
{
- if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+ if (!XDR_GETLONG(xdrs, (long *) &t1) || !XDR_GETLONG(xdrs, (long *) &t2))
return FALSE;
*ullp = ((u_quad_t) t1) << 32;
*ullp |= t2;
@@ -353,10 +353,10 @@ xdr_u_short (XDR *xdrs, u_short *usp)
{
case XDR_ENCODE:
l = (u_long) * usp;
- return XDR_PUTLONG (xdrs, &l);
+ return XDR_PUTLONG (xdrs, (long *) &l);
case XDR_DECODE:
- if (!XDR_GETLONG (xdrs, &l))
+ if (!XDR_GETLONG (xdrs, (long *) &l))
{
return FALSE;
}