From: Jiyong Min Date: Tue, 6 Mar 2018 10:01:32 +0000 (+0900) Subject: Unify the type of the buffer size from 'unsigned int'/'unsigned long' to 'size_t' X-Git-Tag: submit/tizen/20180314.004633~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50e780e848aedd5c376c4c8ed197015d7fb2e9ef;p=platform%2Fcore%2Fapi%2Fimage-util.git Unify the type of the buffer size from 'unsigned int'/'unsigned long' to 'size_t' Change-Id: I80782f8457a3ace220bc74426fbf8b4aaeb5daf4 Signed-off-by: Jiyong Min --- diff --git a/src/image_util_decode.c b/src/image_util_decode.c index c273aaa..2c61ee7 100755 --- a/src/image_util_decode.c +++ b/src/image_util_decode.c @@ -352,7 +352,7 @@ static int _image_util_decode_internal(decode_encode_s * _handle) if (_handle->path) err = mm_util_decode_from_jpeg_file_with_downscale(_handle->path, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[_handle->down_scale], jpeg_data); else - err = mm_util_decode_from_jpeg_memory_with_downscale(_handle->src_buffer[0], (unsigned int)_handle->src_size, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[_handle->down_scale], jpeg_data); + err = mm_util_decode_from_jpeg_memory_with_downscale(_handle->src_buffer[0], (size_t)_handle->src_size, TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[_handle->down_scale], jpeg_data); if (err == MM_UTIL_ERROR_NONE) { *(_handle->dst_buffer) = jpeg_data->data; @@ -369,11 +369,11 @@ static int _image_util_decode_internal(decode_encode_s * _handle) if (_handle->path) err = mm_util_decode_from_png_file(_handle->path, png_data); else - err = mm_util_decode_from_png_memory(_handle->src_buffer[0], _handle->src_size, png_data); + err = mm_util_decode_from_png_memory(_handle->src_buffer[0], (size_t)_handle->src_size, png_data); if (err == MM_UTIL_ERROR_NONE) { *(_handle->dst_buffer) = png_data->data; - _handle->dst_size = png_data->size; + _handle->dst_size = (unsigned long long)png_data->size; _handle->width = png_data->width; _handle->height = png_data->height; } @@ -403,11 +403,11 @@ static int _image_util_decode_internal(decode_encode_s * _handle) if (_handle->path) err = mm_util_decode_from_bmp_file(_handle->path, bmp_data); else - err = mm_util_decode_from_bmp_memory(_handle->src_buffer[0], _handle->src_size, bmp_data); + err = mm_util_decode_from_bmp_memory(_handle->src_buffer[0], (size_t)_handle->src_size, bmp_data); if (err == MM_UTIL_ERROR_NONE) { *(_handle->dst_buffer) = bmp_data->data; - _handle->dst_size = bmp_data->size; + _handle->dst_size = (unsigned long long)bmp_data->size; _handle->width = bmp_data->width; _handle->height = bmp_data->height; } @@ -601,7 +601,7 @@ int image_util_decode_jpeg_from_memory_with_downscale(const unsigned char *jpeg_ mm_util_jpeg_yuv_data decoded; memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data)); - err = mm_util_decode_from_jpeg_memory_with_downscale((void *)jpeg_buffer, (unsigned int)jpeg_size, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &decoded); + err = mm_util_decode_from_jpeg_memory_with_downscale((void *)jpeg_buffer, (size_t)jpeg_size, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &decoded); if (err == MM_UTIL_ERROR_NONE) { *image_buffer = decoded.data; diff --git a/src/image_util_encode.c b/src/image_util_encode.c index bfd9f33..14b7791 100755 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -395,7 +395,7 @@ static int _image_util_encode_internal(decode_encode_s * _handle) case IMAGE_UTIL_JPEG: { mm_util_jpeg_yuv_data *jpeg_data = (mm_util_jpeg_yuv_data *) _handle->image_h; - unsigned int size = 0; + size_t size = 0; jpeg_data->data = _handle->src_buffer[0]; jpeg_data->format = TYPECAST_COLOR_BY_TYPE(_handle->colorspace, IMAGE_UTIL_JPEG); @@ -461,15 +461,12 @@ static int _image_util_encode_internal(decode_encode_s * _handle) size_t size = 0; bmp_data->data = _handle->src_buffer[0]; - if (_handle->path) { + + if (_handle->path) err = mm_util_encode_bmp_to_file(bmp_data, _handle->path); - } else { + else err = mm_util_encode_bmp_to_memory(bmp_data, _handle->dst_buffer, &size); - if (err == MM_UTIL_ERROR_NONE) - bmp_data->size = (unsigned long long)size; - else - bmp_data->size = 0; - } + if (err == MM_UTIL_ERROR_NONE) _handle->dst_size = (unsigned long long)size; }