Update debug message 24/236324/12
authorhj kim <backto.kim@samsung.com>
Tue, 16 Jun 2020 07:47:31 +0000 (16:47 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 18 Jun 2020 01:11:42 +0000 (10:11 +0900)
Change-Id: I68e64f26acd9a93a7026737fb8936c09b4c9c71a

src/image_util.c
src/image_util_decode.c
src/image_util_encode.c

index 5b1c047..b6f6f8f 100644 (file)
@@ -173,7 +173,7 @@ static void __destroy_async_queue(gpointer data)
 {
        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);
@@ -195,7 +195,7 @@ int image_util_transform_create(transformation_h * 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");
 
        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");
@@ -245,7 +245,7 @@ int image_util_transform_set_hardware_acceleration(transformation_h handle, bool
        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
@@ -261,7 +261,7 @@ int image_util_transform_set_colorspace(transformation_h handle, image_util_colo
 
        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;
@@ -276,9 +276,9 @@ int image_util_transform_set_resolution(transformation_h handle, unsigned int wi
 
        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;
@@ -293,7 +293,7 @@ int image_util_transform_set_rotation(transformation_h handle, image_util_rotati
 
        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;
@@ -307,10 +307,10 @@ int image_util_transform_set_crop_area(transformation_h handle, unsigned int sta
        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;
@@ -331,7 +331,7 @@ int image_util_transform_get_colorspace(transformation_h handle, image_util_colo
 {
        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");
 
@@ -346,7 +346,7 @@ int image_util_transform_get_resolution(transformation_h handle, unsigned int *w
 {
        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");
@@ -363,7 +363,7 @@ int image_util_transform_get_rotation(transformation_h handle, image_util_rotati
 {
        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");
 
@@ -378,7 +378,7 @@ int image_util_transform_get_crop_area(transformation_h handle, unsigned int *st
 {
        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");
@@ -474,7 +474,7 @@ int image_util_transform_destroy(transformation_h 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->thread) {
                g_async_queue_push_front(_handle->queue, GINT_TO_POINTER(&_thread_stop));
@@ -537,9 +537,9 @@ int image_util_calculate_buffer_size(int width, int height, image_util_colorspac
 
        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);
 
@@ -586,7 +586,7 @@ int image_util_foreach_supported_colorspace(image_util_type_e image_type, image_
        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))
index 6df1f2d..6019314 100644 (file)
@@ -43,10 +43,10 @@ static int __image_util_decode_read_header(const char *path, unsigned char **buf
        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;
@@ -99,8 +99,8 @@ static int __image_util_decode_check_image_type(const unsigned char *image_buffe
        ,};
        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++) {
@@ -117,7 +117,7 @@ int image_util_decode_create(image_util_decode_h * 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");
 
        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");
@@ -144,7 +144,7 @@ int image_util_decode_set_input_path(image_util_decode_h handle, const char *pat
        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);
@@ -172,8 +172,8 @@ int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigne
        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");
@@ -199,8 +199,8 @@ int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned cha
 
        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;
 
@@ -211,7 +211,7 @@ int image_util_decode_set_colorspace(image_util_decode_h handle, image_util_colo
 {
        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");
@@ -226,7 +226,7 @@ int image_util_decode_set_jpeg_downscale(image_util_decode_h handle, image_util_
 {
        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");
@@ -306,11 +306,12 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi
 
        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");
@@ -441,7 +442,7 @@ static gpointer __image_util_decode_thread(gpointer data)
 
        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)
@@ -487,8 +488,8 @@ static gpointer __image_util_decode_thread(gpointer data)
 
 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);
@@ -505,11 +506,11 @@ int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_co
 
        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);
@@ -578,7 +579,7 @@ int image_util_decode_destroy(image_util_decode_h handle)
 {
        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();
 
index a78eb4e..697dd05 100644 (file)
@@ -35,7 +35,7 @@ static gboolean __is_invalid_image_info(mm_image_info_s image_info)
 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 *));
@@ -82,7 +82,7 @@ int image_util_encode_create(image_util_type_e image_type, image_util_encode_h *
        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));
@@ -134,7 +134,7 @@ int image_util_encode_set_resolution(image_util_encode_h handle, unsigned long w
 
        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 */
@@ -163,7 +163,7 @@ int image_util_encode_set_colorspace(image_util_encode_h handle, image_util_colo
 
        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");
@@ -178,7 +178,7 @@ int image_util_encode_set_quality(image_util_encode_h handle, int 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_JPEG);
 
        image_util_retvm_if((quality <= 0 || quality > 100), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid quality");
@@ -192,7 +192,7 @@ int image_util_encode_set_png_compression(image_util_encode_h handle, image_util
 {
        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");
@@ -207,7 +207,7 @@ int image_util_encode_set_gif_frame_delay_time(image_util_encode_h handle, unsig
        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.");
@@ -233,8 +233,8 @@ int image_util_encode_set_input_buffer(image_util_encode_h handle, const unsigne
 
        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) {
@@ -258,7 +258,7 @@ int image_util_encode_set_output_path(image_util_encode_h handle, const char *pa
 
        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;
@@ -275,8 +275,8 @@ int image_util_encode_set_output_buffer(image_util_encode_h handle, unsigned cha
 
        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);
 
@@ -439,7 +439,7 @@ static gpointer __image_util_encode_thread(gpointer data)
        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) {
@@ -493,8 +493,8 @@ static gpointer __image_util_encode_thread(gpointer data)
 
 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);
@@ -509,8 +509,8 @@ int image_util_encode_run(image_util_encode_h handle, unsigned long long *size)
 
        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");
@@ -528,11 +528,11 @@ int image_util_encode_run_async(image_util_encode_h handle, image_util_encode_co
 
        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);
@@ -645,7 +645,7 @@ int image_util_encode_destroy(image_util_encode_h handle)
        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");
 
@@ -758,8 +758,8 @@ int image_util_encode_jpeg(const unsigned char *buffer, int width, int height, i
 
        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");
@@ -782,9 +782,9 @@ int image_util_encode_jpeg_to_memory(const unsigned char *image_buffer, int widt
 
        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");