From a7461e1430fcc26b02457f7b8f53dc423c062e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 23 Jan 2012 19:31:10 +0100 Subject: [PATCH] build: use intptr_t and uintptr_t to cast ptr to int --- xdr_mem.c | 2 +- xdr_rec.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xdr_mem.c b/xdr_mem.c index 701cad2..f8a2d3a 100644 --- a/xdr_mem.c +++ b/xdr_mem.c @@ -169,7 +169,7 @@ xdrmem_setpos(xdrs, pos) register caddr_t newaddr = xdrs->x_base + pos; register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; - if ((long)newaddr > (long)lastaddr) + if ((intptr_t)newaddr > (intptr_t)lastaddr) return (FALSE); xdrs->x_private = newaddr; xdrs->x_handy = lastaddr - newaddr; diff --git a/xdr_rec.c b/xdr_rec.c index 6859c42..a0d34c6 100644 --- a/xdr_rec.c +++ b/xdr_rec.c @@ -173,7 +173,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) return; } for (rstrm->out_base = rstrm->the_buffer; - (long) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; + (intptr_t) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; rstrm->out_base++); rstrm->in_base = rstrm->out_base + sendsize; /* @@ -472,12 +472,12 @@ xdrrec_endofrecord(xdrs, sendnow) register u_long len; /* fragment length */ if (sendnow || rstrm->frag_sent || - ((u_long)rstrm->out_finger + sizeof(u_long) >= - (u_long)rstrm->out_boundry)) { + ((uintptr_t)rstrm->out_finger + sizeof(u_long) >= + (uintptr_t)rstrm->out_boundry)) { rstrm->frag_sent = FALSE; return (flush_out(rstrm, TRUE)); } - len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) - + len = (uintptr_t)(rstrm->out_finger) - (uintptr_t)(rstrm->frag_header) - sizeof(u_long); *(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG); rstrm->frag_header = (u_long *)rstrm->out_finger; @@ -495,11 +495,11 @@ flush_out(rstrm, eor) bool_t eor; { register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; - register u_long len = (u_long)(rstrm->out_finger) - - (u_long)(rstrm->frag_header) - sizeof(u_long); + register u_long len = (uintptr_t)(rstrm->out_finger) - + (uintptr_t)(rstrm->frag_header) - sizeof(u_long); *(rstrm->frag_header) = htonl(len | eormask); - len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base); + len = (uintptr_t)(rstrm->out_finger) - (uintptr_t)(rstrm->out_base); if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len) != (int)len) return (FALSE); @@ -517,7 +517,7 @@ fill_input_buf(rstrm) register int len; where = rstrm->in_base; - i = (long) rstrm->in_boundry % BYTES_PER_XDR_UNIT; + i = (intptr_t) rstrm->in_boundry % BYTES_PER_XDR_UNIT; where += i; len = rstrm->in_size - i; if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1) -- 1.7.7.5