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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. Created 5 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 unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fpdfdoc/doc_annot.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/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "../../../include/fpdfapi/fpdf_module.h" 9 #include "../../../include/fpdfapi/fpdf_module.h"
10 #include "../../../include/fpdfapi/fpdf_render.h" 10 #include "../../../include/fpdfapi/fpdf_render.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return FALSE; 493 return FALSE;
494 } 494 }
495 return TRUE; 495 return TRUE;
496 } 496 }
497 DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX _BOOL& bColorKey) 497 DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX _BOOL& bColorKey)
498 { 498 {
499 if (m_pColorSpace == NULL) { 499 if (m_pColorSpace == NULL) {
500 return NULL; 500 return NULL;
501 } 501 }
502 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); 502 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents);
503 if (pCompData == NULL) {
504 return NULL;
505 }
506 int max_data = (1 << m_bpc) - 1; 503 int max_data = (1 << m_bpc) - 1;
507 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); 504 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode"));
508 if (pDecode) { 505 if (pDecode) {
509 for (FX_DWORD i = 0; i < m_nComponents; i ++) { 506 for (FX_DWORD i = 0; i < m_nComponents; i ++) {
510 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); 507 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2);
511 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); 508 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1);
512 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d ata; 509 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d ata;
513 FX_FLOAT def_value, def_min, def_max; 510 FX_FLOAT def_value, def_min, def_max;
514 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); 511 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max);
515 if (m_Family == PDFCS_INDEXED) { 512 if (m_Family == PDFCS_INDEXED) {
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 { 1504 {
1508 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1505 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1509 } 1506 }
1510 CPDF_ImageLoader::~CPDF_ImageLoader() 1507 CPDF_ImageLoader::~CPDF_ImageLoader()
1511 { 1508 {
1512 if (!m_bCached) { 1509 if (!m_bCached) {
1513 delete m_pBitmap; 1510 delete m_pBitmap;
1514 delete m_pMask; 1511 delete m_pMask;
1515 } 1512 }
1516 } 1513 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fpdfdoc/doc_annot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698