summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/fpdf_page_func.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-04 14:37:18 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-04 21:48:48 +0000
commitafd0d1f488ea55da545b3310fd8f22e45522a695 (patch)
tree89136eba4669421b6f828edb9f3d69ee558110d0 /core/fpdfapi/page/fpdf_page_func.cpp
parent4f8b044b95dc282959dfe41453e2a9c1ec7e9354 (diff)
downloadpdfium-afd0d1f488ea55da545b3310fd8f22e45522a695.tar.xz
RefCount CPDF_StreamAcc all the time.
Pass stream argument to constructor; it feels like a stream accessor should always be made from a stream rather than passing one in after the fact. Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44 Reviewed-on: https://pdfium-review.googlesource.com/3620 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/fpdf_page_func.cpp')
-rw-r--r--core/fpdfapi/page/fpdf_page_func.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp
index 9be1edb7ff..bc66adf726 100644
--- a/core/fpdfapi/page/fpdf_page_func.cpp
+++ b/core/fpdfapi/page/fpdf_page_func.cpp
@@ -90,10 +90,10 @@ class CPDF_PSFunc : public CPDF_Function {
};
bool CPDF_PSFunc::v_Init(CPDF_Object* pObj) {
- CPDF_StreamAcc acc;
- acc.LoadAllData(pObj->AsStream(), false);
- return m_PS.Parse(reinterpret_cast<const char*>(acc.GetData()),
- acc.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pObj->AsStream());
+ pAcc->LoadAllData(false);
+ return m_PS.Parse(reinterpret_cast<const char*>(pAcc->GetData()),
+ pAcc->GetSize());
}
bool CPDF_PSFunc::v_Call(float* inputs, float* results) const {
@@ -487,8 +487,8 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
return false;
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
- m_pSampleStream = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pSampleStream->LoadAllData(pStream, false);
+ m_pSampleStream = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pSampleStream->LoadAllData(false);
FX_SAFE_UINT32 nTotalSampleBits = 1;
m_EncodeInfo.resize(m_nInputs);
for (uint32_t i = 0; i < m_nInputs; i++) {