{
t_data_s *_t_data = (t_data_s *)data;
- image_util_retm_if((data == NULL), "Invalid data");
+ image_util_retm_if(!data, "Invalid data");
mm_image_destroy_image(_t_data->src);
IMAGE_UTIL_SAFE_FREE(_t_data->transform);
{
image_util_fenter();
- image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
transformation_s *_handle = (transformation_s *) calloc(1, sizeof(transformation_s));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
image_util_warning("DEPRECATION WARNING: image_util_transform_set_hardware_acceleration() is deprecated and will be removed from next release.");
image_util_debug("Set hardware_acceleration %d", mode);
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
#ifndef ENABLE_HW_ACCELERATION
image_util_retvm_if((mode == true), IMAGE_UTIL_ERROR_NOT_SUPPORTED, "hardware acceleration is not supported");
#endif
image_util_debug("Set colorspace_convert_info [%d]", colorspace);
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
_handle->color = colorspace;
image_util_debug("Set resize_info w[%d] h[%d]", width, height);
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((_handle->set_crop), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Crop and Resize can't do at the same time");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%d] h : [%d]", width, height);
+ image_util_retvm_if((_handle->set_crop), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Crop and Resize can't do at the same time");
_handle->width = width;
_handle->height = height;
image_util_debug("Set rotate_info [%d]", rotation);
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
_handle->rotation = rotation;
_handle->set_rotate = true;
unsigned int dest_width = 0;
unsigned int dest_height = 0;
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((_handle->set_resize), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Crop and Resize can't do at the same time");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((start_x >= end_x), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid position start_x : [%d] end_x : [%d]", start_x, end_x);
image_util_retvm_if((start_y >= end_y), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid position start_y : [%d] end_y : [%d]", start_y, end_y);
+ image_util_retvm_if((_handle->set_resize), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Crop and Resize can't do at the same time");
dest_width = end_x - start_x;
dest_height = end_y - start_y;
{
transformation_s *_handle = (transformation_s *) handle;
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!colorspace, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
image_util_retvm_if((!_handle->set_convert), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Did not set colorspace before");
{
transformation_s *_handle = (transformation_s *) handle;
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!width, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width");
image_util_retvm_if(!height, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid height");
image_util_retvm_if((!_handle->set_resize), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Did not set resolution before");
{
transformation_s *_handle = (transformation_s *) handle;
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!rotation, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid rotation");
image_util_retvm_if((!_handle->set_rotate), IMAGE_UTIL_ERROR_INVALID_OPERATION, "Did not set rotation before");
{
transformation_s *_handle = (transformation_s *) handle;
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!start_x, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid start_x");
image_util_retvm_if(!start_y, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid start_y");
image_util_retvm_if(!end_x, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid end_x");
image_util_fenter();
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
if (_handle->thread) {
g_async_queue_push_front(_handle->queue, GINT_TO_POINTER(&_thread_stop));
image_util_warning("DEPRECATION WARNING: image_util_calculate_buffer_size() is deprecated and will be removed from next release.");
- image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
image_util_retvm_if((width <= 0 || height <= 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width or Invalid height");
- image_util_retvm_if((size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "size is null");
+ image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
+ image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid size");
err = mm_util_get_image_size(TYPECAST_COLOR(colorspace), width, height, &size_ptr);
int idx = 0;
IMAGE_UTIL_TYPE_CHECK(image_type);
- image_util_retvm_if((callback == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "callback is null");
+ image_util_retvm_if(!callback, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
for (idx = (int)(NUM_OF_COLORSPACE - 1); idx >= 0; idx--) {
if (_is_supported_colorspace(idx, image_type))
unsigned char *read_buffer = NULL;
image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
- image_util_retvm_if(buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
+ image_util_retvm_if(!buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
fp = fopen(path, "r");
- if (fp == NULL) {
+ if (!fp) {
if (errno == EACCES || errno == EPERM) {
image_util_error("Fail to open path: Permission Denied [%s]", path);
return IMAGE_UTIL_ERROR_PERMISSION_DENIED;
,};
unsigned int i = 0;
- image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
- image_util_retvm_if((image_type == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid type");
+ image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+ image_util_retvm_if(!image_type, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_type");
*image_type = _NOT_SUPPORTED_IMAGE_TYPE; /* init */
for (i = 0; i < sizeof(image_header) / sizeof(image_header[0]); i++) {
{
image_util_fenter();
- image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
decode_s *_handle = (decode_s *) calloc(1, sizeof(decode_s));
image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
decode_s *_handle = (decode_s *) handle;
unsigned char *image_header = NULL;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
err = __image_util_decode_read_header(path, &image_header);
int err = IMAGE_UTIL_ERROR_NONE;
decode_s *_handle = (decode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((src_buffer == NULL || src_size < IMG_HEADER_LENGTH), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input buffer");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if((!src_buffer || src_size < IMG_HEADER_LENGTH), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input buffer");
err = __image_util_decode_check_image_type(src_buffer, &_handle->image_type);
image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__image_util_decode_check_image_type failed");
image_util_fenter();
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if(dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dst_buffer");
_handle->dst_buffer = (void **)dst_buffer;
{
decode_s *_handle = (decode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_TYPE_CHECK(_handle->image_type);
image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
{
decode_s *_handle = (decode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_JPEG);
image_util_retvm_if((down_scale < 0 || down_scale >= _NUM_OF_SCALE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "downscale is invalid");
image_util_warning("DEPRECATION WARNING: image_util_decode_run() is deprecated and will be removed from next release. Use image_util_decode_run2() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((_handle->path == NULL && _handle->src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
- image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
- image_util_retvm_if(width == NULL || height == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width or height");
- image_util_retvm_if(size == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid size");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle->path && !_handle->src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
+ image_util_retvm_if(!_handle->dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
+ image_util_retvm_if(!width, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid width");
+ image_util_retvm_if(!height, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid height");
+ image_util_retvm_if(!size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid size");
err = __image_util_decode_internal(_handle, &image_info);
image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__image_util_decode_internal failed");
image_util_fenter();
- image_util_retvm_if((_handle == NULL), NULL, "Invalid Handle");
+ image_util_retvm_if(!_handle, NULL, "Invalid Handle");
if (_handle->is_decode2) { //new decode
if (_handle->path)
static int __image_util_decode_create_thread(decode_s * handle)
{
- image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
/*create threads */
handle->thread = g_thread_new("decode_thread", __image_util_decode_thread, (gpointer)handle);
image_util_fenter();
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((_handle->path == NULL && _handle->src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
- image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
- image_util_retvm_if((completed_cb == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
- image_util_retvm_if((_handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle->path && !_handle->src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
+ image_util_retvm_if(!_handle->dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output");
+ image_util_retvm_if(!completed_cb, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
+ image_util_retvm_if(_handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
if (_handle->_decode_cb != NULL) {
IMAGE_UTIL_SAFE_FREE(_handle->_decode_cb);
{
decode_s *_handle = (decode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_fenter();
static int __allocate_source_buffer(encode_s *handle)
{
image_util_fenter();
- image_util_retvm_if(handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
if (handle->gif_encode_info.sources == NULL) {
handle->gif_encode_info.sources = calloc(1, sizeof(mm_image_info_s *));
int err = IMAGE_UTIL_ERROR_NONE;
image_util_fenter();
- image_util_retvm_if(handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid handle");
IMAGE_UTIL_TYPE_CHECK(image_type);
encode_s *_handle = (encode_s *) calloc(1, sizeof(encode_s));
image_util_warning("DEPRECATION WARNING: image_util_encode_set_resolution() is deprecated and will be removed from next release. Use image_util_create_image() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((width == 0 || height == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid resolution w : [%lu] h : [%lu]", width, height);
/* multi-src for a-gif */
image_util_warning("DEPRECATION WARNING: image_util_encode_set_colorspace() is deprecated and will be removed from next release. Use image_util_create_image() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_TYPE_CHECK(_handle->image_type);
image_util_retvm_if(!_is_valid_colorspace(colorspace), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
{
encode_s *_handle = (encode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_JPEG);
image_util_retvm_if((quality <= 0 || quality > 100), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid quality");
{
encode_s *_handle = (encode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_PNG);
image_util_retvm_if((compression < IMAGE_UTIL_PNG_COMPRESSION_0 || compression > IMAGE_UTIL_PNG_COMPRESSION_9), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid compression value");
int err = IMAGE_UTIL_ERROR_NONE;
encode_s *_handle = (encode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_GIF);
image_util_warning("DEPRECATION WARNING: image_util_encode_set_gif_frame_delay_time() is deprecated and will be removed from next release. Use image_util_set_delay_time() instead.");
image_util_warning("DEPRECATION WARNING: image_util_encode_set_input_buffer() is deprecated and will be removed from next release. Use image_util_create_image() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input buffer");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!src_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid src_buffer");
/* multi-src for a-gif */
if (_handle->image_type == IMAGE_UTIL_GIF) {
image_util_warning("DEPRECATION WARNING: image_util_encode_set_output_path() is deprecated and will be removed from next release. Use image_util_encode_run_to_file() or image_util_encode_run_async_to_file() instead.");
- image_util_retvm_if(handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
_handle->dst_buffer = NULL;
image_util_warning("DEPRECATION WARNING: image_util_encode_set_output_buffer() is deprecated and will be removed from next release. Use image_util_encode_run_to_buffer() or image_util_encode_run_async_to_buffer() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if(dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output buffer");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!dst_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid dst_buffer");
IMAGE_UTIL_SAFE_FREE(_handle->path);
unsigned char *buffer = NULL;
size_t buffer_size = 0;
- image_util_retvm_if((_handle == NULL), NULL, "Invalid Handle");
+ image_util_retvm_if(!_handle, NULL, "Invalid Handle");
if (_handle->new_src) { //new encode
if (_handle->path) {
static int __image_util_encode_create_thread(encode_s * handle)
{
- image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if((handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
+ image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
/*create threads */
handle->thread = g_thread_new("encode_thread", __image_util_encode_thread, (gpointer)handle);
image_util_warning("DEPRECATION WARNING: image_util_encode_run() is deprecated and will be removed from next release. Use image_util_encode_run_to_file() or image_util_encode_run_to_buffer() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- image_util_retvm_if(_handle->dst_buffer != NULL && size == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(_handle->dst_buffer && !size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
err = __image_util_encode_internal(_handle);
image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__image_util_encode_internal failed");
image_util_warning("DEPRECATION WARNING: image_util_encode_run_async() is deprecated and will be removed from next release. Use image_util_encode_run_async_to_file() or image_util_encode_run_async_to_buffer() instead.");
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((_handle->image_type != IMAGE_UTIL_GIF && __is_invalid_image_info(_handle->src)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
image_util_retvm_if((_handle->image_type == IMAGE_UTIL_GIF && (_handle->gif_encode_info.sources == NULL || __is_invalid_image_info(*_handle->gif_encode_info.sources[0]))), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
- image_util_retvm_if((completed_cb == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
- image_util_retvm_if((_handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
+ image_util_retvm_if(!completed_cb, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
+ image_util_retvm_if(_handle->thread, IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is already running");
if (_handle->_encode_cb != NULL) {
IMAGE_UTIL_SAFE_FREE(_handle->_encode_cb);
int err = IMAGE_UTIL_ERROR_NONE;
encode_s *_handle = (encode_s *) handle;
- image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
+ image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_debug("image_util_encode_destroy");
image_util_warning("DEPRECATION WARNING: image_util_encode_jpeg() is removed from 5.0. Use image_util_encode_create() instead.");
- image_util_retvm_if((path == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "path is null");
- image_util_retvm_if((buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "buffer is null");
+ image_util_retvm_if(!path, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid path");
+ image_util_retvm_if(!buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
image_util_retvm_if((strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
image_util_retvm_if((_is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
image_util_retvm_if((_is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
image_util_warning("DEPRECATION WARNING: image_util_encode_jpeg_to_memory() is removed from 5.0. Use image_util_encode_create() instead.");
- image_util_retvm_if((jpeg_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_buffer is null");
- image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
- image_util_retvm_if((jpeg_size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_size is null");
+ image_util_retvm_if(!image_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid image_buffer");
+ image_util_retvm_if(!jpeg_buffer, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_buffer");
+ image_util_retvm_if(!jpeg_size, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid jpeg_size");
image_util_retvm_if((_is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
image_util_retvm_if((_is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");