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
  * to the relative ip.
131
  * to the relative ip.
132
  */
132
  */
133
 void
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
 		  inet_prefix * ret)
135
 		  inet_prefix * ret)
136
 {
136
 {
137
 	ext_rnode *e_rnode;
137
 	ext_rnode *e_rnode;
1060
 extmap_find_level(map_gnode ** ext_map, map_gnode * gnode,
1060
 extmap_find_level(map_gnode ** ext_map, map_gnode * gnode,
1061
 				  u_char max_level)
1061
 				  u_char max_level)
1062
 {
1062
 {
1063
-	int i, a, b, c;
1063
+	uintptr_t i, a, b, c;
1064
 
1064
 
1065
 	for (i = 1; i < max_level; i++) {
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
 		if (a >= b && a <= c)
1070
 		if (a >= b && a <= c)
1071
 			return i;
1071
 			return i;

+ 1
- 1
src/gmap.h View File

213
 
213
 
214
 int pos_from_gnode(map_gnode * gnode, map_gnode * map);
214
 int pos_from_gnode(map_gnode * gnode, map_gnode * map);
215
 map_gnode *gnode_from_pos(int pos, map_gnode * map);
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
 			   inet_prefix * ret);
217
 			   inet_prefix * ret);
218
 const char *rnode_to_ipstr(u_int mapstart, u_int maprnode,
218
 const char *rnode_to_ipstr(u_int mapstart, u_int maprnode,
219
 						   inet_prefix ipstart);
219
 						   inet_prefix ipstart);

+ 1
- 1
src/llist.c View File

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

+ 2
- 2
src/map.c View File

71
  * corresponding ip.
71
  * corresponding ip.
72
  */
72
  */
73
 void
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
 		inet_prefix * ret)
75
 		inet_prefix * ret)
76
 {
76
 {
77
 	int map_pos =
77
 	int map_pos =
84
  * int `*ret'.
84
  * int `*ret'.
85
  */
85
  */
86
 int
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
 		map_node ** ret)
88
 		map_node ** ret)
89
 {
89
 {
90
 	if (ip.family == AF_INET)
90
 	if (ip.family == AF_INET)

+ 4
- 2
src/map.h View File

166
  */
166
  */
167
 #define INT_MAP_BLOCK_SZ(int_map_sz, rblock_sz) (sizeof(struct int_map_hdr)+(int_map_sz)+(rblock_sz))
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
  * * * Functions' declaration * * *
173
  * * * Functions' declaration * * *
175
 int pos_from_node(map_node * node, map_node * map);
177
 int pos_from_node(map_node * node, map_node * map);
176
 map_node *node_from_pos(int pos, map_node * map);
178
 map_node *node_from_pos(int pos, map_node * map);
177
 void postoip(u_int map_pos, inet_prefix ipstart, inet_prefix * ret);
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
 			 inet_prefix * ret);
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
 			map_node ** ret);
183
 			map_node ** ret);
182
 
184
 
183
 map_node *init_map(size_t len);
185
 map_node *init_map(size_t len);

Loading…
Cancel
Save