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

Issue 590413006: Fix more MSVC warnings, this time mostly about possible value truncation (fixed (Closed)

Created:
6 years, 3 months ago by Peter Kasting
Modified:
6 years, 2 months ago
Reviewers:
awong, scottmg
CC:
chromium-reviews, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fix more MSVC warnings, this time mostly about possible value truncation (fixed by inserting explicit casts; I didn't try to actually change any behavior). BUG=81439 TEST=none Committed: https://crrev.com/2b69d595c4800017e738c011b6762b7d5a42c51d Cr-Commit-Position: refs/heads/master@{#296666}

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -21 lines) Patch
M base/third_party/dmg_fp/dtoa.cc View 11 chunks +14 lines, -13 lines 2 comments Download
M base/third_party/dmg_fp/g_fmt.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/third_party/dmg_fp/msvc_warnings.patch View 8 chunks +128 lines, -7 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
Peter Kasting
6 years, 3 months ago (2014-09-23 23:50:27 UTC) #2
awong
rubber-stamp LGTM
6 years, 3 months ago (2014-09-23 23:55:46 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/590413006/1
6 years, 2 months ago (2014-09-25 06:03:00 UTC) #5
commit-bot: I haz the power
Committed patchset #1 (id:1) as 7c6cbf5a289bc99ac7fd5b43d497b223bd44aa15
6 years, 2 months ago (2014-09-25 06:33:10 UTC) #6
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/2b69d595c4800017e738c011b6762b7d5a42c51d Cr-Commit-Position: refs/heads/master@{#296666}
6 years, 2 months ago (2014-09-25 06:33:53 UTC) #7
scottmg
https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa.cc File base/third_party/dmg_fp/dtoa.cc (right): https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa.cc#newcode4147 base/third_party/dmg_fp/dtoa.cc:4147: *s++ = (char)dig + 1; (man this code is ...
6 years, 2 months ago (2014-09-25 06:44:16 UTC) #9
Peter Kasting
https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa.cc File base/third_party/dmg_fp/dtoa.cc (right): https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa.cc#newcode4147 base/third_party/dmg_fp/dtoa.cc:4147: *s++ = (char)dig + 1; On 2014/09/25 06:44:16, scottmg ...
6 years, 2 months ago (2014-09-25 08:31:22 UTC) #10
scottmg
6 years, 2 months ago (2014-09-25 15:45:55 UTC) #11
Message was sent while issue was closed.
On 2014/09/25 08:31:22, Peter Kasting wrote:
>
https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa.cc
> File base/third_party/dmg_fp/dtoa.cc (right):
> 
>
https://codereview.chromium.org/590413006/diff/1/base/third_party/dmg_fp/dtoa...
> base/third_party/dmg_fp/dtoa.cc:4147: *s++ = (char)dig + 1;
> On 2014/09/25 06:44:16, scottmg wrote:
> > (man this code is frightening)
> 
> What's even worse is that we have multiple copies of it in our codebase.
> 
> > this seems like it could potentially be different, should it be (char)(dig +
> 1)?
> > or if it's always '0'-'9' just ignore me.
> 
> I think it's always 0-9 (otherwise sticking it in the result string is pretty
> strange), but let's assume I'm wrong.  What would be a case when the result
> would be different?  I can't think of a case where adding one after versus
> before casting to char will make a difference, except maybe insofar as signed
> overflow is technically undefined, so one form might be undefined and the
other
> not (but realistically, that's not going to have a practical effect on any of
> our compilers).

Sorry, you're right of course.

Powered by Google App Engine
This is Rietveld 408576698