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

Unified Diff: fpdfsdk/cpdfsdk_baannot.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compile Created 4 years, 3 months 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/fxge/include/cfx_renderdevice.h ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_baannot.cpp
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 836298f50da47af301c480da0191203d70581e4e..7f3b6f4e12ccadb4b7450a94ff17c4b002020110 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -162,35 +162,33 @@ int CPDFSDK_BAAnnot::GetStructParent() const {
// border
void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) {
CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border");
-
if (pBorder) {
pBorder->SetAt(2, new CPDF_Number(nWidth));
} else {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
-
if (!pBSDict) {
- pBSDict = new CPDF_Dictionary;
+ pBSDict =
+ new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
}
-
pBSDict->SetIntegerFor("W", nWidth);
}
}
int CPDFSDK_BAAnnot::GetBorderWidth() const {
- if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border")) {
+ if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"))
return pBorder->GetIntegerAt(2);
- }
- if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS")) {
+
+ if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"))
return pBSDict->GetIntegerFor("W", 1);
- }
+
return 1;
}
void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS");
if (!pBSDict) {
- pBSDict = new CPDF_Dictionary;
+ pBSDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict);
}
@@ -297,22 +295,21 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
const CFX_ByteString& sContents,
const CFX_ByteString& sAPState) {
CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP");
-
if (!pAPDict) {
- pAPDict = new CPDF_Dictionary;
+ pAPDict = new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
m_pAnnot->GetAnnotDict()->SetFor("AP", pAPDict);
}
CPDF_Stream* pStream = nullptr;
CPDF_Dictionary* pParentDict = nullptr;
-
if (sAPState.IsEmpty()) {
pParentDict = pAPDict;
pStream = pAPDict->GetStreamFor(sAPType);
} else {
CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictFor(sAPType);
if (!pAPTypeDict) {
- pAPTypeDict = new CPDF_Dictionary;
+ pAPTypeDict =
+ new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
pAPDict->SetFor(sAPType, pAPTypeDict);
}
pParentDict = pAPTypeDict;
@@ -328,7 +325,8 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
CPDF_Dictionary* pStreamDict = pStream->GetDict();
if (!pStreamDict) {
- pStreamDict = new CPDF_Dictionary;
+ pStreamDict =
+ new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool());
pStreamDict->SetNameFor("Type", "XObject");
pStreamDict->SetNameFor("Subtype", "Form");
pStreamDict->SetIntegerFor("FormType", 1);
« no previous file with comments | « core/fxge/include/cfx_renderdevice.h ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698