From cfc1a654ef3e8b65bc447815d35932c185bf1422 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 16 Apr 2015 14:21:25 -0700 Subject: Replace FX_NEW with new, remote tests from fxcodec R=thestig@chromium.org Review URL: https://codereview.chromium.org/1084303002 --- core/src/fxcodec/codec/fx_codec.cpp | 21 +++++++++------------ core/src/fxcodec/codec/fx_codec_fax.cpp | 5 +---- core/src/fxcodec/codec/fx_codec_flate.cpp | 15 +++------------ core/src/fxcodec/codec/fx_codec_icc.cpp | 16 +++------------- core/src/fxcodec/codec/fx_codec_jbig.cpp | 2 +- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 5 +---- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 5 +---- 7 files changed, 19 insertions(+), 50 deletions(-) diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 456ec40fea..d4df1965fb 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -8,13 +8,13 @@ #include "codec_int.h" CCodec_ModuleMgr::CCodec_ModuleMgr() { - m_pBasicModule = FX_NEW CCodec_BasicModule; - m_pFaxModule = FX_NEW CCodec_FaxModule; - m_pJpegModule = FX_NEW CCodec_JpegModule; - m_pJpxModule = FX_NEW CCodec_JpxModule; - m_pJbig2Module = FX_NEW CCodec_Jbig2Module; - m_pIccModule = FX_NEW CCodec_IccModule; - m_pFlateModule = FX_NEW CCodec_FlateModule; + m_pBasicModule = new CCodec_BasicModule; + m_pFaxModule = new CCodec_FaxModule; + m_pJpegModule = new CCodec_JpegModule; + m_pJpxModule = new CCodec_JpxModule; + m_pJbig2Module = new CCodec_Jbig2Module; + m_pIccModule = new CCodec_IccModule; + m_pFlateModule = new CCodec_FlateModule; } CCodec_ModuleMgr::~CCodec_ModuleMgr() { @@ -243,7 +243,7 @@ FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, } CCodec_ModuleMgr* CCodec_ModuleMgr::Create() { - return FX_NEW CCodec_ModuleMgr; + return new CCodec_ModuleMgr; } void CCodec_ModuleMgr::Destroy() { @@ -433,10 +433,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(FX_BYTE used_bytes) ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { - CCodec_RLScanlineDecoder* pRLScanlineDecoder = FX_NEW CCodec_RLScanlineDecoder; - if (pRLScanlineDecoder == NULL) { - return NULL; - } + CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bpc)) { delete pRLScanlineDecoder; return NULL; diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index c6ab791a0e..667b713df8 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -994,10 +994,7 @@ FX_BOOL CCodec_FaxModule::Encode(FX_LPCBYTE src_buf, int width, int height, int ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { - CCodec_FaxDecoder* pDecoder = FX_NEW CCodec_FaxDecoder; - if (pDecoder == NULL) { - return NULL; - } + CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByteAlign, BlackIs1, Columns, Rows); return pDecoder; } diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index afdb8354e6..3e1aa367c8 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -851,10 +851,7 @@ static void FlateUncompress(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_DWORD orig ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns) { - CCodec_FlateScanlineDecoder* pDecoder = FX_NEW CCodec_FlateScanlineDecoder; - if (pDecoder == NULL) { - return NULL; - } + CCodec_FlateScanlineDecoder* pDecoder = new CCodec_FlateScanlineDecoder; pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } @@ -874,10 +871,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b } } if (bLZW) { - pDecoder = FX_NEW CLZWDecoder; - if (pDecoder == NULL) { - return -1; - } + pDecoder = new CLZWDecoder; dest_size = (FX_DWORD) - 1; offset = src_size; int err = pDecoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange); @@ -885,10 +879,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_b if (err || dest_size == 0 || dest_size + 1 < dest_size) { return (FX_DWORD) - 1; } - pDecoder = FX_NEW CLZWDecoder; - if (pDecoder == NULL) { - return -1; - } + pDecoder = new CLZWDecoder; dest_buf = FX_Alloc( FX_BYTE, dest_size + 1); if (dest_buf == NULL) { return -1; diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 1a4fce63f2..a984fecc30 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -148,10 +148,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr cmsCloseProfile(dstProfile); return NULL; } - pCmm = FX_NEW CLcmsCmm; - if (pCmm == NULL) { - return NULL; - } + pCmm = new CLcmsCmm; pCmm->m_nSrcComponents = nSrcComponents; pCmm->m_nDstComponents = nDstComponents; pCmm->m_hTransform = hTransform; @@ -438,10 +435,7 @@ FX_LPVOID CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, ASSERT(pTransformKey); pTransformKey->AppendBlock(ProfileKey.GetBuffer(0), ProfileKey.GetLength()); if (!m_MapProfile.Lookup(ProfileKey, (FX_LPVOID&)pCache)) { - pCache = FX_NEW CFX_IccProfileCache; - if (pCache == NULL) { - return NULL; - } + pCache = new CFX_IccProfileCache; switch (pIccParam->dwProfileType) { case Icc_PARAMTYPE_BUFFER: pCache->m_pProfile = cmsOpenProfileFromMem(pIccParam->pProfileData, pIccParam->dwProfileSize); @@ -503,11 +497,7 @@ FX_LPVOID CCodec_IccModule::CreateTransform(ICodec_IccModule::IccParam* pInputPa pCmm->m_nSrcComponents = T_CHANNELS(dwInputProfileType); pCmm->m_nDstComponents = T_CHANNELS(dwOutputProfileType); pCmm->m_bLab = T_COLORSPACE(pInputParam->dwFormat) == PT_Lab; - pTransformCache = FX_NEW CFX_IccTransformCache(pCmm); - if (pTransformCache == NULL) { - FX_Free(pCmm); - return NULL; - } + pTransformCache = new CFX_IccTransformCache(pCmm); if (pProofProfile) { pTransformCache->m_pIccTransform = cmsCreateProofingTransform(pInputProfile, dwInputProfileType, pOutputProfile, dwOutputProfileType, pProofProfile, dwIntent, dwPrfIntent, dwPrfFlag); diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 173f7a7d36..278d9cbcf6 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -15,7 +15,7 @@ CCodec_Jbig2Module::~CCodec_Jbig2Module() } void* CCodec_Jbig2Module::CreateJbig2Context() { - return FX_NEW CCodec_Jbig2Context(); + return new CCodec_Jbig2Context(); } void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) { diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 489f099bf8..d4c9926254 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -484,10 +484,7 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(FX_LPCBYTE src_buf, FX_ if (src_buf == NULL || src_size == 0) { return NULL; } - CCodec_JpegDecoder* pDecoder = FX_NEW CCodec_JpegDecoder; - if (pDecoder == NULL) { - return NULL; - } + CCodec_JpegDecoder* pDecoder = new CCodec_JpegDecoder; if (!pDecoder->Create(src_buf, src_size, width, height, nComps, ColorTransform, m_pExtProvider)) { delete pDecoder; return NULL; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 0f0d2e5e41..3b0490f3c6 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -801,10 +801,7 @@ CCodec_JpxModule::CCodec_JpxModule() } void* CCodec_JpxModule::CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) { - CJPX_Decoder* pDecoder = FX_NEW CJPX_Decoder; - if (pDecoder == NULL) { - return NULL; - } + CJPX_Decoder* pDecoder = new CJPX_Decoder; pDecoder->m_useColorSpace = useColorSpace; if (!pDecoder->Init(src_buf, src_size)) { delete pDecoder; -- cgit v1.2.3