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

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_func.cpp

Issue 2000973002: Make CPDF_Function::Load() return an unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix build, nits Created 4 years, 7 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/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_func.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
index bb1d631576b70f6035a9b6fe1c815a41f8596580..ed8e6093d58787879df230a0dd8c27e81427b51d 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
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698