From 3776d592f117c8c5b0d2c37d265cb8ee2ac21695 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 1 Jul 1996 22:16:41 +0000 Subject: Mon Jul 1 12:29:50 1996 Roland McGrath * nss/Makefile (databases): Change host to hosts. * nss/host-lookup.c: Renamed to nss/hosts-lookup.c. --- sunrpc/xdr.c | 93 +++++++++++++++++++++++++++--------------------------------- 1 file changed, 41 insertions(+), 52 deletions(-) (limited to 'sunrpc/xdr.c') diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c index a5241a5120..a5b5e68d75 100644 --- a/sunrpc/xdr.c +++ b/sunrpc/xdr.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; */ #include +#include char *malloc(); #include @@ -99,34 +100,28 @@ xdr_int(xdrs, ip) (void) (xdr_short(xdrs, (short *)ip)); return (xdr_long(xdrs, (long *)ip)); #else - if (sizeof (int) < sizeof (long)) { - long l; - - switch (xdrs->x_op) { - case XDR_ENCODE: - l = (long) *ip; - return XDR_PUTLONG(xdrs, &l); - - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return FALSE; - } - *ip = (int) l; - return TRUE; - } - } else if (sizeof (int) == sizeof (long)) { - return (xdr_long(xdrs, (long *)ip)); - } else if (sizeof (int) == sizeof (short)) { - return (xdr_short(xdrs, (short *)ip)); - } else { - abort (); /* roland@gnu */ -#if 0 - /* force unresolved reference (link-time error): */ - extern unexpected_sizes_in_xdr_int (); +# if INT_MAX < LONG_MAX + long l; - unexpected_sizes_in_xdr_int(); -#endif + switch (xdrs->x_op) { + case XDR_ENCODE: + l = (long) *ip; + return XDR_PUTLONG(xdrs, &l); + + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, &l)) { + return FALSE; + } + *ip = (int) l; + return TRUE; } +# elif INT_MAX == LONG_MAX + return xdr_long(xdrs, (long *)ip); +# elif INT_MAX == SHRT_MAX + return xdr_short(xdrs, (short *)ip); +# else +# error unexpected integer sizes in_xdr_int() +# endif #endif } @@ -142,34 +137,28 @@ xdr_u_int(xdrs, up) (void) (xdr_short(xdrs, (short *)up)); return (xdr_u_long(xdrs, (u_long *)up)); #else - if (sizeof (u_int) < sizeof (u_long)) { - u_long l; - - switch (xdrs->x_op) { - case XDR_ENCODE: - l = (u_long) *up; - return XDR_PUTLONG(xdrs, &l); - - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return FALSE; - } - *up = (u_int) l; - return TRUE; - } - } else if (sizeof (u_int) == sizeof (u_long)) { - return (xdr_u_long(xdrs, (u_long *)up)); - } else if (sizeof (u_int) == sizeof (u_short)) { - return (xdr_short(xdrs, (short *)up)); - } else { - abort (); /* drepper@gnu */ -#if 0 - /* force unresolved reference (link-time error): */ - extern unexpected_sizes_in_xdr_u_int (); +# if UINT_MAX < ULONG_MAX + u_long l; - unexpected_sizes_in_xdr_u_int(); -#endif + switch (xdrs->x_op) { + case XDR_ENCODE: + l = (u_long) *up; + return XDR_PUTLONG(xdrs, &l); + + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, &l)) { + return FALSE; + } + *up = (u_int) l; + return TRUE; } +# elif UINT_MAX == ULONG_MAX + return xdr_u_long(xdrs, (u_long *)up); +# elif UINT_MAX == USHRT_MAX + return xdr_short(xdrs, (short *)up); +# else +# error unexpected integer sizes in_xdr_u_int() +# endif #endif } -- cgit 1.4.1