summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-05 11:02:18 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-05 11:02:18 -0700
commit179bebb9a14dfd3ba91e9e068d4d436657a7c780 (patch)
tree895a59bfcf85a4730badfb2a6df71cf8679a2249 /core/fpdfapi/fpdf_parser
parent4cd49e1c6076bd9ef2d18480d893038822668262 (diff)
downloadpdfium-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/fpdf_parser')
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp12
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp10
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp2
5 files changed, 14 insertions, 14 deletions
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;
}