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

Unified Diff: base/strings/safe_sprintf_unittest.cc

Issue 310323003: Fix SafeSPrintfTest.Truncation in base_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use c++ cast style and fix typo in comment 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/safe_sprintf_unittest.cc
diff --git a/base/strings/safe_sprintf_unittest.cc b/base/strings/safe_sprintf_unittest.cc
index 937fa4eca2329342377ce1596199b62bf3b37935..d9fb64689cc2d3bb81f5f361dd9f91c543f69283 100644
--- a/base/strings/safe_sprintf_unittest.cc
+++ b/base/strings/safe_sprintf_unittest.cc
@@ -416,7 +416,7 @@ void PrintLongString(char* buf, size_t sz) {
// The text that was generated by SafeSPrintf() should always match the
// equivalent text generated by sprintf(). Please note that the format
- // string for sprintf() is nor complicated, as it does not have the
+ // string for sprintf() is not complicated, as it does not have the
// benefit of getting type information from the C++ compiler.
//
// N.B.: It would be so much cleaner to use snprintf(). But unfortunately,
@@ -426,7 +426,8 @@ void PrintLongString(char* buf, size_t sz) {
CHECK_LE(sz, sizeof(ref));
sprintf(ref, "A long string: %%d 00DEADBEEF %lld 0x%llX <NULL>",
static_cast<long long>(std::numeric_limits<intptr_t>::min()),
- (long long)PrintLongString);
+ static_cast<unsigned long long>(
+ reinterpret_cast<uintptr_t>(PrintLongString)));
ref[sz-1] = '\000';
#if defined(NDEBUG)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698