From 660843f9ea0e75b4efc78d17bbc5661c2d3ea2be Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 10 May 2018 19:11:37 +0000 Subject: Clean up post review comments Cleaning up some nits that came in after my previous codec CL had gone into the CQ. BUG=pdfium:1080 Change-Id: I3845136d370f73c9c96ef732e95b8cf0c9c79d91 Reviewed-on: https://pdfium-review.googlesource.com/32351 Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fxcodec/codec/ccodec_progressivedecoder.h | 2 +- core/fxcodec/codec/fx_codec.cpp | 17 +---------------- core/fxcodec/codec/fx_codec_progress.cpp | 8 ++++---- core/fxcodec/fx_codec.h | 18 +++++++++--------- core/fxcodec/fx_codec_def.h | 2 +- 5 files changed, 16 insertions(+), 31 deletions(-) (limited to 'core') diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h index 4eeb59d559..979de6ed25 100644 --- a/core/fxcodec/codec/ccodec_progressivedecoder.h +++ b/core/fxcodec/codec/ccodec_progressivedecoder.h @@ -244,13 +244,13 @@ class CCodec_ProgressiveDecoder : RetainPtr m_pFile; RetainPtr m_pDeviceBitmap; UnownedPtr m_pCodecMgr; + std::unique_ptr m_pJpegContext; #ifdef PDF_ENABLE_XFA_BMP std::unique_ptr m_pBmpContext; #endif // PDF_ENABLE_XFA_BMP #ifdef PDF_ENABLE_XFA_GIF std::unique_ptr m_pGifContext; #endif // PDF_ENABLE_XFA_GIF - std::unique_ptr m_pJpegContext; #ifdef PDF_ENABLE_XFA_PNG std::unique_ptr m_pPngContext; #endif // PDF_ENABLE_XFA_PNG diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index d81e8f756c..54245a5b99 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -1509,22 +1509,7 @@ bool CCodec_BasicModule::A85Encode(const uint8_t* src_buf, } #ifdef PDF_ENABLE_XFA -CFX_DIBAttribute::CFX_DIBAttribute() - : -#ifdef PDF_ENABLE_XFA_BMP - m_nBmpCompressType(0), -#endif // PDF_ENABLE_BMP -#ifdef PDF_ENABLE_XFA_GIF - m_nGifLeft(0), - m_nGifTop(0), - m_pGifLocalPalette(nullptr), - m_nGifLocalPalNum(0), -#endif // PDF_ENABLE_XFA_GIF - m_nXDPI(-1), - m_nYDPI(-1), - m_fAspectRatio(-1.0f), - m_wDPIUnit(0) { -} +CFX_DIBAttribute::CFX_DIBAttribute() {} CFX_DIBAttribute::~CFX_DIBAttribute() { for (const auto& pair : m_Exif) diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index e45dff6682..6b91e864ab 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -1737,6 +1737,8 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, memset(m_pSrcBuf, 0, size); m_SrcSize = size; switch (imageType) { + case FXCODEC_IMAGE_JPG: + return JpegDetectImageType(pAttribute, size); #ifdef PDF_ENABLE_XFA_BMP case FXCODEC_IMAGE_BMP: return BmpDetectImageType(pAttribute, size); @@ -1745,8 +1747,6 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, case FXCODEC_IMAGE_GIF: return GifDetectImageType(pAttribute, size); #endif // PDF_ENABLE_XFA_GIF - case FXCODEC_IMAGE_JPG: - return JpegDetectImageType(pAttribute, size); #ifdef PDF_ENABLE_XFA_PNG case FXCODEC_IMAGE_PNG: return PngDetectImageType(pAttribute, size); @@ -2444,6 +2444,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { return FXCODEC_STATUS_ERROR; switch (m_imagType) { + case FXCODEC_IMAGE_JPG: + return JpegContinueDecode(); #ifdef PDF_ENABLE_XFA_BMP case FXCODEC_IMAGE_BMP: return BmpContinueDecode(); @@ -2452,8 +2454,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() { case FXCODEC_IMAGE_GIF: return GifContinueDecode(); #endif // PDF_ENABLE_XFA_GIF - case FXCODEC_IMAGE_JPG: - return JpegContinueDecode(); #ifdef PDF_ENABLE_XFA_PNG case FXCODEC_IMAGE_PNG: return PngContinueDecode(); diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h index 91d9f2fb32..458358085a 100644 --- a/core/fxcodec/fx_codec.h +++ b/core/fxcodec/fx_codec.h @@ -57,19 +57,19 @@ class CFX_DIBAttribute { ~CFX_DIBAttribute(); #ifdef PDF_ENABLE_XFA_BMP - int32_t m_nBmpCompressType; + int32_t m_nBmpCompressType = 0; #endif // PDF_ENABLE_XFA_BMP #ifdef PDF_ENABLE_XFA_GIF - int32_t m_nGifLeft; - int32_t m_nGifTop; - uint32_t* m_pGifLocalPalette; - uint32_t m_nGifLocalPalNum; + int32_t m_nGifLeft = 0; + int32_t m_nGifTop = 0; + uint32_t* m_pGifLocalPalette = nullptr; + uint32_t m_nGifLocalPalNum = 0; #endif // PDF_ENABLE_XFA_GIF - int32_t m_nXDPI; - int32_t m_nYDPI; - float m_fAspectRatio; - uint16_t m_wDPIUnit; + int32_t m_nXDPI = -1; + int32_t m_nYDPI = -1; + float m_fAspectRatio = -1.0f; + uint16_t m_wDPIUnit = 0; std::map m_Exif; }; #endif // PDF_ENABLE_XFA diff --git a/core/fxcodec/fx_codec_def.h b/core/fxcodec/fx_codec_def.h index 154fe967ee..2d6b5ed937 100644 --- a/core/fxcodec/fx_codec_def.h +++ b/core/fxcodec/fx_codec_def.h @@ -26,10 +26,10 @@ enum FXCODEC_STATUS { #ifdef PDF_ENABLE_XFA enum FXCODEC_IMAGE_TYPE { FXCODEC_IMAGE_UNKNOWN = 0, + FXCODEC_IMAGE_JPG, #ifdef PDF_ENABLE_XFA_BMP FXCODEC_IMAGE_BMP, #endif // PDF_ENABLE_XFA_BMP - FXCODEC_IMAGE_JPG, #ifdef PDF_ENABLE_XFA_PNG FXCODEC_IMAGE_PNG, #endif // PDF_ENABLE_XFA_PNG -- cgit v1.2.3