Merge to XFA: Remove typdefs for pointer types in fx_system.h.
[pdfium.git] / core / src / fxcodec / lgif / fx_gif.cpp
index 1eb4a75..29e99f2 100644 (file)
@@ -5,7 +5,7 @@
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
 \r
 #include "fx_gif.h"\r
-void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size)\r
+void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size)\r
 {\r
     next_in = src_buf;\r
     avail_in = src_size;\r
@@ -65,7 +65,7 @@ void CGifLZWDecoder::AddCode(FX_WORD prefix_code, uint8_t append_char)
         }\r
     }\r
 }\r
-int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)\r
+int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size)\r
 {\r
     if(des_size == 0) {\r
         return 3;\r
@@ -144,7 +144,7 @@ int32_t CGifLZWDecoder::Decode(FX_LPBYTE des_buf, FX_DWORD& des_size)
     }\r
     return 0;\r
 }\r
-static FX_BOOL _gif_grow_buf(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD size)\r
+static FX_BOOL _gif_grow_buf(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD size)\r
 {\r
     if (dst_len < size) {\r
         FX_DWORD len_org = dst_len;\r
@@ -169,7 +169,7 @@ static inline void _gif_cut_index(uint8_t& val, FX_DWORD index, uint8_t index_bi
     FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;\r
     val |= ((index & cut) >> index_bit_use) << bit_use;\r
 }\r
-static inline uint8_t _gif_cut_buf(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)\r
+static inline uint8_t _gif_cut_buf(const uint8_t* buf, FX_DWORD& offset, uint8_t bit_cut, uint8_t& bit_offset, FX_DWORD& bit_num)\r
 {\r
     if (bit_cut != 8) {\r
         FX_WORD index = 0;\r
@@ -206,7 +206,7 @@ void CGifLZWEncoder::ClearTable()
         code_table[i].suffix = 0;\r
     }\r
 }\r
-void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst_buf, FX_DWORD& offset)\r
+void CGifLZWEncoder::Start( uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, FX_DWORD& offset)\r
 {\r
     code_size = code_len + 1;\r
     src_bit_cut = code_size;\r
@@ -225,7 +225,7 @@ void CGifLZWEncoder::Start( uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& dst
     code_table[index_num].prefix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);\r
     code_table[index_num].suffix = _gif_cut_buf(src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);\r
 }\r
-void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)\r
+void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)\r
 {\r
     if (!_gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) {\r
         longjmp(jmp, 1);\r
@@ -236,7 +236,7 @@ void CGifLZWEncoder::WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD&
     FXSYS_memset32(index_buf, 0, GIF_DATA_BLOCK);\r
     index_buf_len = 0;\r
 }\r
-void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )\r
+void CGifLZWEncoder::EncodeString( FX_DWORD index, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )\r
 {\r
     uint8_t index_bit_use;\r
     index_bit_use = 0;\r
@@ -287,7 +287,7 @@ void CGifLZWEncoder::EncodeString( FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWORD&
         index_bit_cur++;\r
     }\r
 }\r
-FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )\r
+FX_BOOL CGifLZWEncoder::Encode( const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset )\r
 {\r
     uint8_t            suffix;\r
     if (setjmp(jmp)) {\r
@@ -313,7 +313,7 @@ FX_BOOL CGifLZWEncoder::Encode( FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE&
     src_bit_num = 0;\r
     return TRUE;\r
 }\r
-FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t& bit_offset )\r
+FX_BOOL CGifLZWEncoder::LookUpInTable( const uint8_t* buf, FX_DWORD& offset, uint8_t& bit_offset )\r
 {\r
     for (FX_WORD i = table_cur; i < index_num; i++) {\r
         if (code_table[i].prefix == code_table[index_num].prefix &&\r
@@ -327,7 +327,7 @@ FX_BOOL CGifLZWEncoder::LookUpInTable( FX_LPCBYTE buf, FX_DWORD& offset, uint8_t
     table_cur = code_end + 1;\r
     return FALSE;\r
 }\r
-void CGifLZWEncoder::Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)\r
+void CGifLZWEncoder::Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset)\r
 {\r
     EncodeString(code_table[index_num].prefix, dst_buf, dst_len, offset);\r
     EncodeString(code_end, dst_buf, dst_len, offset);\r
@@ -532,13 +532,13 @@ void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr)
 #endif\r
     FX_Free(gif_ptr);\r
 }\r
-void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg)\r
+void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg)\r
 {\r
     if(gif_ptr != NULL && gif_ptr->_gif_error_fn != NULL) {\r
         gif_ptr->_gif_error_fn(gif_ptr, err_msg);\r
     }\r
 }\r
-void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg) {}\r
+void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}\r
 int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)\r
 {\r
     if(gif_ptr == NULL) {\r
@@ -547,7 +547,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
     FX_DWORD skip_size_org = gif_ptr->skip_size;\r
     ASSERT(sizeof(GifHeader) == 6);\r
     GifHeader* gif_header_ptr = NULL;\r
-    if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_header_ptr, 6) == NULL) {\r
+    if(_gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) {\r
         return 2;\r
     }\r
     if(FXSYS_strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||\r
@@ -558,7 +558,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
     }\r
     ASSERT(sizeof(GifLSD) == 7);\r
     GifLSD* gif_lsd_ptr = NULL;\r
-    if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_lsd_ptr, 7) == NULL) {\r
+    if(_gif_read_data(gif_ptr, (uint8_t**)&gif_lsd_ptr, 7) == NULL) {\r
         gif_ptr->skip_size = skip_size_org;\r
         return 2;\r
     }\r
@@ -566,7 +566,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
         gif_ptr->global_pal_num = 2 << ((GifGF*)&gif_lsd_ptr->global_flag)->pal_bits;\r
         ASSERT(sizeof(GifPalette) == 3);\r
         int32_t global_pal_size = gif_ptr->global_pal_num * 3;\r
-        FX_LPBYTE global_pal_ptr = NULL;\r
+        uint8_t* global_pal_ptr = NULL;\r
         if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {\r
             gif_ptr->skip_size = skip_size_org;\r
             return 2;\r
@@ -581,8 +581,8 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr)
         GIF_PTR_NOT_NULL(gif_ptr->global_pal_ptr, gif_ptr);\r
         FXSYS_memcpy32(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);\r
     }\r
-    gif_ptr->width = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->width);\r
-    gif_ptr->height = (int)_GetWord_LSBFirst((FX_LPBYTE)&gif_lsd_ptr->height);\r
+    gif_ptr->width = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);\r
+    gif_ptr->height = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);\r
     gif_ptr->bc_index = gif_lsd_ptr->bc_index;\r
     gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;\r
     return 1;\r
@@ -598,7 +598,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr)
             case GIF_D_STATUS_TAIL:\r
                 return 1;\r
             case GIF_D_STATUS_SIG: {\r
-                    FX_LPBYTE sig_ptr = NULL;\r
+                    uint8_t* sig_ptr = NULL;\r
                     if(_gif_read_data(gif_ptr, &sig_ptr, 1) == NULL) {\r
                         return 2;\r
                     }\r
@@ -623,7 +623,7 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr)
                     }\r
                 }\r
             case GIF_D_STATUS_EXT: {\r
-                    FX_LPBYTE ext_ptr = NULL;\r
+                    uint8_t* ext_ptr = NULL;\r
                     if(_gif_read_data(gif_ptr, &ext_ptr, 1) == NULL) {\r
                         return 2;\r
                     }\r
@@ -668,8 +668,8 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr)
                     continue;\r
                 }\r
             case GIF_D_STATUS_IMG_DATA: {\r
-                    FX_LPBYTE data_size_ptr = NULL;\r
-                    FX_LPBYTE data_ptr = NULL;\r
+                    uint8_t* data_size_ptr = NULL;\r
+                    uint8_t* data_ptr = NULL;\r
                     FX_DWORD skip_size_org = gif_ptr->skip_size;\r
                     if(_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {\r
                         return 2;\r
@@ -711,15 +711,15 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr
 }\r
 int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)\r
 {\r
-    FX_LPBYTE data_size_ptr = NULL;\r
-    FX_LPBYTE data_ptr = NULL;\r
+    uint8_t* data_size_ptr = NULL;\r
+    uint8_t* data_ptr = NULL;\r
     FX_DWORD skip_size_org = gif_ptr->skip_size;\r
     switch(gif_ptr->decode_status) {\r
 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION\r
         case GIF_D_STATUS_EXT_AE: {\r
                 ASSERT(sizeof(GifAE) == 12);\r
                 GifAE* gif_ae_ptr = NULL;\r
-                if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_ae_ptr, 12) == NULL) {\r
+                if(_gif_read_data(gif_ptr, (uint8_t**)&gif_ae_ptr, 12) == NULL) {\r
                     return 2;\r
                 }\r
                 CFX_ByteString gif_ae_data_str;\r
@@ -734,7 +734,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                         gif_ptr->skip_size = skip_size_org;\r
                         return 2;\r
                     }\r
-                    gif_ae_data_str += CFX_ByteString((FX_LPCBYTE)data_ptr, data_size);\r
+                    gif_ae_data_str += CFX_ByteString((const uint8_t*)data_ptr, data_size);\r
                 }\r
                 FXSYS_memcpy32(gif_ptr->app_identify, gif_ae_ptr->app_identify, 8);\r
                 FXSYS_memcpy32(gif_ptr->app_authentication, gif_ae_ptr->app_authentication, 3);\r
@@ -745,7 +745,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                 }\r
                 gif_ptr->app_data = FX_Alloc(uint8_t, gif_ptr->app_data_size);\r
                 GIF_PTR_NOT_NULL(gif_ptr->app_data, gif_ptr);\r
-                FXSYS_memcpy32(gif_ptr->app_data, FX_LPCBYTE(gif_ae_data_str), gif_ptr->app_data_size);\r
+                FXSYS_memcpy32(gif_ptr->app_data, const uint8_t*(gif_ae_data_str), gif_ptr->app_data_size);\r
             }\r
             break;\r
 #endif\r
@@ -763,7 +763,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                         gif_ptr->skip_size = skip_size_org;\r
                         return 2;\r
                     }\r
-                    *(gif_ptr->cmt_data_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);\r
+                    *(gif_ptr->cmt_data_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);\r
                 }\r
             }\r
             break;\r
@@ -772,7 +772,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
         case GIF_D_STATUS_EXT_PTE: {\r
                 ASSERT(sizeof(GifPTE) == 13);\r
                 GifPTE* gif_pte_ptr = NULL;\r
-                if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_pte_ptr, 13) == NULL) {\r
+                if(_gif_read_data(gif_ptr, (uint8_t**)&gif_pte_ptr, 13) == NULL) {\r
                     return 2;\r
                 }\r
                 GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);\r
@@ -784,10 +784,10 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                 gif_pt_ptr->string_ptr = new CFX_ByteString;\r
                 GIF_PTR_NOT_NULL(gif_pt_ptr->string_ptr, gif_ptr);\r
                 gif_pt_ptr->pte_ptr->block_size = gif_pte_ptr->block_size;\r
-                gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_left);\r
-                gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_top);\r
-                gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_width);\r
-                gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((FX_LPBYTE)&gif_pte_ptr->grid_height);\r
+                gif_pt_ptr->pte_ptr->grid_left = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);\r
+                gif_pt_ptr->pte_ptr->grid_top = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_top);\r
+                gif_pt_ptr->pte_ptr->grid_width = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_width);\r
+                gif_pt_ptr->pte_ptr->grid_height = _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_height);\r
                 gif_pt_ptr->pte_ptr->char_width = gif_pte_ptr->char_width;\r
                 gif_pt_ptr->pte_ptr->char_height = gif_pte_ptr->char_height;\r
                 gif_pt_ptr->pte_ptr->fc_index = gif_pte_ptr->fc_index;\r
@@ -827,7 +827,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                         }\r
                         return 2;\r
                     }\r
-                    *(gif_pt_ptr->string_ptr) += CFX_ByteString((FX_LPCSTR)data_ptr, data_size);\r
+                    *(gif_pt_ptr->string_ptr) += CFX_ByteString((const FX_CHAR*)data_ptr, data_size);\r
                 }\r
                 gif_ptr->pt_ptr_arr_ptr->Add(gif_pt_ptr);\r
             }\r
@@ -837,7 +837,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
         case GIF_D_STATUS_EXT_GCE: {\r
                 ASSERT(sizeof(GifGCE) == 5);\r
                 GifGCE* gif_gce_ptr = NULL;\r
-                if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_gce_ptr, 6) == NULL) {\r
+                if(_gif_read_data(gif_ptr, (uint8_t**)&gif_gce_ptr, 6) == NULL) {\r
                     return 2;\r
                 }\r
                 if(gif_ptr->gce_ptr == NULL) {\r
@@ -846,7 +846,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr)
                 }\r
                 gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;\r
                 gif_ptr->gce_ptr->gce_flag = gif_gce_ptr->gce_flag;\r
-                gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((FX_LPBYTE)&gif_gce_ptr->delay_time);\r
+                gif_ptr->gce_ptr->delay_time = _GetWord_LSBFirst((uint8_t*)&gif_gce_ptr->delay_time);\r
                 gif_ptr->gce_ptr->trans_index = gif_gce_ptr->trans_index;\r
             }\r
             break;\r
@@ -886,7 +886,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
     FX_DWORD skip_size_org = gif_ptr->skip_size;\r
     ASSERT(sizeof(GifImageInfo) == 9);\r
     GifImageInfo* gif_img_info_ptr = NULL;\r
-    if(_gif_read_data(gif_ptr, (FX_LPBYTE*)&gif_img_info_ptr, 9) == NULL) {\r
+    if(_gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) {\r
         return 2;\r
     }\r
     GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));\r
@@ -894,10 +894,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
     FXSYS_memset32(gif_image_ptr, 0, sizeof(GifImage));\r
     gif_image_ptr->image_info_ptr = (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));\r
     GIF_PTR_NOT_NULL(gif_image_ptr->image_info_ptr, gif_ptr);\r
-    gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->left);\r
-    gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->top);\r
-    gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->width);\r
-    gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((FX_LPBYTE)&gif_img_info_ptr->height);\r
+    gif_image_ptr->image_info_ptr->left = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);\r
+    gif_image_ptr->image_info_ptr->top = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->top);\r
+    gif_image_ptr->image_info_ptr->width = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->width);\r
+    gif_image_ptr->image_info_ptr->height = _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->height);\r
     gif_image_ptr->image_info_ptr->local_flag = gif_img_info_ptr->local_flag;\r
     if(gif_image_ptr->image_info_ptr->left + gif_image_ptr->image_info_ptr->width > gif_ptr->width ||\r
             gif_image_ptr->image_info_ptr->top + gif_image_ptr->image_info_ptr->height > gif_ptr->height) {\r
@@ -915,7 +915,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
     if(gif_img_info_lf_ptr->local_pal) {\r
         ASSERT(sizeof(GifPalette) == 3);\r
         int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;\r
-        FX_LPBYTE loc_pal_ptr = NULL;\r
+        uint8_t* loc_pal_ptr = NULL;\r
         if(_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {\r
             gif_ptr->skip_size = skip_size_org;\r
             if(gif_image_ptr->image_info_ptr != NULL) {\r
@@ -929,10 +929,10 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr)
         }\r
         gif_image_ptr->local_pal_ptr = (GifPalette*)gif_ptr->_gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size);\r
         if(gif_image_ptr->local_pal_ptr != NULL) {\r
-            FXSYS_memcpy32((FX_LPBYTE)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);\r
+            FXSYS_memcpy32((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size);\r
         }\r
     }\r
-    FX_LPBYTE code_size_ptr = NULL;\r
+    uint8_t* code_size_ptr = NULL;\r
     if(_gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {\r
         gif_ptr->skip_size = skip_size_org;\r
         if(gif_image_ptr->image_info_ptr != NULL) {\r
@@ -963,8 +963,8 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num)
       ) {\r
         return 0;\r
     }\r
-    FX_LPBYTE data_size_ptr = NULL;\r
-    FX_LPBYTE data_ptr = NULL;\r
+    uint8_t* data_size_ptr = NULL;\r
+    uint8_t* data_ptr = NULL;\r
     FX_DWORD skip_size_org = gif_ptr->skip_size;\r
     GifImage* gif_image_ptr = gif_ptr->img_ptr_arr_ptr->GetAt(frame_num);\r
     FX_DWORD gif_img_row_bytes = gif_image_ptr->image_info_ptr->width;\r
@@ -1111,7 +1111,7 @@ void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status)
     gif_ptr->avail_in -= gif_ptr->skip_size;\r
     gif_ptr->skip_size = 0;\r
 }\r
-FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp, FX_DWORD data_size)\r
+uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, FX_DWORD data_size)\r
 {\r
     if(gif_ptr == NULL ||\r
             gif_ptr->avail_in < gif_ptr->skip_size + data_size) {\r
@@ -1121,13 +1121,13 @@ FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp,
     gif_ptr->skip_size += data_size;\r
     return *des_buf_pp;\r
 }\r
-void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DWORD src_size)\r
+void _gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, FX_DWORD src_size)\r
 {\r
     gif_ptr->next_in = src_buf;\r
     gif_ptr->avail_in = src_size;\r
     gif_ptr->skip_size = 0;\r
 }\r
-FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_buf_ptr)\r
+FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr)\r
 {\r
     if(avial_buf_ptr != NULL) {\r
         *avial_buf_ptr = NULL;\r
@@ -1141,7 +1141,7 @@ int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
 {\r
     return gif_ptr->img_ptr_arr_ptr->GetSize();\r
 }\r
-static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )\r
+static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )\r
 {\r
     if (gif_ptr->cur_offset) {\r
         return TRUE;\r
@@ -1171,13 +1171,13 @@ static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_
     }\r
     return TRUE;\r
 }\r
-void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height)\r
+void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height)\r
 {\r
-    CFX_ArrayTemplate<FX_LPBYTE> pass[4];\r
+    CFX_ArrayTemplate<uint8_t*> pass[4];\r
     int i, j;\r
     FX_DWORD row;\r
     row = 0;\r
-    FX_LPBYTE temp;\r
+    uint8_t* temp;\r
     while (row < height) {\r
         if (row % 8 == 0) {\r
             j = 0;\r
@@ -1198,12 +1198,12 @@ void interlace_buf(FX_LPCBYTE buf, FX_DWORD pitch, FX_DWORD height)
     }\r
     for (i = 0, row = 0; i < 4; i++) {\r
         for (j = 0; j < pass[i].GetSize(); j++, row++) {\r
-            FXSYS_memcpy32((FX_LPBYTE)&buf[pitch * row], pass[i].GetAt(j), pitch);\r
+            FXSYS_memcpy32((uint8_t*)&buf[pitch * row], pass[i].GetAt(j), pitch);\r
             FX_Free(pass[i].GetAt(j));\r
         }\r
     }\r
 }\r
-static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)\r
+static void _gif_write_block_data(const uint8_t* src_buf, FX_DWORD src_len, uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& dst_offset)\r
 {\r
     FX_DWORD src_offset = 0;\r
     while (src_len > GIF_DATA_BLOCK) {\r
@@ -1217,7 +1217,7 @@ static void _gif_write_block_data(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYT
     FXSYS_memcpy32(&dst_buf[dst_offset], &src_buf[src_offset], src_len);\r
     dst_offset += src_len;\r
 }\r
-static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )\r
+static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )\r
 {\r
     if (!_gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {\r
         return FALSE;\r
@@ -1326,7 +1326,7 @@ static FX_BOOL _gif_write_data( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_bu
     dst_buf[gif_ptr->cur_offset++] = GIF_SIG_TRAILER;\r
     return TRUE;\r
 }\r
-FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD& dst_len )\r
+FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, FX_DWORD& dst_len )\r
 {\r
     if (!_gif_write_header(gif_ptr, dst_buf, dst_len)) {\r
         return FALSE;\r