diff options
author | Nicolas Pena <npm@chromium.org> | 2017-06-22 14:23:52 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-22 18:56:36 +0000 |
commit | b32a949d667600cb33e80e1bb8c97a23d96f27d9 (patch) | |
tree | 756bd8fa5190925421a88e699f39889be7903ec6 /core/fxcodec/codec | |
parent | 84d8eb9b6fdd2afd43f5970b3544d63aa990d30e (diff) | |
download | pdfium-b32a949d667600cb33e80e1bb8c97a23d96f27d9.tar.xz |
Continue BMP decoder cleanup
This CL replaces raw pointers with vector and unique_ptr. It also fixes
other nits.
Change-Id: I45c99c9aa658681ec3f0b48fc4f407b278b250f5
Reviewed-on: https://pdfium-review.googlesource.com/6830
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/ccodec_bmpmodule.cpp | 4 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_bmpmodule.h | 2 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_progress.cpp | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp index 1c8112498c..a64e6783e1 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.cpp +++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp @@ -39,7 +39,7 @@ int32_t CCodec_BmpModule::ReadHeader(Context* pContext, bool* tb_flag, int32_t* components, int32_t* pal_num, - uint32_t** pal_pp, + std::vector<uint32_t>* palette, CFX_DIBAttribute* pAttribute) { auto* ctx = static_cast<CBmpContext*>(pContext); if (setjmp(ctx->m_Bmp.jmpbuf)) @@ -54,7 +54,7 @@ int32_t CCodec_BmpModule::ReadHeader(Context* pContext, *tb_flag = ctx->m_Bmp.imgTB_flag; *components = ctx->m_Bmp.components; *pal_num = ctx->m_Bmp.pal_num; - *pal_pp = ctx->m_Bmp.pal_ptr; + *palette = ctx->m_Bmp.palette; if (pAttribute) { pAttribute->m_wDPIUnit = FXCODEC_RESUNIT_METER; pAttribute->m_nXDPI = ctx->m_Bmp.dpi_x; diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h index 4009150c59..e9ad7c3001 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.h +++ b/core/fxcodec/codec/ccodec_bmpmodule.h @@ -41,7 +41,7 @@ class CCodec_BmpModule { bool* tb_flag, int32_t* components, int32_t* pal_num, - uint32_t** pal_pp, + std::vector<uint32_t>* palette, CFX_DIBAttribute* pAttribute); int32_t LoadImage(Context* pContext); }; diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 3c377771ea..9f74ac3624 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -1027,10 +1027,10 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, } m_offSet += size; pBmpModule->Input(m_pBmpContext.get(), m_pSrcBuf, size); - uint32_t* pPalette = nullptr; + std::vector<uint32_t> palette; int32_t readResult = pBmpModule->ReadHeader( m_pBmpContext.get(), &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom, - &m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute); + &m_SrcComponents, &m_SrcPaletteNumber, &palette, pAttribute); while (readResult == 2) { FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT; if (!BmpReadMoreData(pBmpModule, error_status)) { @@ -1039,7 +1039,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, } readResult = pBmpModule->ReadHeader( m_pBmpContext.get(), &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom, - &m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute); + &m_SrcComponents, &m_SrcPaletteNumber, &palette, pAttribute); } if (readResult == 1) { m_SrcBPC = 8; @@ -1047,7 +1047,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, FX_Free(m_pSrcPalette); if (m_SrcPaletteNumber) { m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber); - memcpy(m_pSrcPalette, pPalette, + memcpy(m_pSrcPalette, palette.data(), m_SrcPaletteNumber * sizeof(uint32_t)); } else { m_pSrcPalette = nullptr; |