From effe1da66883716037d1b93d3f241158072d2e5d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 6 Sep 2017 17:21:20 -0700 Subject: Roll DEPS for build to a049c43. This enables MSVC by default on Windows again, so fix code that fail to build with MSVC too. Change-Id: I03fb4e3697ad777a4dca88af462b35526d6c1d4d Reviewed-on: https://pdfium-review.googlesource.com/13392 Commit-Queue: dsinclair Reviewed-by: dsinclair --- DEPS | 2 +- core/fxcrt/cfx_bytestring_unittest.cpp | 30 +----------------------------- core/fxcrt/cfx_widestring_unittest.cpp | 26 +------------------------- xfa/fxfa/parser/cxfa_widgetdata.cpp | 2 +- 4 files changed, 4 insertions(+), 56 deletions(-) diff --git a/DEPS b/DEPS index b7bc444da3..a6a6049244 100644 --- a/DEPS +++ b/DEPS @@ -5,7 +5,7 @@ vars = { 'pdfium_git': 'https://pdfium.googlesource.com', 'android_ndk_revision': '26d93ec07f3ce2ec2cdfeae1b21ee6f12ff868d8', - 'build_revision': 'bee933aa41e29016998f5fbdd05cc2ce457e28c5', + 'build_revision': 'a049c43089b67a96c57b69dafc91a9a640b6bd70', 'buildtools_revision': 'f90f6a5af3e8cf843395bfe6243cf606f71b5344', 'catapult_revision': '86352b966b0245d6883e5f7df27687856978b6d7', 'clang_revision': 'a1420b85586c1fa3eaf68808bbb095334d2d271d', diff --git a/core/fxcrt/cfx_bytestring_unittest.cpp b/core/fxcrt/cfx_bytestring_unittest.cpp index 415b4621a1..dcb8577b65 100644 --- a/core/fxcrt/cfx_bytestring_unittest.cpp +++ b/core/fxcrt/cfx_bytestring_unittest.cpp @@ -13,9 +13,6 @@ TEST(fxcrt, ByteStringElementAccess) { const CFX_ByteString abc("abc"); -#ifndef NDEBUG - EXPECT_DEATH({ abc[-1]; }, ".*"); -#endif EXPECT_EQ('a', abc[0]); EXPECT_EQ('b', abc[1]); EXPECT_EQ('c', abc[2]); @@ -29,11 +26,8 @@ TEST(fxcrt, ByteStringElementAccess) { EXPECT_EQ('b', mutable_abc[1]); EXPECT_EQ('c', mutable_abc[2]); EXPECT_EQ(abc.c_str(), mutable_abc.c_str()); - -#ifndef NDEBUG - EXPECT_DEATH({ mutable_abc.SetAt(-1, 'd'); }, ".*"); EXPECT_EQ("abc", abc); -#endif + const char* c_str = abc.c_str(); mutable_abc.SetAt(0, 'd'); EXPECT_EQ(c_str, abc.c_str()); @@ -414,8 +408,6 @@ TEST(fxcrt, ByteStringReplace) { TEST(fxcrt, ByteStringInsert) { CFX_ByteString fred("FRED"); - EXPECT_EQ(4u, fred.Insert(-1, 'X')); - EXPECT_EQ("FRED", fred); EXPECT_EQ(5u, fred.Insert(0, 'S')); EXPECT_EQ("SFRED", fred); EXPECT_EQ(6u, fred.Insert(1, 'T')); @@ -426,11 +418,6 @@ TEST(fxcrt, ByteStringInsert) { EXPECT_EQ("STFRUEDV", fred); EXPECT_EQ(8u, fred.Insert(12, 'P')); EXPECT_EQ("STFRUEDV", fred); - { - CFX_ByteString empty; - EXPECT_EQ(0u, empty.Insert(-1, 'X')); - EXPECT_NE("X", empty); - } { CFX_ByteString empty; EXPECT_EQ(1u, empty.Insert(0, 'X')); @@ -487,8 +474,6 @@ TEST(fxcrt, ByteStringDelete) { EXPECT_EQ("ED", fred); EXPECT_EQ(1u, fred.Delete(1)); EXPECT_EQ("E", fred); - EXPECT_EQ(1u, fred.Delete(-1)); - EXPECT_EQ("E", fred); EXPECT_EQ(0u, fred.Delete(0)); EXPECT_EQ("", fred); EXPECT_EQ(0u, fred.Delete(0)); @@ -497,8 +482,6 @@ TEST(fxcrt, ByteStringDelete) { CFX_ByteString empty; EXPECT_EQ(0u, empty.Delete(0)); EXPECT_EQ("", empty); - EXPECT_EQ(0u, empty.Delete(-1)); - EXPECT_EQ("", empty); EXPECT_EQ(0u, empty.Delete(1)); EXPECT_EQ("", empty); } @@ -519,7 +502,6 @@ TEST(fxcrt, ByteStringMid) { EXPECT_EQ("FRED", fred.Mid(0, 4)); EXPECT_EQ("", fred.Mid(0, 10)); - EXPECT_EQ("", fred.Mid(-1, 2)); EXPECT_EQ("RED", fred.Mid(1, 3)); EXPECT_EQ("", fred.Mid(4, 1)); @@ -536,12 +518,10 @@ TEST(fxcrt, ByteStringLeft) { EXPECT_EQ("FRED", fred.Left(4)); EXPECT_EQ("", fred.Left(5)); - EXPECT_EQ("", fred.Left(-1)); CFX_ByteString empty; EXPECT_EQ("", empty.Left(0)); EXPECT_EQ("", empty.Left(1)); - EXPECT_EQ("", empty.Left(-1)); } TEST(fxcrt, ByteStringRight) { @@ -553,12 +533,10 @@ TEST(fxcrt, ByteStringRight) { EXPECT_EQ("FRED", fred.Right(4)); EXPECT_EQ("", fred.Right(5)); - EXPECT_EQ("", fred.Right(-1)); CFX_ByteString empty; EXPECT_EQ("", empty.Right(0)); EXPECT_EQ("", empty.Right(1)); - EXPECT_EQ("", empty.Right(-1)); } TEST(fxcrt, ByteStringFind) { @@ -1009,12 +987,9 @@ TEST(fxcrt, ByteStringCMid) { CFX_ByteStringC longer_string("abcdef"); EXPECT_EQ(longer_string, longer_string.Mid(0, 6)); EXPECT_EQ("", longer_string.Mid(0, 187)); - EXPECT_EQ("", longer_string.Mid(-42, 6)); - EXPECT_EQ("", longer_string.Mid(-42, 187)); CFX_ByteStringC leading_substring("ab"); EXPECT_EQ(leading_substring, longer_string.Mid(0, 2)); - EXPECT_EQ("", longer_string.Mid(-1, 2)); CFX_ByteStringC middle_substring("bcde"); EXPECT_EQ(middle_substring, longer_string.Mid(1, 4)); @@ -1027,9 +1002,6 @@ TEST(fxcrt, ByteStringCMid) { TEST(fxcrt, ByteStringCElementAccess) { // CFX_ByteStringC includes the NUL terminator for non-empty strings. CFX_ByteStringC abc("abc"); -#ifndef NDEBUG - EXPECT_DEATH({ abc[-1]; }, ".*"); -#endif EXPECT_EQ('a', static_cast(abc[0])); EXPECT_EQ('b', static_cast(abc[1])); EXPECT_EQ('c', static_cast(abc[2])); diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/cfx_widestring_unittest.cpp index 1408d10f15..7b12d50601 100644 --- a/core/fxcrt/cfx_widestring_unittest.cpp +++ b/core/fxcrt/cfx_widestring_unittest.cpp @@ -12,9 +12,6 @@ TEST(fxcrt, WideStringElementAccess) { const CFX_WideString abc(L"abc"); -#ifndef NDEBUG - EXPECT_DEATH({ abc[-1]; }, ".*"); -#endif EXPECT_EQ(L'a', abc[0]); EXPECT_EQ(L'b', abc[1]); EXPECT_EQ(L'c', abc[2]); @@ -28,10 +25,8 @@ TEST(fxcrt, WideStringElementAccess) { EXPECT_EQ(L'b', mutable_abc[1]); EXPECT_EQ(L'c', mutable_abc[2]); EXPECT_EQ(abc.c_str(), mutable_abc.c_str()); -#ifndef NDEBUG - EXPECT_DEATH({ mutable_abc.SetAt(-1, L'd'); }, ".*"); EXPECT_EQ(L"abc", abc); -#endif + const wchar_t* c_str = abc.c_str(); mutable_abc.SetAt(0, L'd'); EXPECT_EQ(c_str, abc.c_str()); @@ -373,8 +368,6 @@ TEST(fxcrt, WideStringReplace) { TEST(fxcrt, WideStringInsert) { CFX_WideString fred(L"FRED"); - EXPECT_EQ(4u, fred.Insert(-1, 'X')); - EXPECT_EQ(L"FRED", fred); EXPECT_EQ(5u, fred.Insert(0, 'S')); EXPECT_EQ(L"SFRED", fred); EXPECT_EQ(6u, fred.Insert(1, 'T')); @@ -385,11 +378,6 @@ TEST(fxcrt, WideStringInsert) { EXPECT_EQ(L"STFRUEDV", fred); EXPECT_EQ(8u, fred.Insert(12, 'P')); EXPECT_EQ(L"STFRUEDV", fred); - { - CFX_WideString empty; - EXPECT_EQ(0u, empty.Insert(-1, 'X')); - EXPECT_NE(L"X", empty); - } { CFX_WideString empty; EXPECT_EQ(1u, empty.Insert(0, 'X')); @@ -446,8 +434,6 @@ TEST(fxcrt, WideStringDelete) { EXPECT_EQ(L"ED", fred); EXPECT_EQ(1u, fred.Delete(1)); EXPECT_EQ(L"E", fred); - EXPECT_EQ(1u, fred.Delete(-1)); - EXPECT_EQ(L"E", fred); EXPECT_EQ(0u, fred.Delete(0)); EXPECT_EQ(L"", fred); EXPECT_EQ(0u, fred.Delete(0)); @@ -456,8 +442,6 @@ TEST(fxcrt, WideStringDelete) { CFX_WideString empty; EXPECT_EQ(0u, empty.Delete(0)); EXPECT_EQ(L"", empty); - EXPECT_EQ(0u, empty.Delete(-1)); - EXPECT_EQ(L"", empty); EXPECT_EQ(0u, empty.Delete(1)); EXPECT_EQ(L"", empty); } @@ -478,7 +462,6 @@ TEST(fxcrt, WideStringMid) { EXPECT_EQ(L"FRED", fred.Mid(0, 4)); EXPECT_EQ(L"", fred.Mid(0, 10)); - EXPECT_EQ(L"", fred.Mid(-1, 2)); EXPECT_EQ(L"", fred.Mid(1, 4)); EXPECT_EQ(L"", fred.Mid(4, 1)); @@ -495,12 +478,10 @@ TEST(fxcrt, WideStringLeft) { EXPECT_EQ(L"FRED", fred.Left(4)); EXPECT_EQ(L"", fred.Left(5)); - EXPECT_EQ(L"", fred.Left(-1)); CFX_WideString empty; EXPECT_EQ(L"", empty.Left(0)); EXPECT_EQ(L"", empty.Left(1)); - EXPECT_EQ(L"", empty.Left(-1)); } TEST(fxcrt, WideStringRight) { @@ -512,12 +493,10 @@ TEST(fxcrt, WideStringRight) { EXPECT_EQ(L"FRED", fred.Right(4)); EXPECT_EQ(L"", fred.Right(5)); - EXPECT_EQ(L"", fred.Right(-1)); CFX_WideString empty; EXPECT_EQ(L"", empty.Right(0)); EXPECT_EQ(L"", empty.Right(1)); - EXPECT_EQ(L"", empty.Right(-1)); } TEST(fxcrt, WideStringFind) { @@ -818,9 +797,6 @@ TEST(fxcrt, WideStringCFromVector) { TEST(fxcrt, WideStringCElementAccess) { CFX_WideStringC abc(L"abc"); -#ifndef NDEBUG - EXPECT_DEATH({ abc[-1]; }, ".*"); -#endif EXPECT_EQ(L'a', static_cast(abc[0])); EXPECT_EQ(L'b', static_cast(abc[1])); EXPECT_EQ(L'c', static_cast(abc[2])); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index fd1b2ff9bc..80981d97d6 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -1772,7 +1772,7 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue, dot_index = !dot_index.has_value() ? len : dot_index; if (dot_index.value() >= 1) { - int nPos = dot_index.value() % 3; + FX_STRSIZE nPos = dot_index.value() % 3; wsOutput.clear(); for (FX_STRSIZE i = 0; i < dot_index.value(); i++) { if (i % 3 == nPos && i != 0) -- cgit v1.2.3