return IMAGE_UTIL_ERROR_NONE;
}
-static void _image_util_decode_destroy_image_handle(decode_encode_s * handle)
-{
- image_util_retm_if((handle == NULL), "Invalid Handle");
- void *image_handle = (void *)(handle->image_h);
- image_util_retm_if((image_handle == NULL), "Invalid image handle");
-
- IMAGE_UTIL_SAFE_FREE(image_handle);
-}
-
static int _image_util_decode_create_jpeg_handle(decode_encode_s * handle)
{
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
/* It is needed to reuse decode handle for C#, so it shoud be reallocated */
- void *image_handle = (void *)(handle->image_h);
- if (image_handle != NULL)
- _image_util_decode_destroy_image_handle(handle);
+ IMAGE_UTIL_SAFE_FREE(handle->image_h);
mm_util_jpeg_yuv_data *_handle = (mm_util_jpeg_yuv_data *) calloc(1, sizeof(mm_util_jpeg_yuv_data));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
/* It is needed to reuse decode handle for C#, so it shoud be reallocated */
- void *image_handle = (void *)(handle->image_h);
- if (image_handle != NULL)
- _image_util_decode_destroy_image_handle(handle);
+ IMAGE_UTIL_SAFE_FREE(handle->image_h);
mm_util_png_data *_handle = (mm_util_png_data *) calloc(1, sizeof(mm_util_png_data));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
/* It is needed to reuse decode handle for C#, so it shoud be reallocated */
- void *image_handle = (void *)(handle->image_h);
- if (image_handle != NULL)
- _image_util_decode_destroy_image_handle(handle);
+ IMAGE_UTIL_SAFE_FREE(handle->image_h);
mm_util_gif_data *_handle = (mm_util_gif_data *) calloc(1, sizeof(mm_util_gif_data));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
/* It is needed to reuse decode handle for C#, so it shoud be reallocated */
- void *image_handle = (void *)(handle->image_h);
- if (image_handle != NULL)
- _image_util_decode_destroy_image_handle(handle);
+ IMAGE_UTIL_SAFE_FREE(handle->image_h);
mm_util_bmp_data *_handle = (mm_util_bmp_data *) calloc(1, sizeof(mm_util_bmp_data));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
_handle->src_buffer = NULL;
_handle->dst_buffer = NULL;
_handle->path = NULL;
- _handle->image_h = 0;
+ _handle->image_h = NULL;
_handle->is_decode = TRUE;
_handle->image_type = _NOT_SUPPORTED_IMAGE_TYPE;
_handle->src_buffer = (void *)calloc(1, sizeof(void *));
if (_handle->src_buffer == NULL) {
image_util_error("The memory of input buffer was not allocated");
- _image_util_decode_destroy_image_handle(_handle);
+ IMAGE_UTIL_SAFE_FREE(_handle->image_h);
return IMAGE_UTIL_ERROR_OUT_OF_MEMORY;
}
return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
}
- _image_util_decode_destroy_image_handle(_handle);
+ IMAGE_UTIL_SAFE_FREE(_handle->image_h);
/* g_thread_exit(handle->thread); */
if (_handle->thread) {
_handle->src_buffer = NULL;
_handle->dst_buffer = NULL;
_handle->path = NULL;
- _handle->image_h = 0;
+ _handle->image_h = NULL;
_handle->is_decode = FALSE;
_handle->is_encoded = FALSE;
_handle->current_buffer_count = 0;
}
err = mm_util_gif_image_set_image(frame, src_buffer);
if (err != MM_UTIL_ERROR_NONE) {
- image_util_error("mm_util_gif_image_set_delay_time is failed %d", err);
+ image_util_error("mm_util_gif_image_set_image is failed %d", err);
return _image_error_capi(ERR_TYPE_ENCODE, err);
}
_handle->current_buffer_count++;
image_util_error("Invalid Handle");
return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
}
- image_util_retvm_if((path == NULL || strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
+ image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
if (_handle->dst_buffer)
_handle->dst_buffer = NULL;