1 diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
2 index 3312fa4..502c16c 100644
3 --- a/base/third_party/dmg_fp/dtoa.cc
4 +++ b/base/third_party/dmg_fp/dtoa.cc
5 @@ -548,8 +548,10 @@ Balloc
7 /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
8 /* but this case seems very unlikely. */
9 - if (k <= Kmax && (rv = freelist[k]))
10 + if (k <= Kmax && freelist[k]) {
12 freelist[k] = rv->next;
16 #ifdef Omit_Private_Memory
17 @@ -650,7 +652,7 @@ multadd
21 - b->x[wds++] = carry;
22 + b->x[wds++] = (ULong)carry;
26 @@ -834,7 +836,8 @@ mult
29 for(; xb < xbe; xc0++) {
36 @@ -844,7 +847,7 @@ mult
45 @@ -916,16 +919,19 @@ pow5mult
47 static int p05[3] = { 5, 25, 125 };
52 b = multadd(b, p05[i-1], 0);
60 #ifdef MULTIPLE_THREADS
68 @@ -943,10 +949,12 @@ pow5mult
72 - if (!(p51 = p5->next)) {
75 #ifdef MULTIPLE_THREADS
77 - if (!(p51 = p5->next)) {
80 p51 = p5->next = mult(p5,p5);
83 @@ -997,7 +1005,8 @@ lshift
93 @@ -1299,21 +1308,25 @@ d2b
97 - if ((de = (int)(d0 >> Exp_shift)))
98 + de = (int)(d0 >> Exp_shift);
104 - if ((k = lo0bits(&y))) {
109 x[0] = y | z << (32 - k);
115 + b->wds = x[1] ? 2 : 1;
116 #ifndef Sudden_Underflow
120 - b->wds = (x[1] = z) ? 2 : 1;
124 @@ -1498,7 +1511,7 @@ htinit(unsigned char *h, unsigned char *s, int inc)
127 for(i = 0; (j = s[i]) !=0; i++)
129 + h[j] = (unsigned char)(i + inc);
133 @@ -1536,7 +1549,7 @@ match
137 - while((d = *t++)) {
138 + for(d = *t++; d; d = *t++) {
139 if ((c = *++s) >= 'A' && c <= 'Z')
142 @@ -1566,12 +1579,13 @@ hexnan
145 /* allow optional initial 0x or 0X */
146 - while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
147 + for(c = *(CONST unsigned char*)(s+1); c && c <= ' '; c = *(CONST unsigned char*)(s+1))
149 if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
151 - while((c = *(CONST unsigned char*)++s)) {
152 - if ((c1 = hexdig[c]))
153 + for(c = *(CONST unsigned char*)++s; c; c = *(CONST unsigned char*)++s) {
158 if (udx0 && havedig) {
159 @@ -1594,7 +1608,8 @@ hexnan
163 - } while((c = *++s));
169 @@ -2328,7 +2343,8 @@ bigcomp
170 /* Now b/d = exactly half-way between the two floating-point values */
171 /* on either side of the input string. Compute first digit of b/d. */
173 - if (!(dig = quorem(b,d))) {
176 b = multadd(b, 10, 0); /* very unlikely */
179 @@ -2336,7 +2352,8 @@ bigcomp
180 /* Compare b/d with s0 */
182 for(i = 0; i < nd0; ) {
183 - if ((dd = s0[i++] - '0' - dig))
184 + dd = s0[i++] - '0' - dig;
187 if (!b->x[0] && b->wds == 1) {
189 @@ -2347,7 +2364,8 @@ bigcomp
192 for(j = bc->dp1; i++ < nd;) {
193 - if ((dd = s0[j++] - '0' - dig))
194 + dd = s0[j++] - '0' - dig;
197 if (!b->x[0] && b->wds == 1) {
199 @@ -2747,7 +2765,8 @@ strtod
200 /* Get starting approximation = rv * 10**e1 */
206 dval(&rv) *= tens[i];
208 if (e1 > DBL_MAX_10_EXP) {
209 @@ -2805,7 +2824,8 @@ strtod
216 dval(&rv) /= tens[i];
218 if (e1 >= 1 << n_bigtens)
219 @@ -3283,7 +3303,7 @@ strtod
220 #ifdef Avoid_Underflow
221 if (bc.scale && y <= 2*P*Exp_msk1) {
222 if (aadj <= 0x7fffffff) {
223 - if ((z = aadj) <= 0)
224 + if ((z = (ULong)aadj) <= 0)
227 aadj1 = bc.dsign ? aadj : -aadj;
228 @@ -3456,7 +3476,7 @@ nrv_alloc(CONST char *s, char **rve, int n)
231 t = rv = rv_alloc(n);
232 - while((*t = *s++)) t++;
233 + for(*t = *s++; *t; *t = *s++) t++;
237 @@ -3569,7 +3589,7 @@ dtoa
241 - Bigint *b, *b1, *delta, *mlo, *mhi, *S;
242 + Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S;
246 @@ -3645,10 +3665,9 @@ dtoa
249 b = d2b(&u, &be, &bbits);
250 -#ifdef Sudden_Underflow
251 i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
253 - if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
254 +#ifndef Sudden_Underflow
257 dval(&d2) = dval(&u);
258 word0(&d2) &= Frac_mask1;
259 @@ -3803,13 +3822,16 @@ dtoa
263 - else if ((j1 = -k)) {
264 - dval(&u) *= tens[j1 & 0xf];
265 - for(j = j1 >> 4; j; j >>= 1, i++)
268 - dval(&u) *= bigtens[i];
273 + dval(&u) *= tens[j1 & 0xf];
274 + for(j = j1 >> 4; j; j >>= 1, i++)
277 + dval(&u) *= bigtens[i];
281 if (k_check && dval(&u) < 1. && ilim > 0) {
283 @@ -3837,9 +3859,9 @@ dtoa
285 dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
288 + L = (long)dval(&u);
290 - *s++ = '0' + (int)L;
291 + *s++ = '0' + (char)L;
292 if (dval(&u) < dval(&eps))
294 if (1. - dval(&u) < dval(&eps))
295 @@ -3858,7 +3880,7 @@ dtoa
296 L = (Long)(dval(&u));
297 if (!(dval(&u) -= L))
299 - *s++ = '0' + (int)L;
300 + *s++ = '0' + (char)L;
302 if (dval(&u) > 0.5 + dval(&eps))
304 @@ -3901,7 +3923,7 @@ dtoa
308 - *s++ = '0' + (int)L;
309 + *s++ = '0' + (char)L;
313 @@ -3964,7 +3986,8 @@ dtoa
323 @@ -4002,7 +4025,8 @@ dtoa
324 * can do shifts and ors to compute the numerator for q.
327 - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
328 + i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f;
333 @@ -4077,7 +4101,7 @@ dtoa
334 else if (!b->x[0] && b->wds <= 1)
342 @@ -4107,7 +4131,7 @@ dtoa
351 @@ -4120,13 +4144,13 @@ dtoa
356 + *s++ = (char)dig + 1;
359 #ifdef Honor_FLT_ROUNDS
366 b = multadd(b, 10, 0);
367 @@ -4140,7 +4164,8 @@ dtoa
371 - *s++ = dig = quorem(b,S) + '0';
372 + dig = quorem(b,S) + '0';
374 if (!b->x[0] && b->wds <= 1) {
377 diff --git a/base/third_party/dmg_fp/g_fmt.cc b/base/third_party/dmg_fp/g_fmt.cc
378 index d864eb7..bfa358d 100644
379 --- a/base/third_party/dmg_fp/g_fmt.cc
380 +++ b/base/third_party/dmg_fp/g_fmt.cc
381 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
384 if (decpt == 9999) /* Infinity or Nan */ {
385 - while((*b++ = *s++)) {}
386 + for(*b = *s++; *b++; *b = *s++) {}
389 if (decpt <= -4 || decpt > se - s + 5) {
394 + for(*b = *s++; *b; *b = *s++)
398 @@ -67,7 +67,7 @@ g_fmt(register char *b, double x)
399 for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10) {}
403 + *b++ = (char)i + '0';
407 @@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
409 for(; decpt < 0; decpt++)
411 - while((*b++ = *s++)) {}
412 + for(*b = *s++; *b++; *b = *s++) {}
415 - while((*b = *s++)) {
416 + for(*b = *s++; *b; *b = *s++) {
418 if (--decpt == 0 && *s)