summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-09 14:42:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-09 14:42:42 +0000
commit27924e6c9d43f0eba57d14004853d5a8ba47de26 (patch)
treefcc6639b62cf2fee783123b1858c618ba773da2e /core/fxcodec/codec/fx_codec_progress.cpp
parent5f7c5be8b7072d46e8d8088a1ec14370ecfad44c (diff)
downloadpdfium-27924e6c9d43f0eba57d14004853d5a8ba47de26.tar.xz
Do not build TIFF when codec is disabled
Currently all of the TIFF related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the TIFF codec code if support for TIFF is turned off. It also fixes cases in the code base where tif was being used instead of tiff. BUG=pdfium:1080 Change-Id: If6aaa8af5160fdd5b261e63bab7d5984196efcc9 Reviewed-on: https://pdfium-review.googlesource.com/32193 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_progress.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index e1aec22150..e606c414bb 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -250,10 +250,6 @@ void CCodec_ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len,
CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
CCodec_ModuleMgr* pCodecMgr) {
m_pFile = nullptr;
- m_pJpegContext = nullptr;
- m_pPngContext = nullptr;
- m_pBmpContext = nullptr;
- m_pTiffContext = nullptr;
m_pCodecMgr = nullptr;
m_pSrcBuf = nullptr;
m_pDecodeBuf = nullptr;
@@ -1045,8 +1041,10 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
return PngDetectImageType(pAttribute, size);
case FXCODEC_IMAGE_GIF:
return GifDetectImageType(pAttribute, size);
- case FXCODEC_IMAGE_TIF:
- return TifDetectImageType(pAttribute, size);
+#ifdef PDF_ENABLE_XFA_TIFF
+ case FXCODEC_IMAGE_TIFF:
+ return TiffDetectImageType(pAttribute, size);
+#endif // PDF_ENABLE_XFA_TIFF
default:
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
@@ -1282,8 +1280,10 @@ bool CCodec_ProgressiveDecoder::GifDetectImageType(CFX_DIBAttribute* pAttribute,
return false;
}
-bool CCodec_ProgressiveDecoder::TifDetectImageType(CFX_DIBAttribute* pAttribute,
- uint32_t size) {
+#ifdef PDF_ENABLE_XFA_TIFF
+bool CCodec_ProgressiveDecoder::TiffDetectImageType(
+ CFX_DIBAttribute* pAttribute,
+ uint32_t size) {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
m_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1307,6 +1307,7 @@ bool CCodec_ProgressiveDecoder::TifDetectImageType(CFX_DIBAttribute* pAttribute,
}
return true;
}
+#endif // PDF_ENABLE_XFA_TIFF
FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
const RetainPtr<IFX_SeekableReadStream>& pFile,
@@ -1862,7 +1863,9 @@ std::pair<FXCODEC_STATUS, size_t> CCodec_ProgressiveDecoder::GetFrames() {
case FXCODEC_IMAGE_JPG:
case FXCODEC_IMAGE_BMP:
case FXCODEC_IMAGE_PNG:
- case FXCODEC_IMAGE_TIF:
+#ifdef PDF_ENABLE_XFA_TIFF
+ case FXCODEC_IMAGE_TIFF:
+#endif // PDF_ENABLE_XFA_TIFF
m_FrameNumber = 1;
m_status = FXCODEC_STATUS_DECODE_READY;
return {m_status, 1};
@@ -1960,9 +1963,11 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
return GifStartDecode(pDIBitmap);
case FXCODEC_IMAGE_BMP:
return BmpStartDecode(pDIBitmap);
- case FXCODEC_IMAGE_TIF:
+#ifdef PDF_ENABLE_XFA_TIFF
+ case FXCODEC_IMAGE_TIFF:
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
+#endif // PDF_ENABLE_XFA_TIFF
default:
return FXCODEC_STATUS_ERROR;
}
@@ -2125,8 +2130,10 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
return GifContinueDecode();
case FXCODEC_IMAGE_BMP:
return BmpContinueDecode();
- case FXCODEC_IMAGE_TIF:
- return TifContinueDecode();
+#ifdef PDF_ENABLE_XFA_TIFF
+ case FXCODEC_IMAGE_TIFF:
+ return TiffContinueDecode();
+#endif // PDF_ENABLE_XFA_TIFF
default:
return FXCODEC_STATUS_ERROR;
}
@@ -2278,7 +2285,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpContinueDecode() {
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::TifContinueDecode() {
+#ifdef PDF_ENABLE_XFA_TIFF
+FXCODEC_STATUS CCodec_ProgressiveDecoder::TiffContinueDecode() {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -2416,6 +2424,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::TifContinueDecode() {
m_status = FXCODEC_STATUS_DECODE_FINISH;
return m_status;
}
+#endif // PDF_ENABLE_XFA_TIFF
std::unique_ptr<CCodec_ProgressiveDecoder>
CCodec_ModuleMgr::CreateProgressiveDecoder() {