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..c2033f32bc88b03afbeefd977a55c8a7d89f605f 100644 |
--- a/base/strings/safe_sprintf_unittest.cc |
+++ b/base/strings/safe_sprintf_unittest.cc |
@@ -4,6 +4,7 @@ |
#include "base/strings/safe_sprintf.h" |
+#include <inttypes.h> |
Mark Mentovai
2014/06/15 12:27:26
Does MSVC even have this header?
Yang Gu
2014/06/16 10:39:09
Not quite sure about MSVC. I searched the web and
|
#include <stdio.h> |
#include <string.h> |
@@ -424,9 +425,9 @@ void PrintLongString(char* buf, size_t sz) { |
// are all really awkward. |
char ref[256]; |
CHECK_LE(sz, sizeof(ref)); |
- sprintf(ref, "A long string: %%d 00DEADBEEF %lld 0x%llX <NULL>", |
+ sprintf(ref, "A long string: %%d 00DEADBEEF %lld 0x%" PRIXPTR " <NULL>", |
Mark Mentovai
2014/06/15 12:19:21
Why can’t you use %p here?
Yang Gu
2014/06/16 10:39:09
The actual format is in SafeSNPrintf(), where %p i
|
static_cast<long long>(std::numeric_limits<intptr_t>::min()), |
Mark Mentovai
2014/06/15 12:19:22
Wouldn’t PRIdPTR (and no cast) be better here and
Mark Mentovai
2014/06/15 12:23:02
Mark Mentovai wrote:
Mark Mentovai
2014/06/15 12:27:26
Mark Mentovai wrote:
Yang Gu
2014/06/16 10:39:09
PRIdPTR is in decimal format, but we actually need
|
- (long long)PrintLongString); |
+ (uintptr_t)PrintLongString); |
ref[sz-1] = '\000'; |
#if defined(NDEBUG) |