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;
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;
}
/* 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 */