From 45808c00945a7d1eeaba7b3fc363f79b243021af Mon Sep 17 00:00:00 2001 From: hj kim Date: Tue, 16 Oct 2018 15:49:07 +0900 Subject: [PATCH] Remove unused APIs Change-Id: Iebcd15b636ea69c16cceecd73d1e487f8f521fff --- gif/mm_util_gif.c | 97 ------------------------------------------------------- 1 file changed, 97 deletions(-) diff --git a/gif/mm_util_gif.c b/gif/mm_util_gif.c index 65f435c..a2dafc5 100755 --- a/gif/mm_util_gif.c +++ b/gif/mm_util_gif.c @@ -279,8 +279,6 @@ static int __write_function(GifFileType *gft, const GifByteType *data, int size) static const int DEFAULT_COLORMAP_SIZE = (1 << 8); -int _gif_image_alloc_glob_ext_block(GifFileType *gif_file, int function, int byte_count, ExtensionBlock **ext_block); - static int __gif_extract_rgb(mm_image_info_s *gif_image, unsigned long num_of_pixels, GifByteType **red, GifByteType **green, GifByteType **blue) { GifWord i, j; @@ -557,97 +555,6 @@ int _gif_image_write_ext_block(gif_file_s *gif_file, mm_image_info_s *gif_image) return MM_UTIL_ERROR_NONE; } -int _gif_image_alloc_glob_ext_block(GifFileType *gif_file, int function, int byte_count, ExtensionBlock **ext_block) -{ - int i = 0; - ExtensionBlock *_ext_block = NULL; - - mm_util_retvm_if(gif_file == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); - mm_util_retvm_if(byte_count == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); - mm_util_retvm_if(ext_block == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); - - if (gif_file->ExtensionBlocks == NULL) { - gif_file->ExtensionBlocks = (ExtensionBlock *)calloc(1, sizeof(ExtensionBlock)); - if (gif_file->ExtensionBlocks == NULL) { - mm_util_error("Memory allocation failed"); - *ext_block = NULL; - return MM_UTIL_ERROR_OUT_OF_MEMORY; - } - } else { - /* check exist function block */ - for (i = 0; i < gif_file->ExtensionBlockCount; i++) { - _ext_block = &gif_file->ExtensionBlocks[i]; - if (_ext_block != NULL && _ext_block->Function == function) { - mm_util_error("[Not Error] Ext block has already exist"); - *ext_block = _ext_block; - return MM_UTIL_ERROR_NONE; - } - } - ExtensionBlock *realloc_ptr = (ExtensionBlock *)realloc(gif_file->ExtensionBlocks, (sizeof(ExtensionBlock) * (gif_file->ExtensionBlockCount + 1))); - if (realloc_ptr == NULL) { - mm_util_error("Memory reallocation failed"); - *ext_block = NULL; - return MM_UTIL_ERROR_OUT_OF_MEMORY; - } - gif_file->ExtensionBlocks = realloc_ptr; - } - - /* get allocated extention block */ - _ext_block = &gif_file->ExtensionBlocks[gif_file->ExtensionBlockCount]; - - _ext_block->Function = function; - _ext_block->ByteCount = byte_count; - _ext_block->Bytes = (GifByteType *)calloc(1, (sizeof(GifByteType) * byte_count)); - if (_ext_block->Bytes == NULL) { - mm_util_error("Memory allocation failed"); - /* free all ext_blocks, TODO: free current ext_blocks */ - for (i = 0; i < gif_file->ExtensionBlockCount; i++) { - _ext_block = &gif_file->ExtensionBlocks[i]; - MMUTIL_SAFE_FREE(_ext_block->Bytes); - } - MMUTIL_SAFE_FREE(gif_file->ExtensionBlocks); - gif_file->ExtensionBlockCount = 0; - return MM_UTIL_ERROR_OUT_OF_MEMORY; - } - - gif_file->ExtensionBlockCount++; - - *ext_block = _ext_block; - return MM_UTIL_ERROR_NONE; -} - -int _gif_image_write_glob_ext_blocks(gif_file_s *gif_file) -{ - int i = 0; - ExtensionBlock *_ext_block = NULL; - - mm_util_retvm_if(gif_file == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); - - for (i = 0; i < gif_file->GifFile->ExtensionBlockCount; i++) { - _ext_block = &gif_file->GifFile->ExtensionBlocks[i]; - mm_util_retvm_if(_ext_block == NULL, MM_UTIL_ERROR_NONE, "extension block is empty"); - - if (_ext_block->Function != CONTINUE_EXT_FUNC_CODE) { - if (EGifPutExtensionLeader(gif_file->GifFile, _ext_block->Function) == GIF_ERROR) { - mm_util_error("EGifPutExtensionLeader failed due to %s", GifErrorString(gif_file->GifFile->Error)); - return MM_UTIL_ERROR_INVALID_OPERATION; - } - } - if (EGifPutExtensionBlock(gif_file->GifFile, _ext_block->ByteCount, _ext_block->Bytes) == GIF_ERROR) { - mm_util_error("EGifPutExtensionBlock failed due to %s", GifErrorString(gif_file->GifFile->Error)); - return MM_UTIL_ERROR_INVALID_OPERATION; - } - if (i == gif_file->GifFile->ExtensionBlockCount - 1 || (_ext_block + 1)->Function != CONTINUE_EXT_FUNC_CODE) { - if (EGifPutExtensionTrailer(gif_file->GifFile) == GIF_ERROR) { - mm_util_error("EGifPutExtensionTrailer failed due to %s", GifErrorString(gif_file->GifFile->Error)); - return MM_UTIL_ERROR_INVALID_OPERATION; - } - } - } - - return MM_UTIL_ERROR_NONE; -} - int mm_util_gif_encode_create(mm_gif_file_h *gif_file_h) { gif_file_s *gif_file = NULL; @@ -744,10 +651,6 @@ int mm_util_gif_encode_start(mm_gif_file_h gif_file_h) return MM_UTIL_ERROR_INVALID_OPERATION; } - /* Write global extension blocks */ - ret = _gif_image_write_glob_ext_blocks(gif_file); - mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "_gif_image_write_glob_ext_blocks failed"); - gif_file->is_started = TRUE; return MM_UTIL_ERROR_NONE; -- 2.7.4