Replace output parameters to pointer 70/191370/1
authorjiyong.min <jiyong.min@samsung.com>
Tue, 16 Oct 2018 09:19:44 +0000 (18:19 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 16 Oct 2018 09:20:49 +0000 (18:20 +0900)
Change-Id: I54db27cd62fd1b93203630419383074f73d368dc

gif/mm_util_gif.c

index 5c80755..c0ebe83 100755 (executable)
@@ -36,7 +36,7 @@
 
 #define GRAPHIC_EXT_BLOCK_SIZE 4
 
-static int __convert_gif_to_rgba(void *data, ColorMapObject *color_map, GifRowType *screen_buffer, unsigned long width, unsigned long height)
+static int __convert_gif_to_rgba(void **data, ColorMapObject *color_map, GifRowType *screen_buffer, unsigned long width, unsigned long height)
 {
        unsigned long i, j;
        GifRowType gif_row;
@@ -45,12 +45,12 @@ static int __convert_gif_to_rgba(void *data, ColorMapObject *color_map, GifRowTy
 
        mm_util_fenter();
 
-       if ((data = (void *)calloc(1, width * height * 4)) == NULL) {
+       if ((*data = (void *)calloc(1, width * height * 4)) == NULL) {
                mm_util_error("Failed to allocate memory required, aborted.");
                return MM_UTIL_ERROR_OUT_OF_MEMORY;
        }
 
-       buffer = (GifByteType *) data;
+       buffer = (GifByteType *) *data;
        for (i = 0; i < height; i++) {
                gif_row = screen_buffer[i];
                for (j = 0; j < width; j++) {
@@ -228,7 +228,7 @@ static int __read_gif(mm_image_info_s *decoded, const char *filename, void *memo
                goto error;
        }
 
-       ret = __convert_gif_to_rgba(decoded->data, ColorMap, screen_buffer, GifFile->SWidth, GifFile->SHeight);
+       ret = __convert_gif_to_rgba(&decoded->data, ColorMap, screen_buffer, GifFile->SWidth, GifFile->SHeight);
        if (ret != MM_UTIL_ERROR_NONE) {
                mm_util_error("could not convert gif to rgba");
                ret = MM_UTIL_ERROR_INVALID_OPERATION;
@@ -361,12 +361,12 @@ SUCCESS:
        return ret;
 }
 
-static int _gif_encode_open_file(GifFileType *gft)
+static int _gif_encode_open_file(GifFileType **gft)
 {
        mm_util_fenter();
        mm_util_retvm_if(gft == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
 
-       if ((gft = EGifOpenFileName(GIF_TMP_FILE, 0, NULL)) == NULL) {
+       if ((*gft = EGifOpenFileName(GIF_TMP_FILE, 0, NULL)) == NULL) {
                mm_util_error("could not open file");
                return MM_UTIL_ERROR_INVALID_OPERATION;
        }
@@ -614,7 +614,7 @@ static int _mm_util_gif_encode_start(mm_gif_file_h gif_file_h, unsigned long wid
        mm_util_fenter();
 
        if (gif_file->filename != NULL) {
-               ret = _gif_encode_open_file(gif_file->GifFile);
+               ret = _gif_encode_open_file(&gif_file->GifFile);
                mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "_gif_encode_open_file failed");
        } else if (gif_file->enc_buffer != NULL && gif_file->enc_buffer_size != NULL) {
                ret = _gif_encode_open_mem(gif_file);