#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;
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++) {
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;
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;
}
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);