summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-28 16:47:07 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-28 16:47:07 -0700
commit698c5716d005860360527e4cfe15b4a185589117 (patch)
tree7e82388a12f3de2b6fb179181d77b47d2c547df7 /core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
parent4ba37c6f6964f6a24fc4b8b48bc82c02edb70370 (diff)
downloadpdfium-698c5716d005860360527e4cfe15b4a185589117.tar.xz
Use string pools in some dictionaries, names, and strings.
BUG=pdfium:597 Review-Url: https://codereview.chromium.org/2345063002
Diffstat (limited to 'core/fpdfapi/fpdf_page/fpdf_page_parser.cpp')
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 46ab067b3e..881f9eed25 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -281,7 +281,8 @@ void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
if (len > 32) {
param.m_Type = ContentParam::OBJECT;
- param.m_pObject = new CPDF_Name(PDF_NameDecode(bsName));
+ param.m_pObject = new CPDF_Name(
+ m_pDocument->GetByteStringPool()->Intern(PDF_NameDecode(bsName)));
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Find('#') == -1) {
@@ -343,8 +344,8 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
return pNumber;
}
if (param.m_Type == ContentParam::NAME) {
- CPDF_Name* pName = new CPDF_Name(
- CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
+ CPDF_Name* pName = new CPDF_Name(m_pDocument->GetByteStringPool()->Intern(
+ CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len)));
param.m_Type = ContentParam::OBJECT;
param.m_pObject = pName;
return pName;
@@ -589,7 +590,8 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
void CPDF_StreamContentParser::Handle_BeginImage() {
FX_FILESIZE savePos = m_pSyntax->GetPos();
- CPDF_Dictionary* pDict = new CPDF_Dictionary;
+ CPDF_Dictionary* pDict =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
while (1) {
CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement();
if (type == CPDF_StreamParser::Keyword) {
@@ -1499,7 +1501,7 @@ uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData,
return dwSize;
}
uint32_t InitObjCount = m_pObjectHolder->GetPageObjectList()->size();
- CPDF_StreamParser syntax(pData, dwSize);
+ CPDF_StreamParser syntax(pData, dwSize, m_pDocument->GetByteStringPool());
CPDF_StreamParserAutoClearer auto_clearer(&m_pSyntax, &syntax);
while (1) {
uint32_t cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount;