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

Side by Side Diff: core/src/fxcodec/codec/fx_codec.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/fpdftext/fpdf_text_int.cpp ('k') | core/src/fxcodec/codec/fx_codec_fax.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/fxcodec/fx_codec.h" 7 #include "../../../include/fxcodec/fx_codec.h"
8 #include "codec_int.h" 8 #include "codec_int.h"
9 CCodec_ModuleMgr::CCodec_ModuleMgr() 9 CCodec_ModuleMgr::CCodec_ModuleMgr()
10 { 10 {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 m_SrcSize = src_size; 326 m_SrcSize = src_size;
327 m_OutputWidth = m_OrigWidth = width; 327 m_OutputWidth = m_OrigWidth = width;
328 m_OutputHeight = m_OrigHeight = height; 328 m_OutputHeight = m_OrigHeight = height;
329 m_nComps = nComps; 329 m_nComps = nComps;
330 m_bpc = bpc; 330 m_bpc = bpc;
331 m_bColorTransformed = FALSE; 331 m_bColorTransformed = FALSE;
332 m_DownScale = 1; 332 m_DownScale = 1;
333 m_Pitch = (width * nComps * bpc + 31) / 32 * 4; 333 m_Pitch = (width * nComps * bpc + 31) / 32 * 4;
334 m_dwLineBytes = (width * nComps * bpc + 7) / 8; 334 m_dwLineBytes = (width * nComps * bpc + 7) / 8;
335 m_pScanline = FX_Alloc(FX_BYTE, m_Pitch); 335 m_pScanline = FX_Alloc(FX_BYTE, m_Pitch);
336 if (m_pScanline == NULL) {
337 return FALSE;
338 }
339 return CheckDestSize(); 336 return CheckDestSize();
340 } 337 }
341 FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() 338 FX_BOOL CCodec_RLScanlineDecoder::v_Rewind()
342 { 339 {
343 FXSYS_memset32(m_pScanline, 0, m_Pitch); 340 FXSYS_memset32(m_pScanline, 0, m_Pitch);
344 m_SrcOffset = 0; 341 m_SrcOffset = 0;
345 m_bEOD = FALSE; 342 m_bEOD = FALSE;
346 m_Operator = 0; 343 m_Operator = 0;
347 return TRUE; 344 return TRUE;
348 } 345 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr c_buf, FX_DWORD src_size, int width, int height, 430 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr c_buf, FX_DWORD src_size, int width, int height,
434 int nComps, int bpc) 431 int nComps, int bpc)
435 { 432 {
436 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; 433 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
437 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) { 434 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) {
438 delete pRLScanlineDecoder; 435 delete pRLScanlineDecoder;
439 return NULL; 436 return NULL;
440 } 437 }
441 return pRLScanlineDecoder; 438 return pRLScanlineDecoder;
442 } 439 }
OLDNEW
« no previous file with comments | « core/src/fpdftext/fpdf_text_int.cpp ('k') | core/src/fxcodec/codec/fx_codec_fax.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698