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

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

Issue 1226403008: Merge to M44: Abort on OOM by default in FX_Alloc(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2403
Patch Set: Created 5 years, 5 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/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_memmgr.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 dest_height = -dest_height; 112 dest_height = -dest_height;
113 } 113 }
114 v_DownScale(dest_width, dest_height); 114 v_DownScale(dest_width, dest_height);
115 if (m_pDataCache) { 115 if (m_pDataCache) {
116 if (m_pDataCache->m_Height == m_OutputHeight && m_pDataCache->m_Width == m_OutputWidth) { 116 if (m_pDataCache->m_Height == m_OutputHeight && m_pDataCache->m_Width == m_OutputWidth) {
117 return; 117 return;
118 } 118 }
119 FX_Free(m_pDataCache); 119 FX_Free(m_pDataCache);
120 m_pDataCache = NULL; 120 m_pDataCache = NULL;
121 } 121 }
122 m_pDataCache = (CCodec_ImageDataCache*)FX_AllocNL(FX_BYTE, sizeof(CCodec_Ima geDataCache) + m_Pitch * m_OutputHeight); 122 m_pDataCache = (CCodec_ImageDataCache*)FX_TryAlloc(FX_BYTE, sizeof(CCodec_Im ageDataCache) + m_Pitch * m_OutputHeight);
123 if (m_pDataCache == NULL) { 123 if (m_pDataCache == NULL) {
124 return; 124 return;
125 } 125 }
126 m_pDataCache->m_Height = m_OutputHeight; 126 m_pDataCache->m_Height = m_OutputHeight;
127 m_pDataCache->m_Width = m_OutputWidth; 127 m_pDataCache->m_Width = m_OutputWidth;
128 m_pDataCache->m_nCachedLines = 0; 128 m_pDataCache->m_nCachedLines = 0;
129 } 129 }
130 FX_BOOL CCodec_BasicModule::RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src _size, FX_LPBYTE& dest_buf, 130 FX_BOOL CCodec_BasicModule::RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src _size, FX_LPBYTE& dest_buf,
131 FX_DWORD& dest_size) 131 FX_DWORD& dest_size)
132 { 132 {
(...skipping 300 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, 433 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr c_buf, FX_DWORD src_size, int width, int height,
434 int nComps, int bpc) 434 int nComps, int bpc)
435 { 435 {
436 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; 436 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
437 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) { 437 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) {
438 delete pRLScanlineDecoder; 438 delete pRLScanlineDecoder;
439 return NULL; 439 return NULL;
440 } 440 }
441 return pRLScanlineDecoder; 441 return pRLScanlineDecoder;
442 } 442 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_memmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698