summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_gifmodule.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-05-03 10:54:23 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-03 15:06:31 +0000
commit1e5a98afd195930de69f7b468a852717722377b6 (patch)
tree1488f109aaab731e5f9703ab2b91d607f0d0b9fe /core/fxcodec/codec/ccodec_gifmodule.cpp
parentf45ade3a0af908a1d6a51c5cc675f81517c9a22a (diff)
downloadpdfium-1e5a98afd195930de69f7b468a852717722377b6.tar.xz
Use enum class GifDecodeStatus instead of integers in fx_gif
Change-Id: If37147f513a87bafb3299a493393a6bc44165dbe Reviewed-on: https://pdfium-review.googlesource.com/4811 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_gifmodule.cpp')
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
index ca9fd07ba6..b53880587e 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -115,18 +115,18 @@ void CCodec_GifModule::Finish(FXGIF_Context* ctx) {
}
}
-int32_t CCodec_GifModule::ReadHeader(FXGIF_Context* ctx,
- int* width,
- int* height,
- int* pal_num,
- void** pal_pp,
- int* bg_index,
- CFX_DIBAttribute* pAttribute) {
+GifDecodeStatus CCodec_GifModule::ReadHeader(FXGIF_Context* ctx,
+ int* width,
+ int* height,
+ int* pal_num,
+ void** pal_pp,
+ int* bg_index,
+ CFX_DIBAttribute* pAttribute) {
if (setjmp(ctx->gif_ptr->jmpbuf))
- return 0;
+ return GifDecodeStatus::Error;
- int32_t ret = gif_read_header(ctx->gif_ptr);
- if (ret != 1)
+ GifDecodeStatus ret = gif_read_header(ctx->gif_ptr);
+ if (ret != GifDecodeStatus::Success)
return ret;
*width = ctx->gif_ptr->width;
@@ -134,29 +134,30 @@ int32_t CCodec_GifModule::ReadHeader(FXGIF_Context* ctx,
*pal_num = ctx->gif_ptr->global_pal_num;
*pal_pp = ctx->gif_ptr->global_pal_ptr;
*bg_index = ctx->gif_ptr->bc_index;
- return 1;
+ return GifDecodeStatus::Success;
}
-int32_t CCodec_GifModule::LoadFrameInfo(FXGIF_Context* ctx, int* frame_num) {
+GifDecodeStatus CCodec_GifModule::LoadFrameInfo(FXGIF_Context* ctx,
+ int* frame_num) {
if (setjmp(ctx->gif_ptr->jmpbuf))
- return 0;
+ return GifDecodeStatus::Error;
- int32_t ret = gif_get_frame(ctx->gif_ptr);
- if (ret != 1)
+ GifDecodeStatus ret = gif_get_frame(ctx->gif_ptr);
+ if (ret != GifDecodeStatus::Success)
return ret;
*frame_num = gif_get_frame_num(ctx->gif_ptr);
- return 1;
+ return GifDecodeStatus::Success;
}
-int32_t CCodec_GifModule::LoadFrame(FXGIF_Context* ctx,
- int frame_num,
- CFX_DIBAttribute* pAttribute) {
+GifDecodeStatus CCodec_GifModule::LoadFrame(FXGIF_Context* ctx,
+ int frame_num,
+ CFX_DIBAttribute* pAttribute) {
if (setjmp(ctx->gif_ptr->jmpbuf))
- return 0;
+ return GifDecodeStatus::Error;
- int32_t ret = gif_load_frame(ctx->gif_ptr, frame_num);
- if (ret == 1) {
+ GifDecodeStatus ret = gif_load_frame(ctx->gif_ptr, frame_num);
+ if (ret == GifDecodeStatus::Success) {
if (pAttribute) {
pAttribute->m_nGifLeft =
(*ctx->gif_ptr->img_ptr_arr_ptr)[frame_num]->image_info_ptr->left;