From 81f9eeef041f2974274751d7508598049ae32db2 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 5 Sep 2017 15:33:18 -0400 Subject: Convert FX_STRSIZE int->size_t Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fpdfapi/font/cpdf_cmapparser_unittest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/fpdfapi') diff --git a/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp b/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp index 0d55aa274d..8d99b0dbff 100644 --- a/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp +++ b/core/fpdfapi/font/cpdf_cmapparser_unittest.cpp @@ -45,11 +45,11 @@ TEST(cpdf_cmapparser, CMap_GetCodeRange) { // m_CharSize must be <= 4 EXPECT_FALSE(CPDF_CMapParser::CMap_GetCodeRange(range, "", "")); - EXPECT_EQ(5, range.m_CharSize); + EXPECT_EQ(5u, range.m_CharSize); EXPECT_TRUE( CPDF_CMapParser::CMap_GetCodeRange(range, "<12345678>", "<87654321>")); - EXPECT_EQ(4, range.m_CharSize); + EXPECT_EQ(4u, range.m_CharSize); { uint8_t lower[4] = {18, 52, 86, 120}; uint8_t upper[4] = {135, 101, 67, 33}; @@ -59,13 +59,13 @@ TEST(cpdf_cmapparser, CMap_GetCodeRange) { // Hex characters EXPECT_TRUE(CPDF_CMapParser::CMap_GetCodeRange(range, "", "")); - EXPECT_EQ(1, range.m_CharSize); + EXPECT_EQ(1u, range.m_CharSize); EXPECT_EQ(161, range.m_Lower[0]); EXPECT_EQ(243, range.m_Upper[0]); // The second string should return 0's if it is shorter EXPECT_TRUE(CPDF_CMapParser::CMap_GetCodeRange(range, "", "")); - EXPECT_EQ(1, range.m_CharSize); + EXPECT_EQ(1u, range.m_CharSize); EXPECT_EQ(161, range.m_Lower[0]); EXPECT_EQ(0, range.m_Upper[0]); } -- cgit v1.2.3