mm_util_retvm_if(size <= 0, 0, "Failed to write memory due to size(%d).", size);
mm_util_retvm_if(write_data_ptr == NULL, 0, "Failed to write memory due to invalid output data.");
- mm_util_retvm_if(write_data_ptr->mem == NULL, 0, "Failed to write memory due to invalid output buffer.");
- *(write_data_ptr->mem) = (void *)realloc(*(write_data_ptr->mem), (write_data_ptr->size + size));
- mm_util_retvm_if(*(write_data_ptr->mem) == NULL, 0, "Failed to write memory due to allocation failure.");
+ write_data_ptr->mem = (void *)realloc(write_data_ptr->mem, (write_data_ptr->size + size));
+ mm_util_retvm_if(write_data_ptr->mem == NULL, 0, "Failed to write memory due to allocation failure.");
- memcpy(*(write_data_ptr->mem) + write_data_ptr->size, data, size);
+ memcpy(write_data_ptr->mem + write_data_ptr->size, data, size);
write_data_ptr->size += size;
return size;
mm_util_fenter();
mm_util_retvm_if(gif_file == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
- gif_file->write_data_ptr.mem = (void**)&(gif_file->buffer);
+ gif_file->write_data_ptr.mem = NULL;
gif_file->write_data_ptr.size = 0;
if ((gif_file->GifFile = EGifOpen(&(gif_file->write_data_ptr), __write_function, NULL)) == NULL) {
ret = _gif_encode_move_to_file(gif_file->filename);
mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "__move_tmp_to_origin failed");
} else if (gif_file->write_data_ptr.mem != NULL) {
- ret = _gif_encode_move_to_mem(gif_file->buffer, gif_file->write_data_ptr.size,
+ ret = _gif_encode_move_to_mem(gif_file->write_data_ptr.mem, gif_file->write_data_ptr.size,
gif_file->enc_buffer, gif_file->enc_buffer_size);
- MMUTIL_SAFE_FREE(gif_file->buffer);
+ MMUTIL_SAFE_FREE(gif_file->write_data_ptr.mem);
gif_file->write_data_ptr.size = 0;
mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "_gif_encode_move_to_origin_mem failed");
}
}
MMUTIL_SAFE_G_FREE(gif_file->filename);
- MMUTIL_SAFE_FREE(gif_file->buffer);
+ MMUTIL_SAFE_FREE(gif_file->write_data_ptr.mem);
}