diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-04-01 07:44:05 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-04-01 07:44:05 +0000 |
commit | 46dd7fa28774a43ed962f12dff50a2f623bdfc62 (patch) | |
tree | b9aef01653cce18509f9ef07acab774e1b5b77eb /lib/libc/rpc/xdr_rec.c | |
parent | 1f49fb4097cac5eea507a78749b49b3783984392 (diff) |
ansify. ok deraadt@ jaredy@
Diffstat (limited to 'lib/libc/rpc/xdr_rec.c')
-rw-r--r-- | lib/libc/rpc/xdr_rec.c | 80 |
1 files changed, 25 insertions, 55 deletions
diff --git a/lib/libc/rpc/xdr_rec.c b/lib/libc/rpc/xdr_rec.c index 347cc5c7100..15a502e880f 100644 --- a/lib/libc/rpc/xdr_rec.c +++ b/lib/libc/rpc/xdr_rec.c @@ -27,7 +27,7 @@ * Mountain View, California 94043 */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: xdr_rec.c,v 1.9 2002/02/16 21:27:24 millert Exp $"; +static char *rcsid = "$OpenBSD: xdr_rec.c,v 1.10 2005/04/01 07:44:04 otto Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -63,6 +63,8 @@ static bool_t xdrrec_setpos(XDR *, u_int); static int32_t *xdrrec_inline(XDR *, u_int); static void xdrrec_destroy(XDR *); +struct ct_data; + static struct xdr_ops xdrrec_ops = { xdrrec_getlong, xdrrec_putlong, @@ -132,13 +134,11 @@ static bool_t skip_input_bytes(RECSTREAM *, long); * calls expect that they take an opaque handle rather than an fd. */ void -xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) - XDR *xdrs; - u_int sendsize; - u_int recvsize; - caddr_t tcp_handle; - int (*readit)(); /* like read, but pass it a tcp_handle, not sock */ - int (*writeit)(); /* like write, but pass it a tcp_handle, not sock */ +xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle, + int (*readit)(caddr_t, caddr_t, int), /* like read, but pass it a + tcp_handle, not sock */ + int (*writeit)(caddr_t, caddr_t, int)) /* like write, but pass it a + tcp_handle, not sock */ { RECSTREAM *rstrm = (RECSTREAM *)mem_alloc(sizeof(RECSTREAM)); @@ -193,9 +193,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) */ static bool_t -xdrrec_getlong(xdrs, lp) - XDR *xdrs; - long *lp; +xdrrec_getlong(XDR *xdrs, long int *lp) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int32_t *buflp = (int32_t *)(rstrm->in_finger); @@ -217,9 +215,7 @@ xdrrec_getlong(xdrs, lp) } static bool_t -xdrrec_putlong(xdrs, lp) - XDR *xdrs; - long *lp; +xdrrec_putlong(XDR *xdrs, long int *lp) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int32_t *dest_lp = ((int32_t *)(rstrm->out_finger)); @@ -241,10 +237,7 @@ xdrrec_putlong(xdrs, lp) } static bool_t /* must manage buffers, fragments, and records */ -xdrrec_getbytes(xdrs, addr, len) - XDR *xdrs; - caddr_t addr; - u_int len; +xdrrec_getbytes(XDR *xdrs, caddr_t addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int current; @@ -269,10 +262,7 @@ xdrrec_getbytes(xdrs, addr, len) } static bool_t -xdrrec_putbytes(xdrs, addr, len) - XDR *xdrs; - caddr_t addr; - u_int len; +xdrrec_putbytes(XDR *xdrs, caddr_t addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); long current; @@ -295,8 +285,7 @@ xdrrec_putbytes(xdrs, addr, len) } static u_int -xdrrec_getpos(xdrs) - XDR *xdrs; +xdrrec_getpos(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; long pos; @@ -321,9 +310,7 @@ xdrrec_getpos(xdrs) } static bool_t -xdrrec_setpos(xdrs, pos) - XDR *xdrs; - u_int pos; +xdrrec_setpos(XDR *xdrs, u_int pos) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; u_int currpos = xdrrec_getpos(xdrs); @@ -357,9 +344,7 @@ xdrrec_setpos(xdrs, pos) } static int32_t * -xdrrec_inline(xdrs, len) - XDR *xdrs; - u_int len; +xdrrec_inline(XDR *xdrs, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; int32_t *buf = NULL; @@ -386,8 +371,7 @@ xdrrec_inline(xdrs, len) } static void -xdrrec_destroy(xdrs) - XDR *xdrs; +xdrrec_destroy(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; @@ -406,8 +390,7 @@ xdrrec_destroy(xdrs) * this procedure to guarantee proper record alignment. */ bool_t -xdrrec_skiprecord(xdrs) - XDR *xdrs; +xdrrec_skiprecord(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); @@ -428,8 +411,7 @@ xdrrec_skiprecord(xdrs) * after consuming the rest of the current record. */ bool_t -xdrrec_eof(xdrs) - XDR *xdrs; +xdrrec_eof(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); @@ -452,9 +434,7 @@ xdrrec_eof(xdrs) * pipelined procedure calls.) TRUE => immmediate flush to tcp connection. */ bool_t -xdrrec_endofrecord(xdrs, sendnow) - XDR *xdrs; - bool_t sendnow; +xdrrec_endofrecord(XDR *xdrs, int32_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); u_long len; /* fragment length */ @@ -478,9 +458,7 @@ xdrrec_endofrecord(xdrs, sendnow) * Internal useful routines */ static bool_t -flush_out(rstrm, eor) - RECSTREAM *rstrm; - bool_t eor; +flush_out(RECSTREAM *rstrm, int32_t eor) { u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; u_int32_t len = (u_long)(rstrm->out_finger) - @@ -497,8 +475,7 @@ flush_out(rstrm, eor) } static bool_t /* knows nothing about records! Only about input buffers */ -fill_input_buf(rstrm) - RECSTREAM *rstrm; +fill_input_buf(RECSTREAM *rstrm) { caddr_t where; u_long i; @@ -517,10 +494,7 @@ fill_input_buf(rstrm) } static bool_t /* knows nothing about records! Only about input buffers */ -get_input_bytes(rstrm, addr, len) - RECSTREAM *rstrm; - caddr_t addr; - int len; +get_input_bytes(RECSTREAM *rstrm, caddr_t addr, int len) { long current; @@ -541,8 +515,7 @@ get_input_bytes(rstrm, addr, len) } static bool_t /* next four bytes of the input stream are treated as a header */ -set_input_fragment(rstrm) - RECSTREAM *rstrm; +set_input_fragment(RECSTREAM *rstrm) { u_int32_t header; @@ -557,9 +530,7 @@ set_input_fragment(rstrm) } static bool_t /* consumes input bytes; knows nothing about records! */ -skip_input_bytes(rstrm, cnt) - RECSTREAM *rstrm; - long cnt; +skip_input_bytes(RECSTREAM *rstrm, long int cnt) { long current; @@ -578,8 +549,7 @@ skip_input_bytes(rstrm, cnt) } static u_int -fix_buf_size(s) - u_int s; +fix_buf_size(u_int s) { if (s < 100) |