Use fprintf intead of g_print, printf in testsuite 20/306320/2
authorminje.ahn <minje.ahn@samsung.com>
Tue, 20 Feb 2024 06:38:23 +0000 (15:38 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Tue, 20 Feb 2024 06:39:46 +0000 (15:39 +0900)
Change-Id: Icec9e20c46dc424eac3b71a6108711e8b28ec648
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
anim/test/mm_util_anim_testsuite.c
heif/test/mm_util_heif_testsuite.c
jxl/test/mm_util_jxl_testsuite.c
magick/test/mm_util_magick_testsuite.c
webp/test/mm_util_webp_testsuite.c

index f7eae54..7c6a0c5 100644 (file)
@@ -53,19 +53,19 @@ static void __decode_func(gpointer data, gpointer user_data)
        mm_util_image_h image = NULL;
 
        if (!MMUTIL_STRING_VALID(path)) {
-               g_print("\t[ANIM_testsuite] invalid path %s\n", path);
+               fprintf(stderr, "\t[ANIM_testsuite] invalid path %s\n", path);
                return;
        }
 
        ret = mm_util_decode_image_from_file(path, TEST_COLOR_SPACE, &image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[ANIM_testsuite] mm_util_decode_image_from_file failed %d\n", ret);
+               fprintf(stderr, "\t[ANIM_testsuite] mm_util_decode_image_from_file failed %d\n", ret);
                return;
        }
 
        ret = mm_image_set_delay_time(image, TEST_DELAY_TIME);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[ANIM_testsuite] mm_image_set_delay_time failed %d\n", ret);
+               fprintf(stderr, "\t[ANIM_testsuite] mm_image_set_delay_time failed %d\n", ret);
                return;
        }
 
@@ -82,11 +82,11 @@ static bool __decode_files_in_queue()
        g_queue_foreach(g_queue_files, __decode_func, NULL);
 
        if (g_queue_images->length == 0) {
-               g_print("\t[ANIM_testsuite] no test image\n");
+               fprintf(stderr, "\t[ANIM_testsuite] no test image\n");
                return false;
        }
 
-       g_print("[ANIM_testsuite] %u images have been decoded.\n", g_queue_images->length);
+       fprintf(stderr, "[ANIM_testsuite] %u images have been decoded.\n", g_queue_images->length);
 
        return true;
 }
@@ -110,11 +110,11 @@ static bool __set_input_dir(const char *path)
        const gchar *filename = NULL;
        GError *g_error = NULL;
 
-       g_print("[ANIM_testsuite] path: %s\n", path);
+       fprintf(stderr, "[ANIM_testsuite] path: %s\n", path);
 
        dir = g_dir_open(path, 0, &g_error);
        if (!dir) {
-               g_print("\t[ANIM_testsuite] invalid directory: %s (%s)\n", path, g_error ? g_error->message : "none");
+               fprintf(stderr, "\t[ANIM_testsuite] invalid directory: %s (%s)\n", path, g_error ? g_error->message : "none");
                g_error_free(g_error);
                return false;
        }
@@ -136,13 +136,13 @@ static bool __set_input_dir(const char *path)
        g_dir_close(dir);
 
        if (g_queue_files->length == 0) {
-               g_print("\t[ANIM_testsuite] no test file in directory!\n");
+               fprintf(stderr, "\t[ANIM_testsuite] no test file in directory!\n");
                return false;
        }
 
        /* decode files of dir */
        if (!__decode_files_in_queue()) {
-               g_print("\t[ANIM_testsuite] fail to decode images!\n");
+               fprintf(stderr, "\t[ANIM_testsuite] fail to decode images!\n");
                return false;
        }
 
@@ -278,7 +278,7 @@ static bool __test_encode_to_buffer(mm_util_img_codec_type type, const char *pat
        if (ret == MM_UTIL_ERROR_NONE) {
                ret = mm_util_file_write(path, encoded_data, encoded_size);
                if (ret != MM_UTIL_ERROR_NONE)
-                       printf("Fail mm_util_file_write [%d]\n", ret);
+                       fprintf(stderr, "Fail mm_util_file_write [%d]\n", ret);
        } else {
                fprintf(stderr, "\t[ANIM_testsuite] mm_util_webp_anim_enc_save_to_buffer failed : %d\n", ret);
        }
index e6f32cb..1f5c2d7 100644 (file)
@@ -90,17 +90,17 @@ static mm_util_image_h g_decoded_data = NULL;
 
 static void __print_help(const char *argv0)
 {
-       g_print("\t[usage]\n");
-       g_print("\t\t1. decode : %s mode path color_format(opt.)\n", argv0);
-       g_print("\t\t2. mode : 0 - auto, 1 - decode from file, 2 - decode from memory\n");
-       g_print("\t\t\t e.g. %s 0 test.heif\n", argv0);
-       g_print("\t\t\t e.g. %s 1 test.heif 7\n", argv0);
+       fprintf(stderr, "\t[usage]\n");
+       fprintf(stderr, "\t\t1. decode : %s mode path color_format(opt.)\n", argv0);
+       fprintf(stderr, "\t\t2. mode : 0 - auto, 1 - decode from file, 2 - decode from memory\n");
+       fprintf(stderr, "\t\t\t e.g. %s 0 test.heif\n", argv0);
+       fprintf(stderr, "\t\t\t e.g. %s 1 test.heif 7\n", argv0);
 }
 
 static bool __get_arguments(int argc, char *argv[])
 {
        if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
-               g_print("\t[HEIF_testsuite] wrong mode(%s) for test\n", argv[1]);
+               fprintf(stderr, "\t[HEIF_testsuite] wrong mode(%s) for test\n", argv[1]);
                __print_help(argv[0]);
                return false;
        }
@@ -111,12 +111,12 @@ static bool __get_arguments(int argc, char *argv[])
                // do nothing
        } else if (g_test_mode == TEST_DECODE_FILE) {
                if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
-                       g_print("\t[HEIF_testsuite] color is default(%d)\n", g_color);
+                       fprintf(stderr, "\t[HEIF_testsuite] color is default(%d)\n", g_color);
        } else if (g_test_mode == TEST_DECODE_BUFFER) {
                if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
-                       g_print("\t[HEIF_testsuite] color is default(%d)\n", g_color);
+                       fprintf(stderr, "\t[HEIF_testsuite] color is default(%d)\n", g_color);
        } else {
-               g_print("\t[HEIF_testsuite] wrong mode for test %s\n", argv[1]);
+               fprintf(stderr, "\t[HEIF_testsuite] wrong mode for test %s\n", argv[1]);
                return false;
        }
 
@@ -128,7 +128,7 @@ static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e
        int ret = 0;
 
        if (!path) {
-               g_print("\t[HEIF_testsuite] No-Error\n");
+               fprintf(stderr, "\t[HEIF_testsuite] No-Error\n");
                return true;
        }
 
@@ -136,26 +136,26 @@ static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e
        if (mode == TEST_DECODE_FILE) {
                ret = mm_util_decode_heif_from_file(g_path, color, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[HEIF_testsuite] mm_util_decode_heif_from_file failed %d\n", ret);
+                       fprintf(stderr, "\t[HEIF_testsuite] mm_util_decode_heif_from_file failed %d\n", ret);
                        return false;
                }
        } else if (mode == TEST_DECODE_BUFFER) {
                ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[HEIF_testsuite] mm_util_file_read failed %d\n", ret);
+                       fprintf(stderr, "\t[HEIF_testsuite] mm_util_file_read failed %d\n", ret);
                        return false;
                }
 
                ret = mm_util_decode_heif_from_buffer(g_read_data, g_read_size, color, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[HEIF_testsuite] mm_util_decode_heif_from_buffer failed %d\n", ret);
+                       fprintf(stderr, "\t[HEIF_testsuite] mm_util_decode_heif_from_buffer failed %d\n", ret);
                        return false;
                }
        }
 
        ret = mm_util_jpeg_encode_to_file(g_decoded_data, 100, path);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[HEIF_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, path);
+               fprintf(stderr, "\t[HEIF_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, path);
                return false;
        }
 
@@ -169,7 +169,7 @@ static bool __test_auto()
        bool result = false;
 
        while (test_mode <= TEST_DECODE_BUFFER) {
-               g_print("\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
+               fprintf(stderr, "\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
                /* test decoding heif */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_BUFFER)) {
                        for (color = MM_UTIL_COLOR_YUV420; color < MM_UTIL_COLOR_NUM; color++) {
@@ -179,7 +179,7 @@ static bool __test_auto()
                        }
                }
 
-               g_print("\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST %s\n",
+               fprintf(stderr, "\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST %s\n",
                                MODE_TO_STR[test_mode], (result) ? "SUCCESS" : "FAIL");
                test_mode++;
        }
@@ -195,21 +195,21 @@ int main(int argc, char *argv[])
        }
 
        if (!__get_arguments(argc, argv)) {
-               g_print("\t[HEIF_testsuite] _get_arguments failed\n");
+               fprintf(stderr, "\t[HEIF_testsuite] _get_arguments failed\n");
                goto out;
        }
 
        /* test all functions automatically */
        if (g_test_mode == TEST_AUTO) {
                if (!__test_auto())
-                       g_print("\t[HEIF_testsuite] _test_auto failed\n");
+                       fprintf(stderr, "\t[HEIF_testsuite] _test_auto failed\n");
                goto out;
        }
 
        /* test decoding heif */
        if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
                if (!__test_decode(g_test_mode, g_color, g_test_filename[g_test_mode][g_color]))
-                       g_print("\t[HEIF_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
+                       fprintf(stderr, "\t[HEIF_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
        }
 
 out:
index 832d262..ac5196d 100644 (file)
@@ -72,13 +72,13 @@ static mm_util_enc_opt_h g_enc_opt = NULL;
 
 static void __print_help(const char *argv0)
 {
-       g_print("\t[usage]\n");
-       g_print("\t\t1. decode : %s mode path color_format(opt.) lossless(opt.)\n", argv0);
-       g_print("\t\t2. mode : %d - auto, %d - decode from file, %d - decode from buffer, %d - encode to file, %d - encode to buffer\n",
+       fprintf(stderr, "\t[usage]\n");
+       fprintf(stderr, "\t\t1. decode : %s mode path color_format(opt.) lossless(opt.)\n", argv0);
+       fprintf(stderr, "\t\t2. mode : %d - auto, %d - decode from file, %d - decode from buffer, %d - encode to file, %d - encode to buffer\n",
                        TEST_AUTO, TEST_DECODE_FILE, TEST_DECODE_BUFFER, TEST_ENCODE_FILE, TEST_ENCODE_BUFFER);
-       g_print("\t\t\t e.g. %s %d test.jxl\n", argv0, TEST_AUTO);
-       g_print("\t\t\t e.g. %s %d test.jxl 7\n", argv0, TEST_DECODE_FILE);
-       g_print("\t\t\t e.g. %s %d test.jxl 1920 1280 7\n", argv0, TEST_ENCODE_FILE);
+       fprintf(stderr, "\t\t\t e.g. %s %d test.jxl\n", argv0, TEST_AUTO);
+       fprintf(stderr, "\t\t\t e.g. %s %d test.jxl 7\n", argv0, TEST_DECODE_FILE);
+       fprintf(stderr, "\t\t\t e.g. %s %d test.jxl 1920 1280 7\n", argv0, TEST_ENCODE_FILE);
 }
 
 static bool __get_arguments(int argc, char *argv[])
@@ -86,7 +86,7 @@ static bool __get_arguments(int argc, char *argv[])
        unsigned int lossless = 0;
 
        if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
-               g_print("\t[JXL_testsuite] wrong mode(%s) for test\n", argv[1]);
+               fprintf(stderr, "\t[JXL_testsuite] wrong mode(%s) for test\n", argv[1]);
                __print_help(argv[0]);
                return false;
        }
@@ -96,41 +96,41 @@ static bool __get_arguments(int argc, char *argv[])
        if (g_test_mode == TEST_AUTO) {
                // optional : lossless
                if (!mm_util_safe_str_to_valid_uint(argv[3], 0, 1, &lossless))
-                       g_print("\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
+                       fprintf(stderr, "\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
                else
                        g_lossless = (lossless == 1) ? true : false;
        } else if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
                if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
-                       g_print("\t[JXL_testsuite] color is default(%d)\n", g_color);
+                       fprintf(stderr, "\t[JXL_testsuite] color is default(%d)\n", g_color);
        } else if (g_test_mode == TEST_ENCODE_FILE || g_test_mode == TEST_ENCODE_BUFFER) {
                if (argc < 5) {
-                       g_print("\t[JPEG_testsuite] not enough args\n");
+                       fprintf(stderr, "\t[JPEG_testsuite] not enough args\n");
                        __print_help(argv[0]);
                        return false;
                }
 
                if (!mm_util_safe_str_to_uint(argv[3], &g_width)) {
-                       g_print("\t[JXL_testsuite] wrong width %s\n", argv[3]);
+                       fprintf(stderr, "\t[JXL_testsuite] wrong width %s\n", argv[3]);
                        return false;
                }
 
                if (!mm_util_safe_str_to_uint(argv[4], &g_height)) {
-                       g_print("\t[JXL_testsuite] wrong height %s\n", argv[4]);
+                       fprintf(stderr, "\t[JXL_testsuite] wrong height %s\n", argv[4]);
                        return false;
                }
 
                if (!mm_util_safe_str_to_valid_uint(argv[5], 0, MM_UTIL_COLOR_NUM - 1, &g_color)) {
-                       g_print("\t[JXL_testsuite] wrong color %s\n", argv[5]);
+                       fprintf(stderr, "\t[JXL_testsuite] wrong color %s\n", argv[5]);
                        return false;
                }
 
                // optional : lossless
                if (!mm_util_safe_str_to_valid_uint(argv[6], 0, 1, &lossless))
-                       g_print("\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
+                       fprintf(stderr, "\t[JXL_testsuite] lossless is default(%d)\n", g_lossless);
                else
                        g_lossless = (lossless == 1) ? true : false;
        } else {
-               g_print("\t[JXL_testsuite] wrong mode for test %s\n", argv[1]);
+               fprintf(stderr, "\t[JXL_testsuite] wrong mode for test %s\n", argv[1]);
                return false;
        }
 
@@ -143,13 +143,13 @@ static bool __get_decoded_data(void)
 
        ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
+               fprintf(stderr, "\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
                return false;
        }
        ret = mm_image_create_image(g_width, g_height, g_color,
                                (const unsigned char*)g_read_data, g_read_size, &g_decoded_data);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[JXL_testsuite] mm_image_create_image failed : %d\n", ret);
+               fprintf(stderr, "\t[JXL_testsuite] mm_image_create_image failed : %d\n", ret);
                return false;
        }
 
@@ -163,23 +163,23 @@ static void __set_enc_opt(bool lossless)
        if (!g_enc_opt) {
                ret = mm_util_enc_opt_create(&g_enc_opt);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_enc_opt_create failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_create failed : %d\n", ret);
                        return;
                }
 
                ret = mm_util_enc_opt_set_codec(g_enc_opt, IMG_CODEC_JPEGXL);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_enc_opt_set_codec failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_set_codec failed : %d\n", ret);
                        return;
                }
        }
 
        ret = mm_util_enc_opt_set_lossless(g_enc_opt, lossless);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[JXL_testsuite] mm_util_enc_opt_set_lossless failed : %d\n", ret);
+               fprintf(stderr, "\t[JXL_testsuite] mm_util_enc_opt_set_lossless failed : %d\n", ret);
                return;
        }
-       g_print("\t[JXL_testsuite] __set_enc_opt lossless: %s\n", (lossless) ? "lossless" : "lossy");
+       fprintf(stderr, "\t[JXL_testsuite] __set_enc_opt lossless: %s\n", (lossless) ? "lossless" : "lossy");
 }
 
 static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
@@ -198,26 +198,26 @@ static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e
        if (mode == TEST_DECODE_FILE) {
                ret = mm_util_decode_jxl_from_file(g_path, color, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_decode_jxl_from_file failed %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_decode_jxl_from_file failed %d\n", ret);
                        return false;
                }
        } else if (mode == TEST_DECODE_BUFFER) {
                ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_file_read failed : %d\n", ret);
                        return false;
                }
 
                ret = mm_util_decode_jxl_from_buffer(g_read_data, g_read_size, color, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_decode_jxl_from_buffer failed %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_decode_jxl_from_buffer failed %d\n", ret);
                        return false;
                }
        }
 
        ret = mm_util_jpeg_encode_to_file(g_decoded_data, 100, g_test_filename[mode][color]);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("\t[JXL_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, g_test_filename[mode][color]);
+               fprintf(stderr, "\t[JXL_testsuite] mm_util_jpeg_encode_to_file failed %d : %s\n", ret, g_test_filename[mode][color]);
                return false;
        }
 
@@ -237,19 +237,19 @@ static bool __test_encode(const mm_util_test_mode_e mode, mm_util_color_format_e
        if (mode == TEST_ENCODE_FILE) {
                ret = mm_util_encode_jxl_to_file(g_decoded_data, g_enc_opt, g_test_filename[mode][color]);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_encode_jxl_to_file failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_encode_jxl_to_file failed : %d\n", ret);
                        return false;
                }
        } else if (mode == TEST_ENCODE_BUFFER) {
                ret = mm_util_encode_jxl_to_buffer(g_decoded_data, g_enc_opt, &encoded_data, &encoded_size);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       g_print("\t[JXL_testsuite] mm_util_encode_jxl_to_buffer failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_encode_jxl_to_buffer failed : %d\n", ret);
                        g_free(encoded_data);
                        return false;
                }
                ret = mm_util_file_write(g_test_filename[mode][color], encoded_data, encoded_size);
                if (ret != MM_UTIL_ERROR_NONE)
-                       g_print("\t[JXL_testsuite] mm_util_file_write failed : %d\n", ret);
+                       fprintf(stderr, "\t[JXL_testsuite] mm_util_file_write failed : %d\n", ret);
 
                g_free(encoded_data);
        }
@@ -266,25 +266,25 @@ static void __test_auto(void)
        for (color = 0; color < MM_UTIL_COLOR_NUM; color++) {
                if (g_test_filename[TEST_DECODE_FILE][color]) {    // check supported
                        result = __test_decode(TEST_DECODE_FILE, color);
-                       g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+                       fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
                                        MODE_TO_STR[TEST_DECODE_FILE], color, (result) ? "SUCCESS" : "FAIL");
                }
 
                if (g_test_filename[TEST_ENCODE_FILE][color]) {    // check supported
                        result = __test_encode(TEST_ENCODE_FILE, color);
-                       g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+                       fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
                                        MODE_TO_STR[TEST_ENCODE_FILE], color, (result) ? "SUCCESS" : "FAIL");
                }
 
                if (g_test_filename[TEST_DECODE_BUFFER][color]) {    // check supported
                        result = __test_decode(TEST_DECODE_BUFFER, color);
-                       g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+                       fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
                                                        MODE_TO_STR[TEST_DECODE_BUFFER], color, (result) ? "SUCCESS" : "FAIL");
                }
 
                if (g_test_filename[TEST_ENCODE_BUFFER][color]) {    // check supported
                        result = __test_encode(TEST_ENCODE_BUFFER, color);
-                       g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
+                       fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n",
                                        MODE_TO_STR[TEST_ENCODE_BUFFER], color, (result) ? "SUCCESS" : "FAIL");
                }
        }
@@ -298,7 +298,7 @@ int main(int argc, char *argv[])
        }
 
        if (!__get_arguments(argc, argv)) {
-               g_print("\t[JXL_testsuite] _get_arguments failed\n");
+               fprintf(stderr, "\t[JXL_testsuite] _get_arguments failed\n");
                goto out;
        }
 
@@ -310,17 +310,17 @@ int main(int argc, char *argv[])
                break;
        case TEST_DECODE_FILE:
        case TEST_DECODE_BUFFER:
-               g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
+               fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
                                        g_color, (__test_decode(g_test_mode, g_color)) ? "SUCCESS" : "FAIL");
                break;
        case TEST_ENCODE_FILE:
        case TEST_ENCODE_BUFFER:
                if (!__get_decoded_data()) {
-                       g_print("\t[JXL_testsuite] __get_decoded_data failed\n");
+                       fprintf(stderr, "\t[JXL_testsuite] __get_decoded_data failed\n");
                        goto out;
                }
                __set_enc_opt(g_lossless);
-               g_print("\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
+               fprintf(stderr, "\t[JXL_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s(%d)\' TEST %s\n", MODE_TO_STR[g_test_mode],
                                        g_color, (__test_encode(g_test_mode, g_color)) ? "SUCCESS" : "FAIL");
                break;
        default:
index fdb1363..1173b39 100644 (file)
@@ -58,7 +58,7 @@ static char *__get_dst_path(mm_util_rotate_type_e rotation)
        case MM_UTIL_ROTATE_FLIP_VERT:
                return "/opt/usr/home/owner/dst_V.jpg";
        default:
-               printf("Invalid rotation\n");
+               fprintf(stderr, "Invalid rotation\n");
                return "/opt/usr/home/owner/dst_default.jpg";
        }
 
@@ -81,7 +81,7 @@ static char *__get_dst_raw_path(mm_util_rotate_type_e rotation)
        case MM_UTIL_ROTATE_FLIP_VERT:
                return "/opt/usr/home/owner/dst_V.raw";
        default:
-               printf("Invalid rotation\n");
+               fprintf(stderr, "Invalid rotation\n");
                return "/opt/usr/home/owner/dst_default.raw";
        }
 
@@ -99,15 +99,15 @@ static void __save_to_file(mm_util_image_h handle, const char *out_path)
 
        ret = mm_image_get_image(handle, &width, &height, &format, &buffer, &size);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_get_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_get_image [%d]\n", ret);
                return;
        }
 
-       printf("[save to file] buffer[%p], width[%u], height[%u], size[%zu], format [%d], out_path [%s]\n", buffer, width, height, size, format, out_path);
+       fprintf(stderr, "[save to file] buffer[%p], width[%u], height[%u], size[%zu], format [%d], out_path [%s]\n", buffer, width, height, size, format, out_path);
 
        ret = mm_util_file_write(out_path, buffer, size);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_file_write [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_file_write [%d]\n", ret);
 
        g_free(buffer);
 }
@@ -121,19 +121,19 @@ static int __get_buffer_for_test(mm_util_color_format_e req_format, unsigned cha
 
        ret = mm_util_resize_P_B(src_path, 4000, 3000, req_format, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail [%d]\n", ret);
+               fprintf(stderr, "Fail [%d]\n", ret);
                return ret;
        }
 
        ret = mm_image_get_image(dst_handle, width, height, format, buffer, size);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_get_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_get_image [%d]\n", ret);
                mm_image_destroy_image(dst_handle);
                g_free(*buffer);
                return ret;
        }
 
-       printf("[get_buffer] buffer[%p], width[%u], height[%u], size[%zu], format [%d]\n", *buffer, *width, *height, *size, *format);
+       fprintf(stderr, "[get_buffer] buffer[%p], width[%u], height[%u], size[%zu], format [%d]\n", *buffer, *width, *height, *size, *format);
 
        mm_image_destroy_image(dst_handle);
 
@@ -145,11 +145,11 @@ static int __magick_rotate_P_P_test(mm_util_rotate_type_e rotation)
        int ret = MM_UTIL_ERROR_NONE;
        const char * src_path = "/opt/usr/home/owner/origin.jpg";
 
-       printf("* Rotate P P Test * rotation = [%d]* \n", rotation);
+       fprintf(stderr, "* Rotate P P Test * rotation = [%d]* \n", rotation);
 
        ret = mm_util_rotate_P_P(src_path, rotation, __get_dst_path(rotation));
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_rotate_P_P [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_rotate_P_P [%d]\n", ret);
 
        return ret;
 }
@@ -163,11 +163,11 @@ static int __magick_resize_P_P_test(unsigned int req_width, unsigned int req_hei
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_pp_%u_%u.jpg", req_width, req_height);
        //snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_%d_%d.png", req_width, req_height);
 
-       printf("* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
+       fprintf(stderr, "* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
 
        ret = mm_util_resize_P_P(src_path, req_width, req_height, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_resize_P_P [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_resize_P_P [%d]\n", ret);
 
        return ret;
 }
@@ -178,11 +178,11 @@ static int __magick_rotate_P_B_test(mm_util_rotate_type_e rotation, mm_util_colo
        mm_util_image_h dst_handle = NULL;
        const char * src_path = "/opt/usr/home/owner/origin.jpg";
 
-       printf("* Rotate P B Test * rotation = [%d] format = [%d] \n", rotation, req_format);
+       fprintf(stderr, "* Rotate P B Test * rotation = [%d] format = [%d] \n", rotation, req_format);
 
        ret = mm_util_rotate_P_B(src_path, rotation, req_format, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_rotate_P_B [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_rotate_P_B [%d]\n", ret);
                return ret;
        }
 
@@ -202,11 +202,11 @@ static int __magick_resize_P_B_test(unsigned int req_width, unsigned int req_hei
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_pb_%u_%u.raw", req_width, req_height);
 
-       printf("* Resize P B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+       fprintf(stderr, "* Resize P B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
 
        ret = mm_util_resize_P_B(src_path, req_width, req_height, req_format, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_resize_P_B [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_resize_P_B [%d]\n", ret);
                return ret;
        }
 
@@ -227,24 +227,24 @@ static int __magick_rotate_B_P_test(mm_util_rotate_type_e rotation, mm_util_colo
        size_t size = 0;
        mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
 
-       printf("* Rotate B P Test * rotation = [%d] \n", rotation);
+       fprintf(stderr, "* Rotate B P Test * rotation = [%d] \n", rotation);
 
        ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __get_buffer_for_test [%d]\n", ret);
+               fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
                return ret;
        }
 
        ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_create_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
                g_free(buffer);
                return ret;
        }
 
        ret = mm_util_rotate_B_P(src_handle, rotation, __get_dst_path(rotation));
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_rotate_B_P [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_rotate_B_P [%d]\n", ret);
 
        mm_image_destroy_image(src_handle);
 
@@ -266,24 +266,24 @@ static int __magick_resize_B_P_test(unsigned int req_width, unsigned int req_hei
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bp_%u_%u.jpg", req_width, req_height);
 
-       printf("* Resize B P Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+       fprintf(stderr, "* Resize B P Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
 
        ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __get_buffer_for_test [%d]\n", ret);
+               fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
                return ret;
        }
 
        ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_create_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
                g_free(buffer);
                return ret;
        }
 
        ret = mm_util_resize_B_P(src_handle, req_width, req_height, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_resize_B_P [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_resize_B_P [%d]\n", ret);
 
        mm_image_destroy_image(src_handle);
 
@@ -303,24 +303,24 @@ static int __magick_rotate_B_B_test(mm_util_rotate_type_e rotation, mm_util_colo
        size_t size = 0;
        mm_util_color_format_e format = MM_UTIL_COLOR_NUM;
 
-       printf("* Rotate B B Test * rotation = [%d] \n", rotation);
+       fprintf(stderr, "* Rotate B B Test * rotation = [%d] \n", rotation);
 
        ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __get_buffer_for_test [%d]\n", ret);
+               fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
                return ret;
        }
 
        ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_create_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
                g_free(buffer);
                return ret;
        }
 
        ret = mm_util_rotate_B_B(src_handle, rotation, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_rotate_B_B [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_rotate_B_B [%d]\n", ret);
 
        g_free(buffer);
 
@@ -346,24 +346,24 @@ static int __magick_resize_B_B_test(unsigned int req_width, unsigned int req_hei
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/resize_bb_%u_%u.raw", req_width, req_height);
 
-       printf("* Resize B B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
+       fprintf(stderr, "* Resize B B Test * W * H [%u * %u], format [%d], path [%s]\n", req_width, req_height, req_format, dst_path);
 
        ret = __get_buffer_for_test(req_format, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __get_buffer_for_test [%d]\n", ret);
+               fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
                return ret;
        }
 
        ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_create_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
                g_free(buffer);
                return ret;
        }
 
        ret = mm_util_resize_B_B(src_handle, req_width, req_height, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_resize_B_B [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_resize_B_B [%d]\n", ret);
 
        g_free(buffer);
 
@@ -390,23 +390,23 @@ static int __magick_convert_B_B_test(mm_util_color_format_e in_format, mm_util_c
 
        ret = __get_buffer_for_test(in_format, &buffer, &width, &height, &size, &format);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __get_buffer_for_test [%d]\n", ret);
+               fprintf(stderr, "Fail __get_buffer_for_test [%d]\n", ret);
                return ret;
        }
 
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/convert_bb_%u_%u_%d_%d.raw", width, height, in_format, out_format);
-       printf("* Convert B B Test * input_format [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
+       fprintf(stderr, "* Convert B B Test * input_format [%d], output_formt [%d] path [%s]\n", in_format, out_format, dst_path);
 
        ret = mm_image_create_image(width, height, format, buffer, size, &src_handle);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_image_create_image [%d]\n", ret);
+               fprintf(stderr, "Fail mm_image_create_image [%d]\n", ret);
                g_free(buffer);
                return ret;
        }
 
        ret = mm_util_convert_B_B(src_handle, out_format, &dst_handle);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_convert_B_B [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_convert_B_B [%d]\n", ret);
 
        g_free(buffer);
 
@@ -426,11 +426,11 @@ static int __magick_resize_and_rotate_P_P_test(unsigned int req_width, unsigned
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/resize_rotate_pp_%u_%u.jpg", req_width, req_height);
 
-       printf("* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
+       fprintf(stderr, "* Resize P P Test * W * H = [%u * %u], path = [%s] \n", req_width, req_height, dst_path);
 
        ret = mm_util_resize_and_rotate_P_P(src_path, req_width, req_height, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_resize_P_P [%d]\n", ret);
+               fprintf(stderr, "Fail mm_util_resize_P_P [%d]\n", ret);
 
        return ret;
 }
@@ -441,7 +441,7 @@ static int __magick_decode_file_test(const char *path, mm_util_color_format_e fo
 
        ret = mm_util_decode_image_from_file(path, format, decoded_image);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_decode_image_from_file [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_decode_image_from_file [0x%x]\n", ret);
 
        return ret;
 }
@@ -454,13 +454,13 @@ static int __magick_decode_buffer_test(const char *path, mm_util_color_format_e
 
        ret = mm_util_file_read(path, &src_buffer, &src_buffer_size);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_file_read [%s: %d]\n", path, ret);
+               fprintf(stderr, "Fail mm_util_file_read [%s: %d]\n", path, ret);
                return ret;
        }
 
        ret = mm_util_decode_image_from_buffer(src_buffer, src_buffer_size, format, decoded_image);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_decode_image_from_buffer [0x%x]\n", ret);
 
        g_free(src_buffer);
        return ret;
@@ -475,26 +475,26 @@ static int __magick_encode_setup(mm_util_img_codec_type codec, unsigned int comp
 
        ret = mm_util_enc_opt_create(&enc_option);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_enc_opt_create [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_enc_opt_create [0x%x]\n", ret);
                return ret;
        }
 
        ret = mm_util_enc_opt_set_codec(enc_option, codec);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_enc_opt_set_codec [0x%x]\n", ret);
                goto ERROR;
        }
 
        if (codec == IMG_CODEC_PNG) {
                ret = mm_util_enc_opt_set_png_compression(enc_option, compression);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       printf("Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
+                       fprintf(stderr, "Fail mm_util_enc_opt_set_png_compression [0x%x]\n", ret);
                        goto ERROR;
                }
        } else if (codec == IMG_CODEC_WEBP) {
                ret = mm_util_enc_opt_set_lossless(enc_option, lossless);
                if (ret != MM_UTIL_ERROR_NONE) {
-                       printf("Fail mm_util_enc_opt_set_lossless [0x%x]\n", ret);
+                       fprintf(stderr, "Fail mm_util_enc_opt_set_lossless [0x%x]\n", ret);
                        goto ERROR;
                }
        }
@@ -514,13 +514,13 @@ static int __magick_encode_file_test(mm_util_image_h decoded_image, mm_util_img_
 
        ret = __magick_encode_setup(codec, compression, lossless, &enc_option);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_encode_setup [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_setup [0x%x]\n", ret);
                return ret;
        }
 
        ret = mm_util_encode_image_to_file(decoded_image, enc_option, path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_encode_image_to_file [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_encode_image_to_file [0x%x]\n", ret);
 
        mm_util_enc_opt_destroy(enc_option);
 
@@ -536,19 +536,19 @@ static int __magick_encode_buffer_test(mm_util_image_h decoded_image, mm_util_im
 
        ret = __magick_encode_setup(codec, compression, lossless, &enc_option);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_encode_setup [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_setup [0x%x]\n", ret);
                return ret;
        }
 
        ret = mm_util_encode_image_to_buffer(decoded_image, enc_option, &buffer, &buffer_size);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail mm_util_encode_image_to_buffer [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_encode_image_to_buffer [0x%x]\n", ret);
                goto END;
        }
 
        ret = mm_util_file_write(path, buffer, buffer_size);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail mm_util_file_write [0x%x]\n", ret);
+               fprintf(stderr, "Fail mm_util_file_write [0x%x]\n", ret);
 
 END:
        mm_util_enc_opt_destroy(enc_option);
@@ -567,17 +567,17 @@ static int __magick_decenc_file_png_test(mm_util_color_format_e format, unsigned
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_file_png_test_%d_%u.png", format, comp_level);
 
-       printf("* PNG test [%s] \n", dst_path);
+       fprintf(stderr, "* PNG test [%s] \n", dst_path);
 
        ret = __magick_decode_file_test(src_path, format, &decoded_image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_decode_file_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_decode_file_test [0x%x]\n", ret);
                return ret;
        }
 
        ret = __magick_encode_file_test(decoded_image, IMG_CODEC_PNG, comp_level, false, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail __magick_encode_file_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_file_test [0x%x]\n", ret);
 
        mm_image_destroy_image(decoded_image);
 
@@ -594,17 +594,17 @@ static int __magick_decenc_buffer_png_test(mm_util_color_format_e format, unsign
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_buffer_png_test_%d_%u.png", format, comp_level);
 
-       printf("* PNG test [%s] \n", dst_path);
+       fprintf(stderr, "* PNG test [%s] \n", dst_path);
 
        ret = __magick_decode_buffer_test(src_path, format, &decoded_image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_decode_buffer_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_decode_buffer_test [0x%x]\n", ret);
                return ret;
        }
 
        ret = __magick_encode_buffer_test(decoded_image, IMG_CODEC_PNG, comp_level, false, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail __magick_encode_buffer_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_buffer_test [0x%x]\n", ret);
 
        mm_image_destroy_image(decoded_image);
 
@@ -621,17 +621,17 @@ static int __magick_decenc_file_webp_test(mm_util_color_format_e format, bool lo
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_file_webp_test_%d_%s.webp", format, (lossless ? "ll" : "nor"));
 
-       printf("* WEBP test [%s] \n", dst_path);
+       fprintf(stderr, "* WEBP test [%s] \n", dst_path);
 
        ret = __magick_decode_file_test(src_path, format, &decoded_image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_decode_file_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_decode_file_test [0x%x]\n", ret);
                return ret;
        }
 
        ret = __magick_encode_file_test(decoded_image, IMG_CODEC_WEBP, 0, lossless, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail __magick_encode_file_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_file_test [0x%x]\n", ret);
 
        mm_image_destroy_image(decoded_image);
 
@@ -648,17 +648,17 @@ static int __magick_decenc_buffer_webp_test(mm_util_color_format_e format, bool
        memset(dst_path, 0x00, sizeof(dst_path));
        snprintf(dst_path, sizeof(dst_path), "/opt/usr/home/owner/media/decenc_buffer_webp_test_%d_%s.webp", format, (lossless ? "ll" : "nor"));
 
-       printf("* WEBP test [%s] \n", dst_path);
+       fprintf(stderr, "* WEBP test [%s] \n", dst_path);
 
        ret = __magick_decode_buffer_test(src_path, format, &decoded_image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               printf("Fail __magick_decode_buffer_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_decode_buffer_test [0x%x]\n", ret);
                return ret;
        }
 
        ret = __magick_encode_buffer_test(decoded_image, IMG_CODEC_WEBP, 0, lossless, dst_path);
        if (ret != MM_UTIL_ERROR_NONE)
-               printf("Fail __magick_encode_buffer_test [0x%x]\n", ret);
+               fprintf(stderr, "Fail __magick_encode_buffer_test [0x%x]\n", ret);
 
        mm_image_destroy_image(decoded_image);
 
@@ -671,7 +671,7 @@ int main(int argc, char *argv[])
 
 
        if (argv[1] == NULL) {
-               printf("Choose menu!! ex) mm_util_magick_testsuite 1\n");
+               fprintf(stderr, "Choose menu!! ex) mm_util_magick_testsuite 1\n");
 
        } else if (strcmp(argv[1], "1") == 0) {
                ret = __magick_rotate_P_P_test(MM_UTIL_ROTATE_0);
@@ -793,7 +793,7 @@ int main(int argc, char *argv[])
                ret = __magick_decenc_buffer_webp_test(MM_UTIL_COLOR_RGBA, true);
 
        } else {
-               printf("Invalid parameter\n");
+               fprintf(stderr, "Invalid parameter\n");
        }
 
        return ret;
index d83669a..fe2905e 100644 (file)
@@ -48,19 +48,19 @@ static void __decode_func(gpointer data, gpointer user_data)
        mm_util_image_h image = NULL;
 
        if (!MMUTIL_STRING_VALID(path)) {
-               g_print("invalid path %s\n", path);
+               fprintf(stderr, "invalid path %s\n", path);
                return;
        }
 
        ret = mm_util_decode_image_from_file(path, g_color, &image);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("mm_util_decode_image_from_file failed %d\n", ret);
+               fprintf(stderr, "mm_util_decode_image_from_file failed %d\n", ret);
                return;
        }
 
        ret = mm_image_set_delay_time(image, g_delay_time);
        if (ret != MM_UTIL_ERROR_NONE) {
-               g_print("mm_image_set_delay_time failed %d\n", ret);
+               fprintf(stderr, "mm_image_set_delay_time failed %d\n", ret);
                return;
        }
 
@@ -77,11 +77,11 @@ static bool __decode_files_in_queue()
        g_queue_foreach(g_queue_files, __decode_func, NULL);
 
        if (g_queue_images->length == 0) {
-               g_print("No valid image\n");
+               fprintf(stderr, "No valid image\n");
                return false;
        }
 
-       g_print("%u valid image have been decoded.\n", g_queue_images->length);
+       fprintf(stderr, "%u valid image have been decoded.\n", g_queue_images->length);
 
        return true;
 }
@@ -107,7 +107,7 @@ static bool __set_input_dir(const char *path)
 
        dir = g_dir_open(path, 0, &g_error);
        if (!dir) {
-               g_print("invalid dir %s (%s)\n", path, g_error ? g_error->message : "none");
+               fprintf(stderr, "invalid dir %s (%s)\n", path, g_error ? g_error->message : "none");
                g_error_free(g_error);
                return false;
        }
@@ -124,13 +124,13 @@ static bool __set_input_dir(const char *path)
        g_dir_close(dir);
 
        if (g_queue_files->length == 0) {
-               g_print("\tNo test file in directory(%s)!\n", path);
+               fprintf(stderr, "\tNo test file in directory(%s)!\n", path);
                return false;
        }
 
        /* decode files of dir */
        if (!__decode_files_in_queue()) {
-               g_print("Fail to decode files from dir! %s\n", path);
+               fprintf(stderr, "Fail to decode files from dir! %s\n", path);
                return false;
        }