diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-05 11:02:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-05 11:02:18 -0700 |
commit | 179bebb9a14dfd3ba91e9e068d4d436657a7c780 (patch) | |
tree | 895a59bfcf85a4730badfb2a6df71cf8679a2249 /core/fpdfapi | |
parent | 4cd49e1c6076bd9ef2d18480d893038822668262 (diff) | |
download | pdfium-179bebb9a14dfd3ba91e9e068d4d436657a7c780.tar.xz |
Rename GetCStr and GetPtr to match CFX_ByteString.
This CL updates CFX_ByteStringC to use the more common c_str
and raw_str instead of GetCStr and GetPtr.
Review URL: https://codereview.chromium.org/1857713003
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/fpdf_font/fpdf_font.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp | 12 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 2 |
7 files changed, 17 insertions, 17 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index aff2b72960..9670aa8e7f 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -131,7 +131,7 @@ uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { // Static. uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.GetCStr(); + const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return 0; @@ -171,7 +171,7 @@ static CFX_WideString StringDataAdd(CFX_WideString str) { // Static. CFX_WideString CPDF_ToUnicodeMap::StringToWideString( const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.GetCStr(); + const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return CFX_WideString(); diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp index 2e4b5e4dff..37ec63fb8b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp @@ -89,7 +89,7 @@ void CPDF_GeneralStateData::SetBlendMode(const CFX_ByteStringC& blend_mode) { if (blend_mode.GetLength() > 15) { return; } - FXSYS_memcpy(m_BlendMode, blend_mode.GetPtr(), blend_mode.GetLength()); + FXSYS_memcpy(m_BlendMode, blend_mode.raw_str(), blend_mode.GetLength()); m_BlendMode[blend_mode.GetLength()] = 0; m_BlendType = GetBlendTypeInternal(blend_mode); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 6c1738d5a6..17fd891d1b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -34,7 +34,7 @@ void TestArrayAccessors(const CPDF_Array* arr, CPDF_Dictionary* dict_val, CPDF_Stream* stream_val) { EXPECT_STREQ(str_val, arr->GetStringAt(index).c_str()); - EXPECT_STREQ(const_str_val, arr->GetConstStringAt(index).GetCStr()); + EXPECT_STREQ(const_str_val, arr->GetConstStringAt(index).c_str()); EXPECT_EQ(int_val, arr->GetIntegerAt(index)); EXPECT_EQ(float_val, arr->GetNumberAt(index)); EXPECT_EQ(float_val, arr->GetFloatAt(index)); @@ -207,10 +207,10 @@ TEST_F(PDFObjectsTest, GetConstString) { for (size_t i = 0; i < m_DirectObjs.size(); ++i) { if (!direct_obj_results[i]) { EXPECT_EQ(direct_obj_results[i], - m_DirectObjs[i]->GetConstString().GetCStr()); + m_DirectObjs[i]->GetConstString().c_str()); } else { EXPECT_STREQ(direct_obj_results[i], - m_DirectObjs[i]->GetConstString().GetCStr()); + m_DirectObjs[i]->GetConstString().c_str()); } } // Check indirect references. @@ -218,10 +218,10 @@ TEST_F(PDFObjectsTest, GetConstString) { nullptr, nullptr, nullptr}; for (size_t i = 0; i < m_RefObjs.size(); ++i) { if (!indirect_obj_results[i]) { - EXPECT_EQ(nullptr, m_RefObjs[i]->GetConstString().GetCStr()); + EXPECT_EQ(nullptr, m_RefObjs[i]->GetConstString().c_str()); } else { EXPECT_STREQ(indirect_obj_results[i], - m_RefObjs[i]->GetConstString().GetCStr()); + m_RefObjs[i]->GetConstString().c_str()); } } } @@ -677,7 +677,7 @@ TEST(PDFArrayTest, GetTypeAt) { 0, 0, 0, 0, 0, 0, 0}; for (size_t i = 0; i < arr->GetCount(); ++i) { EXPECT_STREQ(expected_str[i], arr->GetStringAt(i).c_str()); - EXPECT_STREQ(expected_cstr[i], arr->GetConstStringAt(i).GetCStr()); + EXPECT_STREQ(expected_cstr[i], arr->GetConstStringAt(i).c_str()); EXPECT_EQ(expected_int[i], arr->GetIntegerAt(i)); EXPECT_EQ(expected_float[i], arr->GetNumberAt(i)); EXPECT_EQ(expected_float[i], arr->GetFloatAt(i)); diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp index e32021e25d..394004dfc4 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp @@ -12,7 +12,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize) : m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {} CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) - : m_pData(str.GetPtr()), m_dwSize(str.GetLength()), m_dwCurPos(0) {} + : m_pData(str.raw_str()), m_dwSize(str.GetLength()), m_dwCurPos(0) {} void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) { pStart = nullptr; diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp index 67287dfd5a..db3ccf5e3d 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp @@ -54,7 +54,7 @@ TEST(SimpleParserTest, GetWord) { CFX_ByteStringC word = parser.GetWord(); EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected), data.expected_size), - std::string(word.GetCStr(), word.GetLength())) + std::string(word.c_str(), word.GetLength())) << " for case " << i; } } diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index d04a682b77..3deecf54ff 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -662,7 +662,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, // Earlier version of PDF specification doesn't require EOL marker before // 'endstream' keyword. If keyword 'endstream' follows the bytes in // specified length, it signals the end of stream. - if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.GetPtr(), + if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.raw_str(), kEndStreamStr.GetLength()) == 0) { bSearchForKeyword = FALSE; } @@ -774,8 +774,8 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, int numMarkers = ReadEOLMarkers(m_Pos); if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && numMarkers != 0 && - FXSYS_memcmp(m_WordBuffer, kEndObjStr.GetPtr(), kEndObjStr.GetLength()) == - 0) { + FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), + kEndObjStr.GetLength()) == 0) { m_Pos = streamStartPos; } return pStream; @@ -849,7 +849,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, if (!bForward) offset = taglen - 1; - const uint8_t* tag_data = tag.GetPtr(); + const uint8_t* tag_data = tag.raw_str(); uint8_t byte; while (1) { if (bForward) { @@ -921,7 +921,7 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, if (tags[i] == 0) { uint32_t len = i - start; max_len = std::max(len, max_len); - patterns[itag].m_pTag = tags.GetCStr() + start; + patterns[itag].m_pTag = tags.c_str() + start; patterns[itag].m_Len = len; patterns[itag].m_Offset = 0; start = i + 1; diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 8228c497e9..31e7388bd7 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -88,7 +88,7 @@ int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) { CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) { int size = bstr.GetLength(); - const FX_CHAR* pSrc = bstr.GetCStr(); + const FX_CHAR* pSrc = bstr.c_str(); if (!FXSYS_memchr(pSrc, '#', size)) { return bstr; } |