From 4ff9e46c8c572d5c7258cf42d79d2f938a16d119 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 7 Dec 2001 19:20:17 +0000 Subject: [PATCH] * clnt_raw, clnt_tcp.c, clnt_udp.c: Use a union structure to ensure argument alignment. * pmap_clnt.c, pmap_clnt.h (pmap_set): Change port argument to int to avoid width warnings. * rpc_callmsg.c (xdr_callmsg): Cast argument to XDR_INLINE to avoid signed vs. unsigned warning. * svc.c: Cast assignment to avoid signed warning. * xdr.c (xdr_u_short, xdr_u_long): cast pointers to long * in invocation of XDR_PUTLONG. * xdr_alloc.c (xdralloc_putbytes): Cast argument to DynInsert to avoid signed/unsigned warning. * auth_gssapi.c, svc_auth_gssapi, xdr_rec.c: Cast arguments to avoid alignment warnings. * svc_tcp.c, xdr_stdio.c: Cast argument to fread/fwrite/read/write. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14054 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/rpc/ChangeLog | 24 ++++++++++++++++++++++++ src/lib/rpc/auth_gssapi.c | 2 +- src/lib/rpc/clnt_raw.c | 11 +++++++---- src/lib/rpc/clnt_tcp.c | 15 +++++++++------ src/lib/rpc/clnt_udp.c | 5 +++-- src/lib/rpc/pmap_clnt.c | 2 +- src/lib/rpc/pmap_clnt.h | 2 +- src/lib/rpc/pmap_rmt.c | 4 ++-- src/lib/rpc/rpc_callmsg.c | 9 +++++---- src/lib/rpc/svc.c | 2 +- src/lib/rpc/svc_auth_gssapi.c | 11 ++++++----- src/lib/rpc/svc_tcp.c | 4 ++-- src/lib/rpc/xdr.c | 6 +++--- src/lib/rpc/xdr_alloc.c | 2 +- src/lib/rpc/xdr_rec.c | 26 +++++++++++++------------- src/lib/rpc/xdr_stdio.c | 6 ++++-- 16 files changed, 83 insertions(+), 48 deletions(-) diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index ca3f0a49b..eed252fc8 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,27 @@ +2001-12-07 Ezra Peisach + + * clnt_raw, clnt_tcp.c, clnt_udp.c: Use a union structure to + ensure argument alignment. + + * pmap_clnt.c, pmap_clnt.h (pmap_set): Change port argument to int + to avoid width warnings. + + * rpc_callmsg.c (xdr_callmsg): Cast argument to XDR_INLINE to + avoid signed vs. unsigned warning. + + * svc.c: Cast assignment to avoid signed warning. + + * xdr.c (xdr_u_short, xdr_u_long): cast pointers to long * in + invocation of XDR_PUTLONG. + + * xdr_alloc.c (xdralloc_putbytes): Cast argument to DynInsert to + avoid signed/unsigned warning. + + * auth_gssapi.c, svc_auth_gssapi, xdr_rec.c: Cast arguments to + avoid alignment warnings. + + * svc_tcp.c, xdr_stdio.c: Cast argument to fread/fwrite/read/write. + 2001-10-09 Ken Raeburn * auth_gssapi.h, auth_gssapi_misc.c, getrpcent.c, diff --git a/src/lib/rpc/auth_gssapi.c b/src/lib/rpc/auth_gssapi.c index 89167e583..a18939ae6 100644 --- a/src/lib/rpc/auth_gssapi.c +++ b/src/lib/rpc/auth_gssapi.c @@ -508,7 +508,7 @@ static bool_t marshall_new_creds(auth, auth_msg, client_handle) creds.client_handle.value = NULL; } - xdrmem_create(&xdrs, AUTH_PRIVATE(auth)->cred_buf, + xdrmem_create(&xdrs, (caddr_t) AUTH_PRIVATE(auth)->cred_buf, MAX_AUTH_BYTES, XDR_ENCODE); if (! xdr_authgssapi_creds(&xdrs, &creds)) { PRINTF(("marshall_new_creds: failed encoding auth_gssapi_creds\n")); diff --git a/src/lib/rpc/clnt_raw.c b/src/lib/rpc/clnt_raw.c index 464142a44..f3f2ff15d 100644 --- a/src/lib/rpc/clnt_raw.c +++ b/src/lib/rpc/clnt_raw.c @@ -53,7 +53,10 @@ static struct clntraw_private { CLIENT client_object; XDR xdr_stream; char _raw_buf[UDPMSGSIZE]; - char mashl_callmsg[MCALL_MSG_SIZE]; + union { + struct rpc_msg mashl_rpcmsg; + char mashl_callmsg[MCALL_MSG_SIZE]; + } u; unsigned int mcnt; } *clntraw_private; @@ -103,7 +106,7 @@ clntraw_create(prog, vers) call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; call_msg.rm_call.cb_prog = prog; call_msg.rm_call.cb_vers = vers; - xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); + xdrmem_create(xdrs, clp->u.mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); if (! xdr_callhdr(xdrs, &call_msg)) { perror("clnt_raw.c - Fatal header serialization error."); } @@ -148,8 +151,8 @@ call_again: */ xdrs->x_op = XDR_ENCODE; XDR_SETPOS(xdrs, 0); - ((struct rpc_msg *)clp->mashl_callmsg)->rm_xid ++ ; - if ((! XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || + clp->u.mashl_rpcmsg.rm_xid ++ ; + if ((! XDR_PUTBYTES(xdrs, clp->u.mashl_callmsg, clp->mcnt)) || (! XDR_PUTLONG(xdrs, &procl)) || (! AUTH_MARSHALL(h->cl_auth, xdrs)) || (! (*xargs)(xdrs, argsp))) { diff --git a/src/lib/rpc/clnt_tcp.c b/src/lib/rpc/clnt_tcp.c index b43775e2b..abadf339c 100644 --- a/src/lib/rpc/clnt_tcp.c +++ b/src/lib/rpc/clnt_tcp.c @@ -86,7 +86,10 @@ struct ct_data { bool_t ct_waitset; /* wait set by clnt_control? */ struct sockaddr_in ct_addr; struct rpc_err ct_error; - char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */ + union { + char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */ + rpc_u_int32 ct_mcalli; + } ct_u; unsigned int ct_mpos; /* pos after marshal */ XDR ct_xdrs; }; @@ -191,7 +194,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) /* * pre-serialize the staic part of the call msg and stash it away */ - xdrmem_create(&(ct->ct_xdrs), ct->ct_mcall, MCALL_MSG_SIZE, + xdrmem_create(&(ct->ct_xdrs), ct->ct_u.ct_mcall, MCALL_MSG_SIZE, XDR_ENCODE); if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) { if (ct->ct_closeit) { @@ -236,7 +239,7 @@ clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) register XDR *xdrs = &(ct->ct_xdrs); struct rpc_msg reply_msg; rpc_u_int32 x_id; - rpc_u_int32 *msg_x_id = (rpc_u_int32 *)(ct->ct_mcall); /* yuk */ + rpc_u_int32 *msg_x_id = &ct->ct_u.ct_mcalli; /* yuk */ register bool_t shipnow; int refreshes = 2; long procl = proc; @@ -253,7 +256,7 @@ call_again: xdrs->x_op = XDR_ENCODE; ct->ct_error.re_status = RPC_SUCCESS; x_id = ntohl(--(*msg_x_id)); - if ((! XDR_PUTBYTES(xdrs, ct->ct_mcall, ct->ct_mpos)) || + if ((! XDR_PUTBYTES(xdrs, ct->ct_u.ct_mcall, ct->ct_mpos)) || (! XDR_PUTLONG(xdrs, &procl)) || (! AUTH_MARSHALL(h->cl_auth, xdrs)) || (! AUTH_WRAP(h->cl_auth, xdrs, xdr_args, args_ptr))) { @@ -457,7 +460,7 @@ readtcp(ctptr, buf, len) } break; } - switch (len = read(ct->ct_sock, buf, len)) { + switch (len = read(ct->ct_sock, buf, (size_t) len)) { case 0: /* premature eof */ @@ -484,7 +487,7 @@ writetcp(ctptr, buf, len) register int i, cnt; for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write(ct->ct_sock, buf, cnt)) == -1) { + if ((i = write(ct->ct_sock, buf, (size_t) cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; return (-1); diff --git a/src/lib/rpc/clnt_udp.c b/src/lib/rpc/clnt_udp.c index 798622e25..78102269e 100644 --- a/src/lib/rpc/clnt_udp.c +++ b/src/lib/rpc/clnt_udp.c @@ -263,7 +263,7 @@ call_again: /* * the transaction is the first thing in the out buffer */ - (*(unsigned short *)(cu->cu_outbuf))++; + (*(rpc_u_int32 *)(void *)(cu->cu_outbuf))++; if ((! XDR_PUTLONG(xdrs, &procl)) || (! AUTH_MARSHALL(cl->cl_auth, xdrs)) || (! AUTH_WRAP(cl->cl_auth, xdrs, xargs, argsp))) @@ -340,7 +340,8 @@ send_again: if (inlen < sizeof(rpc_u_int32)) continue; /* see if reply transaction id matches sent id */ - if (*((rpc_u_int32 *)(cu->cu_inbuf)) != *((rpc_u_int32 *)(cu->cu_outbuf))) + if (*((rpc_u_int32 *)(void *)(cu->cu_inbuf)) != + *((rpc_u_int32 *)(void *)(cu->cu_outbuf))) continue; /* we now assume we have the proper reply */ break; diff --git a/src/lib/rpc/pmap_clnt.c b/src/lib/rpc/pmap_clnt.c index e2d47ecad..7c9de2f6c 100644 --- a/src/lib/rpc/pmap_clnt.c +++ b/src/lib/rpc/pmap_clnt.c @@ -60,7 +60,7 @@ pmap_set(program, version, protocol, port) rpc_u_int32 program; rpc_u_int32 version; int protocol; - unsigned short port; + int port; { struct sockaddr_in myaddress; int socket = -1; diff --git a/src/lib/rpc/pmap_clnt.h b/src/lib/rpc/pmap_clnt.h index 6cc4b68e9..976b15ec9 100644 --- a/src/lib/rpc/pmap_clnt.h +++ b/src/lib/rpc/pmap_clnt.h @@ -65,7 +65,7 @@ #define pmap_getport gssrpc_pmap_getport extern bool_t pmap_set(rpc_u_int32, rpc_u_int32, int, - unsigned short); + int); extern bool_t pmap_unset(rpc_u_int32, rpc_u_int32); extern struct pmaplist *pmap_getmaps(struct sockaddr_in *); enum clnt_stat pmap_rmtcall(struct sockaddr_in *, rpc_u_int32, diff --git a/src/lib/rpc/pmap_rmt.c b/src/lib/rpc/pmap_rmt.c index 1d090f732..bc71ec060 100644 --- a/src/lib/rpc/pmap_rmt.c +++ b/src/lib/rpc/pmap_rmt.c @@ -151,10 +151,10 @@ xdr_rmtcallres(xdrs, crp) { caddr_t port_ptr; - port_ptr = (caddr_t)crp->port_ptr; + port_ptr = (caddr_t)(void *)crp->port_ptr; if (xdr_reference(xdrs, &port_ptr, sizeof (rpc_u_int32), xdr_u_int32) && xdr_u_int32(xdrs, &crp->resultslen)) { - crp->port_ptr = (rpc_u_int32 *)port_ptr; + crp->port_ptr = (rpc_u_int32 *)(void *)port_ptr; return ((*(crp->xdr_results))(xdrs, crp->results_ptr)); } return (FALSE); diff --git a/src/lib/rpc/rpc_callmsg.c b/src/lib/rpc/rpc_callmsg.c index a1de54464..831f2fd2d 100644 --- a/src/lib/rpc/rpc_callmsg.c +++ b/src/lib/rpc/rpc_callmsg.c @@ -60,10 +60,11 @@ xdr_callmsg(xdrs, cmsg) if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) { return (FALSE); } - buf = (rpc_int32 *) XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT + buf = (rpc_int32 *) XDR_INLINE(xdrs, (int) ( + 8 * BYTES_PER_XDR_UNIT + RNDUP(cmsg->rm_call.cb_cred.oa_length) + 2 * BYTES_PER_XDR_UNIT - + RNDUP(cmsg->rm_call.cb_verf.oa_length)); + + RNDUP(cmsg->rm_call.cb_verf.oa_length))); if (buf != NULL) { IXDR_PUT_LONG(buf, cmsg->rm_xid); IXDR_PUT_ENUM(buf, cmsg->rm_direction); @@ -125,7 +126,7 @@ xdr_callmsg(xdrs, cmsg) mem_alloc(oa->oa_length); } buf = (rpc_int32 *) - XDR_INLINE(xdrs, RNDUP(oa->oa_length)); + XDR_INLINE(xdrs, (int)RNDUP(oa->oa_length)); if (buf == NULL) { if (xdr_opaque(xdrs, oa->oa_base, oa->oa_length) == FALSE) { @@ -161,7 +162,7 @@ xdr_callmsg(xdrs, cmsg) mem_alloc(oa->oa_length); } buf = (rpc_int32 *) - XDR_INLINE(xdrs, RNDUP(oa->oa_length)); + XDR_INLINE(xdrs, (int)RNDUP(oa->oa_length)); if (buf == NULL) { if (xdr_opaque(xdrs, oa->oa_base, oa->oa_length) == FALSE) { diff --git a/src/lib/rpc/svc.c b/src/lib/rpc/svc.c index 74e9f9149..7429acda1 100644 --- a/src/lib/rpc/svc.c +++ b/src/lib/rpc/svc.c @@ -468,7 +468,7 @@ svc_getreqset(readfds) /* now match message with a registered service*/ prog_found = FALSE; - low_vers = 0 - 1; + low_vers = (rpc_u_int32) -1L; high_vers = 0; for (s = svc_head; s != NULL_SVC; s = s->sc_next) { if (s->sc_prog == r.rq_prog) { diff --git a/src/lib/rpc/svc_auth_gssapi.c b/src/lib/rpc/svc_auth_gssapi.c index 5473815d4..12000df66 100644 --- a/src/lib/rpc/svc_auth_gssapi.c +++ b/src/lib/rpc/svc_auth_gssapi.c @@ -661,7 +661,8 @@ static svc_auth_gssapi_data *create_client() if (client_data == NULL) return NULL; memset((char *) client_data, 0, sizeof(*client_data)); - L_PRINTF(2, ("create_client: new client_data = %p\n", client_data)); + L_PRINTF(2, ("create_client: new client_data = %p\n", + (void *) client_data)); /* set up client data structure */ client_data->established = 0; @@ -781,7 +782,7 @@ static void destroy_client(client_data) client_list *c, *c2; PRINTF(("destroy_client: destroying client_data\n")); - L_PRINTF(2, ("destroy_client: client_data = %p\n", client_data)); + L_PRINTF(2, ("destroy_client: client_data = %p\n", (void *) client_data)); #ifdef DEBUG_GSSAPI if (svc_debug_gssapi >= 3) @@ -848,7 +849,7 @@ static void dump_db(msg) while (c) { client_data = c->client; L_PRINTF(3, ("\tclient_data = %p, exp = %d\n", - client_data, client_data->expiration)); + (void *) client_data, client_data->expiration)); c = c->next; } @@ -867,7 +868,7 @@ static void clean_client() client_data = c->client; L_PRINTF(2, ("clean_client: client_data = %p\n", - client_data)); + (void *) client_data)); if (client_data->expiration < time(0)) { PRINTF(("clean_client: client %d expired\n", @@ -1066,7 +1067,7 @@ static bool_t svc_auth_gssapi_unwrap(auth, in_xdrs, xdr_func, xdr_ptr) if (! client_data->established) { PRINTF(("svc_gssapi_unwrap: not established, noop\n")); - return (*xdr_func)(in_xdrs, (auth_gssapi_init_arg *) xdr_ptr); + return (*xdr_func)(in_xdrs, (auth_gssapi_init_arg *)(void *) xdr_ptr); } else if (! auth_gssapi_unwrap_data(&gssstat, &minor_stat, client_data->context, client_data->seq_num-1, diff --git a/src/lib/rpc/svc_tcp.c b/src/lib/rpc/svc_tcp.c index 5c7b0e9e5..2d31f9e23 100644 --- a/src/lib/rpc/svc_tcp.c +++ b/src/lib/rpc/svc_tcp.c @@ -341,7 +341,7 @@ readtcp(xprtptr, buf, len) #else } while (readfds != mask); #endif /* def FD_SETSIZE */ - if ((len = read(sock, buf, len)) > 0) { + if ((len = read(sock, buf, (size_t) len)) > 0) { return (len); } fatal_err: @@ -363,7 +363,7 @@ writetcp(xprtptr, buf, len) register int i, cnt; for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write(xprt->xp_sock, buf, cnt)) < 0) { + if ((i = write(xprt->xp_sock, buf, (size_t) cnt)) < 0) { ((struct tcp_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED; return (-1); diff --git a/src/lib/rpc/xdr.c b/src/lib/rpc/xdr.c index 85c86e576..fd924c913 100644 --- a/src/lib/rpc/xdr.c +++ b/src/lib/rpc/xdr.c @@ -214,7 +214,7 @@ xdr_u_long(xdrs, ulp) return (FALSE); } } - return (XDR_PUTLONG(xdrs, ulp)); + return (XDR_PUTLONG(xdrs, (long *)ulp)); } if (xdrs->x_op == XDR_DECODE) { return (XDR_GETLONG(xdrs, (long *)ulp)); @@ -267,10 +267,10 @@ xdr_u_short(xdrs, usp) case XDR_ENCODE: l = (unsigned long) *usp; - return (XDR_PUTLONG(xdrs, &l)); + return (XDR_PUTLONG(xdrs, (long *) &l)); case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { + if (!XDR_GETLONG(xdrs, (long *) &l)) { return (FALSE); } *usp = (unsigned short) l; diff --git a/src/lib/rpc/xdr_alloc.c b/src/lib/rpc/xdr_alloc.c index 6ee9a742f..5b14307bf 100644 --- a/src/lib/rpc/xdr_alloc.c +++ b/src/lib/rpc/xdr_alloc.c @@ -128,7 +128,7 @@ static bool_t xdralloc_putbytes(xdrs, addr, len) { if (DynInsert((DynObject) xdrs->x_private, DynSize((DynObject) xdrs->x_private), - addr, len) != DYN_OK) + addr, (int) len) != DYN_OK) return FALSE; return TRUE; } diff --git a/src/lib/rpc/xdr_rec.c b/src/lib/rpc/xdr_rec.c index 202250459..28faaf24c 100644 --- a/src/lib/rpc/xdr_rec.c +++ b/src/lib/rpc/xdr_rec.c @@ -176,7 +176,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) rstrm->readit = readit; rstrm->writeit = writeit; rstrm->out_finger = rstrm->out_boundry = rstrm->out_base; - rstrm->frag_header = (rpc_u_int32 *)rstrm->out_base; + rstrm->frag_header = (rpc_u_int32 *)(void *)rstrm->out_base; rstrm->out_finger += sizeof(rpc_u_int32); rstrm->out_boundry += sendsize; rstrm->frag_sent = FALSE; @@ -199,7 +199,7 @@ xdrrec_getlong(xdrs, lp) long *lp; { register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - register rpc_int32 *buflp = (rpc_int32 *)(rstrm->in_finger); + register rpc_int32 *buflp = (rpc_int32 *)(void *)(rstrm->in_finger); int mylong; /* first try the inline, fast case */ @@ -222,7 +222,7 @@ xdrrec_putlong(xdrs, lp) long *lp; { register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - register rpc_int32 *dest_lp = ((rpc_int32 *)(rstrm->out_finger)); + register rpc_int32 *dest_lp = ((rpc_int32 *)(void *)(rstrm->out_finger)); if ((rstrm->out_finger += sizeof(rpc_int32)) > rstrm->out_boundry) { /* @@ -233,7 +233,7 @@ xdrrec_putlong(xdrs, lp) rstrm->frag_sent = TRUE; if (! flush_out(rstrm, FALSE)) return (FALSE); - dest_lp = ((rpc_int32 *)(rstrm->out_finger)); + dest_lp = ((rpc_int32 *)(void *)(rstrm->out_finger)); rstrm->out_finger += sizeof(rpc_int32); } *dest_lp = (rpc_int32)htonl((rpc_u_int32)(*lp)); @@ -275,10 +275,10 @@ xdrrec_putbytes(xdrs, addr, len) register unsigned int len; { register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - register int current; + register size_t current; while (len > 0) { - current = (int) ((long)rstrm->out_boundry - + current = (size_t) ((long)rstrm->out_boundry - (long)rstrm->out_finger); current = (len < current) ? len : current; memmove(rstrm->out_finger, addr, current); @@ -308,7 +308,7 @@ xdrrec_getpos(xdrs) #ifdef __osf__ pos = -1; #else - pos = lseek((int)rstrm->tcp_handle, (long) 0, 1); + pos = lseek((int)rstrm->tcp_handle, (off_t) 0, 1); #endif if (pos != -1) switch (xdrs->x_op) { @@ -379,7 +379,7 @@ xdrrec_inline(xdrs, len) case XDR_ENCODE: if ((rstrm->out_finger + len) <= rstrm->out_boundry) { - buf = (rpc_int32 *) rstrm->out_finger; + buf = (rpc_int32 *)(void *) rstrm->out_finger; rstrm->out_finger += len; } break; @@ -387,7 +387,7 @@ xdrrec_inline(xdrs, len) case XDR_DECODE: if ((len <= rstrm->fbtbc) && ((rstrm->in_finger + len) <= rstrm->in_boundry)) { - buf = (rpc_int32 *) rstrm->in_finger; + buf = (rpc_int32 *)(void *) rstrm->in_finger; rstrm->fbtbc -= len; rstrm->in_finger += len; } @@ -482,7 +482,7 @@ xdrrec_endofrecord(xdrs, sendnow) len = (long)(rstrm->out_finger) - (long)(rstrm->frag_header) - sizeof(unsigned int); *(rstrm->frag_header) = htonl((unsigned int)len | LAST_FRAG); - rstrm->frag_header = (rpc_u_int32 *)rstrm->out_finger; + rstrm->frag_header = (rpc_u_int32 *)(void *)rstrm->out_finger; rstrm->out_finger += sizeof(unsigned int); return (TRUE); } @@ -505,7 +505,7 @@ flush_out(rstrm, eor) if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len) != (int)len) return (FALSE); - rstrm->frag_header = (rpc_u_int32 *)rstrm->out_base; + rstrm->frag_header = (rpc_u_int32 *)(void *)rstrm->out_base; rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(rpc_u_int32); return (TRUE); } @@ -536,10 +536,10 @@ get_input_bytes(rstrm, addr, len) register caddr_t addr; register int len; { - register int current; + register size_t current; while (len > 0) { - current = (int)((long)rstrm->in_boundry - + current = (size_t)((long)rstrm->in_boundry - (long)rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) diff --git a/src/lib/rpc/xdr_stdio.c b/src/lib/rpc/xdr_stdio.c index 6afdb5ad9..1e524ffc5 100644 --- a/src/lib/rpc/xdr_stdio.c +++ b/src/lib/rpc/xdr_stdio.c @@ -133,7 +133,8 @@ xdrstdio_getbytes(xdrs, addr, len) unsigned int len; { - if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1)) + if ((len != 0) && (fread(addr, (size_t)len, 1, + (FILE *)xdrs->x_private) != 1)) return (FALSE); return (TRUE); } @@ -145,7 +146,8 @@ xdrstdio_putbytes(xdrs, addr, len) unsigned int len; { - if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1)) + if ((len != 0) && (fwrite(addr, (size_t)len, 1, + (FILE *)xdrs->x_private) != 1)) return (FALSE); return (TRUE); } -- 2.26.2