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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_icc.cpp

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/pdf_vt.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.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 "../../../../third_party/lcms2-2.6/include/lcms2.h" 7 #include "../../../../third_party/lcms2-2.6/include/lcms2.h"
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "codec_int.h" 9 #include "codec_int.h"
10 10
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 507 }
508 return pTransformCache->m_pCmm; 508 return pTransformCache->m_pCmm;
509 } 509 }
510 CCodec_IccModule::~CCodec_IccModule() 510 CCodec_IccModule::~CCodec_IccModule()
511 { 511 {
512 FX_POSITION pos = m_MapProfile.GetStartPosition(); 512 FX_POSITION pos = m_MapProfile.GetStartPosition();
513 CFX_ByteString key; 513 CFX_ByteString key;
514 CFX_IccProfileCache* pProfileCache; 514 CFX_IccProfileCache* pProfileCache;
515 while (pos) { 515 while (pos) {
516 m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache); 516 m_MapProfile.GetNextAssoc(pos, key, (void*&)pProfileCache);
517 if (pProfileCache) { 517 delete pProfileCache;
518 delete pProfileCache;
519 }
520 } 518 }
521 pos = m_MapTranform.GetStartPosition(); 519 pos = m_MapTranform.GetStartPosition();
522 CFX_IccTransformCache* pTransformCache; 520 CFX_IccTransformCache* pTransformCache;
523 while (pos) { 521 while (pos) {
524 m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache); 522 m_MapTranform.GetNextAssoc(pos, key, (void*&)pTransformCache);
525 if (pTransformCache) { 523 delete pTransformCache;
526 delete pTransformCache;
527 }
528 } 524 }
529 } 525 }
530 void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWO RD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat) 526 void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, FX_DWO RD dwProfileSize, int32_t& nComponents, int32_t intent, FX_DWORD dwSrcFormat)
531 { 527 {
532 return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); 528 return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat);
533 } 529 }
534 void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_ DWORD dwSrcProfileSize, int32_t& nSrcComponents, 530 void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, FX_ DWORD dwSrcProfileSize, int32_t& nSrcComponents,
535 const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent, 531 const uint8_t* pDstProfileData, FX_DWORD dwDstProfileSize, int32_t intent,
536 FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat) 532 FX_DWORD dwSrcFormat , FX_DWORD dwDstFormat)
537 { 533 {
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 uint8_t c1 = FXSYS_round(c * 255); 1357 uint8_t c1 = FXSYS_round(c * 255);
1362 uint8_t m1 = FXSYS_round(m * 255); 1358 uint8_t m1 = FXSYS_round(m * 255);
1363 uint8_t y1 = FXSYS_round(y * 255); 1359 uint8_t y1 = FXSYS_round(y * 255);
1364 uint8_t k1 = FXSYS_round(k * 255); 1360 uint8_t k1 = FXSYS_round(k * 255);
1365 uint8_t r, g, b; 1361 uint8_t r, g, b;
1366 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b); 1362 AdobeCMYK_to_sRGB1(c1, m1, y1, k1, r, g, b);
1367 R = 1.0f * r / 255; 1363 R = 1.0f * r / 255;
1368 G = 1.0f * g / 255; 1364 G = 1.0f * g / 255;
1369 B = 1.0f * b / 255; 1365 B = 1.0f * b / 255;
1370 } 1366 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/pdf_vt.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698