From 2e2ee0e7f786dbc27a5b85b27d5e91e821069aea Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Wed, 10 May 2017 14:42:26 -0400 Subject: Cleanup CGifDecompressor part 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9754da8d1bf54b328761ac9d83fcc4a3518b4a73 Reviewed-on: https://pdfium-review.googlesource.com/5230 Reviewed-by: dsinclair Commit-Queue: Nicolás Peña --- core/fxcodec/codec/ccodec_gifmodule.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'core/fxcodec/codec/ccodec_gifmodule.cpp') diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp index 33d74a9da4..70f55ceaa8 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.cpp +++ b/core/fxcodec/codec/ccodec_gifmodule.cpp @@ -82,27 +82,18 @@ GifDecodeStatus CCodec_GifModule::LoadFrame(FXGIF_Context* ctx, if (ret == GifDecodeStatus::Success) { if (pAttribute) { pAttribute->m_nGifLeft = - (*ctx->m_Gif->img_ptr_arr_ptr)[frame_num]->image_info_ptr->left; - pAttribute->m_nGifTop = - (*ctx->m_Gif->img_ptr_arr_ptr)[frame_num]->image_info_ptr->top; + ctx->m_Gif->m_Images[frame_num]->m_ImageInfo.left; + pAttribute->m_nGifTop = ctx->m_Gif->m_Images[frame_num]->m_ImageInfo.top; pAttribute->m_fAspectRatio = ctx->m_Gif->pixel_aspect; - if (ctx->m_Gif->cmt_data_ptr) { - const uint8_t* buf = - (const uint8_t*)ctx->m_Gif->cmt_data_ptr->GetBuffer(0); - uint32_t len = ctx->m_Gif->cmt_data_ptr->GetLength(); - if (len > 21) { - uint8_t size = *buf++; - if (size) { - pAttribute->m_strAuthor = CFX_ByteString(buf, size); - } else { - pAttribute->m_strAuthor.clear(); - } - buf += size; - size = *buf++; - if (size == 20) { - memcpy(pAttribute->m_strTime, buf, size); - } - } + const uint8_t* buf = + reinterpret_cast(ctx->m_Gif->cmt_data.GetBuffer(0)); + uint32_t len = ctx->m_Gif->cmt_data.GetLength(); + if (len > 21) { + uint8_t size = *buf++; + if (size != 0) + pAttribute->m_strAuthor = CFX_ByteString(buf, size); + else + pAttribute->m_strAuthor.clear(); } } } -- cgit v1.2.3