Add support for the RPC 64-bit integer type ``hyper''.

This commit is contained in:
David E. O'Brien 1998-09-08 17:33:12 +00:00
parent 9754189a91
commit c304ad8a23
3 changed files with 62 additions and 4 deletions

View File

@ -28,7 +28,7 @@
*
* from: @(#)xdr.h 1.19 87/04/22 SMI
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
* $Id: xdr.h,v 1.5 1996/12/30 13:59:41 peter Exp $
* $Id: xdr.h,v 1.10 1997/05/28 04:45:15 wpaul Exp $
*/
/*
@ -245,6 +245,8 @@ extern bool_t xdr_int16_t __P((XDR *, int16_t *));
extern bool_t xdr_u_int16_t __P((XDR *, u_int16_t *));
extern bool_t xdr_int32_t __P((XDR *, int32_t *));
extern bool_t xdr_u_int32_t __P((XDR *, u_int32_t *));
extern bool_t xdr_int64_t __P((XDR *, int64_t *));
extern bool_t xdr_u_int64_t __P((XDR *, u_int64_t *));
extern bool_t xdr_bool __P((XDR *, bool_t *));
extern bool_t xdr_enum __P((XDR *, enum_t *));
extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t));

View File

@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
static char *rcsid = "$Id: xdr.c,v 1.4 1996/12/30 14:07:07 peter Exp $";
static char *rcsid = "$Id: xdr.c,v 1.7 1997/05/28 04:57:30 wpaul Exp $";
#endif
/*
@ -251,6 +251,62 @@ xdr_u_int32_t(xdrs, u_int32_p)
return (FALSE);
}
/*
* XDR 64-bit integers
*/
bool_t
xdr_int64_t(xdrs, int64_p)
register XDR *xdrs;
int64_t *int64_p;
{
int64_t x;
switch (xdrs->x_op) {
case XDR_ENCODE:
return (xdr_opaque(xdrs, (caddr_t)int64_p, sizeof(int64_t)));
case XDR_DECODE:
if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
return (FALSE);
}
*int64_p = x;
return (TRUE);
case XDR_FREE:
return (TRUE);
}
return (FALSE);
}
/*
* XDR unsigned 64-bit integers
*/
bool_t
xdr_u_int64_t(xdrs, uint64_p)
register XDR *xdrs;
u_int64_t *uint64_p;
{
u_int64_t x;
switch (xdrs->x_op) {
case XDR_ENCODE:
return (xdr_opaque(xdrs, (caddr_t)uint64_p, sizeof(u_int64_t)));
case XDR_DECODE:
if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
return (FALSE);
}
*uint64_p = x;
return (TRUE);
case XDR_FREE:
return (TRUE);
}
return (FALSE);
}
/*
* XDR short integers

View File

@ -593,7 +593,7 @@ get_type(prefixp, typep, dkind)
(void) peekscan(TOK_INT, &tok);
break;
case TOK_HYPER:
*typep = "longlong_t";
*typep = "int64_t";
(void) peekscan(TOK_INT, &tok);
break;
@ -642,7 +642,7 @@ unsigned_dec(typep)
break;
case TOK_HYPER:
get_token(&tok);
*typep = "ulonglong_t";
*typep = "u_int64_t";
(void) peekscan(TOK_INT, &tok);
break;
case TOK_INT: