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

Side by Side Diff: fpdfsdk/fpdfppo.cpp

Issue 2495003006: Fix unique ptrs in fpdfppo.cpp (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/fpdfppo_embeddertest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "public/fpdf_ppo.h" 7 #include "public/fpdf_ppo.h"
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 std::unique_ptr<CPDF_Object> pClone = pDirect->Clone(); 278 std::unique_ptr<CPDF_Object> pClone = pDirect->Clone();
279 if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { 279 if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) {
280 if (pDictClone->KeyExist("Type")) { 280 if (pDictClone->KeyExist("Type")) {
281 CFX_ByteString strType = pDictClone->GetStringFor("Type"); 281 CFX_ByteString strType = pDictClone->GetStringFor("Type");
282 if (!FXSYS_stricmp(strType.c_str(), "Pages")) 282 if (!FXSYS_stricmp(strType.c_str(), "Pages"))
283 return 4; 283 return 4;
284 if (!FXSYS_stricmp(strType.c_str(), "Page")) 284 if (!FXSYS_stricmp(strType.c_str(), "Page"))
285 return 0; 285 return 0;
286 } 286 }
287 } 287 }
288 dwNewObjNum = pDoc->AddIndirectObject(pClone.get()); 288 CPDF_Object* pUnownedClone = pClone.get();
289 dwNewObjNum = pDoc->AddIndirectObject(pClone.release());
289 (*pObjNumberMap)[dwObjnum] = dwNewObjNum; 290 (*pObjNumberMap)[dwObjnum] = dwNewObjNum;
290 if (!UpdateReference(pClone.get(), pDoc, pObjNumberMap)) 291 if (!UpdateReference(pUnownedClone, pDoc, pObjNumberMap))
291 return 0; 292 return 0;
292 293
293 pClone.release(); // TODO(tsepez): figure out ownership.
294 return dwNewObjNum; 294 return dwNewObjNum;
295 } 295 }
296 296
297 FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, 297 FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring,
298 std::vector<uint16_t>* pageArray, 298 std::vector<uint16_t>* pageArray,
299 int nCount) { 299 int nCount) {
300 if (rangstring.GetLength() != 0) { 300 if (rangstring.GetLength() != 0) {
301 rangstring.Remove(' '); 301 rangstring.Remove(' ');
302 int nLength = rangstring.GetLength(); 302 int nLength = rangstring.GetLength();
303 CFX_ByteString cbCompareString("0123456789-,"); 303 CFX_ByteString cbCompareString("0123456789-,");
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return false; 388 return false;
389 389
390 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 390 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
391 if (!pDstDict) 391 if (!pDstDict)
392 return false; 392 return false;
393 393
394 pDstDict->SetFor("ViewerPreferences", 394 pDstDict->SetFor("ViewerPreferences",
395 pSrcDict->CloneDirectObject().release()); 395 pSrcDict->CloneDirectObject().release());
396 return true; 396 return true;
397 } 397 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fpdfppo_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698