summaryrefslogtreecommitdiff
path: root/dev-libs/libdnsres/files/libdnsres-0.1a-modern-types.patch
blob: 503602d507fb913f9a30c9c0b121e63c2edbbba4 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
Per discussion in https://github.com/gentoo/gentoo/pull/36138#discussion_r1594836910
transformed u_intX_t to uintX_t, changed relevant includes and trimmed
really redundant checks, includes, undefines
https://bugs.gentoo.org/880341
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,18 +1,6 @@
 /* Define if kqueue works correctly with pipes */
 #undef HAVE_WORKING_KQUEUE
 
-/* Define to `unsigned long long' if <sys/types.h> doesn't define.  */
-#undef u_int64_t
-
-/* Define to `unsigned int' if <sys/types.h> doesn't define.  */
-#undef u_int32_t
-
-/* Define to `unsigned short' if <sys/types.h> doesn't define.  */
-#undef u_int16_t
-
-/* Define to `unsigned char' if <sys/types.h> doesn't define.  */
-#undef u_int8_t
-
 /* Define if timeradd is defined in <sys/time.h> */
 #undef HAVE_TIMERADD
 #ifndef HAVE_TIMERADD
--- a/arc4random.c
+++ b/arc4random.c
@@ -1,4 +1,4 @@
-#include <sys/types.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <time.h>
 
@@ -10,8 +10,8 @@
  * application anyway.  Screw you, hippy!
  */
 
-u_int32_t arc4random(void);
-u_int32_t arc4random(void)
+uint32_t arc4random(void);
+uint32_t arc4random(void)
 {
 	static int init;
 
--- a/base64.c
+++ b/base64.c
@@ -42,7 +42,6 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -52,6 +51,7 @@
 #include <ctype.h>
 #include <stdio.h>
 
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
--- a/config.h.in
+++ b/config.h.in
@@ -2,18 +2,6 @@
 /* Define if kqueue works correctly with pipes */
 #undef HAVE_WORKING_KQUEUE
 
-/* Define to `unsigned long long' if <sys/types.h> doesn't define.  */
-#undef u_int64_t
-
-/* Define to `unsigned int' if <sys/types.h> doesn't define.  */
-#undef u_int32_t
-
-/* Define to `unsigned short' if <sys/types.h> doesn't define.  */
-#undef u_int16_t
-
-/* Define to `unsigned char' if <sys/types.h> doesn't define.  */
-#undef u_int8_t
-
 /* Define if timeradd is defined in <sys/time.h> */
 #undef HAVE_TIMERADD
 #ifndef HAVE_TIMERADD
@@ -250,14 +238,3 @@
 /* Define to unsigned int if you dont have it */
 #undef socklen_t
 
-/* Define to `unsigned short' if <sys/types.h> does not define. */
-#undef u_int16_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef u_int32_t
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#undef u_int64_t
-
-/* Define to `unsigned char' if <sys/types.h> does not define. */
-#undef u_int8_t
--- a/configure.in
+++ b/configure.in
@@ -167,10 +167,6 @@
 
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
-AC_CHECK_TYPE(u_int64_t, unsigned long long)
-AC_CHECK_TYPE(u_int32_t, unsigned int)
-AC_CHECK_TYPE(u_int16_t, unsigned short)
-AC_CHECK_TYPE(u_int8_t, unsigned char)
 
 AC_MSG_CHECKING([for sin_len])
 AC_TRY_COMPILE([
--- a/dnsres-internal.h
+++ b/dnsres-internal.h
@@ -101,6 +101,9 @@
  * --Copyright--
  */
 
+
+#include <stdint.h>
+
 #ifndef _DNSRES_INTERNAL_H_
 #define _DNSRES_INTERNAL_H_
 
@@ -305,24 +308,24 @@
  */
 #define DNSRES_GETSHORT(s, cp) { \
 	unsigned char *t_cp = (unsigned char *)(cp); \
-	(s) = ((u_int16_t)t_cp[0] << 8) \
-	    | ((u_int16_t)t_cp[1]) \
+	(s) = ((uint16_t)t_cp[0] << 8) \
+	    | ((uint16_t)t_cp[1]) \
 	    ; \
 	(cp) += INT16SZ; \
 }
 
 #define DNSRES_GETLONG(l, cp) { \
 	unsigned char *t_cp = (unsigned char *)(cp); \
-	(l) = ((u_int32_t)t_cp[0] << 24) \
-	    | ((u_int32_t)t_cp[1] << 16) \
-	    | ((u_int32_t)t_cp[2] << 8) \
-	    | ((u_int32_t)t_cp[3]) \
+	(l) = ((uint32_t)t_cp[0] << 24) \
+	    | ((uint32_t)t_cp[1] << 16) \
+	    | ((uint32_t)t_cp[2] << 8) \
+	    | ((uint32_t)t_cp[3]) \
 	    ; \
 	(cp) += INT32SZ; \
 }
 
 #define DNSRES_PUTSHORT(s, cp) { \
-	u_int16_t t_s = (u_int16_t)(s); \
+	uint16_t t_s = (uint16_t)(s); \
 	unsigned char *t_cp = (unsigned char *)(cp); \
 	*t_cp++ = t_s >> 8; \
 	*t_cp   = t_s; \
@@ -330,7 +333,7 @@
 }
 
 #define DNSRES_PUTLONG(l, cp) { \
-	u_int32_t t_l = (u_int32_t)(l); \
+	uint32_t t_l = (uint32_t)(l); \
 	unsigned char *t_cp = (unsigned char *)(cp); \
 	*t_cp++ = t_l >> 24; \
 	*t_cp++ = t_l >> 16; \
--- a/dnsres.h
+++ b/dnsres.h
@@ -118,7 +118,7 @@
 #define _DNSRES_H_
 
 #include <sys/param.h>
-#include <sys/types.h>
+#include <stdint.h>
 
 /*
  * Type values for resources and queries
@@ -482,7 +482,7 @@
 	char	unused[3];
 	struct {
 		struct in_addr	addr;
-		u_int32_t	mask;
+		uint32_t	mask;
 	} sort_list[MAXRESOLVSORT];
 	char    lookups[MAXDNSLUS];
 
--- a/getaddrinfo.c
+++ b/getaddrinfo.c
@@ -110,7 +110,7 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
+#include <stdint.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -221,7 +221,7 @@
 static int get_port(struct dnsres_servent_state *,
         struct addrinfo *, const char *, int);
 static const struct afd *find_afd(int);
-static int ip6_str2scopeid(char *, struct sockaddr_in6 *, u_int32_t *);
+static int ip6_str2scopeid(char *, struct sockaddr_in6 *, uint32_t *);
 
 static void _sethtent(struct dnsres_hostent_state *);
 static void _endhtent(struct dnsres_hostent_state *);
@@ -969,7 +969,7 @@
 
 	error = explore_numeric(state, pai, addr, servname, res, hostname);
 	if (error == 0) {
-		u_int32_t scopeid;
+		uint32_t scopeid;
 
 		for (cur = *res; cur; cur = cur->ai_next) {
 			if (cur->ai_family != AF_INET6)
@@ -1148,10 +1148,7 @@
 
 /* convert a string to a scope identifier. XXX: IPv6 specific */
 static int
-ip6_str2scopeid(scope, sin6, scopeid)
-	char *scope;
-	struct sockaddr_in6 *sin6;
-	u_int32_t *scopeid;
+ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, uint32_t *scopeid)
 {
 	u_long lscopeid;
 	struct in6_addr *a6 = &sin6->sin6_addr;
@@ -1185,7 +1182,7 @@
   trynumeric:
 	errno = 0;
 	lscopeid = strtoul(scope, &ep, 10);
-	*scopeid = (u_int32_t)(lscopeid & 0xffffffffUL);
+	*scopeid = (uint32_t)(lscopeid & 0xffffffffUL);
 	if (errno == 0 && ep && *ep == '\0' && *scopeid == lscopeid)
 		return 0;
 	else
--- a/res_comp.c
+++ b/res_comp.c
@@ -64,6 +64,7 @@
 #include <stdio.h>
 #include <ctype.h>
 
+#include <stdint.h>
 #include <unistd.h>
 #include <string.h>
 #include <event.h>
@@ -81,10 +82,7 @@
  * Return size of compressed name or -1 if there was an error.
  */
 int
-dn_expand(msg, eomorig, comp_dn, exp_dn, length)
-	const u_char *msg, *eomorig, *comp_dn;
-	char *exp_dn;
-	int length;
+dn_expand(const u_char *msg, const u_char *eomorig, const u_char *comp_dn, char *exp_dn, int length)
 {
 	const u_char *cp;
 	char *dn;
@@ -165,10 +163,7 @@
  * is NULL, we don't update the list.
  */
 int
-dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
-	const char *exp_dn;
-	u_char *comp_dn, **dnptrs, **lastdnptr;
-	int length;
+dn_comp(const char *exp_dn, u_char *comp_dn, int length, u_char **dnptrs, u_char **lastdnptr)
 {
 	register u_char *cp, *dn;
 	register int c, l;
@@ -245,8 +240,7 @@
  * Skip over a compressed domain name. Return the size or -1.
  */
 int
-__dnsres_dn_skipname(comp_dn, eom)
-	const u_char *comp_dn, *eom;
+__dnsres_dn_skipname(const u_char *comp_dn, const u_char *eom)
 {
 	register const u_char *cp;
 	register int n;
@@ -289,9 +283,7 @@
  * not the pointer to the start of the message.
  */
 static int
-dn_find(exp_dn, msg, dnptrs, lastdnptr)
-	u_char *exp_dn, *msg;
-	u_char **dnptrs, **lastdnptr;
+dn_find(u_char *exp_dn, u_char *msg, u_char **dnptrs, u_char **lastdnptr)
 {
 	register u_char *dn, *cp, **cpp;
 	register int n;
@@ -389,8 +381,7 @@
  * but must otherwise be as a host name.
  */
 int
-res_ownok(dn)
-	const char *dn;
+res_ownok(const char *dn)
 {
 	if (asterchar(dn[0])) {
 		if (periodchar(dn[1]))
@@ -406,8 +397,7 @@
  * label, but the rest of the name has to look like a host name.
  */
 int
-res_mailok(dn)
-	const char *dn;
+res_mailok(const char *dn)
 {
 	int ch, escaped = 0;
 
@@ -436,8 +426,7 @@
  * recommendations.
  */
 int
-res_dnok(dn)
-	const char *dn;
+res_dnok(const char *dn)
 {
 	int ch;
 
@@ -451,36 +440,32 @@
  * Routines to insert/extract short/long's.
  */
 
-u_int16_t
-__dnsres_getshort(msgp)
-	register const u_char *msgp;
+uint16_t
+__dnsres_getshort(register const u_char *msgp)
 {
-	register u_int16_t u;
+	register uint16_t u;
 
 	DNSRES_GETSHORT(u, msgp);
 	return (u);
 }
 
-u_int32_t
-__dnsres_getlong(msgp)
-	register const u_char *msgp;
+uint32_t
+__dnsres_getlong(register const u_char *msgp)
 {
-	register u_int32_t u;
+	register uint32_t u;
 
 	DNSRES_GETLONG(u, msgp);
 	return (u);
 }
 
 void
-__dnsres_putshort(register u_int16_t s, register u_char *msgp)
+__dnsres_putshort(register uint16_t s, register u_char *msgp)
 {
 	DNSRES_PUTSHORT(s, msgp);
 }
 
 void
-__dnsres_putlong(l, msgp)
-	register u_int32_t l;
-	register u_char *msgp;
+__dnsres_putlong(register uint32_t l, register u_char *msgp)
 {
 	DNSRES_PUTLONG(l, msgp);
 }
--- a/res_debug.c
+++ b/res_debug.c
@@ -73,8 +73,9 @@
  * --Copyright--
  */
 
+#include <stdint.h>
 #include <sys/param.h>
-#include <sys/types.h>
+#include <stdint.h>
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -457,9 +458,9 @@
 	int type, class, dlen, n, c;
 	struct in_addr inaddr;
 	const u_char *cp1, *cp2;
-	u_int32_t tmpttl, t;
+	uint32_t tmpttl, t;
 	int lcnt;
-	u_int16_t keyflags;
+	uint16_t keyflags;
 	char rrname[DNSRES_MAXDNAME];		/* The fqdn of this RR */
 	char base64_key[MAX_KEY_BASE64];
 
@@ -1010,7 +1011,7 @@
  * Return a mnemonic for a time to live
  */
 const char *
-p_time(u_int32_t value)
+p_time(uint32_t value)
 {
 	static char nbuf[40];
 	char *ebuf;
@@ -1091,7 +1092,7 @@
 
 /* takes an XeY precision/size value, returns a string representation. */
 static const char *
-precsize_ntoa(u_int8_t prec)
+precsize_ntoa(uint8_t prec)
 {
 	static char retbuf[sizeof "90000000.00"];
 	unsigned long val;
@@ -1107,11 +1108,11 @@
 }
 
 /* converts ascii size/precision X * 10**Y(cm) to 0xXY.  moves pointer. */
-static u_int8_t
+static uint8_t
 precsize_aton(unsigned char **strptr)
 {
 	unsigned int mval = 0, cmval = 0;
-	u_int8_t retval = 0;
+	uint8_t retval = 0;
 	unsigned char *cp;
 	int exponent;
 	int mantissa;
@@ -1148,11 +1149,11 @@
 }
 
 /* converts ascii lat/lon to unsigned encoded 32-bit number.  moves pointer. */
-static u_int32_t
+static uint32_t
 latlon2ul(unsigned char **latlonstrptr, int *which)
 {
 	unsigned char *cp;
-	u_int32_t retval;
+	uint32_t retval;
 	int deg = 0, min = 0, secs = 0, secsfrac = 0;
 
 	cp = *latlonstrptr;
@@ -1252,12 +1253,12 @@
 	u_char *bcp;
 	unsigned char *cp;
 
-	u_int32_t latit = 0, longit = 0, alt = 0;
-	u_int32_t lltemp1 = 0, lltemp2 = 0;
+	uint32_t latit = 0, longit = 0, alt = 0;
+	uint32_t lltemp1 = 0, lltemp2 = 0;
 	int altmeters = 0, altfrac = 0, altsign = 1;
-	u_int8_t hp = 0x16;	/* default = 1e6 cm = 10000.00m = 10km */
-	u_int8_t vp = 0x13;	/* default = 1e3 cm = 10.00m */
-	u_int8_t siz = 0x12;	/* default = 1e2 cm = 1.00m */
+	uint8_t hp = 0x16;	/* default = 1e6 cm = 10000.00m = 10km */
+	uint8_t vp = 0x13;	/* default = 1e3 cm = 10.00m */
+	uint8_t siz = 0x12;	/* default = 1e2 cm = 1.00m */
 	int which1 = 0, which2 = 0;
 
 	cp = (unsigned char *)ascii;
@@ -1343,7 +1344,7 @@
  defaults:
 
 	bcp = binary;
-	*bcp++ = (u_int8_t) 0;	/* version byte */
+	*bcp++ = (uint8_t) 0;	/* version byte */
 	*bcp++ = siz;
 	*bcp++ = hp;
 	*bcp++ = vp;
@@ -1375,8 +1376,8 @@
 	const int referencealt = 100000 * 100;
 
 	int32_t latval, longval, altval;
-	u_int32_t templ;
-	u_int8_t sizeval, hpval, vpval, versionval;
+	uint32_t templ;
+	uint8_t sizeval, hpval, vpval, versionval;
     
 	char *sizestr, *hpstr, *vpstr;
 
--- a/res_init.c
+++ b/res_init.c
@@ -85,7 +85,7 @@
 #include "config.h"
 #endif
 
-#include <sys/types.h>
+#include <stdint.h>
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/time.h>
@@ -137,7 +137,7 @@
 #ifdef RESOLVSORT
 static const char sort_mask[] = "/&";
 #define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)
-static u_int32_t net_mask(struct in_addr);
+static uint32_t net_mask(struct in_addr);
 #endif
 
 /*
@@ -603,11 +603,10 @@
 
 #ifdef RESOLVSORT
 /* XXX - should really support CIDR which means explicit masks always. */
-static u_int32_t
-net_mask(in)		/* XXX - should really use system's version of this */
-	struct in_addr in;
+static uint32_t
+net_mask(struct in_addr in)		/* XXX - should really use system's version of this */
 {
-	register u_int32_t i = ntohl(in.s_addr);
+	register uint32_t i = ntohl(in.s_addr);
 
 	if (IN_CLASSA(i))
 		return (htonl(IN_CLASSA_NET));
--- a/res_random.c
+++ b/res_random.c
@@ -54,7 +54,7 @@
  * so that an attacker will not get sequential ids.
  */
 
-#include <sys/types.h>
+#include <stdint.h>
 #include <netinet/in.h>
 #include <sys/time.h>
 
@@ -72,23 +72,23 @@
 #define RU_M	31104           /* RU_M = 2^7*3^5 - don't change */
 
 #define PFAC_N 3
-const static u_int16_t pfacts[PFAC_N] = {
+const static uint16_t pfacts[PFAC_N] = {
 	2, 
 	3,
 	2729
 };
 
-static u_int16_t ru_x;
-static u_int16_t ru_seed, ru_seed2;
-static u_int16_t ru_a, ru_b;
-static u_int16_t ru_g;
-static u_int16_t ru_counter = 0;
-static u_int16_t ru_msb = 0;
+static uint16_t ru_x;
+static uint16_t ru_seed, ru_seed2;
+static uint16_t ru_a, ru_b;
+static uint16_t ru_g;
+static uint16_t ru_counter = 0;
+static uint16_t ru_msb = 0;
 static long ru_reseed;
-static u_int32_t tmp;                /* Storage for unused random */
+static uint32_t tmp;                /* Storage for unused random */
 static struct timeval tv;
 
-static u_int16_t pmod(u_int16_t, u_int16_t, u_int16_t);
+static uint16_t pmod(uint16_t, uint16_t, uint16_t);
 static void res_initid(void);
 
 /*
@@ -96,10 +96,10 @@
  * of 0 - (mod-1)
  */
 
-static u_int16_t
-pmod(u_int16_t gen, u_int16_t exp, u_int16_t mod)
+static uint16_t
+pmod(uint16_t gen, uint16_t exp, uint16_t mod)
 {
-	u_int16_t s, t, u;
+	uint16_t s, t, u;
 
 	s = 1;
 	t = gen;
@@ -125,7 +125,7 @@
 static void 
 res_initid()
 {
-	u_int16_t j, i;
+	uint16_t j, i;
 	int noprime = 1;
 
 	tmp = arc4random();
@@ -208,7 +208,7 @@
 main(int argc, char **argv)
 {
 	int i, n;
-	u_int16_t wert;
+	uint16_t wert;
 
 	res_initid();
 
--- a/resolv.h
+++ b/resolv.h
@@ -119,7 +119,8 @@
 #define	_RESOLV_H_
 
 #include <sys/param.h>
-# include <sys/types.h>
+#include <sys/types.h>
+#include <stdint.h>
 #include <sys/socket.h>
 #include <stdio.h>
 
@@ -293,10 +294,10 @@
 void			fp_nquery(struct dnsres *,
 			    const unsigned char *msg, int len, FILE *file);
 const char *		hostalias(struct dnsres *, const char *);
-void			putlong(u_int32_t, unsigned char *);
-void			putshort(u_int16_t, unsigned char *);
+void			putlong(uint32_t, unsigned char *);
+void			putshort(uint16_t, unsigned char *);
 const char *		p_class(int);
-const char *		p_time(u_int32_t);
+const char *		p_time(uint32_t);
 const char *		p_type(int);
 void			p_query(struct dnsres *,
 		            const unsigned char *);
@@ -365,7 +366,7 @@
 #endif
 
 #ifndef ARC4RANDOM
-u_int32_t		arc4random(void);
+uint32_t		arc4random(void);
 #endif
 
 #endif /* !_RESOLV_H_ */