Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / base / strings / safe_sprintf_unittest.cc
index 937fa4e..98ecd24 100644 (file)
@@ -27,7 +27,7 @@ TEST(SafeSPrintfTest, Empty) {
   char buf[2] = { 'X', 'X' };
 
   // Negative buffer size should always result in an error.
-  EXPECT_EQ(-1, SafeSNPrintf(buf, -1, ""));
+  EXPECT_EQ(-1, SafeSNPrintf(buf, static_cast<size_t>(-1), ""));
   EXPECT_EQ('X', buf[0]);
   EXPECT_EQ('X', buf[1]);
 
@@ -65,7 +65,7 @@ TEST(SafeSPrintfTest, NoArguments) {
   memcpy(buf, ref, sizeof(buf));
 
   // A negative buffer size should always result in an error.
-  EXPECT_EQ(-1, SafeSNPrintf(buf, -1, text));
+  EXPECT_EQ(-1, SafeSNPrintf(buf, static_cast<size_t>(-1), text));
   EXPECT_TRUE(!memcmp(buf, ref, sizeof(buf)));
 
   // Zero buffer size should always result in an error.
@@ -129,7 +129,7 @@ TEST(SafeSPrintfTest, OneArgument) {
   memcpy(buf, ref, sizeof(buf));
 
   // A negative buffer size should always result in an error.
-  EXPECT_EQ(-1, SafeSNPrintf(buf, -1, fmt, ' '));
+  EXPECT_EQ(-1, SafeSNPrintf(buf, static_cast<size_t>(-1), fmt, ' '));
   EXPECT_TRUE(!memcmp(buf, ref, sizeof(buf)));
 
   // Zero buffer size should always result in an error.
@@ -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)