diff options
author | peter <peter@FreeBSD.org> | 1996-12-30 14:07:11 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-12-30 14:07:11 +0000 |
commit | dd628555ded706aeb52ebe2618a29335b88d82a2 (patch) | |
tree | c2637d779b879fd180fe881fdb6be5a307f97c6e /lib/libc/xdr/xdr_stdio.c | |
parent | 2095ec92ed195b8797cd240e292c4fc4120b87b0 (diff) | |
download | FreeBSD-src-dd628555ded706aeb52ebe2618a29335b88d82a2.zip FreeBSD-src-dd628555ded706aeb52ebe2618a29335b88d82a2.tar.gz |
- Missing prototypes, including pointers to functions
- 64 bit long type safe (wire protocols specified in explicit sized types)
- Support systems that don't do unaligned accesses
- Support for explicit int16 and int32 sizes in xdr
Obtained from: a diff of FreeBSD vs. OpenBSD/NetBSD rpc code.
Diffstat (limited to 'lib/libc/xdr/xdr_stdio.c')
-rw-r--r-- | lib/libc/xdr/xdr_stdio.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c index 5cfdf20..64b0b82 100644 --- a/lib/libc/xdr/xdr_stdio.c +++ b/lib/libc/xdr/xdr_stdio.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_stdio.c,v 1.1 1994/08/07 18:39:35 wollman Exp $"; +static char *rcsid = "$Id: xdr_stdio.c,v 1.2 1995/05/30 05:42:12 rgrimes Exp $"; #endif /* @@ -53,7 +53,7 @@ static bool_t xdrstdio_getbytes(); static bool_t xdrstdio_putbytes(); static u_int xdrstdio_getpos(); static bool_t xdrstdio_setpos(); -static long * xdrstdio_inline(); +static int32_t *xdrstdio_inline(); static void xdrstdio_destroy(); /* @@ -99,7 +99,7 @@ xdrstdio_destroy(xdrs) { (void)fflush((FILE *)xdrs->x_private); /* xx should we close the file ?? */ -}; +} static bool_t xdrstdio_getlong(xdrs, lp) @@ -107,11 +107,10 @@ xdrstdio_getlong(xdrs, lp) register long *lp; { - if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1) + if (fread((caddr_t)lp, sizeof(int32_t), 1, + (FILE *)xdrs->x_private) != 1) return (FALSE); -#ifndef mc68000 - *lp = ntohl(*lp); -#endif + *lp = (long)ntohl((int32_t)*lp); return (TRUE); } @@ -121,11 +120,10 @@ xdrstdio_putlong(xdrs, lp) long *lp; { -#ifndef mc68000 - long mycopy = htonl(*lp); - lp = &mycopy; -#endif - if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1) + long mycopy = (long)htonl((int32_t)*lp); + + if (fwrite((caddr_t)&mycopy, sizeof(int32_t), 1, + (FILE *)xdrs->x_private) != 1) return (FALSE); return (TRUE); } @@ -172,7 +170,7 @@ xdrstdio_setpos(xdrs, pos) FALSE : TRUE); } -static long * +static int32_t * xdrstdio_inline(xdrs, len) XDR *xdrs; u_int len; |