app-cdr/k3b:3.5 from kde-sunset
[anomen-overlay.git] / kde-base / kdelibs / files / kdelibs-3.5.10-kjs-gcc44.patch
blobcc052af9250cb0064d9ed5041e78fdc6f6c220ed
1 --- kjs/dtoa.cpp.orig 2009-05-26 17:20:54.673539511 +0200
2 +++ kjs/dtoa.cpp 2009-05-26 17:24:20.117023777 +0200
3 @@ -207,11 +207,7 @@ typedef unsigned Long ULong;
4 #endif
6 #ifdef MALLOC
7 -#ifdef KR_headers
8 -extern char *MALLOC();
9 -#else
10 extern void *MALLOC(size_t);
11 -#endif
12 #else
13 #define MALLOC malloc
14 #endif
15 @@ -273,12 +269,8 @@ extern "C" {
16 #endif
18 #ifndef CONST
19 -#ifdef KR_headers
20 -#define CONST /* blank */
21 -#else
22 #define CONST const
23 #endif
24 -#endif
26 #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
27 Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
28 @@ -286,37 +278,19 @@ Exactly one of IEEE_8087, IEEE_MC68k, VA
30 typedef union { double d; ULong L[2]; } U;
32 -#ifdef YES_ALIAS
33 -#define dval(x) x
34 +#define dval(x) (x).d
35 #ifdef IEEE_8087
36 -#define word0(x) ((ULong *)&x)[1]
37 -#define word1(x) ((ULong *)&x)[0]
38 +#define word0(x) (x).L[1]
39 +#define word1(x) (x).L[0]
40 #else
41 -#define word0(x) ((ULong *)&x)[0]
42 -#define word1(x) ((ULong *)&x)[1]
43 -#endif
44 -#else
45 -#ifdef IEEE_8087
46 -#define word0(x) ((U*)&x)->L[1]
47 -#define word1(x) ((U*)&x)->L[0]
48 -#else
49 -#define word0(x) ((U*)&x)->L[0]
50 -#define word1(x) ((U*)&x)->L[1]
51 -#endif
52 -#define dval(x) ((U*)&x)->d
53 +#define word0(x) (x).L[0]
54 +#define word1(x) (x).L[1]
55 #endif
57 /* The following definition of Storeinc is appropriate for MIPS processors.
58 * An alternative that might be better on some machines is
59 - * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
61 -#if defined(IEEE_8087) + defined(VAX)
62 -#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
63 -((unsigned short *)a)[0] = (unsigned short)c, a++)
64 -#else
65 -#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
66 -((unsigned short *)a)[1] = (unsigned short)c, a++)
67 -#endif
68 +#define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
70 /* #define P DBL_MANT_DIG */
71 /* Ten_pmax = floor(P*log(2)/log(5)) */
72 @@ -440,11 +414,7 @@ typedef union { double d; ULong L[2]; }
73 #ifdef RND_PRODQUOT
74 #define rounded_product(a,b) a = rnd_prod(a, b)
75 #define rounded_quotient(a,b) a = rnd_quot(a, b)
76 -#ifdef KR_headers
77 -extern double rnd_prod(), rnd_quot();
78 -#else
79 extern double rnd_prod(double, double), rnd_quot(double, double);
80 -#endif
81 #else
82 #define rounded_product(a,b) a *= b
83 #define rounded_quotient(a,b) a /= b
84 @@ -457,11 +427,7 @@ extern double rnd_prod(double, double),
85 #define Pack_32
86 #endif
88 -#ifdef KR_headers
89 -#define FFFFFFFF ((((unsigned long)0xffff)<<16)|(unsigned long)0xffff)
90 -#else
91 #define FFFFFFFF 0xffffffffUL
92 -#endif
94 #ifdef NO_LONG_LONG
95 #undef ULLong
96 @@ -502,11 +468,7 @@ Bigint {
98 static Bigint *
99 Balloc
100 -#ifdef KR_headers
101 - (k) int k;
102 -#else
103 (int k)
104 -#endif
106 int x;
107 Bigint *rv;
108 @@ -542,11 +504,7 @@ Balloc
110 static void
111 Bfree
112 -#ifdef KR_headers
113 - (v) Bigint *v;
114 -#else
115 (Bigint *v)
116 -#endif
118 if (v) {
119 ACQUIRE_DTOA_LOCK(0);
120 @@ -561,11 +519,7 @@ y->wds*sizeof(Long) + 2*sizeof(int))
122 static Bigint *
123 multadd
124 -#ifdef KR_headers
125 - (b, m, a) Bigint *b; int m, a;
126 -#else
127 (Bigint *b, int m, int a) /* multiply by m and add a */
128 -#endif
130 int i, wds;
131 #ifdef ULLong
132 @@ -618,11 +572,7 @@ multadd
134 static Bigint *
136 -#ifdef KR_headers
137 - (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9;
138 -#else
139 (CONST char *s, int nd0, int nd, ULong y9)
140 -#endif
142 Bigint *b;
143 int i, k;
144 @@ -656,11 +606,7 @@ s2b
146 static int
147 hi0bits
148 -#ifdef KR_headers
149 - (x) register ULong x;
150 -#else
151 (register ULong x)
152 -#endif
154 register int k = 0;
156 @@ -690,11 +636,7 @@ hi0bits
158 static int
159 lo0bits
160 -#ifdef KR_headers
161 - (y) ULong *y;
162 -#else
163 (ULong *y)
164 -#endif
166 register int k;
167 register ULong x = *y;
168 @@ -738,11 +680,7 @@ lo0bits
170 static Bigint *
172 -#ifdef KR_headers
173 - (i) int i;
174 -#else
175 (int i)
176 -#endif
178 Bigint *b;
180 @@ -754,11 +692,7 @@ i2b
182 static Bigint *
183 mult
184 -#ifdef KR_headers
185 - (a, b) Bigint *a, *b;
186 -#else
187 (Bigint *a, Bigint *b)
188 -#endif
190 Bigint *c;
191 int k, wa, wb, wc;
192 @@ -866,11 +800,7 @@ mult
194 static Bigint *
195 pow5mult
196 -#ifdef KR_headers
197 - (b, k) Bigint *b; int k;
198 -#else
199 (Bigint *b, int k)
200 -#endif
202 Bigint *b1, *p5, *p51;
203 int i;
204 @@ -923,11 +853,7 @@ pow5mult
206 static Bigint *
207 lshift
208 -#ifdef KR_headers
209 - (b, k) Bigint *b; int k;
210 -#else
211 (Bigint *b, int k)
212 -#endif
214 int i, k1, n, n1;
215 Bigint *b1;
216 @@ -983,11 +909,7 @@ lshift
218 static int
220 -#ifdef KR_headers
221 - (a, b) Bigint *a, *b;
222 -#else
223 (Bigint *a, Bigint *b)
224 -#endif
226 ULong *xa, *xa0, *xb, *xb0;
227 int i, j;
228 @@ -1017,11 +939,7 @@ cmp
230 static Bigint *
231 diff
232 -#ifdef KR_headers
233 - (a, b) Bigint *a, *b;
234 -#else
235 (Bigint *a, Bigint *b)
236 -#endif
238 Bigint *c;
239 int i, wa, wb;
240 @@ -1111,15 +1029,12 @@ diff
242 static double
244 -#ifdef KR_headers
245 - (x) double x;
246 -#else
247 - (double x)
248 -#endif
249 + (double dx)
251 register Long L;
252 - double a;
253 + U x, a;
255 + dval(x) = dx;
256 L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
257 #ifndef Avoid_Underflow
258 #ifndef Sudden_Underflow
259 @@ -1153,15 +1068,11 @@ ulp
261 static double
263 -#ifdef KR_headers
264 - (a, e) Bigint *a; int *e;
265 -#else
266 (Bigint *a, int *e)
267 -#endif
269 ULong *xa, *xa0, w, y, z;
270 int k;
271 - double d;
272 + U d;
273 #ifdef VAX
274 ULong d0, d1;
275 #else
276 @@ -1223,12 +1134,9 @@ b2d
278 static Bigint *
280 -#ifdef KR_headers
281 - (d, e, bits) double d; int *e, *bits;
282 -#else
283 - (double d, int *e, int *bits)
284 -#endif
285 + (double dd, int *e, int *bits)
287 + U d;
288 Bigint *b;
289 int de, k;
290 ULong *x, y, z;
291 @@ -1237,6 +1145,9 @@ d2b
292 #endif
293 #ifdef VAX
294 ULong d0, d1;
295 +#endif
296 + dval(d) = dd;
297 +#ifdef VAX
298 d0 = word0(d) >> 16 | word0(d) << 16;
299 d1 = word1(d) >> 16 | word1(d) << 16;
300 #else
301 @@ -1361,13 +1272,9 @@ d2b
303 static double
304 ratio
305 -#ifdef KR_headers
306 - (a, b) Bigint *a, *b;
307 -#else
308 (Bigint *a, Bigint *b)
309 -#endif
311 - double da, db;
312 + U da, db;
313 int k, ka, kb;
315 dval(da) = b2d(a, &ka);
316 @@ -1453,11 +1360,7 @@ static CONST double tinytens[] = { 1e-16
318 static int
319 match
320 -#ifdef KR_headers
321 - (sp, t) char **sp, *t;
322 -#else
323 (CONST char **sp, CONST char *t)
324 -#endif
326 int c, d;
327 CONST char *s = *sp;
328 @@ -1475,11 +1378,7 @@ match
329 #ifndef No_Hex_NaN
330 static void
331 hexnan
332 -#ifdef KR_headers
333 - (rvp, sp) double *rvp; CONST char **sp;
334 -#else
335 - (double *rvp, CONST char **sp)
336 -#endif
337 + (U *rvp, CONST char **sp)
339 ULong c, x[2];
340 CONST char *s;
341 @@ -1529,11 +1428,7 @@ hexnan
343 double
344 kjs_strtod
345 -#ifdef KR_headers
346 - (s00, se) CONST char *s00; char **se;
347 -#else
348 (CONST char *s00, char **se)
349 -#endif
351 #ifdef Avoid_Underflow
352 int scale;
353 @@ -1541,7 +1436,8 @@ kjs_strtod
354 int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
355 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
356 CONST char *s, *s0, *s1;
357 - double aadj, aadj1, adj, rv, rv0;
358 + double aadj, aadj1, adj;
359 + U aadj2, rv, rv0;
360 Long L;
361 ULong y, z;
362 Bigint *bb = NULL, *bb1 = NULL, *bd = NULL, *bd0 = NULL, *bs = NULL, *delta = NULL;
363 @@ -2302,7 +2198,9 @@ kjs_strtod
364 aadj = z;
365 aadj1 = dsign ? aadj : -aadj;
367 - word0(aadj1) += (2*P+1)*Exp_msk1 - y;
368 + dval(aadj2) = aadj1;
369 + word0(aadj2) += (2*P+1)*Exp_msk1 - y;
370 + aadj1 = dval(aadj2);
372 adj = aadj1 * ulp(dval(rv));
373 dval(rv) += adj;
374 @@ -2419,11 +2317,7 @@ kjs_strtod
376 static int
377 quorem
378 -#ifdef KR_headers
379 - (b, S) Bigint *b, *S;
380 -#else
381 (Bigint *b, Bigint *S)
382 -#endif
384 int n;
385 ULong *bx, *bxe, q, *sx, *sxe;
386 @@ -2540,11 +2434,7 @@ quorem
387 #endif
389 static char *
390 -#ifdef KR_headers
391 -rv_alloc(i) int i;
392 -#else
393 rv_alloc(int i)
394 -#endif
396 int j, k, *r;
398 @@ -2563,11 +2453,7 @@ rv_alloc(int i)
401 static char *
402 -#ifdef KR_headers
403 -nrv_alloc(s, rve, n) char *s, **rve; int n;
404 -#else
405 nrv_alloc(CONST char *s, char **rve, int n)
406 -#endif
408 char *rv, *t;
410 @@ -2585,11 +2471,7 @@ nrv_alloc(CONST char *s, char **rve, int
413 void
414 -#ifdef KR_headers
415 -kjs_freedtoa(s) char *s;
416 -#else
417 kjs_freedtoa(char *s)
418 -#endif
420 Bigint *b = (Bigint *)((int *)s - 1);
421 b->maxwds = 1 << (b->k = *(int*)b);
422 @@ -2636,12 +2518,7 @@ kjs_freedtoa(char *s)
424 char *
425 kjs_dtoa
426 -#ifdef KR_headers
427 - (d, mode, ndigits, decpt, sign, rve)
428 - double d; int mode, ndigits, *decpt, *sign; char **rve;
429 -#else
430 - (double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
431 -#endif
432 + (double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
434 /* Arguments ndigits, decpt, sign are similar to those
435 of ecvt and fcvt; trailing zeros are suppressed from
436 @@ -2686,7 +2563,8 @@ kjs_dtoa
437 ULong x;
438 #endif
439 Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S;
440 - double d2, ds, eps;
441 + U d, d2, eps;
442 + double ds;
443 char *s, *s0;
444 #ifdef Honor_FLT_ROUNDS
445 int rounding;
446 @@ -2702,6 +2580,7 @@ kjs_dtoa
448 #endif
450 + dval(d) = dd;
451 if (word0(d) & Sign_bit) {
452 /* set sign for everything, including 0's and NaNs */
453 *sign = 1;