diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-31 22:46:37 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-31 22:46:37 +0000 |
commit | a38996be8593ba78d3eb31e30d2d6f7c61990ec6 (patch) | |
tree | be978e80632c64f2d7bb46b879092d9d7f28a003 /core/fxcodec/codec | |
parent | ca3a100e7dcf3671bd0774ec3f5233df6996dcea (diff) | |
download | pdfium-a38996be8593ba78d3eb31e30d2d6f7c61990ec6.tar.xz |
Remove avail_buf out argument from GetAvailInput() methods.chromium/3542chromium/3541chromium/3540chromium/3539
It's always passed as nullptr. It's a good thing, too, since it looks
like some of the implementations are returning a wrong pointer.
Add some missing |const|s.
Change-Id: I768048fdfe4cdd1dc838fee26fec18e024e39920
Reviewed-on: https://pdfium-review.googlesource.com/41810
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/ccodec_bmpmodule.cpp | 6 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_bmpmodule.h | 2 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_gifmodule.cpp | 6 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_gifmodule.h | 2 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_jpegmodule.cpp | 9 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_jpegmodule.h | 2 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_progressivedecoder.cpp | 13 |
7 files changed, 14 insertions, 26 deletions
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp index 75e59edf2b..ff4164ce4f 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.cpp +++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp @@ -63,10 +63,8 @@ int32_t CCodec_BmpModule::LoadImage(Context* pContext) { return ctx->m_Bmp.DecodeImage(); } -FX_FILESIZE CCodec_BmpModule::GetAvailInput(Context* pContext, - uint8_t** avail_buf_ptr) { - auto* ctx = static_cast<CFX_BmpContext*>(pContext); - return ctx->m_Bmp.GetAvailInput(avail_buf_ptr); +FX_FILESIZE CCodec_BmpModule::GetAvailInput(Context* pContext) const { + return static_cast<CFX_BmpContext*>(pContext)->m_Bmp.GetAvailInput(); } void CCodec_BmpModule::Input(Context* pContext, pdfium::span<uint8_t> src_buf) { diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h index 42d686e6f3..6dc0ebd860 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.h +++ b/core/fxcodec/codec/ccodec_bmpmodule.h @@ -34,7 +34,7 @@ class CCodec_BmpModule { ~CCodec_BmpModule(); std::unique_ptr<Context> Start(Delegate* pDelegate); - FX_FILESIZE GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr); + FX_FILESIZE GetAvailInput(Context* pContext) const; void Input(Context* pContext, pdfium::span<uint8_t> src_buf); int32_t ReadHeader(Context* pContext, int32_t* width, diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp index 872d90f770..a93cb27674 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.cpp +++ b/core/fxcodec/codec/ccodec_gifmodule.cpp @@ -66,10 +66,8 @@ CFX_GifDecodeStatus CCodec_GifModule::LoadFrame(Context* pContext, return CFX_GifDecodeStatus::Success; } -uint32_t CCodec_GifModule::GetAvailInput(Context* pContext, - uint8_t** avail_buf_ptr) { - auto* context = static_cast<CFX_GifContext*>(pContext); - return context->GetAvailInput(avail_buf_ptr); +uint32_t CCodec_GifModule::GetAvailInput(Context* pContext) const { + return static_cast<CFX_GifContext*>(pContext)->GetAvailInput(); } void CCodec_GifModule::Input(Context* pContext, pdfium::span<uint8_t> src_buf) { diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h index f14665ba2c..9529583426 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.h +++ b/core/fxcodec/codec/ccodec_gifmodule.h @@ -43,7 +43,7 @@ class CCodec_GifModule { ~CCodec_GifModule(); std::unique_ptr<Context> Start(Delegate* pDelegate); - uint32_t GetAvailInput(Context* context, uint8_t** avail_buf_ptr); + uint32_t GetAvailInput(Context* context) const; void Input(Context* context, pdfium::span<uint8_t> src_buf); CFX_GifDecodeStatus ReadHeader(Context* context, int* width, diff --git a/core/fxcodec/codec/ccodec_jpegmodule.cpp b/core/fxcodec/codec/ccodec_jpegmodule.cpp index e6aef3c05b..aaf16ae762 100644 --- a/core/fxcodec/codec/ccodec_jpegmodule.cpp +++ b/core/fxcodec/codec/ccodec_jpegmodule.cpp @@ -464,15 +464,8 @@ bool CCodec_JpegModule::ReadScanline(Context* pContext, return nlines == 1; } -uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext, - uint8_t** avail_buf_ptr) { +uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext) const { auto* ctx = static_cast<CJpegContext*>(pContext); - if (avail_buf_ptr) { - *avail_buf_ptr = nullptr; - if (ctx->m_SrcMgr.bytes_in_buffer > 0) { - *avail_buf_ptr = (uint8_t*)ctx->m_SrcMgr.next_input_byte; - } - } return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer; } diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h index fb116f5d88..2c72db3316 100644 --- a/core/fxcodec/codec/ccodec_jpegmodule.h +++ b/core/fxcodec/codec/ccodec_jpegmodule.h @@ -56,7 +56,7 @@ class CCodec_JpegModule { bool StartScanline(Context* pContext, int down_scale); bool ReadScanline(Context* pContext, uint8_t* dest_buf); - uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr); + uint32_t GetAvailInput(Context* pContext) const; #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ static bool JpegEncode(const RetainPtr<CFX_DIBBase>& pSource, diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp index 6faaaa11cd..280b647ebd 100644 --- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp +++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp @@ -418,7 +418,7 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass, #ifdef PDF_ENABLE_XFA_GIF void CCodec_ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) { uint32_t remain_size = - m_pCodecMgr->GetGifModule()->GetAvailInput(m_pGifContext.get(), nullptr); + m_pCodecMgr->GetGifModule()->GetAvailInput(m_pGifContext.get()); cur_pos = m_offSet - remain_size; } @@ -805,7 +805,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData( return false; dwSize = dwSize - m_offSet; - FX_SAFE_UINT32 avail_input = pBmpModule->GetAvailInput(pBmpContext, nullptr); + FX_SAFE_UINT32 avail_input = pBmpModule->GetAvailInput(pBmpContext); if (!avail_input.IsValid()) return false; @@ -898,10 +898,9 @@ bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule, return false; uint32_t dwFileRemaining = m_pFile->GetSize() - m_offSet; - uint32_t dwUnusedBuffer = - !m_InvalidateGifBuffer - ? pGifModule->GetAvailInput(m_pGifContext.get(), nullptr) - : 0; + uint32_t dwUnusedBuffer = !m_InvalidateGifBuffer + ? pGifModule->GetAvailInput(m_pGifContext.get()) + : 0; uint32_t dwAmountToFetchFromFile = dwFileRemaining; if (dwUnusedBuffer == m_SrcSize) { if (dwFileRemaining > FXCODEC_BLOCK_SIZE) @@ -1129,7 +1128,7 @@ bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule, return false; } dwSize = dwSize - m_offSet; - uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext.get(), nullptr); + uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext.get()); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; |