1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

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.
This commit is contained in:
Andreas Schwab
1999-04-08 02:10:39 +00:00
parent 516d718a39
commit 50f301a819
7 changed files with 169 additions and 31 deletions

View File

@ -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: