From 5df369d4876c9675d6a36fb9bfd20016c7f0ad82 Mon Sep 17 00:00:00 2001 From: Jiyong Min Date: Tue, 27 Sep 2016 08:57:53 +0900 Subject: [PATCH] Modify invalid conversion type and argument mismatch - PROBLEM build warning Change-Id: Ibc5da37d908d59d8cdcaca928af0e41a834d075f Signed-off-by: Jiyong Min --- libdcm-util/dcm_image_codec.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libdcm-util/dcm_image_codec.cpp b/libdcm-util/dcm_image_codec.cpp index 54c553d..034beed 100755 --- a/libdcm-util/dcm_image_codec.cpp +++ b/libdcm-util/dcm_image_codec.cpp @@ -145,13 +145,14 @@ static int _dcm_rotate_image(const unsigned char *source, const dcm_image_format return DCM_SUCCESS; } -int _dcm_rotate_rgb(unsigned char *source, const unsigned int size, int format, unsigned int *ori_width, unsigned int *ori_height) +int _dcm_rotate_rgb(unsigned char *source, const unsigned long long *size, int format, unsigned int *ori_width, unsigned int *ori_height) { unsigned int dpp = 0; /* data per pixel */ unsigned int x = 0, y = 0; unsigned int i = 0; unsigned int width = 0, height = 0; unsigned char *temp_buf = NULL; + size_t _size = (size_t)*size; if (format == DCM_IMAGE_FORMAT_RGBA) { dpp = 4; @@ -162,13 +163,13 @@ int _dcm_rotate_rgb(unsigned char *source, const unsigned int size, int format, return DCM_ERROR_INVALID_PARAMETER; } - temp_buf = malloc(size); + temp_buf = (unsigned char*)malloc(_size); if (temp_buf == NULL) { dcm_error("Failed to allocate memory"); return DCM_ERROR_OUT_OF_MEMORY; } /* initialize */ - memset(temp_buf, 0x00, size); + memset(temp_buf, 0x00, _size); width = *ori_width; height = *ori_height; @@ -183,7 +184,7 @@ int _dcm_rotate_rgb(unsigned char *source, const unsigned int size, int format, } /* copy image from temp buffer to original buffer */ - memcpy(source, temp_buf, size); + memcpy(source, temp_buf, _size); DCM_SAFE_FREE(temp_buf); /* swap width & height due to rotate 90 degree */ -- 2.34.1