summaryrefslogtreecommitdiff
path: root/core/fxcodec
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-31 17:12:59 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-01 16:14:26 +0000
commit19cda483c13d978c43eb5bebe1b7f803161864bb (patch)
tree4408bfebac3ac64975feeeb5fa39d3c81d9cb1ff /core/fxcodec
parente858aa4b70db7408bda1aed71827d9eee1dd98c5 (diff)
downloadpdfium-19cda483c13d978c43eb5bebe1b7f803161864bb.tar.xz
Missing one unowned_ptr in ccodec_progressivedecoder.h
Change-Id: Ief386ce0d3887cc2876ce4b430f657b7462e3277 Reviewed-on: https://pdfium-review.googlesource.com/6170 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec')
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h2
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp22
2 files changed, 11 insertions, 13 deletions
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 33ac558fc9..eab76a7e21 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -133,7 +133,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
CFX_UnownedPtr<CCodec_JpegModule::Context> m_pJpegContext;
CFX_UnownedPtr<CCodec_PngModule::Context> m_pPngContext;
std::unique_ptr<CGifContext> m_pGifContext;
- CCodec_BmpModule::Context* m_pBmpContext;
+ CFX_UnownedPtr<CCodec_BmpModule::Context> m_pBmpContext;
CFX_UnownedPtr<CCodec_TiffContext> m_pTiffContext;
FXCODEC_IMAGE_TYPE m_imagType;
uint32_t m_offSet;
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 1691a31cbe..f65235139d 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -298,7 +298,7 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
if (m_pJpegContext)
m_pCodecMgr->GetJpegModule()->Finish(m_pJpegContext.Release());
if (m_pBmpContext)
- m_pCodecMgr->GetBmpModule()->Finish(m_pBmpContext);
+ m_pCodecMgr->GetBmpModule()->Finish(m_pBmpContext.Release());
if (m_pPngContext)
m_pCodecMgr->GetPngModule()->Finish(m_pPngContext.Release());
if (m_pTiffContext)
@@ -851,7 +851,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
return false;
dwSize = dwSize - m_offSet;
- uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, nullptr);
+ uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext.Get(), nullptr);
if (dwAvail == m_SrcSize) {
if (dwSize > FXCODEC_BLOCK_SIZE) {
dwSize = FXCODEC_BLOCK_SIZE;
@@ -877,7 +877,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
return false;
}
m_offSet += dwSize;
- pBmpModule->Input(m_pBmpContext, m_pSrcBuf, dwSize + dwAvail);
+ pBmpModule->Input(m_pBmpContext.Get(), m_pSrcBuf, dwSize + dwAvail);
return true;
}
@@ -1031,10 +1031,10 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
return false;
}
m_offSet += size;
- pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size);
+ pBmpModule->Input(m_pBmpContext.Get(), m_pSrcBuf, size);
uint32_t* pPalette = nullptr;
int32_t readResult = pBmpModule->ReadHeader(
- m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
+ m_pBmpContext.Get(), &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
&m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute);
while (readResult == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
@@ -1043,7 +1043,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
return false;
}
readResult = pBmpModule->ReadHeader(
- m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
+ m_pBmpContext.Get(), &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom,
&m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute);
}
if (readResult == 1) {
@@ -1059,10 +1059,8 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
}
return true;
}
- if (m_pBmpContext) {
- pBmpModule->Finish(m_pBmpContext);
- m_pBmpContext = nullptr;
- }
+ if (m_pBmpContext)
+ pBmpModule->Finish(m_pBmpContext.Release());
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
}
@@ -2125,7 +2123,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
return m_status;
}
while (true) {
- int32_t readRes = pBmpModule->LoadImage(m_pBmpContext);
+ int32_t readRes = pBmpModule->LoadImage(m_pBmpContext.Get());
while (readRes == 2) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if (!BmpReadMoreData(pBmpModule, error_status)) {
@@ -2134,7 +2132,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
m_status = error_status;
return m_status;
}
- readRes = pBmpModule->LoadImage(m_pBmpContext);
+ readRes = pBmpModule->LoadImage(m_pBmpContext.Get());
}
if (readRes == 1) {
m_pDeviceBitmap = nullptr;