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

Side by Side Diff: core/fpdfapi/page/cpdf_colorspace.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (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 | « core/fpdfapi/page/cpdf_allstates.cpp ('k') | core/fpdfapi/page/cpdf_docpagedata.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfapi/page/cpdf_colorspace.h" 7 #include "core/fpdfapi/page/cpdf_colorspace.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return std::unique_ptr<CPDF_ColorSpace>( 338 return std::unique_ptr<CPDF_ColorSpace>(
339 ColorspaceFromName(pObj->GetString())); 339 ColorspaceFromName(pObj->GetString()));
340 } 340 }
341 if (CPDF_Stream* pStream = pObj->AsStream()) { 341 if (CPDF_Stream* pStream = pObj->AsStream()) {
342 CPDF_Dictionary* pDict = pStream->GetDict(); 342 CPDF_Dictionary* pDict = pStream->GetDict();
343 if (!pDict) 343 if (!pDict)
344 return nullptr; 344 return nullptr;
345 345
346 for (const auto& it : *pDict) { 346 for (const auto& it : *pDict) {
347 std::unique_ptr<CPDF_ColorSpace> pRet; 347 std::unique_ptr<CPDF_ColorSpace> pRet;
348 CPDF_Object* pValue = it.second; 348 CPDF_Object* pValue = it.second.get();
349 if (ToName(pValue)) 349 if (ToName(pValue))
350 pRet.reset(ColorspaceFromName(pValue->GetString())); 350 pRet.reset(ColorspaceFromName(pValue->GetString()));
351 if (pRet) 351 if (pRet)
352 return pRet; 352 return pRet;
353 } 353 }
354 return nullptr; 354 return nullptr;
355 } 355 }
356 356
357 CPDF_Array* pArray = pObj->AsArray(); 357 CPDF_Array* pArray = pObj->AsArray();
358 if (!pArray || pArray->IsEmpty()) 358 if (!pArray || pArray->IsEmpty())
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1268
1269 return m_pAltCS->GetRGB(results, R, G, B); 1269 return m_pAltCS->GetRGB(results, R, G, B);
1270 } 1270 }
1271 1271
1272 void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled) { 1272 void CPDF_DeviceNCS::EnableStdConversion(bool bEnabled) {
1273 CPDF_ColorSpace::EnableStdConversion(bEnabled); 1273 CPDF_ColorSpace::EnableStdConversion(bEnabled);
1274 if (m_pAltCS) { 1274 if (m_pAltCS) {
1275 m_pAltCS->EnableStdConversion(bEnabled); 1275 m_pAltCS->EnableStdConversion(bEnabled);
1276 } 1276 }
1277 } 1277 }
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_allstates.cpp ('k') | core/fpdfapi/page/cpdf_docpagedata.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698