summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-16 17:31:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-16 17:31:18 -0800
commit5913a6ca71c85401e3f5317758d44a9fc4a667b2 (patch)
tree388ad0bd98b44a47c251568e198e2c3c231c7d30 /core/fpdfapi/parser/cpdf_document.cpp
parentcc4d0a44f3025821f88f3ed1ee78dfdc416487c7 (diff)
downloadpdfium-5913a6ca71c85401e3f5317758d44a9fc4a667b2.tar.xz
Make CPDF_Object subclass constructors intern strings
Make CDPF_Arrays intern the object they create. Allow passing nullptr as a CFX_WeakPtr shortcut as well. Review-Url: https://codereview.chromium.org/2509123002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 9d1db26e30..c7f99fa6ef 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -647,19 +647,19 @@ CPDF_Image* CPDF_Document::LoadImageFromPageData(uint32_t dwStreamObjNum) {
void CPDF_Document::CreateNewDoc() {
ASSERT(!m_pRootDict && !m_pInfoDict);
- m_pRootDict = NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ m_pRootDict = NewIndirect<CPDF_Dictionary>();
m_pRootDict->SetNameFor("Type", "Catalog");
- CPDF_Dictionary* pPages = NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pPages = NewIndirect<CPDF_Dictionary>();
pPages->SetNameFor("Type", "Pages");
pPages->SetNumberFor("Count", 0);
pPages->SetFor("Kids", new CPDF_Array);
m_pRootDict->SetReferenceFor("Pages", this, pPages);
- m_pInfoDict = NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ m_pInfoDict = NewIndirect<CPDF_Dictionary>();
}
CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) {
- CPDF_Dictionary* pDict = NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pDict = NewIndirect<CPDF_Dictionary>();
pDict->SetNameFor("Type", "Page");
uint32_t dwObjNum = pDict->GetObjNum();
if (!InsertNewPage(iPage, pDict)) {
@@ -778,8 +778,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
if (i == FX_ArraySize(g_FX_CharsetUnicodes))
return i;
- CPDF_Dictionary* pEncodingDict =
- NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pEncodingDict = NewIndirect<CPDF_Dictionary>();
pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
@@ -801,8 +800,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
bool bVert,
CFX_ByteString basefont,
std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert) {
- CPDF_Dictionary* pFontDict =
- NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
CFX_ByteString cmap;
CFX_ByteString ordering;
int supplement = 0;
@@ -877,8 +875,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(),
false, false, charset == FXFONT_SYMBOL_CHARSET);
- CPDF_Dictionary* pBaseDict =
- NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pBaseDict = NewIndirect<CPDF_Dictionary>();
pBaseDict->SetNameFor("Type", "Font");
std::unique_ptr<CFX_UnicodeEncoding> pEncoding(
new CFX_UnicodeEncoding(pFont));
@@ -1008,8 +1005,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
ptm->otmrcFontBox.right, ptm->otmrcFontBox.top};
FX_Free(tm_buf);
basefont.Replace(" ", "");
- CPDF_Dictionary* pBaseDict =
- NewIndirect<CPDF_Dictionary>(GetByteStringPool());
+ CPDF_Dictionary* pBaseDict = NewIndirect<CPDF_Dictionary>();
pBaseDict->SetNameFor("Type", "Font");
CPDF_Dictionary* pFontDict = pBaseDict;
if (!bCJK) {