aboutsummaryrefslogtreecommitdiffstats
path: root/community/portablexdr/portablexdr-build-use-intptr_t-and-uintptr_t-to-cast-ptr-to-int.patch
blob: 847ca1591047d6c096f9abf63cf23ea0db7fee65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From a7461e1430fcc26b02457f7b8f53dc423c062e1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
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