int ret = 0;
int width;
int height;
- int len;
unsigned char *img_buffer;
unsigned int img_buffer_size;
- char filename[MAX_FILENAME_LEN];
-
if (argc < 1) {
fprintf(stderr, "Usage: ./mm_imgcv_testsuite filename(jpg format only)\n");
return ret;
}
- len = strlen(argv[1]);
- if (len > MAX_FILENAME_LEN) {
- fprintf(stderr, "filename is too long\n");
+ if (argv[1] == NULL || strlen(argv[1]) == 0) {
+ fprintf(stderr, "filename is wrong %s\n", argv[1]);
+ fprintf(stderr, "Usage: ./mm_imgcv_testsuite filename(jpg format only)\n");
return -1;
}
- strncpy(filename, argv[1], len);
-
/* decode jpg image */
mm_util_jpeg_yuv_data decoded;
memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
- ret = mm_util_decode_from_jpeg_file_with_downscale(filename, MM_UTIL_COLOR_RGB24, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &decoded);
+ ret = mm_util_decode_from_jpeg_file_with_downscale(argv[1], MM_UTIL_COLOR_RGB24, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, &decoded);
if (!ret) {
img_buffer = decoded.data;