Remove unused macro and modify few data type due to out-of-range issue 62/200762/7
authorjiyong.min <jiyong.min@samsung.com>
Mon, 4 Mar 2019 01:10:51 +0000 (10:10 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Wed, 6 Mar 2019 05:25:19 +0000 (14:25 +0900)
Change-Id: I88e9e8b4220e3f09aff73886c317f39f24374cf5

common/include/mm_util_private.h
imgp/include/mm_util_imgp.h [changed mode: 0755->0644]
imgp/include/mm_util_imgp_internal.h [changed mode: 0755->0644]
imgp/mm_util_imgp.c
packaging/libmm-utility.spec

index 0695f15..1ef398f 100644 (file)
@@ -44,7 +44,6 @@ extern "C" {
 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
 #define MM_UTIL_ROUND_UP_8(num) (((num)+7)&~7)
-#define MM_UTIL_ROUND_UP_16(num) (((num)+15)&~15)
 #define MM_UTIL_ROUND_DOWN_2(num) ((num)&(~1))
 #define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
 #define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
old mode 100755 (executable)
new mode 100644 (file)
index 3192275..73bdb9c
@@ -42,12 +42,19 @@ typedef enum {
 } mm_util_img_rotate_type;
 
 int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, unsigned int height, size_t *imgsize);
-int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, mm_util_color_format_e dst_format, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, unsigned int dst_width, unsigned int dst_height, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format, mm_util_img_rotate_type angle, unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
-int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height, mm_util_color_format_e src_format,
-                       unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_width, unsigned int crop_dest_height,
-                       unsigned char **dst, unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_convert_colorspace(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+               mm_util_color_format_e src_format, mm_util_color_format_e dst_format, unsigned char **dst,
+               unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_resize_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+               mm_util_color_format_e src_format, unsigned int dst_width, unsigned int dst_height, unsigned char **dst,
+               unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_rotate_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+               mm_util_color_format_e src_format, mm_util_img_rotate_type angle, unsigned char **dst,
+               unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
+int mm_util_crop_image(const unsigned char *src, unsigned int src_width, unsigned int src_height,
+               mm_util_color_format_e src_format, unsigned int crop_start_x, unsigned int crop_start_y,
+               unsigned int crop_dest_width, unsigned int crop_dest_height, unsigned char **dst,
+               unsigned int *result_buf_width, unsigned int *result_buf_height, size_t *result_buf_size);
 
 
 #ifdef __cplusplus
old mode 100755 (executable)
new mode 100644 (file)
index 7b8bcfd..2d6f4f6 100644 (file)
 
 typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_plugin_type_e);
 
-static int check_valid_picture_size(int width, int height)
+static int __check_valid_picture_size(unsigned int width, unsigned int height)
 {
-       if ((int)width > 0 && (int)height > 0 &&
-               ((width + 128) * (unsigned long long)(height + 128)) < INT_MAX/4)
+       if ((size_t)((width + 128) * (height + 128)) < (size_t)(INT_MAX/4))
                return MM_UTIL_ERROR_NONE;
 
        return MM_UTIL_ERROR_INVALID_PARAMETER;
@@ -196,13 +195,13 @@ static int __mm_util_get_crop_image_size(mm_util_color_format_e format, unsigned
        int ret = MM_UTIL_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
        unsigned char y_chroma_shift = 0;
-       int size, w2, h2, size2;
-       int stride, stride2;
+       unsigned int w2, h2, stride, stride2;
+       size_t size, size2;
 
        mm_util_fenter();
 
        mm_util_retvm_if(imgsize == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid imgsize");
-       mm_util_retvm_if(check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width and height");
+       mm_util_retvm_if(__check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width and height");
 
        *imgsize = 0;
 
@@ -347,8 +346,8 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned int idx = 0;
-       int src_bytesperline = src_width * 3;
-       int dst_bytesperline = crop_dest_width * 3;
+       unsigned long src_bytesperline = src_width * 3;
+       unsigned long dst_bytesperline = crop_dest_width * 3;
 
        src += crop_start_y * src_bytesperline + 3 * crop_start_x;
 
@@ -366,8 +365,8 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned int idx = 0;
-       int src_bytesperline = src_width * 2;
-       int dst_bytesperline = crop_dest_width * 2;
+       unsigned long src_bytesperline = src_width * 2;
+       unsigned long dst_bytesperline = crop_dest_width * 2;
 
        src += crop_start_y * src_bytesperline + 2 * crop_start_x;
 
@@ -385,8 +384,8 @@ unsigned int crop_start_x, unsigned int crop_start_y, unsigned int crop_dest_wid
 {
        int ret = MM_UTIL_ERROR_NONE;
        unsigned int idx = 0;
-       int start_x = crop_start_x;
-       int start_y = crop_start_y;
+       unsigned int start_x = crop_start_x;
+       unsigned int start_y = crop_start_y;
 
        const unsigned char *_src = src + start_y * src_width + start_x;
 
@@ -858,14 +857,14 @@ int mm_util_get_image_size(mm_util_color_format_e format, unsigned int width, un
        int ret = MM_UTIL_ERROR_NONE;
        unsigned char x_chroma_shift = 0;
        unsigned char y_chroma_shift = 0;
-       int size, w2, h2, size2;
-       int stride, stride2;
+       unsigned int w2, h2, stride, stride2;
+       size_t size, size2;
 
        mm_util_fenter();
 
        mm_util_retvm_if((imgsize == NULL), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid imgsize");
        mm_util_retvm_if((IS_MM_UTIL_COLOR_FORMAT(format) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid format [%d]", format);
-       mm_util_retvm_if((check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE), MM_UTIL_ERROR_INVALID_PARAMETER, "image width & height is too big");
+       mm_util_retvm_if((__check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE), MM_UTIL_ERROR_INVALID_PARAMETER, "image width & height is too big");
 
        *imgsize = 0;
 
index 7c878a0..5d8a979 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.1.30
+Version:    0.1.31
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0