typedef struct {
unsigned long width; /**< width */
unsigned long height; /**< height */
- unsigned long long size; /**< size */
+ size_t size; /**< size */
void *data; /**< data */
} mm_util_bmp_data;
* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_decode_from_bmp_memory(void *memory, unsigned long long src_size, mm_util_bmp_data * decoded);
+int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_bmp_data * decoded);
/**
* This function encodes raw data to bmp file
MMUTIL_SAFE_FREE(bitmap);
}
-static int __read_bmp(mm_util_bmp_data *decoded, const char *filename, void *memory, unsigned long long src_size)
+static int __read_bmp(mm_util_bmp_data *decoded, const char *filename, void *memory, size_t src_size)
{
bmp_bitmap_callback_vt bitmap_callbacks = {
__bitmap_create,
return ret;
}
-int mm_util_decode_from_bmp_memory(void *memory, unsigned long long src_size, mm_util_bmp_data *decoded)
+int mm_util_decode_from_bmp_memory(void *memory, const size_t src_size, mm_util_bmp_data *decoded)
{
int ret;
mm_util_color_format_e format; /**< pixel format*/
int width; /**< width */
int height; /**< heigt */
- unsigned int size; /**< size */
+ size_t size; /**< size */
void *data; /**< data */ // int decode_yuv_subsample; /**< decode_yuv_subsample */
} mm_util_jpeg_yuv_data;
* @see mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, unsigned int *size);
+int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, size_t *size);
/**
* This function extracts yuv data from jpeg file with downscale decode option
* @see mm_util_jpeg_yuv_data, mm_util_color_format_e
* @since R1, 1.0
*/
-int mm_util_decode_from_jpeg_memory_with_downscale(void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
+int mm_util_decode_from_jpeg_memory_with_downscale(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded);
#ifdef __cplusplus
MM_UTIL_JPEG_MEM,
} mm_util_jpeg_cont_format_e;
-static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void **mem, unsigned int *csize, void *rawdata, int width, int height, mm_util_color_format_e color_format, int quality)
+static int __mm_image_encode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, FILE *fp, void **mem, size_t *csize, void *rawdata, int width, int height, mm_util_color_format_e color_format, int quality)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
}
if (control_format == MM_UTIL_JPEG_MEM)
- *csize = (unsigned int)size;
+ *csize = (size_t)size;
return iErrorCode;
}
-static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, mm_util_jpeg_yuv_data *decoded_data, FILE *fp, void *src, unsigned int size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale)
+static int __mm_image_decode_with_libjpeg(mm_util_jpeg_cont_format_e control_format, mm_util_jpeg_yuv_data *decoded_data, FILE *fp, void *src, size_t size, mm_util_color_format_e color_format, mm_util_jpeg_decode_downscale downscale)
{
int iErrorCode = MM_UTIL_ERROR_NONE;
struct jpeg_decompress_struct dinfo;
jpeg_stdio_src(&dinfo, fp);
mm_util_debug("jpeg_stdio_src");
} else {
- jpeg_mem_src(&dinfo, src, size);
+ jpeg_mem_src(&dinfo, src, (unsigned long)size);
mm_util_debug("jpeg_mem_src");
}
return ret;
}
-int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, unsigned int *size)
+int mm_util_jpeg_encode_to_memory(mm_util_jpeg_yuv_data *decoded, int quality, void **mem, size_t *size)
{
int ret = MM_UTIL_ERROR_NONE;
MMUTIL_SAFE_FREE(decoded->data);
decoded->data = dst;
- decoded->size = (unsigned int)res_buffer_size;
+ decoded->size = res_buffer_size;
}
} else {
ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_FILE, decoded, fp, NULL, 0, fmt, downscale);
return ret;
}
-int mm_util_decode_from_jpeg_memory_with_downscale(void *src, unsigned int size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
+int mm_util_decode_from_jpeg_memory_with_downscale(void *src, const size_t size, mm_util_color_format_e fmt, mm_util_jpeg_decode_downscale downscale, mm_util_jpeg_yuv_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;
MMUTIL_SAFE_FREE(decoded->data);
decoded->data = dst;
- decoded->size = (unsigned int)res_buffer_size;
+ decoded->size = res_buffer_size;
}
} else {
ret = __mm_image_decode_with_libjpeg(MM_UTIL_JPEG_MEM, decoded, NULL, src, size, fmt, downscale);
fprintf(stderr, "\t[JPEG_testsuite] mm_util_decode_from_jpeg_file_with_downscale failed %d\n", ret);
return FALSE;
}
- if (FALSE == _write_file(DECODE_FILE_PATH, g_decoded_data.data, (size_t)g_decoded_data.size)) {
+ if (FALSE == _write_file(DECODE_FILE_PATH, g_decoded_data.data, g_decoded_data.size)) {
fprintf(stderr, "\t[JPEG_testsuite] writing decoded data failed : %s\n", DECODE_FILE_PATH);
return FALSE;
}
return FALSE;
}
- ret = mm_util_decode_from_jpeg_memory_with_downscale(g_readed_data, (unsigned int)g_readed_size, g_color, g_downscale, &g_decoded_data);
+ ret = mm_util_decode_from_jpeg_memory_with_downscale(g_readed_data, g_readed_size, g_color, g_downscale, &g_decoded_data);
if (ret != MM_UTIL_ERROR_NONE) {
fprintf(stderr, "\t[JPEG_testsuite] mm_util_decode_from_jpeg_memory_with_downscale failed %d\n", ret);
return FALSE;
}
- if (FALSE == _write_file(DECODE_MEM_PATH, g_decoded_data.data, (size_t)g_decoded_data.size)) {
+ if (FALSE == _write_file(DECODE_MEM_PATH, g_decoded_data.data, g_decoded_data.size)) {
fprintf(stderr, "\t[JPEG_testsuite] writing decoded data failed : %s\n", DECODE_MEM_PATH);
return FALSE;
}
int ret = 0;
/* for encoding jpeg to memory */
void *encoded_data = NULL;
- unsigned int encoded_size = 0;
+ size_t encoded_size = 0;
if ((mode != TEST_ENCODE_FILE) && (mode != TEST_ENCODE_MEMORY))
return TRUE;
- if (FALSE == _read_file(g_path, &g_decoded_data.data, &g_readed_size)) {
+ if (FALSE == _read_file(g_path, &g_decoded_data.data, &g_decoded_data.size)) {
fprintf(stderr, "\t[JPEG_testsuite] reading file error\n");
return FALSE;
}
- g_decoded_data.size = (unsigned int)g_readed_size;
g_decoded_data.format = (mm_util_color_format_e)g_color;
/* test encoding jpeg */
SAFE_FREE(encoded_data);
return FALSE;
}
- if (FALSE == _write_file(ENCODE_MEM_PATH, encoded_data, (size_t)encoded_size)) {
+ if (FALSE == _write_file(ENCODE_MEM_PATH, encoded_data, encoded_size)) {
fprintf(stderr, "\t[JPEG_testsuite] writing decoded data failed : %s\n", ENCODE_MEM_PATH);
SAFE_FREE(encoded_data);
return FALSE;
* @see mm_util_png_data, mm_util_init_decode_png
* @since R1, 1.0
*/
-int mm_util_decode_from_png_memory(void *memory, unsigned long long src_size, mm_util_png_data * decoded);
+int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_util_png_data * decoded);
/**
* This function extracts raw data to png file
return ret;
}
-int mm_util_decode_from_png_memory(void *memory, unsigned long long src_size, mm_util_png_data *decoded)
+int mm_util_decode_from_png_memory(void *memory, const size_t src_size, mm_util_png_data *decoded)
{
int ret = MM_UTIL_ERROR_NONE;