summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_annot.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-11 18:14:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-11 18:14:56 -0700
commit822484b5f88d92dbcd567b1c2da38af1e720b56f (patch)
treede1902c744cbe38023432cc3f860d99df90beb70 /core/fpdfdoc/doc_annot.cpp
parente09c1e4db92e28a332f55aa3c80ceb44f4b74287 (diff)
downloadpdfium-822484b5f88d92dbcd567b1c2da38af1e720b56f.tar.xz
Remove CPDF_Object::GetConstString and overrides
GetConstString() has sharp edges in that when applied to a CPDF_Number, it must return null whereas GetString() returns a the stringified number, because of the inability to control the lifetime of the underlying allocated string. Deleting this method showed several places where we actually wanted a *String, not a *StringC, so we were re-allocating a string we already had. Review URL: https://codereview.chromium.org/1879683002
Diffstat (limited to 'core/fpdfdoc/doc_annot.cpp')
-rw-r--r--core/fpdfdoc/doc_annot.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 8650fbd23d..3b90b0b4b5 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -43,7 +43,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pDict = pAnnots->GetDictAt(i);
}
m_AnnotList.push_back(new CPDF_Annot(pDict, this));
- if (bRegenerateAP && pDict->GetConstStringBy("Subtype") == "Widget" &&
+ if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
CPDF_InterForm::UpdatingAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
}
@@ -127,10 +127,12 @@ void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage,
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
: m_pAnnotDict(pDict),
m_pList(pList),
- m_sSubtype(m_pAnnotDict->GetConstStringBy("Subtype")) {}
+ m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")) {}
+
CPDF_Annot::~CPDF_Annot() {
ClearCachedAP();
}
+
void CPDF_Annot::ClearCachedAP() {
for (const auto& pair : m_APMap) {
delete pair.second;