summaryrefslogtreecommitdiff
blob: eb564512075e6dc5ab4dbbeab4c308d58a97c7b6 (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
diff -Naur cdb-0.75-orig/cdb.c cdb-0.75/cdb.c
--- cdb-0.75-orig/cdb.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdb.c	2009-01-16 19:46:17.000000000 +0100
@@ -41,7 +41,7 @@
     }
 }
 
-int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos)
+int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32_t pos)
 {
   if (c->map) {
     if ((pos > c->size) || (c->size - pos < len)) goto FORMAT;
@@ -67,7 +67,7 @@
   return -1;
 }
 
-static int match(struct cdb *c,char *key,unsigned int len,uint32 pos)
+static int match(struct cdb *c,char *key,unsigned int len,uint32_t pos)
 {
   char buf[32];
   int n;
@@ -87,8 +87,8 @@
 int cdb_findnext(struct cdb *c,char *key,unsigned int len)
 {
   char buf[8];
-  uint32 pos;
-  uint32 u;
+  uint32_t pos;
+  uint32_t u;
 
   if (!c->loop) {
     u = cdb_hash(key,len);
diff -Naur cdb-0.75-orig/cdbdump.c cdb-0.75/cdbdump.c
--- cdb-0.75-orig/cdbdump.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdbdump.c	2009-01-16 19:46:17.000000000 +0100
@@ -18,7 +18,7 @@
   if (buffer_flush(buffer_1) == -1) die_write();
 }
 
-uint32 pos = 0;
+uint32_t pos = 0;
 
 void get(char *buf,unsigned int len)
 {
@@ -37,7 +37,7 @@
 
 char buf[512];
 
-void copy(uint32 len)
+void copy(uint32_t len)
 {
   unsigned int x;
 
@@ -50,7 +50,7 @@
   }
 }
 
-void getnum(uint32 *num)
+void getnum(uint32_t *num)
 {
   get(buf,4);
   uint32_unpack(buf,num);
@@ -60,9 +60,9 @@
 
 main()
 {
-  uint32 eod;
-  uint32 klen;
-  uint32 dlen;
+  uint32_t eod;
+  uint32_t klen;
+  uint32_t dlen;
 
   getnum(&eod);
   while (pos < 2048) getnum(&dlen);
diff -Naur cdb-0.75-orig/cdbget.c cdb-0.75/cdbget.c
--- cdb-0.75-orig/cdbget.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdbget.c	2009-01-16 19:46:17.000000000 +0100
@@ -27,8 +27,8 @@
 {
   char *key;
   int r;
-  uint32 pos;
-  uint32 len;
+  uint32_t pos;
+  uint32_t len;
   unsigned long u = 0;
 
   if (!*argv) die_usage();
diff -Naur cdb-0.75-orig/cdb.h cdb-0.75/cdb.h
--- cdb-0.75-orig/cdb.h	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdb.h	2009-01-16 19:46:17.000000000 +0100
@@ -6,26 +6,26 @@
 #include "uint32.h"
 
 #define CDB_HASHSTART 5381
-extern uint32 cdb_hashadd(uint32,unsigned char);
-extern uint32 cdb_hash(char *,unsigned int);
+extern uint32_t cdb_hashadd(uint32_t,unsigned char);
+extern uint32_t cdb_hash(char *,unsigned int);
 
 struct cdb {
   char *map; /* 0 if no map is available */
   int fd;
-  uint32 size; /* initialized if map is nonzero */
-  uint32 loop; /* number of hash slots searched under this key */
-  uint32 khash; /* initialized if loop is nonzero */
-  uint32 kpos; /* initialized if loop is nonzero */
-  uint32 hpos; /* initialized if loop is nonzero */
-  uint32 hslots; /* initialized if loop is nonzero */
-  uint32 dpos; /* initialized if cdb_findnext() returns 1 */
-  uint32 dlen; /* initialized if cdb_findnext() returns 1 */
+  uint32_t size; /* initialized if map is nonzero */
+  uint32_t loop; /* number of hash slots searched under this key */
+  uint32_t khash; /* initialized if loop is nonzero */
+  uint32_t kpos; /* initialized if loop is nonzero */
+  uint32_t hpos; /* initialized if loop is nonzero */
+  uint32_t hslots; /* initialized if loop is nonzero */
+  uint32_t dpos; /* initialized if cdb_findnext() returns 1 */
+  uint32_t dlen; /* initialized if cdb_findnext() returns 1 */
 } ;
 
 extern void cdb_free(struct cdb *);
 extern void cdb_init(struct cdb *,int fd);
 
-extern int cdb_read(struct cdb *,char *,unsigned int,uint32);
+extern int cdb_read(struct cdb *,char *,unsigned int,uint32_t);
 
 extern void cdb_findstart(struct cdb *);
 extern int cdb_findnext(struct cdb *,char *,unsigned int);
diff -Naur cdb-0.75-orig/cdb_hash.c cdb-0.75/cdb_hash.c
--- cdb-0.75-orig/cdb_hash.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdb_hash.c	2009-01-16 19:46:17.000000000 +0100
@@ -2,15 +2,15 @@
 
 #include "cdb.h"
 
-uint32 cdb_hashadd(uint32 h,unsigned char c)
+uint32_t cdb_hashadd(uint32_t h,unsigned char c)
 {
   h += (h << 5);
   return h ^ c;
 }
 
-uint32 cdb_hash(char *buf,unsigned int len)
+uint32_t cdb_hash(char *buf,unsigned int len)
 {
-  uint32 h;
+  uint32_t h;
 
   h = CDB_HASHSTART;
   while (len) {
diff -Naur cdb-0.75-orig/cdb_make.c cdb-0.75/cdb_make.c
--- cdb-0.75-orig/cdb_make.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdb_make.c	2009-01-16 19:51:05.000000000 +0100
@@ -19,15 +19,15 @@
   return seek_set(fd,c->pos);
 }
 
-static int posplus(struct cdb_make *c,uint32 len)
+static int posplus(struct cdb_make *c,uint32_t len)
 {
-  uint32 newpos = c->pos + len;
+  uint32_t newpos = c->pos + len;
   if (newpos < len) { errno = error_nomem; return -1; }
   c->pos = newpos;
   return 0;
 }
 
-int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h)
+int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32_t h)
 {
   struct cdb_hplist *head;
 
@@ -74,11 +74,11 @@
 {
   char buf[8];
   int i;
-  uint32 len;
-  uint32 u;
-  uint32 memsize;
-  uint32 count;
-  uint32 where;
+  uint32_t len;
+  uint32_t u;
+  uint32_t memsize;
+  uint32_t count;
+  uint32_t where;
   struct cdb_hplist *x;
   struct cdb_hp *hp;
 
@@ -99,7 +99,7 @@
   }
 
   memsize += c->numentries; /* no overflow possible up to now */
-  u = (uint32) 0 - (uint32) 1;
+  u = UINT32_MAX;
   u /= sizeof(struct cdb_hp);
   if (memsize > u) { errno = error_nomem; return -1; }
 
diff -Naur cdb-0.75-orig/cdbmake.c cdb-0.75/cdbmake.c
--- cdb-0.75-orig/cdbmake.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdbmake.c	2009-01-16 19:46:17.000000000 +0100
@@ -41,7 +41,7 @@
   unsigned int klen;
   unsigned int dlen;
   unsigned int i;
-  uint32 h;
+  uint32_t h;
   int fd;
   char ch;
 
diff -Naur cdb-0.75-orig/cdb_make.h cdb-0.75/cdb_make.h
--- cdb-0.75-orig/cdb_make.h	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdb_make.h	2009-01-16 19:46:17.000000000 +0100
@@ -8,7 +8,7 @@
 
 #define CDB_HPLIST 1000
 
-struct cdb_hp { uint32 h; uint32 p; } ;
+struct cdb_hp { uint32_t h; uint32_t p; } ;
 
 struct cdb_hplist {
   struct cdb_hp hp[CDB_HPLIST];
@@ -19,20 +19,20 @@
 struct cdb_make {
   char bspace[8192];
   char final[2048];
-  uint32 count[256];
-  uint32 start[256];
+  uint32_t count[256];
+  uint32_t start[256];
   struct cdb_hplist *head;
   struct cdb_hp *split; /* includes space for hash */
   struct cdb_hp *hash;
-  uint32 numentries;
+  uint32_t numentries;
   buffer b;
-  uint32 pos;
+  uint32_t pos;
   int fd;
 } ;
 
 extern int cdb_make_start(struct cdb_make *,int);
 extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int);
-extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32);
+extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32_t);
 extern int cdb_make_add(struct cdb_make *,char *,unsigned int,char *,unsigned int);
 extern int cdb_make_finish(struct cdb_make *);
 
diff -Naur cdb-0.75-orig/cdbstats.c cdb-0.75/cdbstats.c
--- cdb-0.75-orig/cdbstats.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdbstats.c	2009-01-16 19:46:17.000000000 +0100
@@ -28,7 +28,7 @@
   if (buffer_flush(buffer_1small) == -1) die_write();
 }
 
-uint32 pos = 0;
+uint32_t pos = 0;
 
 void get(char *buf,unsigned int len)
 {
@@ -43,7 +43,7 @@
   }
 }
 
-void getnum(uint32 *num)
+void getnum(uint32_t *num)
 {
   char buf[4];
   get(buf,4);
@@ -70,9 +70,9 @@
 
 main()
 {
-  uint32 eod;
-  uint32 klen;
-  uint32 dlen;
+  uint32_t eod;
+  uint32_t klen;
+  uint32_t dlen;
   seek_pos rest;
   int r;
 
diff -Naur cdb-0.75-orig/cdbtest.c cdb-0.75/cdbtest.c
--- cdb-0.75-orig/cdbtest.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/cdbtest.c	2009-01-16 19:46:17.000000000 +0100
@@ -24,7 +24,7 @@
   if (buffer_flush(buffer_1small) == -1) die_write();
 }
 
-uint32 pos = 0;
+uint32_t pos = 0;
 
 void get(char *buf,unsigned int len)
 {
@@ -40,7 +40,7 @@
   }
 }
 
-void getnum(uint32 *num)
+void getnum(uint32_t *num)
 {
   char buf[4];
   get(buf,4);
@@ -68,9 +68,9 @@
 
 main()
 {
-  uint32 eod;
-  uint32 klen;
-  uint32 dlen;
+  uint32_t eod;
+  uint32_t klen;
+  uint32_t dlen;
   seek_pos rest;
   int r;
 
diff -Naur cdb-0.75-orig/Makefile cdb-0.75/Makefile
--- cdb-0.75-orig/Makefile	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/Makefile	2009-01-16 19:46:17.000000000 +0100
@@ -298,13 +298,6 @@
 uint32.h
 	./compile testzero.c
 
-uint32.h: \
-tryulong32.c compile load uint32.h1 uint32.h2
-	( ( ./compile tryulong32.c && ./load tryulong32 && \
-	./tryulong32 ) >/dev/null 2>&1 \
-	&& cat uint32.h2 || cat uint32.h1 ) > uint32.h
-	rm -f tryulong32.o tryulong32
-
 uint32_pack.o: \
 compile uint32_pack.c uint32.h
 	./compile uint32_pack.c
diff -Naur cdb-0.75-orig/TARGETS cdb-0.75/TARGETS
--- cdb-0.75-orig/TARGETS	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/TARGETS	2009-01-16 19:52:06.000000000 +0100
@@ -1,6 +1,5 @@
 load
 compile
-uint32.h
 cdbget.o
 systype
 makelib
diff -Naur cdb-0.75-orig/uint32.h cdb-0.75/uint32.h
--- cdb-0.75-orig/uint32.h	1970-01-01 01:00:00.000000000 +0100
+++ cdb-0.75/uint32.h	2009-01-16 19:46:17.000000000 +0100
@@ -0,0 +1,11 @@
+#ifndef UINT32_H
+#define UINT32_H
+
+#include <stdint.h>
+
+extern void uint32_pack(char *,uint32_t);
+extern void uint32_pack_big(char *,uint32_t);
+extern void uint32_unpack(char *,uint32_t *);
+extern void uint32_unpack_big(char *,uint32_t *);
+
+#endif
diff -Naur cdb-0.75-orig/uint32.h1 cdb-0.75/uint32.h1
--- cdb-0.75-orig/uint32.h1	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/uint32.h1	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-#ifndef UINT32_H
-#define UINT32_H
-
-typedef unsigned int uint32;
-
-extern void uint32_pack(char *,uint32);
-extern void uint32_pack_big(char *,uint32);
-extern void uint32_unpack(char *,uint32 *);
-extern void uint32_unpack_big(char *,uint32 *);
-
-#endif
diff -Naur cdb-0.75-orig/uint32.h2 cdb-0.75/uint32.h2
--- cdb-0.75-orig/uint32.h2	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/uint32.h2	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-#ifndef UINT32_H
-#define UINT32_H
-
-typedef unsigned long uint32;
-
-extern void uint32_pack(char *,uint32);
-extern void uint32_pack_big(char *,uint32);
-extern void uint32_unpack(char *,uint32 *);
-extern void uint32_unpack_big(char *,uint32 *);
-
-#endif
diff -Naur cdb-0.75-orig/uint32_pack.c cdb-0.75/uint32_pack.c
--- cdb-0.75-orig/uint32_pack.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/uint32_pack.c	2009-01-16 19:46:17.000000000 +0100
@@ -1,6 +1,6 @@
 #include "uint32.h"
 
-void uint32_pack(char s[4],uint32 u)
+void uint32_pack(char s[4],uint32_t u)
 {
   s[0] = u & 255;
   u >>= 8;
@@ -10,7 +10,7 @@
   s[3] = u >> 8;
 }
 
-void uint32_pack_big(char s[4],uint32 u)
+void uint32_pack_big(char s[4],uint32_t u)
 {
   s[3] = u & 255;
   u >>= 8;
diff -Naur cdb-0.75-orig/uint32_unpack.c cdb-0.75/uint32_unpack.c
--- cdb-0.75-orig/uint32_unpack.c	2009-01-16 19:38:41.000000000 +0100
+++ cdb-0.75/uint32_unpack.c	2009-01-16 19:46:17.000000000 +0100
@@ -1,8 +1,8 @@
 #include "uint32.h"
 
-void uint32_unpack(char s[4],uint32 *u)
+void uint32_unpack(char s[4],uint32_t *u)
 {
-  uint32 result;
+  uint32_t result;
 
   result = (unsigned char) s[3];
   result <<= 8;
@@ -15,9 +15,9 @@
   *u = result;
 }
 
-void uint32_unpack_big(char s[4],uint32 *u)
+void uint32_unpack_big(char s[4],uint32_t *u)
 {
-  uint32 result;
+  uint32_t result;
 
   result = (unsigned char) s[0];
   result <<= 8;