mac: Let IPhotoDataProvider::GetAlbumNames() return albums in a deterministic order.
[chromium-blink-merge.git] / base / third_party / dmg_fp / msvc_warnings.patch
blob22e89cd37358be073e71a8f06033209f49e266df
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
6 ACQUIRE_DTOA_LOCK(0);
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]) {
11 + rv = freelist[k];
12 freelist[k] = rv->next;
13 + }
14 else {
15 x = 1 << k;
16 #ifdef Omit_Private_Memory
17 @@ -650,7 +652,7 @@ multadd
18 Bfree(b);
19 b = b1;
21 - b->x[wds++] = carry;
22 + b->x[wds++] = (ULong)carry;
23 b->wds = wds;
25 return b;
26 @@ -834,7 +836,8 @@ mult
27 xc0 = c->x;
28 #ifdef ULLong
29 for(; xb < xbe; xc0++) {
30 - if ((y = *xb++)) {
31 + y = *xb++;
32 + if (y) {
33 x = xa;
34 xc = xc0;
35 carry = 0;
36 @@ -844,7 +847,7 @@ mult
37 *xc++ = z & FFFFFFFF;
39 while(x < xae);
40 - *xc = carry;
41 + *xc = (ULong)carry;
44 #else
45 @@ -916,16 +919,19 @@ pow5mult
46 int i;
47 static int p05[3] = { 5, 25, 125 };
49 - if ((i = k & 3))
50 + i = k & 3;
51 + if (i)
52 b = multadd(b, p05[i-1], 0);
54 if (!(k >>= 2))
55 return b;
56 - if (!(p5 = p5s)) {
57 + p5 = p5s;
58 + if (!p5) {
59 /* first time */
60 #ifdef MULTIPLE_THREADS
61 ACQUIRE_DTOA_LOCK(1);
62 - if (!(p5 = p5s)) {
63 + p5 = p5s;
64 + if (!p5) {
65 p5 = p5s = i2b(625);
66 p5->next = 0;
68 @@ -943,10 +949,12 @@ pow5mult
70 if (!(k >>= 1))
71 break;
72 - if (!(p51 = p5->next)) {
73 + p51 = p5->next;
74 + if (!p51) {
75 #ifdef MULTIPLE_THREADS
76 ACQUIRE_DTOA_LOCK(1);
77 - if (!(p51 = p5->next)) {
78 + p51 = p5->next;
79 + if (!p51) {
80 p51 = p5->next = mult(p5,p5);
81 p51->next = 0;
83 @@ -997,7 +1005,8 @@ lshift
84 z = *x++ >> k1;
86 while(x < xe);
87 - if ((*x1 = z))
88 + *x1 = z;
89 + if (*x1)
90 ++n1;
92 #else
93 @@ -1299,21 +1308,25 @@ d2b
94 z |= Exp_msk11;
95 #endif
96 #else
97 - if ((de = (int)(d0 >> Exp_shift)))
98 + de = (int)(d0 >> Exp_shift);
99 + if (de)
100 z |= Exp_msk1;
101 #endif
102 #ifdef Pack_32
103 - if ((y = d1)) {
104 - if ((k = lo0bits(&y))) {
105 + y = d1;
106 + if (y) {
107 + k = lo0bits(&y);
108 + if (k) {
109 x[0] = y | z << (32 - k);
110 z >>= k;
112 else
113 x[0] = y;
114 + x[1] = z;
115 + b->wds = x[1] ? 2 : 1;
116 #ifndef Sudden_Underflow
117 - i =
118 + i = b->wds;
119 #endif
120 - b->wds = (x[1] = z) ? 2 : 1;
122 else {
123 k = lo0bits(&z);
124 @@ -1498,7 +1511,7 @@ htinit(unsigned char *h, unsigned char *s, int inc)
126 int i, j;
127 for(i = 0; (j = s[i]) !=0; i++)
128 - h[j] = i + inc;
129 + h[j] = (unsigned char)(i + inc);
132 static void
133 @@ -1536,7 +1549,7 @@ match
134 int c, d;
135 CONST char *s = *sp;
137 - while((d = *t++)) {
138 + for(d = *t++; d; d = *t++) {
139 if ((c = *++s) >= 'A' && c <= 'Z')
140 c += 'a' - 'A';
141 if (c != d)
142 @@ -1566,12 +1579,13 @@ hexnan
143 udx0 = 1;
144 s = *sp;
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))
148 ++s;
149 if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
150 s += 2;
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) {
154 + c1 = hexdig[c];
155 + if (c1)
156 c = c1 & 0xf;
157 else if (c <= ' ') {
158 if (udx0 && havedig) {
159 @@ -1594,7 +1608,8 @@ hexnan
160 *sp = s + 1;
161 break;
163 - } while((c = *++s));
164 + c = *++s;
165 + } while(c);
166 break;
168 #endif
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))) {
174 + dig = quorem(b,d);
175 + if (!dig) {
176 b = multadd(b, 10, 0); /* very unlikely */
177 dig = quorem(b,d);
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;
185 + if (dd)
186 goto ret;
187 if (!b->x[0] && b->wds == 1) {
188 if (i < nd)
189 @@ -2347,7 +2364,8 @@ bigcomp
190 dig = quorem(b,d);
192 for(j = bc->dp1; i++ < nd;) {
193 - if ((dd = s0[j++] - '0' - dig))
194 + dd = s0[j++] - '0' - dig;
195 + if (dd)
196 goto ret;
197 if (!b->x[0] && b->wds == 1) {
198 if (i < nd)
199 @@ -2747,7 +2765,8 @@ strtod
200 /* Get starting approximation = rv * 10**e1 */
202 if (e1 > 0) {
203 - if ((i = e1 & 15))
204 + i = e1 & 15;
205 + if (i)
206 dval(&rv) *= tens[i];
207 if (e1 &= ~15) {
208 if (e1 > DBL_MAX_10_EXP) {
209 @@ -2805,7 +2824,8 @@ strtod
211 else if (e1 < 0) {
212 e1 = -e1;
213 - if ((i = e1 & 15))
214 + i = e1 & 15;
215 + if (i)
216 dval(&rv) /= tens[i];
217 if (e1 >>= 4) {
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)
225 z = 1;
226 aadj = z;
227 aadj1 = bc.dsign ? aadj : -aadj;
228 @@ -3456,7 +3476,7 @@ nrv_alloc(CONST char *s, char **rve, int n)
229 char *rv, *t;
231 t = rv = rv_alloc(n);
232 - while((*t = *s++)) t++;
233 + for(*t = *s++; *t; *t = *s++) t++;
234 if (rve)
235 *rve = t;
236 return rv;
237 @@ -3569,7 +3589,7 @@ dtoa
238 int denorm;
239 ULong x;
240 #endif
241 - Bigint *b, *b1, *delta, *mlo, *mhi, *S;
242 + Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S;
243 U d2, eps, u;
244 double ds;
245 char *s, *s0;
246 @@ -3645,10 +3665,9 @@ dtoa
247 #endif
249 b = d2b(&u, &be, &bbits);
250 -#ifdef Sudden_Underflow
251 i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
252 -#else
253 - if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
254 +#ifndef Sudden_Underflow
255 + if (i) {
256 #endif
257 dval(&d2) = dval(&u);
258 word0(&d2) &= Frac_mask1;
259 @@ -3803,13 +3822,16 @@ dtoa
261 dval(&u) /= ds;
263 - else if ((j1 = -k)) {
264 - dval(&u) *= tens[j1 & 0xf];
265 - for(j = j1 >> 4; j; j >>= 1, i++)
266 - if (j & 1) {
267 - ieps++;
268 - dval(&u) *= bigtens[i];
270 + else {
271 + j1 = -k;
272 + if (j1) {
273 + dval(&u) *= tens[j1 & 0xf];
274 + for(j = j1 >> 4; j; j >>= 1, i++)
275 + if (j & 1) {
276 + ieps++;
277 + dval(&u) *= bigtens[i];
281 if (k_check && dval(&u) < 1. && ilim > 0) {
282 if (ilim1 <= 0)
283 @@ -3837,9 +3859,9 @@ dtoa
285 dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
286 for(i = 0;;) {
287 - L = dval(&u);
288 + L = (long)dval(&u);
289 dval(&u) -= L;
290 - *s++ = '0' + (int)L;
291 + *s++ = '0' + (char)L;
292 if (dval(&u) < dval(&eps))
293 goto ret1;
294 if (1. - dval(&u) < dval(&eps))
295 @@ -3858,7 +3880,7 @@ dtoa
296 L = (Long)(dval(&u));
297 if (!(dval(&u) -= L))
298 ilim = i;
299 - *s++ = '0' + (int)L;
300 + *s++ = '0' + (char)L;
301 if (i == ilim) {
302 if (dval(&u) > 0.5 + dval(&eps))
303 goto bump_up;
304 @@ -3901,7 +3923,7 @@ dtoa
305 dval(&u) += ds;
307 #endif
308 - *s++ = '0' + (int)L;
309 + *s++ = '0' + (char)L;
310 if (!dval(&u)) {
311 #ifdef SET_INEXACT
312 inexact = 0;
313 @@ -3964,7 +3986,8 @@ dtoa
314 Bfree(b);
315 b = b1;
317 - if ((j = b5 - m5))
318 + j = b5 - m5;
319 + if (j)
320 b = pow5mult(b, j);
322 else
323 @@ -4002,7 +4025,8 @@ dtoa
324 * can do shifts and ors to compute the numerator for q.
326 #ifdef Pack_32
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;
329 + if (i)
330 i = 32 - i;
331 #define iInc 28
332 #else
333 @@ -4077,7 +4101,7 @@ dtoa
334 else if (!b->x[0] && b->wds <= 1)
335 inexact = 0;
336 #endif
337 - *s++ = dig;
338 + *s++ = (char)dig;
339 goto ret;
341 #endif
342 @@ -4107,7 +4131,7 @@ dtoa
343 goto round_9_up;
345 accept_dig:
346 - *s++ = dig;
347 + *s++ = (char)dig;
348 goto ret;
350 if (j1 > 0) {
351 @@ -4120,13 +4144,13 @@ dtoa
352 *s++ = '9';
353 goto roundoff;
355 - *s++ = dig + 1;
356 + *s++ = (char)dig + 1;
357 goto ret;
359 #ifdef Honor_FLT_ROUNDS
360 keep_dig:
361 #endif
362 - *s++ = dig;
363 + *s++ = (char)dig;
364 if (i == ilim)
365 break;
366 b = multadd(b, 10, 0);
367 @@ -4140,7 +4164,8 @@ dtoa
369 else
370 for(i = 1;; i++) {
371 - *s++ = dig = quorem(b,S) + '0';
372 + dig = quorem(b,S) + '0';
373 + *s++ = (char)dig;
374 if (!b->x[0] && b->wds <= 1) {
375 #ifdef SET_INEXACT
376 inexact = 0;
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)
382 if (sign)
383 *b++ = '-';
384 if (decpt == 9999) /* Infinity or Nan */ {
385 - while((*b++ = *s++)) {}
386 + for(*b = *s++; *b++; *b = *s++) {}
387 goto done0;
389 if (decpt <= -4 || decpt > se - s + 5) {
390 *b++ = *s++;
391 if (*s) {
392 *b++ = '.';
393 - while((*b = *s++))
394 + for(*b = *s++; *b; *b = *s++)
395 b++;
397 *b++ = 'e';
398 @@ -67,7 +67,7 @@ g_fmt(register char *b, double x)
399 for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10) {}
400 for(;;) {
401 i = decpt / k;
402 - *b++ = i + '0';
403 + *b++ = (char)i + '0';
404 if (--j <= 0)
405 break;
406 decpt -= i*k;
407 @@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
408 *b++ = '.';
409 for(; decpt < 0; decpt++)
410 *b++ = '0';
411 - while((*b++ = *s++)) {}
412 + for(*b = *s++; *b++; *b = *s++) {}
414 else {
415 - while((*b = *s++)) {
416 + for(*b = *s++; *b; *b = *s++) {
417 b++;
418 if (--decpt == 0 && *s)
419 *b++ = '.';