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

Unified Diff: base/strings/safe_sprintf.cc

Issue 368133002: Fixes for re-enabling more MSVC level 4 warnings: base/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build, attempt 2 Created 6 years, 6 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 | « base/strings/safe_sprintf.h ('k') | base/strings/safe_sprintf_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/safe_sprintf.cc
diff --git a/base/strings/safe_sprintf.cc b/base/strings/safe_sprintf.cc
index 1e09b6e899e3c4a9524b725e4f697913ee8689bc..1aa27dcd4321cefb8ee8e59eb53fb87a57f2d695 100644
--- a/base/strings/safe_sprintf.cc
+++ b/base/strings/safe_sprintf.cc
@@ -508,7 +508,7 @@ ssize_t SafeSNPrintf(char* buf, size_t sz, const char* fmt, const Arg* args,
buffer.Pad(' ', padding, 1);
// Convert the argument to an ASCII character and output it.
- char ch = static_cast<char>(arg.i);
+ char ch = static_cast<char>(arg.integer.i);
if (!ch) {
goto end_of_output_buffer;
}
@@ -534,7 +534,7 @@ ssize_t SafeSNPrintf(char* buf, size_t sz, const char* fmt, const Arg* args,
DEBUG_CHECK(arg.type == Arg::INT || arg.type == Arg::UINT);
goto fail_to_expand;
}
- i = arg.i;
+ i = arg.integer.i;
if (ch != 'd') {
// The Arg() constructor automatically performed sign expansion on
@@ -544,8 +544,8 @@ ssize_t SafeSNPrintf(char* buf, size_t sz, const char* fmt, const Arg* args,
// We have to do this here, instead of in the Arg() constructor, as
// the Arg() constructor cannot tell whether we will output a %d
// or a %x. Only the latter should experience masking.
- if (arg.width < sizeof(int64_t)) {
- i &= (1LL << (8*arg.width)) - 1;
+ if (arg.integer.width < sizeof(int64_t)) {
+ i &= (1LL << (8*arg.integer.width)) - 1;
}
}
} else {
@@ -554,8 +554,9 @@ ssize_t SafeSNPrintf(char* buf, size_t sz, const char* fmt, const Arg* args,
i = reinterpret_cast<uintptr_t>(arg.ptr);
} else if (arg.type == Arg::STRING) {
i = reinterpret_cast<uintptr_t>(arg.str);
- } else if (arg.type == Arg::INT && arg.width == sizeof(NULL) &&
- arg.i == 0) { // Allow C++'s version of NULL
+ } else if (arg.type == Arg::INT &&
+ arg.integer.width == sizeof(NULL) &&
+ arg.integer.i == 0) { // Allow C++'s version of NULL
i = 0;
} else {
DEBUG_CHECK(arg.type == Arg::POINTER || arg.type == Arg::STRING);
@@ -588,8 +589,8 @@ ssize_t SafeSNPrintf(char* buf, size_t sz, const char* fmt, const Arg* args,
const char *s;
if (arg.type == Arg::STRING) {
s = arg.str ? arg.str : "<NULL>";
- } else if (arg.type == Arg::INT && arg.width == sizeof(NULL) &&
- arg.i == 0) { // Allow C++'s version of NULL
+ } else if (arg.type == Arg::INT && arg.integer.width == sizeof(NULL) &&
+ arg.integer.i == 0) { // Allow C++'s version of NULL
s = "<NULL>";
} else {
DEBUG_CHECK(arg.type == Arg::STRING);
« no previous file with comments | « base/strings/safe_sprintf.h ('k') | base/strings/safe_sprintf_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698