diff options
author | brucedawson <brucedawson@chromium.org> | 2016-03-08 15:58:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-09 00:00:56 +0000 |
commit | a4f7adc756e673c3380bf65b23b8b6b57f48a8b8 (patch) | |
tree | 6cbb3bdabbc2325b932185247b94c111d291a756 /google_apis/gaia | |
parent | d949540bf2f028ed08405993a83f42fddda0c7ec (diff) | |
download | chromium_src-a4f7adc756e673c3380bf65b23b8b6b57f48a8b8.zip chromium_src-a4f7adc756e673c3380bf65b23b8b6b57f48a8b8.tar.gz chromium_src-a4f7adc756e673c3380bf65b23b8b6b57f48a8b8.tar.bz2 |
Fix shift warnings from VC++ 2015 Update 2
Update 2 gives warnings when you shift an int and then assign to a
64-bit value. This behavior can lead to unintended truncation if you
shift too far. These warnings existed in VC++ 2013 as well, but VC++
2015 Update 2 issues the warnings more aggressively.
Sample code that is warned about:
int64_t val = 1 << retry_num;
Sample fix:
int64_t val = static_cast<int64_t>(1) << retry_num;
or (if retry_num is guaranteed to be small enough):
int val = 1 << retry_num;
We could suppress the warnings, but I think they are good-ish warnings
so I'd rather not do that.
TBR=jam@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1774003002
Cr-Commit-Position: refs/heads/master@{#379984}
Diffstat (limited to 'google_apis/gaia')
-rw-r--r-- | google_apis/gaia/oauth2_token_service.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/google_apis/gaia/oauth2_token_service.cc b/google_apis/gaia/oauth2_token_service.cc index e146ca9..def534a 100644 --- a/google_apis/gaia/oauth2_token_service.cc +++ b/google_apis/gaia/oauth2_token_service.cc @@ -313,7 +313,7 @@ void OAuth2TokenService::Fetcher::OnGetTokenFailure( int64_t OAuth2TokenService::Fetcher::ComputeExponentialBackOffMilliseconds( int retry_num) { DCHECK(retry_num < max_fetch_retry_num_); - int64_t exponential_backoff_in_seconds = 1 << retry_num; + int exponential_backoff_in_seconds = 1 << retry_num; // Returns a backoff with randomness < 1000ms return (exponential_backoff_in_seconds + base::RandDouble()) * 1000; } |