diff options
author | Nicolas Pena <npm@chromium.org> | 2018-05-09 23:25:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-09 23:25:53 +0000 |
commit | ad18d2fba9dd5833a2e34bfe90c8e3c9a485e805 (patch) | |
tree | 2c5b678637ad9324e6fcd8414fbc883ac07ad0c1 /core/fxcodec/codec | |
parent | 3774c7a452886b9c8beeb5fa1b54a34611551180 (diff) | |
download | pdfium-ad18d2fba9dd5833a2e34bfe90c8e3c9a485e805.tar.xz |
Use enum class instead of int in CJBig2_Contextchromium/3426
This CL changes CJBig2_Context return methods as follows:
* Internal methods return JBig2_Result instead of int.
* Public methods return a bool (for success/failure) instead of int.
In a followup, several of the enum class values may be merged together
since they are not all needed.
Change-Id: Ifdab83b8037262370cd7c4a80e94aa94d59aa589
Reviewed-on: https://pdfium-review.googlesource.com/32310
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/ccodec_jbig2module.h | 3 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_jbig.cpp | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h index 306b079846..534c0a3ab6 100644 --- a/core/fxcodec/codec/ccodec_jbig2module.h +++ b/core/fxcodec/codec/ccodec_jbig2module.h @@ -51,7 +51,8 @@ class CCodec_Jbig2Module { PauseIndicatorIface* pPause); private: - FXCODEC_STATUS Decode(CCodec_Jbig2Context* pJbig2Context, int result); + FXCODEC_STATUS Decode(CCodec_Jbig2Context* pJbig2Context, + bool decode_success); }; #endif // CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index d8d112bab0..36d6a0609e 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -64,26 +64,26 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( pJbig2Context->m_pContext = pdfium::MakeUnique<CJBig2_Context>( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), false); - int ret = pJbig2Context->m_pContext->GetFirstPage(dest_buf, width, height, - dest_pitch, pPause); - return Decode(pJbig2Context, ret); + bool succeeded = pJbig2Context->m_pContext->GetFirstPage( + dest_buf, width, height, dest_pitch, pPause); + return Decode(pJbig2Context, succeeded); } FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode( CCodec_Jbig2Context* pJbig2Context, PauseIndicatorIface* pPause) { - int ret = pJbig2Context->m_pContext->Continue(pPause); - return Decode(pJbig2Context, ret); + bool succeeded = pJbig2Context->m_pContext->Continue(pPause); + return Decode(pJbig2Context, succeeded); } FXCODEC_STATUS CCodec_Jbig2Module::Decode(CCodec_Jbig2Context* pJbig2Context, - int result) { + bool decode_success) { FXCODEC_STATUS status = pJbig2Context->m_pContext->GetProcessingStatus(); if (status != FXCODEC_STATUS_DECODE_FINISH) return status; pJbig2Context->m_pContext.reset(); - if (result != JBIG2_SUCCESS) + if (!decode_success) return FXCODEC_STATUS_ERROR; int dword_size = pJbig2Context->m_height * pJbig2Context->m_dest_pitch / 4; |