mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 14:26:09 +03:00
420 lines
9.0 KiB
Diff
420 lines
9.0 KiB
Diff
|
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
|
||
|
index 3312fa4..502c16c 100644
|
||
|
--- a/base/third_party/dmg_fp/dtoa.cc
|
||
|
+++ b/base/third_party/dmg_fp/dtoa.cc
|
||
|
@@ -548,8 +548,10 @@ Balloc
|
||
|
ACQUIRE_DTOA_LOCK(0);
|
||
|
/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
|
||
|
/* but this case seems very unlikely. */
|
||
|
- if (k <= Kmax && (rv = freelist[k]))
|
||
|
+ if (k <= Kmax && freelist[k]) {
|
||
|
+ rv = freelist[k];
|
||
|
freelist[k] = rv->next;
|
||
|
+ }
|
||
|
else {
|
||
|
x = 1 << k;
|
||
|
#ifdef Omit_Private_Memory
|
||
|
@@ -650,7 +652,7 @@ multadd
|
||
|
Bfree(b);
|
||
|
b = b1;
|
||
|
}
|
||
|
- b->x[wds++] = carry;
|
||
|
+ b->x[wds++] = (ULong)carry;
|
||
|
b->wds = wds;
|
||
|
}
|
||
|
return b;
|
||
|
@@ -834,7 +836,8 @@ mult
|
||
|
xc0 = c->x;
|
||
|
#ifdef ULLong
|
||
|
for(; xb < xbe; xc0++) {
|
||
|
- if ((y = *xb++)) {
|
||
|
+ y = *xb++;
|
||
|
+ if (y) {
|
||
|
x = xa;
|
||
|
xc = xc0;
|
||
|
carry = 0;
|
||
|
@@ -844,7 +847,7 @@ mult
|
||
|
*xc++ = z & FFFFFFFF;
|
||
|
}
|
||
|
while(x < xae);
|
||
|
- *xc = carry;
|
||
|
+ *xc = (ULong)carry;
|
||
|
}
|
||
|
}
|
||
|
#else
|
||
|
@@ -916,16 +919,19 @@ pow5mult
|
||
|
int i;
|
||
|
static int p05[3] = { 5, 25, 125 };
|
||
|
|
||
|
- if ((i = k & 3))
|
||
|
+ i = k & 3;
|
||
|
+ if (i)
|
||
|
b = multadd(b, p05[i-1], 0);
|
||
|
|
||
|
if (!(k >>= 2))
|
||
|
return b;
|
||
|
- if (!(p5 = p5s)) {
|
||
|
+ p5 = p5s;
|
||
|
+ if (!p5) {
|
||
|
/* first time */
|
||
|
#ifdef MULTIPLE_THREADS
|
||
|
ACQUIRE_DTOA_LOCK(1);
|
||
|
- if (!(p5 = p5s)) {
|
||
|
+ p5 = p5s;
|
||
|
+ if (!p5) {
|
||
|
p5 = p5s = i2b(625);
|
||
|
p5->next = 0;
|
||
|
}
|
||
|
@@ -943,10 +949,12 @@ pow5mult
|
||
|
}
|
||
|
if (!(k >>= 1))
|
||
|
break;
|
||
|
- if (!(p51 = p5->next)) {
|
||
|
+ p51 = p5->next;
|
||
|
+ if (!p51) {
|
||
|
#ifdef MULTIPLE_THREADS
|
||
|
ACQUIRE_DTOA_LOCK(1);
|
||
|
- if (!(p51 = p5->next)) {
|
||
|
+ p51 = p5->next;
|
||
|
+ if (!p51) {
|
||
|
p51 = p5->next = mult(p5,p5);
|
||
|
p51->next = 0;
|
||
|
}
|
||
|
@@ -997,7 +1005,8 @@ lshift
|
||
|
z = *x++ >> k1;
|
||
|
}
|
||
|
while(x < xe);
|
||
|
- if ((*x1 = z))
|
||
|
+ *x1 = z;
|
||
|
+ if (*x1)
|
||
|
++n1;
|
||
|
}
|
||
|
#else
|
||
|
@@ -1299,21 +1308,25 @@ d2b
|
||
|
z |= Exp_msk11;
|
||
|
#endif
|
||
|
#else
|
||
|
- if ((de = (int)(d0 >> Exp_shift)))
|
||
|
+ de = (int)(d0 >> Exp_shift);
|
||
|
+ if (de)
|
||
|
z |= Exp_msk1;
|
||
|
#endif
|
||
|
#ifdef Pack_32
|
||
|
- if ((y = d1)) {
|
||
|
- if ((k = lo0bits(&y))) {
|
||
|
+ y = d1;
|
||
|
+ if (y) {
|
||
|
+ k = lo0bits(&y);
|
||
|
+ if (k) {
|
||
|
x[0] = y | z << (32 - k);
|
||
|
z >>= k;
|
||
|
}
|
||
|
else
|
||
|
x[0] = y;
|
||
|
+ x[1] = z;
|
||
|
+ b->wds = x[1] ? 2 : 1;
|
||
|
#ifndef Sudden_Underflow
|
||
|
- i =
|
||
|
+ i = b->wds;
|
||
|
#endif
|
||
|
- b->wds = (x[1] = z) ? 2 : 1;
|
||
|
}
|
||
|
else {
|
||
|
k = lo0bits(&z);
|
||
|
@@ -1498,7 +1511,7 @@ htinit(unsigned char *h, unsigned char *s, int inc)
|
||
|
{
|
||
|
int i, j;
|
||
|
for(i = 0; (j = s[i]) !=0; i++)
|
||
|
- h[j] = i + inc;
|
||
|
+ h[j] = (unsigned char)(i + inc);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
@@ -1536,7 +1549,7 @@ match
|
||
|
int c, d;
|
||
|
CONST char *s = *sp;
|
||
|
|
||
|
- while((d = *t++)) {
|
||
|
+ for(d = *t++; d; d = *t++) {
|
||
|
if ((c = *++s) >= 'A' && c <= 'Z')
|
||
|
c += 'a' - 'A';
|
||
|
if (c != d)
|
||
|
@@ -1566,12 +1579,13 @@ hexnan
|
||
|
udx0 = 1;
|
||
|
s = *sp;
|
||
|
/* allow optional initial 0x or 0X */
|
||
|
- while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
|
||
|
+ for(c = *(CONST unsigned char*)(s+1); c && c <= ' '; c = *(CONST unsigned char*)(s+1))
|
||
|
++s;
|
||
|
if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
|
||
|
s += 2;
|
||
|
- while((c = *(CONST unsigned char*)++s)) {
|
||
|
- if ((c1 = hexdig[c]))
|
||
|
+ for(c = *(CONST unsigned char*)++s; c; c = *(CONST unsigned char*)++s) {
|
||
|
+ c1 = hexdig[c];
|
||
|
+ if (c1)
|
||
|
c = c1 & 0xf;
|
||
|
else if (c <= ' ') {
|
||
|
if (udx0 && havedig) {
|
||
|
@@ -1594,7 +1608,8 @@ hexnan
|
||
|
*sp = s + 1;
|
||
|
break;
|
||
|
}
|
||
|
- } while((c = *++s));
|
||
|
+ c = *++s;
|
||
|
+ } while(c);
|
||
|
break;
|
||
|
}
|
||
|
#endif
|
||
|
@@ -2328,7 +2343,8 @@ bigcomp
|
||
|
/* Now b/d = exactly half-way between the two floating-point values */
|
||
|
/* on either side of the input string. Compute first digit of b/d. */
|
||
|
|
||
|
- if (!(dig = quorem(b,d))) {
|
||
|
+ dig = quorem(b,d);
|
||
|
+ if (!dig) {
|
||
|
b = multadd(b, 10, 0); /* very unlikely */
|
||
|
dig = quorem(b,d);
|
||
|
}
|
||
|
@@ -2336,7 +2352,8 @@ bigcomp
|
||
|
/* Compare b/d with s0 */
|
||
|
|
||
|
for(i = 0; i < nd0; ) {
|
||
|
- if ((dd = s0[i++] - '0' - dig))
|
||
|
+ dd = s0[i++] - '0' - dig;
|
||
|
+ if (dd)
|
||
|
goto ret;
|
||
|
if (!b->x[0] && b->wds == 1) {
|
||
|
if (i < nd)
|
||
|
@@ -2347,7 +2364,8 @@ bigcomp
|
||
|
dig = quorem(b,d);
|
||
|
}
|
||
|
for(j = bc->dp1; i++ < nd;) {
|
||
|
- if ((dd = s0[j++] - '0' - dig))
|
||
|
+ dd = s0[j++] - '0' - dig;
|
||
|
+ if (dd)
|
||
|
goto ret;
|
||
|
if (!b->x[0] && b->wds == 1) {
|
||
|
if (i < nd)
|
||
|
@@ -2747,7 +2765,8 @@ strtod
|
||
|
/* Get starting approximation = rv * 10**e1 */
|
||
|
|
||
|
if (e1 > 0) {
|
||
|
- if ((i = e1 & 15))
|
||
|
+ i = e1 & 15;
|
||
|
+ if (i)
|
||
|
dval(&rv) *= tens[i];
|
||
|
if (e1 &= ~15) {
|
||
|
if (e1 > DBL_MAX_10_EXP) {
|
||
|
@@ -2805,7 +2824,8 @@ strtod
|
||
|
}
|
||
|
else if (e1 < 0) {
|
||
|
e1 = -e1;
|
||
|
- if ((i = e1 & 15))
|
||
|
+ i = e1 & 15;
|
||
|
+ if (i)
|
||
|
dval(&rv) /= tens[i];
|
||
|
if (e1 >>= 4) {
|
||
|
if (e1 >= 1 << n_bigtens)
|
||
|
@@ -3283,7 +3303,7 @@ strtod
|
||
|
#ifdef Avoid_Underflow
|
||
|
if (bc.scale && y <= 2*P*Exp_msk1) {
|
||
|
if (aadj <= 0x7fffffff) {
|
||
|
- if ((z = aadj) <= 0)
|
||
|
+ if ((z = (ULong)aadj) <= 0)
|
||
|
z = 1;
|
||
|
aadj = z;
|
||
|
aadj1 = bc.dsign ? aadj : -aadj;
|
||
|
@@ -3456,7 +3476,7 @@ nrv_alloc(CONST char *s, char **rve, int n)
|
||
|
char *rv, *t;
|
||
|
|
||
|
t = rv = rv_alloc(n);
|
||
|
- while((*t = *s++)) t++;
|
||
|
+ for(*t = *s++; *t; *t = *s++) t++;
|
||
|
if (rve)
|
||
|
*rve = t;
|
||
|
return rv;
|
||
|
@@ -3569,7 +3589,7 @@ dtoa
|
||
|
int denorm;
|
||
|
ULong x;
|
||
|
#endif
|
||
|
- Bigint *b, *b1, *delta, *mlo, *mhi, *S;
|
||
|
+ Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S;
|
||
|
U d2, eps, u;
|
||
|
double ds;
|
||
|
char *s, *s0;
|
||
|
@@ -3645,10 +3665,9 @@ dtoa
|
||
|
#endif
|
||
|
|
||
|
b = d2b(&u, &be, &bbits);
|
||
|
-#ifdef Sudden_Underflow
|
||
|
i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
|
||
|
-#else
|
||
|
- if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
|
||
|
+#ifndef Sudden_Underflow
|
||
|
+ if (i) {
|
||
|
#endif
|
||
|
dval(&d2) = dval(&u);
|
||
|
word0(&d2) &= Frac_mask1;
|
||
|
@@ -3803,13 +3822,16 @@ dtoa
|
||
|
}
|
||
|
dval(&u) /= ds;
|
||
|
}
|
||
|
- else if ((j1 = -k)) {
|
||
|
- dval(&u) *= tens[j1 & 0xf];
|
||
|
- for(j = j1 >> 4; j; j >>= 1, i++)
|
||
|
- if (j & 1) {
|
||
|
- ieps++;
|
||
|
- dval(&u) *= bigtens[i];
|
||
|
- }
|
||
|
+ else {
|
||
|
+ j1 = -k;
|
||
|
+ if (j1) {
|
||
|
+ dval(&u) *= tens[j1 & 0xf];
|
||
|
+ for(j = j1 >> 4; j; j >>= 1, i++)
|
||
|
+ if (j & 1) {
|
||
|
+ ieps++;
|
||
|
+ dval(&u) *= bigtens[i];
|
||
|
+ }
|
||
|
+ }
|
||
|
}
|
||
|
if (k_check && dval(&u) < 1. && ilim > 0) {
|
||
|
if (ilim1 <= 0)
|
||
|
@@ -3837,9 +3859,9 @@ dtoa
|
||
|
*/
|
||
|
dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
|
||
|
for(i = 0;;) {
|
||
|
- L = dval(&u);
|
||
|
+ L = (long)dval(&u);
|
||
|
dval(&u) -= L;
|
||
|
- *s++ = '0' + (int)L;
|
||
|
+ *s++ = '0' + (char)L;
|
||
|
if (dval(&u) < dval(&eps))
|
||
|
goto ret1;
|
||
|
if (1. - dval(&u) < dval(&eps))
|
||
|
@@ -3858,7 +3880,7 @@ dtoa
|
||
|
L = (Long)(dval(&u));
|
||
|
if (!(dval(&u) -= L))
|
||
|
ilim = i;
|
||
|
- *s++ = '0' + (int)L;
|
||
|
+ *s++ = '0' + (char)L;
|
||
|
if (i == ilim) {
|
||
|
if (dval(&u) > 0.5 + dval(&eps))
|
||
|
goto bump_up;
|
||
|
@@ -3901,7 +3923,7 @@ dtoa
|
||
|
dval(&u) += ds;
|
||
|
}
|
||
|
#endif
|
||
|
- *s++ = '0' + (int)L;
|
||
|
+ *s++ = '0' + (char)L;
|
||
|
if (!dval(&u)) {
|
||
|
#ifdef SET_INEXACT
|
||
|
inexact = 0;
|
||
|
@@ -3964,7 +3986,8 @@ dtoa
|
||
|
Bfree(b);
|
||
|
b = b1;
|
||
|
}
|
||
|
- if ((j = b5 - m5))
|
||
|
+ j = b5 - m5;
|
||
|
+ if (j)
|
||
|
b = pow5mult(b, j);
|
||
|
}
|
||
|
else
|
||
|
@@ -4002,7 +4025,8 @@ dtoa
|
||
|
* can do shifts and ors to compute the numerator for q.
|
||
|
*/
|
||
|
#ifdef Pack_32
|
||
|
- if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
|
||
|
+ i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f;
|
||
|
+ if (i)
|
||
|
i = 32 - i;
|
||
|
#define iInc 28
|
||
|
#else
|
||
|
@@ -4077,7 +4101,7 @@ dtoa
|
||
|
else if (!b->x[0] && b->wds <= 1)
|
||
|
inexact = 0;
|
||
|
#endif
|
||
|
- *s++ = dig;
|
||
|
+ *s++ = (char)dig;
|
||
|
goto ret;
|
||
|
}
|
||
|
#endif
|
||
|
@@ -4107,7 +4131,7 @@ dtoa
|
||
|
goto round_9_up;
|
||
|
}
|
||
|
accept_dig:
|
||
|
- *s++ = dig;
|
||
|
+ *s++ = (char)dig;
|
||
|
goto ret;
|
||
|
}
|
||
|
if (j1 > 0) {
|
||
|
@@ -4120,13 +4144,13 @@ dtoa
|
||
|
*s++ = '9';
|
||
|
goto roundoff;
|
||
|
}
|
||
|
- *s++ = dig + 1;
|
||
|
+ *s++ = (char)dig + 1;
|
||
|
goto ret;
|
||
|
}
|
||
|
#ifdef Honor_FLT_ROUNDS
|
||
|
keep_dig:
|
||
|
#endif
|
||
|
- *s++ = dig;
|
||
|
+ *s++ = (char)dig;
|
||
|
if (i == ilim)
|
||
|
break;
|
||
|
b = multadd(b, 10, 0);
|
||
|
@@ -4140,7 +4164,8 @@ dtoa
|
||
|
}
|
||
|
else
|
||
|
for(i = 1;; i++) {
|
||
|
- *s++ = dig = quorem(b,S) + '0';
|
||
|
+ dig = quorem(b,S) + '0';
|
||
|
+ *s++ = (char)dig;
|
||
|
if (!b->x[0] && b->wds <= 1) {
|
||
|
#ifdef SET_INEXACT
|
||
|
inexact = 0;
|
||
|
diff --git a/base/third_party/dmg_fp/g_fmt.cc b/base/third_party/dmg_fp/g_fmt.cc
|
||
|
index d864eb7..bfa358d 100644
|
||
|
--- a/base/third_party/dmg_fp/g_fmt.cc
|
||
|
+++ b/base/third_party/dmg_fp/g_fmt.cc
|
||
|
@@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
|
||
|
if (sign)
|
||
|
*b++ = '-';
|
||
|
if (decpt == 9999) /* Infinity or Nan */ {
|
||
|
- while((*b++ = *s++)) {}
|
||
|
+ for(*b = *s++; *b++; *b = *s++) {}
|
||
|
goto done0;
|
||
|
}
|
||
|
if (decpt <= -4 || decpt > se - s + 5) {
|
||
|
*b++ = *s++;
|
||
|
if (*s) {
|
||
|
*b++ = '.';
|
||
|
- while((*b = *s++))
|
||
|
+ for(*b = *s++; *b; *b = *s++)
|
||
|
b++;
|
||
|
}
|
||
|
*b++ = 'e';
|
||
|
@@ -67,7 +67,7 @@ g_fmt(register char *b, double x)
|
||
|
for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10) {}
|
||
|
for(;;) {
|
||
|
i = decpt / k;
|
||
|
- *b++ = i + '0';
|
||
|
+ *b++ = (char)i + '0';
|
||
|
if (--j <= 0)
|
||
|
break;
|
||
|
decpt -= i*k;
|
||
|
@@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
|
||
|
*b++ = '.';
|
||
|
for(; decpt < 0; decpt++)
|
||
|
*b++ = '0';
|
||
|
- while((*b++ = *s++)) {}
|
||
|
+ for(*b = *s++; *b++; *b = *s++) {}
|
||
|
}
|
||
|
else {
|
||
|
- while((*b = *s++)) {
|
||
|
+ for(*b = *s++; *b; *b = *s++) {
|
||
|
b++;
|
||
|
if (--decpt == 0 && *s)
|
||
|
*b++ = '.';
|