{
switch (type) {
case IMAGE_UTIL_JPEG:
- image_util_retvm_if((_convert_jpeg_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[jpeg]not supported format");
+ image_util_retvm_if((_convert_jpeg_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[jpeg] %d not supported format", colorspace);
break;
case IMAGE_UTIL_PNG:
- image_util_retvm_if((_convert_png_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[png]not supported format");
+ image_util_retvm_if((_convert_png_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[png] %d not supported format", colorspace);
break;
case IMAGE_UTIL_GIF:
- image_util_retvm_if((_convert_gif_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[gif]not supported format");
+ image_util_retvm_if((_convert_gif_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[gif] %d not supported format", colorspace);
break;
case IMAGE_UTIL_BMP:
- image_util_retvm_if((_convert_bmp_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[bmp]not supported format");
+ image_util_retvm_if((_convert_bmp_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "[bmp] %d not supported format", colorspace);
break;
default:
image_util_retvm_if((_convert_bmp_colorspace_tbl[colorspace] == _NOT_SUPPORTED_COLORSPACE), FALSE, "Invalid image type");
int image_util_foreach_supported_jpeg_colorspace(image_util_supported_jpeg_colorspace_cb callback, void *user_data)
{
- image_util_colorspace_e idx = _NOT_SUPPORTED_COLORSPACE;
+ int idx = _NOT_SUPPORTED_COLORSPACE;
DEPRECATION_LOGW("image_util_foreach_supported_jpeg_colorspace()", "image_util_foreach_supported_colorspace()");
int image_util_foreach_supported_colorspace(image_util_type_e image_type, image_util_supported_colorspace_cb callback, void *user_data)
{
- image_util_colorspace_e idx = _NOT_SUPPORTED_COLORSPACE;
+ int idx = _NOT_SUPPORTED_COLORSPACE;
image_util_retvm_if((callback == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "callback is null");
}
if (_handle->image_count <= _handle->current_resolution_count) {
- gif_data->frames = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
- if (gif_data->frames == NULL) {
+ mm_util_gif_frame_data **tmp_buffer = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
+ if (tmp_buffer == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
+ gif_data->frames = tmp_buffer;
gif_data->frames[_handle->image_count] = (mm_util_gif_frame_data *) calloc(1, sizeof(mm_util_gif_frame_data));
if (gif_data->frames[_handle->image_count] == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
_handle->image_count++;
return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
}
if (_handle->image_count <= _handle->current_delay_count) {
- gif_data->frames = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
- if (gif_data->frames == NULL) {
+ mm_util_gif_frame_data **tmp_buffer = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
+ if (tmp_buffer == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
+ gif_data->frames = tmp_buffer;
gif_data->frames[_handle->image_count] = (mm_util_gif_frame_data *) calloc(1, sizeof(mm_util_gif_frame_data));
if (gif_data->frames[_handle->image_count] == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
_handle->image_count++;
/* initialize buffer and value for source buffer */
if (_handle->image_type == IMAGE_UTIL_GIF) {
+ void *tmp_buffer = NULL;
if (_handle->is_encoded) {
_image_util_encode_destroy_gif_buffer(_handle->image_h);
err = _image_util_encode_create_gif_buffer(_handle->image_h);
_handle->current_resolution_count = 0;
_handle->current_delay_count = 0;
}
- _handle->src_buffer = (void *)realloc(_handle->src_buffer, (_handle->current_buffer_count + 1) * sizeof(void *));
-
- if (_handle->src_buffer != NULL)
- _handle->src_buffer[_handle->current_buffer_count] = (void *)src_buffer;
+ tmp_buffer = (void *)realloc(_handle->src_buffer, (_handle->current_buffer_count + 1) * sizeof(void *));
+ image_util_retvm_if((tmp_buffer == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "memory reallocation failed");
+ _handle->src_buffer = tmp_buffer;
+ _handle->src_buffer[_handle->current_buffer_count] = (void *)src_buffer;
} else {
if (_handle->src_buffer == NULL)
_handle->src_buffer = (void *)calloc(1, sizeof(void *));
return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
}
if (_handle->image_count <= _handle->current_buffer_count) {
- gif_data->frames = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
- if (gif_data->frames == NULL) {
+ mm_util_gif_frame_data **tmp_buffer = (mm_util_gif_frame_data **) realloc(gif_data->frames, (_handle->image_count + 1) * sizeof(mm_util_gif_frame_data *));
+ if (tmp_buffer == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
+ gif_data->frames = tmp_buffer;
gif_data->frames[_handle->image_count] = (mm_util_gif_frame_data *) calloc(1, sizeof(mm_util_gif_frame_data));
if (gif_data->frames[_handle->image_count] == NULL) {
image_util_error("Error - OUT_OF_MEMORY");
- IMAGE_UTIL_SAFE_FREE(_handle);
+ _image_util_encode_destroy_gif_buffer(gif_data);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
_handle->image_count++;