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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_colors.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/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_func.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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "pageint.h" 10 #include "pageint.h"
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 923
924 CPDF_ColorSpace* m_pAltCS; 924 CPDF_ColorSpace* m_pAltCS;
925 CPDF_Function* m_pFunc; 925 CPDF_Function* m_pFunc;
926 enum { None, All, Colorant } m_Type; 926 enum { None, All, Colorant } m_Type;
927 }; 927 };
928 CPDF_SeparationCS::~CPDF_SeparationCS() 928 CPDF_SeparationCS::~CPDF_SeparationCS()
929 { 929 {
930 if (m_pAltCS) { 930 if (m_pAltCS) {
931 m_pAltCS->ReleaseCS(); 931 m_pAltCS->ReleaseCS();
932 } 932 }
933 if (m_pFunc) { 933 delete m_pFunc;
934 delete m_pFunc;
935 }
936 } 934 }
937 void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA T& min, FX_FLOAT& max) const 935 void CPDF_SeparationCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOA T& min, FX_FLOAT& max) const
938 { 936 {
939 value = 1.0f; 937 value = 1.0f;
940 min = 0; 938 min = 0;
941 max = 1.0f; 939 max = 1.0f;
942 } 940 }
943 FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) 941 FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
944 { 942 {
945 CFX_ByteString name = pArray->GetString(1); 943 CFX_ByteString name = pArray->GetString(1);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override; 1011 void GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOA T& max) const override;
1014 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; 1012 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override;
1015 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override; 1013 FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const override;
1016 void EnableStdConversion(FX_BOOL bEnabled) override; 1014 void EnableStdConversion(FX_BOOL bEnabled) override;
1017 1015
1018 CPDF_ColorSpace* m_pAltCS; 1016 CPDF_ColorSpace* m_pAltCS;
1019 CPDF_Function* m_pFunc; 1017 CPDF_Function* m_pFunc;
1020 }; 1018 };
1021 CPDF_DeviceNCS::~CPDF_DeviceNCS() 1019 CPDF_DeviceNCS::~CPDF_DeviceNCS()
1022 { 1020 {
1023 if (m_pFunc) { 1021 delete m_pFunc;
1024 delete m_pFunc;
1025 }
1026 if (m_pAltCS) { 1022 if (m_pAltCS) {
1027 m_pAltCS->ReleaseCS(); 1023 m_pAltCS->ReleaseCS();
1028 } 1024 }
1029 } 1025 }
1030 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const 1026 void CPDF_DeviceNCS::GetDefaultValue(int iComponent, FX_FLOAT& value, FX_FLOAT& min, FX_FLOAT& max) const
1031 { 1027 {
1032 value = 1.0f; 1028 value = 1.0f;
1033 min = 0; 1029 min = 0;
1034 max = 1.0f; 1030 max = 1.0f;
1035 } 1031 }
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 PatternValue* pvalue = (PatternValue*)m_pBuffer; 1434 PatternValue* pvalue = (PatternValue*)m_pBuffer;
1439 return pvalue->m_nComps ? pvalue->m_Comps : NULL; 1435 return pvalue->m_nComps ? pvalue->m_Comps : NULL;
1440 } 1436 }
1441 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const 1437 FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const
1442 { 1438 {
1443 if (m_pCS != other.m_pCS || m_pCS == NULL) { 1439 if (m_pCS != other.m_pCS || m_pCS == NULL) {
1444 return FALSE; 1440 return FALSE;
1445 } 1441 }
1446 return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; 1442 return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
1447 } 1443 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698