about summary refs log tree commit diff
path: root/sunrpc/xdr_stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/xdr_stdio.c')
-rw-r--r--sunrpc/xdr_stdio.c155
1 files changed, 71 insertions, 84 deletions
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 351b8f94b4..f95bc70be1 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -45,27 +45,28 @@ static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
 #include <stdio.h>
 #include <rpc/xdr.h>
 
-static bool_t	xdrstdio_getlong();
-static bool_t	xdrstdio_putlong();
-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 void	xdrstdio_destroy();
+static bool_t xdrstdio_getlong (XDR *, long *);
+static bool_t xdrstdio_putlong (XDR *, long *);
+static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int);
+static bool_t xdrstdio_putbytes (XDR *, caddr_t, u_int);
+static u_int xdrstdio_getpos (XDR *);
+static bool_t xdrstdio_setpos (XDR *, u_int);
+static long *xdrstdio_inline (XDR *, int);
+static void xdrstdio_destroy (XDR *);
 
 /*
  * Ops vector for stdio type XDR
  */
-static struct xdr_ops	xdrstdio_ops = {
-	xdrstdio_getlong,	/* deserialize a long int */
-	xdrstdio_putlong,	/* serialize a long int */
-	xdrstdio_getbytes,	/* deserialize counted bytes */
-	xdrstdio_putbytes,	/* serialize counted bytes */
-	xdrstdio_getpos,	/* get offset in the stream */
-	xdrstdio_setpos,	/* set offset in the stream */
-	xdrstdio_inline,	/* prime stream for inline macros */
-	xdrstdio_destroy	/* destroy stream */
+static const struct xdr_ops xdrstdio_ops =
+{
+  xdrstdio_getlong,		/* deserialize a long int */
+  xdrstdio_putlong,		/* serialize a long int */
+  xdrstdio_getbytes,		/* deserialize counted bytes */
+  xdrstdio_putbytes,		/* serialize counted bytes */
+  xdrstdio_getpos,		/* get offset in the stream */
+  xdrstdio_setpos,		/* set offset in the stream */
+  xdrstdio_inline,		/* prime stream for inline macros */
+  xdrstdio_destroy		/* destroy stream */
 };
 
 /*
@@ -74,17 +75,17 @@ static struct xdr_ops	xdrstdio_ops = {
  * Operation flag is set to op.
  */
 void
-xdrstdio_create(xdrs, file, op)
-	register XDR *xdrs;
-	FILE *file;
-	enum xdr_op op;
+xdrstdio_create (xdrs, file, op)
+     XDR *xdrs;
+     FILE *file;
+     enum xdr_op op;
 {
 
-	xdrs->x_op = op;
-	xdrs->x_ops = &xdrstdio_ops;
-	xdrs->x_private = (caddr_t)file;
-	xdrs->x_handy = 0;
-	xdrs->x_base = 0;
+  xdrs->x_op = op;
+  xdrs->x_ops = &xdrstdio_ops;
+  xdrs->x_private = (caddr_t) file;
+  xdrs->x_handy = 0;
+  xdrs->x_base = 0;
 }
 
 /*
@@ -92,95 +93,81 @@ xdrstdio_create(xdrs, file, op)
  * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
  */
 static void
-xdrstdio_destroy(xdrs)
-	register XDR *xdrs;
+xdrstdio_destroy (xdrs)
+     XDR *xdrs;
 {
-	(void)fflush((FILE *)xdrs->x_private);
-	/* xx should we close the file ?? */
+  (void) fflush ((FILE *) xdrs->x_private);
+  /* xx should we close the file ?? */
 };
 
 static bool_t
-xdrstdio_getlong(xdrs, lp)
-	XDR *xdrs;
-	register long *lp;
+xdrstdio_getlong (xdrs, lp)
+     XDR *xdrs;
+     long *lp;
 {
-	int32_t mycopy;
+  int32_t mycopy;
 
-	if (fread((caddr_t)&mycopy, 4, 1, (FILE *)xdrs->x_private) != 1)
-		return (FALSE);
-	*lp = (int32_t) ntohl(mycopy);
-	return (TRUE);
+  if (fread ((caddr_t) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+    return FALSE;
+  *lp = (int32_t) ntohl (mycopy);
+  return TRUE;
 }
 
 static bool_t
-xdrstdio_putlong(xdrs, lp)
-	XDR *xdrs;
-	long *lp;
+xdrstdio_putlong (XDR *xdrs, long *lp)
 {
 
-	int32_t  mycopy = htonl(*lp);
-	lp = &mycopy;
-	if (fwrite((caddr_t)lp, 4, 1, (FILE *)xdrs->x_private) != 1)
-		return (FALSE);
-	return (TRUE);
+  long mycopy = htonl (*lp);
+  lp = &mycopy;
+  if (fwrite ((caddr_t) lp, 4, 1, (FILE *) xdrs->x_private) != 1)
+    return FALSE;
+  return TRUE;
 }
 
 static bool_t
-xdrstdio_getbytes(xdrs, addr, len)
-	XDR *xdrs;
-	caddr_t addr;
-	u_int len;
+xdrstdio_getbytes (xdrs, addr, len)
+     XDR *xdrs;
+     caddr_t addr;
+     u_int len;
 {
 
-	if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
-		return (FALSE);
-	return (TRUE);
+  if ((len != 0) && (fread (addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
+    return FALSE;
+  return TRUE;
 }
 
 static bool_t
-xdrstdio_putbytes(xdrs, addr, len)
-	XDR *xdrs;
-	caddr_t addr;
-	u_int len;
+xdrstdio_putbytes (XDR *xdrs, caddr_t addr, u_int len)
 {
-
-	if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
-		return (FALSE);
-	return (TRUE);
+  if ((len != 0) && (fwrite (addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
+    return FALSE;
+  return TRUE;
 }
 
 static u_int
-xdrstdio_getpos(xdrs)
-	XDR *xdrs;
+xdrstdio_getpos (XDR *xdrs)
 {
-
-	return ((u_int) ftell((FILE *)xdrs->x_private));
+  return (u_int) ftell ((FILE *) xdrs->x_private);
 }
 
 static bool_t
-xdrstdio_setpos(xdrs, pos)
-	XDR *xdrs;
-	u_int pos;
+xdrstdio_setpos (XDR *xdrs, u_int pos)
 {
-
-	return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
-		FALSE : TRUE);
+  return fseek ((FILE *) xdrs->x_private, (long) pos, 0) < 0 ? FALSE : TRUE;
 }
 
 static long *
-xdrstdio_inline(xdrs, len)
-	XDR *xdrs;
-	u_int len;
+xdrstdio_inline (XDR *xdrs, int len)
 {
 
-	/*
-	 * Must do some work to implement this: must insure
-	 * enough data in the underlying stdio buffer,
-	 * that the buffer is aligned so that we can indirect through a
-	 * long *, and stuff this pointer in xdrs->x_buf.  Doing
-	 * a fread or fwrite to a scratch buffer would defeat
-	 * most of the gains to be had here and require storage
-	 * management on this buffer, so we don't do this.
-	 */
-	return (NULL);
+  /*
+   * Must do some work to implement this: must insure
+   * enough data in the underlying stdio buffer,
+   * that the buffer is aligned so that we can indirect through a
+   * long *, and stuff this pointer in xdrs->x_buf.  Doing
+   * a fread or fwrite to a scratch buffer would defeat
+   * most of the gains to be had here and require storage
+   * management on this buffer, so we don't do this.
+   */
+  return NULL;
 }