Unify the type of width and height to 'unsigned int' 34/200934/5
authorjiyong.min <jiyong.min@samsung.com>
Wed, 6 Mar 2019 07:05:00 +0000 (16:05 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Thu, 7 Mar 2019 01:11:04 +0000 (10:11 +0900)
- The type of width and height was previously mixed
with 'unsigned long' and 'unsigned int'.

Change-Id: I2a6d47aa8e5cc375818bb0a400a495d8d0193d6d

src/image_util.c [changed mode: 0755->0644]
src/image_util_decode.c

old mode 100755 (executable)
new mode 100644 (file)
index 3d5d15a..64889c7
@@ -120,7 +120,7 @@ static void __mm_util_destroy_color_image(mm_image_info_s *image)
        IMAGE_UTIL_SAFE_FREE(image);
 }
 
-static int __mm_util_create_color_image(mm_image_info_s **image, unsigned long width, unsigned long height, mm_util_color_format_e color, void *data, size_t size)
+static int __mm_util_create_color_image(mm_image_info_s **image, unsigned int width, unsigned int height, mm_util_color_format_e color, void *data, size_t size)
 {
        int ret = IMAGE_UTIL_ERROR_NONE;
        mm_image_info_s *_color_image = NULL;
@@ -147,7 +147,7 @@ static int __mm_util_create_color_image(mm_image_info_s **image, unsigned long w
        _color_image->height = height;
        _color_image->color = color;
 
-       image_util_debug("w [%lu], h [%lu], color [%u], size [%zu], data [%p]", _color_image->width, _color_image->height, _color_image->color, _color_image->size, _color_image->data);
+       image_util_debug("w [%u], h [%u], color [%u], size [%zu], data [%p]", _color_image->width, _color_image->height, _color_image->color, _color_image->size, _color_image->data);
 
        *image = _color_image;
 
@@ -253,7 +253,7 @@ static int __mm_util_transform(transformation_s *handle)
        }
 
        if (dst_buf[dst_index] != NULL && res_buffer_size != 0) {
-               ret = __mm_util_create_color_image(&(handle->dst), (unsigned long)src_width, (unsigned long)src_height, src_format, (void *)dst_buf[dst_index], res_buffer_size);
+               ret = __mm_util_create_color_image(&(handle->dst), src_width, src_height, src_format, (void *)dst_buf[dst_index], res_buffer_size);
                if (ret != IMAGE_UTIL_ERROR_NONE)
                        image_util_error("__mm_util_create_color_image failed");
        } else {
@@ -271,7 +271,7 @@ static int __image_util_image_to_packet(mm_image_info_s *image, media_packet_h *
 {
        int err = IMAGE_UTIL_ERROR_NONE;
        mm_util_color_format_e format = 0;
-       unsigned long width = 0, height = 0;
+       unsigned int width = 0, height = 0;
        void *buffer = NULL;
        size_t buffer_size = 0;
        media_format_h fmt = NULL;
@@ -363,12 +363,12 @@ gpointer __mm_util_thread_repeate(gpointer data)
                handle->src = pop_data;
                handle->dst = NULL;
 
-               image_util_debug("orig_image: %p [%zu] %lu X %lu (%u)", pop_data->data, pop_data->size, pop_data->width, pop_data->height, pop_data->color);
+               image_util_debug("orig_image: %p [%zu] %u X %u (%u)", pop_data->data, pop_data->size, pop_data->width, pop_data->height, pop_data->color);
 
                ret = __mm_util_transform(handle);
 
                if (handle->dst != NULL)
-                       image_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color);
+                       image_util_debug("result_image: %p [%zu] %u X %u (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color);
                else
                        image_util_error("Error - handle->dst is NULL");
 
@@ -432,7 +432,7 @@ static int _image_util_packet_to_image(media_packet_h packet, mm_image_info_s **
        image_util_debug("[Fotmat: %u] W x H : %d x %d", mimetype, width, height);
        image_util_retvm_if(((width == 0) || (height == 0) || (size == 0) || (ptr == NULL)), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid source packet");
 
-       err = __mm_util_create_color_image(color_image, (unsigned long)width, (unsigned long)height, __mimetype_to_image_format(mimetype), ptr, (size_t)size);
+       err = __mm_util_create_color_image(color_image, (unsigned int)width, (unsigned int)height, __mimetype_to_image_format(mimetype), ptr, (size_t)size);
        image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__mm_util_create_color_image failed (%d)", err);
 
        image_util_debug("_image_util_packet_to_image succeed");
index bcf3da6..6e04397 100755 (executable)
@@ -222,7 +222,7 @@ int image_util_decode_set_jpeg_downscale(image_util_decode_h handle, image_util_
        return IMAGE_UTIL_ERROR_NONE;
 }
 
-static int _image_util_decode_internal(decode_s * _handle, unsigned long *res_width, unsigned long *res_height, size_t *res_size)
+static int __image_util_decode_internal(decode_s * _handle, unsigned int *res_width, unsigned int *res_height, size_t *res_size)
 {
        int err = MM_UTIL_ERROR_NONE;
        image_util_fenter();
@@ -250,7 +250,7 @@ static int _image_util_decode_internal(decode_s * _handle, unsigned long *res_wi
                        if (_handle->path)
                                err = mm_util_decode_from_png_file(_handle->path, &image_info);
                        else
-                               err = mm_util_decode_from_png_memory(_handle->src_buffer, (size_t)_handle->src_size, &image_info);
+                               err = mm_util_decode_from_png_memory(_handle->src_buffer, _handle->src_size, &image_info);
                }
                break;
        case IMAGE_UTIL_GIF:
@@ -258,7 +258,7 @@ static int _image_util_decode_internal(decode_s * _handle, unsigned long *res_wi
                        if (_handle->path)
                                err = mm_util_decode_from_gif_file(_handle->path, &image_info);
                        else
-                               err = mm_util_decode_from_gif_memory(_handle->src_buffer, (size_t)_handle->src_size, &image_info);
+                               err = mm_util_decode_from_gif_memory(_handle->src_buffer, _handle->src_size, &image_info);
                }
                break;
        case IMAGE_UTIL_BMP:
@@ -266,7 +266,7 @@ static int _image_util_decode_internal(decode_s * _handle, unsigned long *res_wi
                        if (_handle->path)
                                err = mm_util_decode_from_bmp_file(_handle->path, &image_info);
                        else
-                               err = mm_util_decode_from_bmp_memory(_handle->src_buffer, (size_t)_handle->src_size, &image_info);
+                               err = mm_util_decode_from_bmp_memory(_handle->src_buffer, _handle->src_size, &image_info);
                }
                break;
        default:
@@ -288,7 +288,7 @@ static int _image_util_decode_internal(decode_s * _handle, unsigned long *res_wi
                image_util_error("fail to decode image [%d]", err);
        }
 
-       image_util_debug("dst_buffer(%p) width (%lu) height (%lu) dst_size (%zu)", *(_handle->dst_buffer), *res_width, *res_height, *res_size);
+       image_util_debug("dst_buffer(%p) width (%u) height (%u) dst_size (%zu)", *(_handle->dst_buffer), *res_width, *res_height, *res_size);
 
        return _image_error_capi(err);
 }
@@ -297,8 +297,8 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi
 {
        int err = IMAGE_UTIL_ERROR_NONE;
        decode_s *_handle = (decode_s *) handle;
-       unsigned long _width = 0;
-       unsigned long _height = 0;
+       unsigned int _width = 0;
+       unsigned int _height = 0;
        size_t _size = 0;
 
        image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
@@ -307,11 +307,11 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi
        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");
 
-       err = _image_util_decode_internal(_handle, &_width, &_height, &_size);
+       err = __image_util_decode_internal(_handle, &_width, &_height, &_size);
        image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_internal failed");
 
-       *width = _width;
-       *height = _height;
+       *width = (unsigned long)_width;
+       *height = (unsigned long)_height;
        *size = (unsigned long long)_size;
 
        return err;
@@ -322,15 +322,15 @@ gpointer _image_util_decode_thread(gpointer data)
 {
        decode_s *_handle = (decode_s *) data;
        int err = IMAGE_UTIL_ERROR_NONE;
-       unsigned long _width = 0;
-       unsigned long _height = 0;
+       unsigned int _width = 0;
+       unsigned int _height = 0;
        size_t _size = 0;
 
        image_util_fenter();
 
        image_util_retvm_if((_handle == NULL), NULL, "Invalid Handle");
 
-       err = _image_util_decode_internal(_handle, &_width, &_height, &_size);
+       err = __image_util_decode_internal(_handle, &_width, &_height, &_size);
        if (err == IMAGE_UTIL_ERROR_NONE)
                image_util_debug("Success - decode_internal");
        else
@@ -338,7 +338,7 @@ gpointer _image_util_decode_thread(gpointer data)
 
        if (_handle->_decode_cb) {
                image_util_debug("call completed_cb");
-               _handle->_decode_cb->image_decode_completed_cb(err, _handle->_decode_cb->user_data, _width, _height, (unsigned long long)_size);
+               _handle->_decode_cb->image_decode_completed_cb(err, _handle->_decode_cb->user_data, (unsigned long)_width, (unsigned long)_height, (unsigned long long)_size);
        } else {
                image_util_error("No callback");
        }