Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1188)

Unified Diff: base/third_party/dmg_fp/dtoa.cc

Issue 590413006: Fix more MSVC warnings, this time mostly about possible value truncation (fixed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/third_party/dmg_fp/g_fmt.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/third_party/dmg_fp/dtoa.cc
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index 7219624449d5c423f91af9b6288de5ec3f0c964a..502c16cc72f3ccc7ff217434ebf011e07acbf4a7 100644
--- a/base/third_party/dmg_fp/dtoa.cc
+++ b/base/third_party/dmg_fp/dtoa.cc
@@ -652,7 +652,7 @@ multadd
Bfree(b);
b = b1;
}
- b->x[wds++] = carry;
+ b->x[wds++] = (ULong)carry;
b->wds = wds;
}
return b;
@@ -847,7 +847,7 @@ mult
*xc++ = z & FFFFFFFF;
}
while(x < xae);
- *xc = carry;
+ *xc = (ULong)carry;
}
}
#else
@@ -1511,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
@@ -3303,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;
@@ -3859,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))
@@ -3880,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;
@@ -3923,7 +3923,7 @@ dtoa
dval(&u) += ds;
}
#endif
- *s++ = '0' + (int)L;
+ *s++ = '0' + (char)L;
if (!dval(&u)) {
#ifdef SET_INEXACT
inexact = 0;
@@ -4101,7 +4101,7 @@ dtoa
else if (!b->x[0] && b->wds <= 1)
inexact = 0;
#endif
- *s++ = dig;
+ *s++ = (char)dig;
goto ret;
}
#endif
@@ -4131,7 +4131,7 @@ dtoa
goto round_9_up;
}
accept_dig:
- *s++ = dig;
+ *s++ = (char)dig;
goto ret;
}
if (j1 > 0) {
@@ -4144,13 +4144,13 @@ dtoa
*s++ = '9';
goto roundoff;
}
- *s++ = dig + 1;
+ *s++ = (char)dig + 1;
scottmg 2014/09/25 06:44:16 (man this code is frightening) this seems like it
Peter Kasting 2014/09/25 08:31:22 What's even worse is that we have multiple copies
goto ret;
}
#ifdef Honor_FLT_ROUNDS
keep_dig:
#endif
- *s++ = dig;
+ *s++ = (char)dig;
if (i == ilim)
break;
b = multadd(b, 10, 0);
@@ -4164,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;
« no previous file with comments | « no previous file | base/third_party/dmg_fp/g_fmt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698