summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-19 10:45:09 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-19 10:45:09 -0700
commite6db16e7e6cdc3dd213c16de0d792b77656ac7a6 (patch)
tree2097b754b075107b8cd149eb99c62cdd2db06ac8 /core/fpdfdoc/cpvt_generateap.cpp
parenta5b37f6b916f1a35d3fbb3f0b41e9e4b4d265370 (diff)
downloadpdfium-e6db16e7e6cdc3dd213c16de0d792b77656ac7a6.tar.xz
Clean up CPDF_Stream.
Replace the CPDF_Stream(nullptr, 0, nullptr) pattern with a default ctor. Remove unused parameters from CPDF_Stream::SetData(). Both are always passed as FALSE. CPDF_Stream declared its own m_GenNum, which shadowed the one in CPDF_Object. It was used only to distinguish file/memory streams, so add a bool explicitly for this purpose. Remove the union, it would be sad if we confused user data with a C++ object with virtual function calls. Use unique_ptrs with appropriate deleters to manage memory. Review-Url: https://codereview.chromium.org/2347993002
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index d37aaf3acb..1e531799e8 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -166,7 +166,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N");
if (!pNormalStream) {
- pNormalStream = new CPDF_Stream(nullptr, 0, nullptr);
+ pNormalStream = new CPDF_Stream;
int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
}
@@ -418,8 +418,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
} break;
}
if (pNormalStream) {
- pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE,
- FALSE);
+ pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize());
pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
pStreamDict->SetMatrixFor("Matrix", matrix);
@@ -591,12 +590,10 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
CPDF_Dictionary* pAPDict = new CPDF_Dictionary;
pAnnotDict->SetFor("AP", pAPDict);
- CPDF_Stream* pNormalStream = new CPDF_Stream(nullptr, 0, nullptr);
+ CPDF_Stream* pNormalStream = new CPDF_Stream;
int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
-
- pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE,
- FALSE);
+ pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize());
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
pStreamDict->SetIntegerFor("FormType", 1);
@@ -607,7 +604,6 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
? CPDF_Annot::RectFromQuadPoints(pAnnotDict)
: pAnnotDict->GetRectFor("Rect");
pStreamDict->SetRectFor("BBox", rect);
-
pStreamDict->SetFor("Resources", pResourceDict);
}