Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2342)

Unified Diff: core/fpdfapi/parser/cpdf_syntax_parser.cpp

Issue 2509123002: Make CPDF_Object subclass constructors intern strings (Closed)
Patch Set: Nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.h ('k') | core/fpdfdoc/cpdf_filespec_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_syntax_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 6a3db602860adfaacc3be4bd82dcce808b7d874e..6a38ce8c45b5557fb1f3c8da20c8da9125ea62e5 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -402,13 +402,13 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
CFX_ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return pdfium::MakeUnique<CPDF_String>(MaybeIntern(str), false);
+ return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return pdfium::MakeUnique<CPDF_String>(MaybeIntern(str), true);
+ return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
}
if (word == "[") {
std::unique_ptr<CPDF_Array> pArray = pdfium::MakeUnique<CPDF_Array>();
@@ -419,8 +419,9 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
return std::move(pArray);
}
if (word[0] == '/') {
- return pdfium::MakeUnique<CPDF_Name>(MaybeIntern(
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))));
+ return pdfium::MakeUnique<CPDF_Name>(
+ m_pPool,
+ PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
int32_t nKeys = 0;
@@ -522,13 +523,13 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
CFX_ByteString str = ReadString();
if (m_pCryptoHandler)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return pdfium::MakeUnique<CPDF_String>(MaybeIntern(str), false);
+ return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
CFX_ByteString str = ReadHexString();
if (m_pCryptoHandler)
m_pCryptoHandler->Decrypt(objnum, gennum, str);
- return pdfium::MakeUnique<CPDF_String>(MaybeIntern(str), true);
+ return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
}
if (word == "[") {
std::unique_ptr<CPDF_Array> pArray = pdfium::MakeUnique<CPDF_Array>();
@@ -539,8 +540,9 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
return m_WordBuffer[0] == ']' ? std::move(pArray) : nullptr;
}
if (word[0] == '/') {
- return pdfium::MakeUnique<CPDF_Name>(MaybeIntern(
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))));
+ return pdfium::MakeUnique<CPDF_Name>(
+ m_pPool,
+ PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
std::unique_ptr<CPDF_Dictionary> pDict =
@@ -916,7 +918,3 @@ void CPDF_SyntaxParser::SetEncrypt(
std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) {
m_pCryptoHandler = std::move(pCryptoHandler);
}
-
-CFX_ByteString CPDF_SyntaxParser::MaybeIntern(const CFX_ByteString& str) {
- return m_pPool ? m_pPool->Intern(str) : str;
-}
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.h ('k') | core/fpdfdoc/cpdf_filespec_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698