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

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

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 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
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 {
11 m_pBasicModule = FX_NEW CCodec_BasicModule; 11 m_pBasicModule = FX_NEW CCodec_BasicModule;
12 m_pFaxModule = FX_NEW CCodec_FaxModule; 12 m_pFaxModule = FX_NEW CCodec_FaxModule;
13 m_pJpegModule = FX_NEW CCodec_JpegModule; 13 m_pJpegModule = FX_NEW CCodec_JpegModule;
14 m_pJpxModule = FX_NEW CCodec_JpxModule; 14 m_pJpxModule = FX_NEW CCodec_JpxModule;
(...skipping 97 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*)FXMEM_DefaultAlloc( 122 m_pDataCache = (CCodec_ImageDataCache*)FX_AllocNL(FX_BYTE, sizeof(CCodec_Ima geDataCache) + m_Pitch * m_OutputHeight);
palmer 2014/07/07 19:17:53 Potential integer overflow here.
123 sizeof(CCodec_ImageDataCache) + m_Pitch * m_OutputHeight, FXMEM_NONLEAVE);
124 if (m_pDataCache == NULL) { 123 if (m_pDataCache == NULL) {
125 return; 124 return;
126 } 125 }
127 m_pDataCache->m_Height = m_OutputHeight; 126 m_pDataCache->m_Height = m_OutputHeight;
128 m_pDataCache->m_Width = m_OutputWidth; 127 m_pDataCache->m_Width = m_OutputWidth;
129 m_pDataCache->m_nCachedLines = 0; 128 m_pDataCache->m_nCachedLines = 0;
130 } 129 }
131 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,
132 FX_DWORD& dest_size) 131 FX_DWORD& dest_size)
133 { 132 {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 CCodec_RLScanlineDecoder* pRLScanlineDecoder = FX_NEW CCodec_RLScanlineDecod er; 437 CCodec_RLScanlineDecoder* pRLScanlineDecoder = FX_NEW CCodec_RLScanlineDecod er;
439 if (pRLScanlineDecoder == NULL) { 438 if (pRLScanlineDecoder == NULL) {
440 return NULL; 439 return NULL;
441 } 440 }
442 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) { 441 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp c)) {
443 delete pRLScanlineDecoder; 442 delete pRLScanlineDecoder;
444 return NULL; 443 return NULL;
445 } 444 }
446 return pRLScanlineDecoder; 445 return pRLScanlineDecoder;
447 } 446 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698