1 |
mabi 10/03/30 23:20:28 |
2 |
|
3 |
Added: cdb-0.75-stdint.diff |
4 |
Log: |
5 |
fix bug #248327 |
6 |
(Portage version: 2.1.7.17/cvs/Linux i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 dev-db/cdb/files/cdb-0.75-stdint.diff |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/cdb/files/cdb-0.75-stdint.diff?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/cdb/files/cdb-0.75-stdint.diff?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: cdb-0.75-stdint.diff |
15 |
=================================================================== |
16 |
diff -Naur cdb-0.75-orig/cdb.c cdb-0.75/cdb.c |
17 |
--- cdb-0.75-orig/cdb.c 2009-01-16 19:38:41.000000000 +0100 |
18 |
+++ cdb-0.75/cdb.c 2009-01-16 19:46:17.000000000 +0100 |
19 |
@@ -41,7 +41,7 @@ |
20 |
} |
21 |
} |
22 |
|
23 |
-int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos) |
24 |
+int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32_t pos) |
25 |
{ |
26 |
if (c->map) { |
27 |
if ((pos > c->size) || (c->size - pos < len)) goto FORMAT; |
28 |
@@ -67,7 +67,7 @@ |
29 |
return -1; |
30 |
} |
31 |
|
32 |
-static int match(struct cdb *c,char *key,unsigned int len,uint32 pos) |
33 |
+static int match(struct cdb *c,char *key,unsigned int len,uint32_t pos) |
34 |
{ |
35 |
char buf[32]; |
36 |
int n; |
37 |
@@ -87,8 +87,8 @@ |
38 |
int cdb_findnext(struct cdb *c,char *key,unsigned int len) |
39 |
{ |
40 |
char buf[8]; |
41 |
- uint32 pos; |
42 |
- uint32 u; |
43 |
+ uint32_t pos; |
44 |
+ uint32_t u; |
45 |
|
46 |
if (!c->loop) { |
47 |
u = cdb_hash(key,len); |
48 |
diff -Naur cdb-0.75-orig/cdbdump.c cdb-0.75/cdbdump.c |
49 |
--- cdb-0.75-orig/cdbdump.c 2009-01-16 19:38:41.000000000 +0100 |
50 |
+++ cdb-0.75/cdbdump.c 2009-01-16 19:46:17.000000000 +0100 |
51 |
@@ -18,7 +18,7 @@ |
52 |
if (buffer_flush(buffer_1) == -1) die_write(); |
53 |
} |
54 |
|
55 |
-uint32 pos = 0; |
56 |
+uint32_t pos = 0; |
57 |
|
58 |
void get(char *buf,unsigned int len) |
59 |
{ |
60 |
@@ -37,7 +37,7 @@ |
61 |
|
62 |
char buf[512]; |
63 |
|
64 |
-void copy(uint32 len) |
65 |
+void copy(uint32_t len) |
66 |
{ |
67 |
unsigned int x; |
68 |
|
69 |
@@ -50,7 +50,7 @@ |
70 |
} |
71 |
} |
72 |
|
73 |
-void getnum(uint32 *num) |
74 |
+void getnum(uint32_t *num) |
75 |
{ |
76 |
get(buf,4); |
77 |
uint32_unpack(buf,num); |
78 |
@@ -60,9 +60,9 @@ |
79 |
|
80 |
main() |
81 |
{ |
82 |
- uint32 eod; |
83 |
- uint32 klen; |
84 |
- uint32 dlen; |
85 |
+ uint32_t eod; |
86 |
+ uint32_t klen; |
87 |
+ uint32_t dlen; |
88 |
|
89 |
getnum(&eod); |
90 |
while (pos < 2048) getnum(&dlen); |
91 |
diff -Naur cdb-0.75-orig/cdbget.c cdb-0.75/cdbget.c |
92 |
--- cdb-0.75-orig/cdbget.c 2009-01-16 19:38:41.000000000 +0100 |
93 |
+++ cdb-0.75/cdbget.c 2009-01-16 19:46:17.000000000 +0100 |
94 |
@@ -27,8 +27,8 @@ |
95 |
{ |
96 |
char *key; |
97 |
int r; |
98 |
- uint32 pos; |
99 |
- uint32 len; |
100 |
+ uint32_t pos; |
101 |
+ uint32_t len; |
102 |
unsigned long u = 0; |
103 |
|
104 |
if (!*argv) die_usage(); |
105 |
diff -Naur cdb-0.75-orig/cdb.h cdb-0.75/cdb.h |
106 |
--- cdb-0.75-orig/cdb.h 2009-01-16 19:38:41.000000000 +0100 |
107 |
+++ cdb-0.75/cdb.h 2009-01-16 19:46:17.000000000 +0100 |
108 |
@@ -6,26 +6,26 @@ |
109 |
#include "uint32.h" |
110 |
|
111 |
#define CDB_HASHSTART 5381 |
112 |
-extern uint32 cdb_hashadd(uint32,unsigned char); |
113 |
-extern uint32 cdb_hash(char *,unsigned int); |
114 |
+extern uint32_t cdb_hashadd(uint32_t,unsigned char); |
115 |
+extern uint32_t cdb_hash(char *,unsigned int); |
116 |
|
117 |
struct cdb { |
118 |
char *map; /* 0 if no map is available */ |
119 |
int fd; |
120 |
- uint32 size; /* initialized if map is nonzero */ |
121 |
- uint32 loop; /* number of hash slots searched under this key */ |
122 |
- uint32 khash; /* initialized if loop is nonzero */ |
123 |
- uint32 kpos; /* initialized if loop is nonzero */ |
124 |
- uint32 hpos; /* initialized if loop is nonzero */ |
125 |
- uint32 hslots; /* initialized if loop is nonzero */ |
126 |
- uint32 dpos; /* initialized if cdb_findnext() returns 1 */ |
127 |
- uint32 dlen; /* initialized if cdb_findnext() returns 1 */ |
128 |
+ uint32_t size; /* initialized if map is nonzero */ |
129 |
+ uint32_t loop; /* number of hash slots searched under this key */ |
130 |
+ uint32_t khash; /* initialized if loop is nonzero */ |
131 |
+ uint32_t kpos; /* initialized if loop is nonzero */ |
132 |
+ uint32_t hpos; /* initialized if loop is nonzero */ |
133 |
+ uint32_t hslots; /* initialized if loop is nonzero */ |
134 |
+ uint32_t dpos; /* initialized if cdb_findnext() returns 1 */ |
135 |
+ uint32_t dlen; /* initialized if cdb_findnext() returns 1 */ |
136 |
} ; |
137 |
|
138 |
extern void cdb_free(struct cdb *); |
139 |
extern void cdb_init(struct cdb *,int fd); |
140 |
|
141 |
-extern int cdb_read(struct cdb *,char *,unsigned int,uint32); |
142 |
+extern int cdb_read(struct cdb *,char *,unsigned int,uint32_t); |
143 |
|
144 |
extern void cdb_findstart(struct cdb *); |
145 |
extern int cdb_findnext(struct cdb *,char *,unsigned int); |
146 |
diff -Naur cdb-0.75-orig/cdb_hash.c cdb-0.75/cdb_hash.c |
147 |
--- cdb-0.75-orig/cdb_hash.c 2009-01-16 19:38:41.000000000 +0100 |
148 |
+++ cdb-0.75/cdb_hash.c 2009-01-16 19:46:17.000000000 +0100 |
149 |
@@ -2,15 +2,15 @@ |
150 |
|
151 |
#include "cdb.h" |
152 |
|
153 |
-uint32 cdb_hashadd(uint32 h,unsigned char c) |
154 |
+uint32_t cdb_hashadd(uint32_t h,unsigned char c) |
155 |
{ |
156 |
h += (h << 5); |
157 |
return h ^ c; |
158 |
} |
159 |
|
160 |
-uint32 cdb_hash(char *buf,unsigned int len) |
161 |
+uint32_t cdb_hash(char *buf,unsigned int len) |
162 |
{ |
163 |
- uint32 h; |
164 |
+ uint32_t h; |
165 |
|
166 |
h = CDB_HASHSTART; |
167 |
while (len) { |
168 |
diff -Naur cdb-0.75-orig/cdb_make.c cdb-0.75/cdb_make.c |
169 |
--- cdb-0.75-orig/cdb_make.c 2009-01-16 19:38:41.000000000 +0100 |
170 |
+++ cdb-0.75/cdb_make.c 2009-01-16 19:51:05.000000000 +0100 |
171 |
@@ -19,15 +19,15 @@ |
172 |
return seek_set(fd,c->pos); |
173 |
} |
174 |
|
175 |
-static int posplus(struct cdb_make *c,uint32 len) |
176 |
+static int posplus(struct cdb_make *c,uint32_t len) |
177 |
{ |
178 |
- uint32 newpos = c->pos + len; |
179 |
+ uint32_t newpos = c->pos + len; |
180 |
if (newpos < len) { errno = error_nomem; return -1; } |
181 |
c->pos = newpos; |
182 |
return 0; |
183 |
} |
184 |
|
185 |
-int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h) |
186 |
+int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32_t h) |
187 |
{ |
188 |
struct cdb_hplist *head; |
189 |
|
190 |
@@ -74,11 +74,11 @@ |
191 |
{ |
192 |
char buf[8]; |
193 |
int i; |
194 |
- uint32 len; |
195 |
- uint32 u; |
196 |
- uint32 memsize; |
197 |
- uint32 count; |
198 |
- uint32 where; |
199 |
+ uint32_t len; |
200 |
+ uint32_t u; |
201 |
+ uint32_t memsize; |
202 |
+ uint32_t count; |
203 |
+ uint32_t where; |
204 |
struct cdb_hplist *x; |
205 |
struct cdb_hp *hp; |
206 |
|
207 |
@@ -99,7 +99,7 @@ |
208 |
} |
209 |
|
210 |
memsize += c->numentries; /* no overflow possible up to now */ |
211 |
- u = (uint32) 0 - (uint32) 1; |
212 |
+ u = UINT32_MAX; |
213 |
u /= sizeof(struct cdb_hp); |
214 |
if (memsize > u) { errno = error_nomem; return -1; } |
215 |
|
216 |
diff -Naur cdb-0.75-orig/cdbmake.c cdb-0.75/cdbmake.c |
217 |
--- cdb-0.75-orig/cdbmake.c 2009-01-16 19:38:41.000000000 +0100 |
218 |
+++ cdb-0.75/cdbmake.c 2009-01-16 19:46:17.000000000 +0100 |
219 |
@@ -41,7 +41,7 @@ |
220 |
unsigned int klen; |
221 |
unsigned int dlen; |
222 |
unsigned int i; |
223 |
- uint32 h; |
224 |
+ uint32_t h; |
225 |
int fd; |
226 |
char ch; |
227 |
|
228 |
diff -Naur cdb-0.75-orig/cdb_make.h cdb-0.75/cdb_make.h |
229 |
--- cdb-0.75-orig/cdb_make.h 2009-01-16 19:38:41.000000000 +0100 |
230 |
+++ cdb-0.75/cdb_make.h 2009-01-16 19:46:17.000000000 +0100 |
231 |
@@ -8,7 +8,7 @@ |
232 |
|
233 |
#define CDB_HPLIST 1000 |
234 |
|
235 |
-struct cdb_hp { uint32 h; uint32 p; } ; |
236 |
+struct cdb_hp { uint32_t h; uint32_t p; } ; |
237 |
|
238 |
struct cdb_hplist { |
239 |
struct cdb_hp hp[CDB_HPLIST]; |
240 |
@@ -19,20 +19,20 @@ |
241 |
struct cdb_make { |
242 |
char bspace[8192]; |
243 |
char final[2048]; |
244 |
- uint32 count[256]; |
245 |
- uint32 start[256]; |
246 |
+ uint32_t count[256]; |
247 |
+ uint32_t start[256]; |
248 |
struct cdb_hplist *head; |
249 |
struct cdb_hp *split; /* includes space for hash */ |
250 |
struct cdb_hp *hash; |
251 |
- uint32 numentries; |
252 |
+ uint32_t numentries; |
253 |
buffer b; |
254 |
- uint32 pos; |
255 |
+ uint32_t pos; |
256 |
int fd; |
257 |
} ; |
258 |
|
259 |
extern int cdb_make_start(struct cdb_make *,int); |
260 |
extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int); |
261 |
-extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32); |
262 |
+extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32_t); |
263 |
extern int cdb_make_add(struct cdb_make *,char *,unsigned int,char *,unsigned int); |
264 |
extern int cdb_make_finish(struct cdb_make *); |
265 |
|
266 |
diff -Naur cdb-0.75-orig/cdbstats.c cdb-0.75/cdbstats.c |
267 |
--- cdb-0.75-orig/cdbstats.c 2009-01-16 19:38:41.000000000 +0100 |
268 |
+++ cdb-0.75/cdbstats.c 2009-01-16 19:46:17.000000000 +0100 |
269 |
@@ -28,7 +28,7 @@ |
270 |
if (buffer_flush(buffer_1small) == -1) die_write(); |
271 |
} |
272 |
|
273 |
-uint32 pos = 0; |
274 |
+uint32_t pos = 0; |
275 |
|
276 |
void get(char *buf,unsigned int len) |
277 |
{ |
278 |
@@ -43,7 +43,7 @@ |
279 |
} |
280 |
} |
281 |
|
282 |
-void getnum(uint32 *num) |
283 |
+void getnum(uint32_t *num) |
284 |
{ |
285 |
char buf[4]; |
286 |
get(buf,4); |
287 |
@@ -70,9 +70,9 @@ |
288 |
|
289 |
main() |
290 |
{ |
291 |
- uint32 eod; |
292 |
- uint32 klen; |
293 |
- uint32 dlen; |
294 |
+ uint32_t eod; |
295 |
+ uint32_t klen; |
296 |
+ uint32_t dlen; |
297 |
seek_pos rest; |
298 |
int r; |
299 |
|
300 |
diff -Naur cdb-0.75-orig/cdbtest.c cdb-0.75/cdbtest.c |
301 |
--- cdb-0.75-orig/cdbtest.c 2009-01-16 19:38:41.000000000 +0100 |
302 |
+++ cdb-0.75/cdbtest.c 2009-01-16 19:46:17.000000000 +0100 |
303 |
@@ -24,7 +24,7 @@ |
304 |
if (buffer_flush(buffer_1small) == -1) die_write(); |
305 |
} |
306 |
|
307 |
-uint32 pos = 0; |
308 |
+uint32_t pos = 0; |
309 |
|
310 |
void get(char *buf,unsigned int len) |
311 |
{ |
312 |
@@ -40,7 +40,7 @@ |
313 |
} |
314 |
} |
315 |
|
316 |
-void getnum(uint32 *num) |
317 |
+void getnum(uint32_t *num) |
318 |
{ |
319 |
char buf[4]; |
320 |
get(buf,4); |
321 |
@@ -68,9 +68,9 @@ |
322 |
|
323 |
main() |
324 |
{ |
325 |
- uint32 eod; |
326 |
- uint32 klen; |
327 |
- uint32 dlen; |
328 |
+ uint32_t eod; |
329 |
+ uint32_t klen; |
330 |
+ uint32_t dlen; |
331 |
seek_pos rest; |
332 |
int r; |
333 |
|
334 |
diff -Naur cdb-0.75-orig/Makefile cdb-0.75/Makefile |
335 |
--- cdb-0.75-orig/Makefile 2009-01-16 19:38:41.000000000 +0100 |
336 |
+++ cdb-0.75/Makefile 2009-01-16 19:46:17.000000000 +0100 |
337 |
@@ -298,13 +298,6 @@ |
338 |
uint32.h |
339 |
./compile testzero.c |
340 |
|
341 |
-uint32.h: \ |
342 |
-tryulong32.c compile load uint32.h1 uint32.h2 |
343 |
- ( ( ./compile tryulong32.c && ./load tryulong32 && \ |
344 |
- ./tryulong32 ) >/dev/null 2>&1 \ |
345 |
- && cat uint32.h2 || cat uint32.h1 ) > uint32.h |
346 |
- rm -f tryulong32.o tryulong32 |
347 |
- |
348 |
uint32_pack.o: \ |
349 |
compile uint32_pack.c uint32.h |
350 |
./compile uint32_pack.c |
351 |
diff -Naur cdb-0.75-orig/TARGETS cdb-0.75/TARGETS |
352 |
--- cdb-0.75-orig/TARGETS 2009-01-16 19:38:41.000000000 +0100 |
353 |
+++ cdb-0.75/TARGETS 2009-01-16 19:52:06.000000000 +0100 |
354 |
@@ -1,6 +1,5 @@ |
355 |
load |
356 |
compile |
357 |
-uint32.h |
358 |
cdbget.o |
359 |
systype |
360 |
makelib |
361 |
diff -Naur cdb-0.75-orig/uint32.h cdb-0.75/uint32.h |
362 |
--- cdb-0.75-orig/uint32.h 1970-01-01 01:00:00.000000000 +0100 |
363 |
+++ cdb-0.75/uint32.h 2009-01-16 19:46:17.000000000 +0100 |
364 |
@@ -0,0 +1,11 @@ |
365 |
+#ifndef UINT32_H |
366 |
+#define UINT32_H |
367 |
+ |
368 |
+#include <stdint.h> |
369 |
+ |
370 |
+extern void uint32_pack(char *,uint32_t); |
371 |
+extern void uint32_pack_big(char *,uint32_t); |
372 |
+extern void uint32_unpack(char *,uint32_t *); |
373 |
+extern void uint32_unpack_big(char *,uint32_t *); |
374 |
+ |
375 |
+#endif |
376 |
diff -Naur cdb-0.75-orig/uint32.h1 cdb-0.75/uint32.h1 |
377 |
--- cdb-0.75-orig/uint32.h1 2009-01-16 19:38:41.000000000 +0100 |
378 |
+++ cdb-0.75/uint32.h1 1970-01-01 01:00:00.000000000 +0100 |
379 |
@@ -1,11 +0,0 @@ |
380 |
-#ifndef UINT32_H |
381 |
-#define UINT32_H |
382 |
- |
383 |
-typedef unsigned int uint32; |
384 |
- |
385 |
-extern void uint32_pack(char *,uint32); |
386 |
-extern void uint32_pack_big(char *,uint32); |
387 |
-extern void uint32_unpack(char *,uint32 *); |
388 |
-extern void uint32_unpack_big(char *,uint32 *); |
389 |
- |
390 |
-#endif |
391 |
diff -Naur cdb-0.75-orig/uint32.h2 cdb-0.75/uint32.h2 |
392 |
--- cdb-0.75-orig/uint32.h2 2009-01-16 19:38:41.000000000 +0100 |
393 |
+++ cdb-0.75/uint32.h2 1970-01-01 01:00:00.000000000 +0100 |
394 |
@@ -1,11 +0,0 @@ |
395 |
-#ifndef UINT32_H |
396 |
-#define UINT32_H |
397 |
- |
398 |
-typedef unsigned long uint32; |
399 |
- |
400 |
-extern void uint32_pack(char *,uint32); |
401 |
-extern void uint32_pack_big(char *,uint32); |
402 |
-extern void uint32_unpack(char *,uint32 *); |
403 |
-extern void uint32_unpack_big(char *,uint32 *); |
404 |
- |
405 |
-#endif |
406 |
diff -Naur cdb-0.75-orig/uint32_pack.c cdb-0.75/uint32_pack.c |
407 |
--- cdb-0.75-orig/uint32_pack.c 2009-01-16 19:38:41.000000000 +0100 |
408 |
+++ cdb-0.75/uint32_pack.c 2009-01-16 19:46:17.000000000 +0100 |
409 |
@@ -1,6 +1,6 @@ |
410 |
#include "uint32.h" |
411 |
|
412 |
-void uint32_pack(char s[4],uint32 u) |
413 |
+void uint32_pack(char s[4],uint32_t u) |
414 |
{ |
415 |
s[0] = u & 255; |
416 |
u >>= 8; |
417 |
@@ -10,7 +10,7 @@ |
418 |
s[3] = u >> 8; |
419 |
} |
420 |
|
421 |
-void uint32_pack_big(char s[4],uint32 u) |
422 |
+void uint32_pack_big(char s[4],uint32_t u) |
423 |
{ |
424 |
s[3] = u & 255; |
425 |
u >>= 8; |
426 |
diff -Naur cdb-0.75-orig/uint32_unpack.c cdb-0.75/uint32_unpack.c |
427 |
--- cdb-0.75-orig/uint32_unpack.c 2009-01-16 19:38:41.000000000 +0100 |
428 |
+++ cdb-0.75/uint32_unpack.c 2009-01-16 19:46:17.000000000 +0100 |
429 |
@@ -1,8 +1,8 @@ |
430 |
#include "uint32.h" |
431 |
|
432 |
-void uint32_unpack(char s[4],uint32 *u) |
433 |
+void uint32_unpack(char s[4],uint32_t *u) |
434 |
{ |
435 |
- uint32 result; |
436 |
+ uint32_t result; |
437 |
|
438 |
result = (unsigned char) s[3]; |
439 |
result <<= 8; |
440 |
@@ -15,9 +15,9 @@ |
441 |
*u = result; |
442 |
} |
443 |
|
444 |
-void uint32_unpack_big(char s[4],uint32 *u) |
445 |
+void uint32_unpack_big(char s[4],uint32_t *u) |
446 |
{ |
447 |
- uint32 result; |
448 |
+ uint32_t result; |
449 |
|
450 |
result = (unsigned char) s[0]; |
451 |
result <<= 8; |