Browse Source

Suppressed warnings about int to pointer cast

Yann Weber 7 years ago
parent
commit
bf6792ebc0
5 changed files with 13 additions and 11 deletions
  1. 5
    5
      src/gmap.c
  2. 1
    1
      src/gmap.h
  3. 1
    1
      src/llist.c
  4. 2
    2
      src/map.c
  5. 4
    2
      src/map.h

+ 5
- 5
src/gmap.c View File

@@ -131,7 +131,7 @@ gnode_from_pos(int pos, map_gnode * map)
131 131
  * to the relative ip.
132 132
  */
133 133
 void
134
-rnodetoip(u_int mapstart, u_int maprnode, inet_prefix ipstart,
134
+rnodetoip(uintptr_t mapstart, uintptr_t maprnode, inet_prefix ipstart,
135 135
 		  inet_prefix * ret)
136 136
 {
137 137
 	ext_rnode *e_rnode;
@@ -1060,12 +1060,12 @@ int
1060 1060
 extmap_find_level(map_gnode ** ext_map, map_gnode * gnode,
1061 1061
 				  u_char max_level)
1062 1062
 {
1063
-	int i, a, b, c;
1063
+	uintptr_t i, a, b, c;
1064 1064
 
1065 1065
 	for (i = 1; i < max_level; i++) {
1066
-		a = (int) gnode;
1067
-		b = (int) &ext_map[_EL(i)][0];
1068
-		c = (int) &ext_map[_EL(i)][MAXGROUPNODE - 1];
1066
+		a = (uintptr_t) gnode;
1067
+		b = (uintptr_t) &ext_map[_EL(i)][0];
1068
+		c = (uintptr_t) &ext_map[_EL(i)][MAXGROUPNODE - 1];
1069 1069
 
1070 1070
 		if (a >= b && a <= c)
1071 1071
 			return i;

+ 1
- 1
src/gmap.h View File

@@ -213,7 +213,7 @@ int is_group_invalid(int *gids, int gid, int lvl, int family);
213 213
 
214 214
 int pos_from_gnode(map_gnode * gnode, map_gnode * map);
215 215
 map_gnode *gnode_from_pos(int pos, map_gnode * map);
216
-void rnodetoip(u_int mapstart, u_int maprnode, inet_prefix ipstart,
216
+void rnodetoip(uintptr_t mapstart, uintptr_t maprnode, inet_prefix ipstart,
217 217
 			   inet_prefix * ret);
218 218
 const char *rnode_to_ipstr(u_int mapstart, u_int maprnode,
219 219
 						   inet_prefix ipstart);

+ 1
- 1
src/llist.c View File

@@ -574,7 +574,7 @@ do{                  							\
574 574
 #define clist_init(_counter)						\
575 575
 ({									\
576 576
 	*(_counter)=0;							\
577
-	0;								\
577
+	(uintptr_t)0;								\
578 578
 })
579 579
 
580 580
 #define clist_destroy(_head, _counter)					\

+ 2
- 2
src/map.c View File

@@ -71,7 +71,7 @@ postoip(u_int map_pos, inet_prefix ipstart, inet_prefix * ret)
71 71
  * corresponding ip.
72 72
  */
73 73
 void
74
-maptoip(u_int mapstart, u_int mapoff, inet_prefix ipstart,
74
+maptoip(uintptr_t mapstart, uintptr_t mapoff, inet_prefix ipstart,
75 75
 		inet_prefix * ret)
76 76
 {
77 77
 	int map_pos =
@@ -84,7 +84,7 @@ maptoip(u_int mapstart, u_int mapoff, inet_prefix ipstart,
84 84
  * int `*ret'.
85 85
  */
86 86
 int
87
-iptomap(u_int mapstart, inet_prefix ip, inet_prefix ipstart,
87
+iptomap(uintptr_t mapstart, inet_prefix ip, inet_prefix ipstart,
88 88
 		map_node ** ret)
89 89
 {
90 90
 	if (ip.family == AF_INET)

+ 4
- 2
src/map.h View File

@@ -166,6 +166,8 @@ INT_INFO int_map_hdr_iinfo = { 2,
166 166
  */
167 167
 #define INT_MAP_BLOCK_SZ(int_map_sz, rblock_sz) (sizeof(struct int_map_hdr)+(int_map_sz)+(rblock_sz))
168 168
 
169
+/*conversion macro*/
170
+#define UINT2NODE(i) ((map_node *)(uintptr_t)(i))
169 171
 
170 172
 /* 
171 173
  * * * Functions' declaration * * *
@@ -175,9 +177,9 @@ INT_INFO int_map_hdr_iinfo = { 2,
175 177
 int pos_from_node(map_node * node, map_node * map);
176 178
 map_node *node_from_pos(int pos, map_node * map);
177 179
 void postoip(u_int map_pos, inet_prefix ipstart, inet_prefix * ret);
178
-void maptoip(u_int mapstart, u_int mapoff, inet_prefix ipstart,
180
+void maptoip(uintptr_t mapstart, uintptr_t mapoff, inet_prefix ipstart,
179 181
 			 inet_prefix * ret);
180
-int iptomap(u_int mapstart, inet_prefix ip, inet_prefix ipstart,
182
+int iptomap(uintptr_t mapstart, inet_prefix ip, inet_prefix ipstart,
181 183
 			map_node ** ret);
182 184
 
183 185
 map_node *init_map(size_t len);

Loading…
Cancel
Save