diff options
author | Andreas Schwab <schwab@suse.de> | 1999-04-08 02:10:39 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 1999-04-08 02:10:39 +0000 |
commit | 50f301a819f48c6e64232f2cd22d8e77f59d0f29 (patch) | |
tree | 9a387001ce142a37230f98423cf5db120b6653d5 /sunrpc/xdr_intXX_t.c | |
parent | 516d718a39eb540abca2915499b925962886ded9 (diff) | |
download | glibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.tar.gz glibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.tar.xz glibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.zip |
1999-04-01 Thorsten Kukuk <kukuk@suse.de>
* sunrpc/Versions: Add new xdr functions to GLIBC_2.1.1 * sunrpc/xdr.c: Add xdr_hyper, xdr_u_hyper, xdr_longlong_t and xdr_u_longlong_t. Based on patch from Dan Shechter <damageboy@isdn.net.il>. * sunrpc/xdr_intXX_t.c: Implement xdr_int64_t, xdr_uint64_t * sunrpc/rpc/xdr.h: Add prototypes for new xdr functions. * nis/nis_lookup.c (nis_lookup): Don't overwrite RPC error code.
Diffstat (limited to 'sunrpc/xdr_intXX_t.c')
-rw-r--r-- | sunrpc/xdr_intXX_t.c | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/sunrpc/xdr_intXX_t.c b/sunrpc/xdr_intXX_t.c index 98132cd802..e50859e2aa 100644 --- a/sunrpc/xdr_intXX_t.c +++ b/sunrpc/xdr_intXX_t.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Copyright (c) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998. @@ -20,6 +20,60 @@ #include <rpc/types.h> #include <rpc/xdr.h> +/* XDR 64bit integers */ +bool_t +xdr_int64_t (XDR *xdrs, int64_t *ip) +{ + int32_t t1; + int32_t t2; + + switch (xdrs->x_op) + { + case XDR_ENCODE: + t1 = (int32_t) ((*ip) >> 32); + t2 = (int32_t) (*ip); + return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, &t2)); + case XDR_DECODE: + if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, &t2)) + return FALSE; + *ip = ((int64_t) t1) << 32; + *ip |= t2; + return TRUE; + case XDR_FREE: + return TRUE; + default: + return FALSE; + } +} + +/* XDR 64bit unsigned integers */ +bool_t +xdr_uint64_t (XDR *xdrs, uint64_t *uip) +{ + uint32_t t1; + uint32_t t2; + + switch (xdrs->x_op) + { + case XDR_ENCODE: + t1 = (uint32_t) ((*uip) >> 32); + t2 = (uint32_t) (*uip); + return (XDR_PUTINT32 (xdrs, (int32_t *) &t1) && + XDR_PUTINT32(xdrs, (int32_t *) &t2)); + case XDR_DECODE: + if (!XDR_GETINT32(xdrs, (int32_t *) &t1) || + !XDR_GETINT32(xdrs, (int32_t *) &t2)) + return FALSE; + *uip = ((uint64_t) t1) << 32; + *uip |= t2; + return TRUE; + case XDR_FREE: + return TRUE; + default: + return FALSE; + } +} + /* XDR 32bit integers */ bool_t xdr_int32_t (XDR *xdrs, int32_t *lp) @@ -43,10 +97,10 @@ xdr_uint32_t (XDR *xdrs, uint32_t *ulp) { switch (xdrs->x_op) { - case XDR_DECODE: - return XDR_GETINT32 (xdrs, (int32_t *) ulp); 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: |