summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-23 14:56:02 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-23 14:56:02 -0700
commit490d6128e6faef423fa6f965f792513e138bc04a (patch)
treec9e3ea73ae672b0861c92a188a9b84e808d827ea /core/fpdfapi/fpdf_page/fpdf_page_func.cpp
parent109975b30dbb2b047001a840b8a1e77434fce7b3 (diff)
downloadpdfium-490d6128e6faef423fa6f965f792513e138bc04a.tar.xz
Make CPDF_Function::Load() return an unique_ptr.chromium/2750chromium/2749chromium/2748
Review-Url: https://codereview.chromium.org/2000973002
Diffstat (limited to 'core/fpdfapi/fpdf_page/fpdf_page_func.cpp')
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_func.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
index bb1d631576..ed8e6093d5 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -792,9 +792,10 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
}
// static
-CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
+std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) {
+ std::unique_ptr<CPDF_Function> pFunc;
if (!pFuncObj)
- return nullptr;
+ return pFunc;
int iType = -1;
if (CPDF_Stream* pStream = pFuncObj->AsStream())
@@ -803,7 +804,6 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
iType = pDict->GetIntegerBy("FunctionType");
Type type = IntegerToFunctionType(iType);
- std::unique_ptr<CPDF_Function> pFunc;
if (type == Type::kType0Sampled)
pFunc.reset(new CPDF_SampledFunc());
else if (type == Type::kType2ExpotentialInterpolation)
@@ -814,8 +814,8 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
pFunc.reset(new CPDF_PSFunc());
if (!pFunc || !pFunc->Init(pFuncObj))
- return nullptr;
- return pFunc.release();
+ return std::unique_ptr<CPDF_Function>();
+ return pFunc;
}
// static