Use stdbool instead of gboolean 27/306027/4
authorminje.ahn <minje.ahn@samsung.com>
Thu, 15 Feb 2024 08:12:54 +0000 (17:12 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Thu, 15 Feb 2024 23:19:15 +0000 (08:19 +0900)
Change-Id: I9edb79ddacd84d2b4abee6d54ad5612a6077edab
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
24 files changed:
anim/include/mm_util_anim.h
anim/test/mm_util_anim_testsuite.c
common/include/mm_util_image.h
common/include/mm_util_private.h
common/mm_util_image.c
common/mm_util_private.c
gif/mm_util_gif.c
gif/test/mm_util_gif_testsuite.c
gif/unittest/FileInterface.cpp
gif/unittest/FileInterface.h
gif/unittest/libmm_gif_unittest.cpp
heif/test/mm_util_heif_testsuite.c
imgcv/unittest/libmm_imgcv_unittest.cpp
imgp/mm_util_imgp.c
imgp/test/mm_util_imgp_testsuite.c
imgp/unittest/libmm_imgp_unittest.cpp
jpeg/mm_util_jpeg.c
jpeg/test/mm_util_jpeg_testsuite.c
jpeg/unittest/FileInterface.cpp
jpeg/unittest/FileInterface.h
jpeg/unittest/libmm_jpeg_unittest.cpp
jxl/test/mm_util_jxl_testsuite.c
magick/mm_util_magick.c
webp/test/mm_util_webp_testsuite.c

index 34aa4ce..28859bb 100644 (file)
@@ -21,7 +21,6 @@
 extern "C" {
 #endif
 
-#include <stdbool.h>
 #include "mm_util_type.h"
 
 typedef void *mm_util_anim_enc_h;
index db36483..321a992 100644 (file)
@@ -72,7 +72,7 @@ static void __decode_func(gpointer data, gpointer user_data)
        g_queue_push_tail(g_queue_images, image);
 }
 
-static gboolean __decode_files_in_queue()
+static bool __decode_files_in_queue()
 {
        if (g_queue_images)
                g_queue_free_full(g_queue_images, mm_image_destroy_image);
@@ -83,12 +83,12 @@ static gboolean __decode_files_in_queue()
 
        if (g_queue_images->length == 0) {
                g_print("\t[ANIM_testsuite] no test image\n");
-               return FALSE;
+               return false;
        }
 
        g_print("[ANIM_testsuite] %u images have been decoded.\n", g_queue_images->length);
 
-       return TRUE;
+       return true;
 }
 
 static int __sort_compare(gconstpointer a, gconstpointer b, gpointer user_data)
@@ -104,7 +104,7 @@ static int __sort_compare(gconstpointer a, gconstpointer b, gpointer user_data)
        return g_ascii_strcasecmp(_a, _b);
 }
 
-static gboolean __set_input_dir(const char *path)
+static bool __set_input_dir(const char *path)
 {
        GDir *dir = NULL;
        const gchar *filename = NULL;
@@ -116,7 +116,7 @@ static gboolean __set_input_dir(const char *path)
        if (!dir) {
                g_print("\t[ANIM_testsuite] invalid directory: %s (%s)\n", path, g_error ? g_error->message : "none");
                g_error_free(g_error);
-               return FALSE;
+               return false;
        }
 
        if (g_queue_files)
@@ -137,16 +137,16 @@ static gboolean __set_input_dir(const char *path)
 
        if (g_queue_files->length == 0) {
                g_print("\t[ANIM_testsuite] no test file in directory!\n");
-               return FALSE;
+               return false;
        }
 
        /* decode files of dir */
        if (!__decode_files_in_queue()) {
                g_print("\t[ANIM_testsuite] fail to decode images!\n");
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __print_help(const char *argv0)
@@ -156,21 +156,21 @@ static void __print_help(const char *argv0)
        fprintf(stderr, "\t\t2. support jpeg/png/gif/bmp/webp files to animation webp\n");
 }
 
-static gboolean __get_arguments(int argc, char *argv[])
+static bool __get_arguments(int argc, char *argv[])
 {
        g_path = g_strdup(argv[1]);
 
        if (!MMUTIL_STRING_VALID(g_path)) {
                fprintf(stderr, "\t[ANIM_testsuite] invalid path %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
        if (!__set_input_dir(g_path)) {
                fprintf(stderr, "\t[ANIM_testsuite] __set_input_dir failed\n");
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __add_image(gpointer data, gpointer user_data)
@@ -215,7 +215,7 @@ static int __anim_encode_setup(mm_util_img_codec_type type, mm_util_anim_enc_h *
                        goto ERROR;
        }
 
-       ret = mm_util_anim_enc_set_lossless(anim_enc, TRUE);
+       ret = mm_util_anim_enc_set_lossless(anim_enc, true);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[ANIM_testsuite] mm_util_anim_enc_set_lossless failed : %d\n", ret);
                if (ret != MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT)
@@ -231,7 +231,7 @@ ERROR:
        return ret;
 }
 
-static gboolean __test_encode_to_file(mm_util_img_codec_type type, const char *path)
+static bool __test_encode_to_file(mm_util_img_codec_type type, const char *path)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_anim_enc_h anim_enc = NULL;
@@ -241,7 +241,7 @@ static gboolean __test_encode_to_file(mm_util_img_codec_type type, const char *p
        ret = __anim_encode_setup(type, &anim_enc);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[ANIM_testsuite] __anim_enc_setup failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        g_queue_foreach(g_queue_images, __add_image, anim_enc);
@@ -257,7 +257,7 @@ static gboolean __test_encode_to_file(mm_util_img_codec_type type, const char *p
        return (ret == MM_UTIL_ERROR_NONE);
 }
 
-static gboolean __test_encode_to_buffer(mm_util_img_codec_type type, const char *path)
+static bool __test_encode_to_buffer(mm_util_img_codec_type type, const char *path)
 {
        int ret = MM_UTIL_ERROR_NONE;
        mm_util_anim_enc_h anim_enc = NULL;
@@ -270,7 +270,7 @@ static gboolean __test_encode_to_buffer(mm_util_img_codec_type type, const char
        ret = __anim_encode_setup(type, &anim_enc);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[ANIM_testsuite] __anim_enc_setup failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
        g_queue_foreach(g_queue_images, __add_image, anim_enc);
 
@@ -334,4 +334,3 @@ out:
 
        return 0;
 }
-
index 018e8ba..b015f51 100755 (executable)
@@ -17,7 +17,6 @@
 #ifndef __MM_UTIL_IMAGE_H__
 #define __MM_UTIL_IMAGE_H__
 
-#include <glib.h>
 #include <stdint.h>
 #include "mm_util_type.h"
 
@@ -27,7 +26,7 @@ extern "C" {
 
 #define TEMP_DATA_SIZE SIZE_MAX        //To be removed
 
-gboolean mm_image_is_valid_image(mm_util_image_h image);
+bool mm_image_is_valid_image(mm_util_image_h image);
 void mm_image_debug_image(mm_util_image_h image, const char *message);
 
 int mm_image_create_image(unsigned int width, unsigned int height,
index db33d13..ba845e9 100644 (file)
 #ifndef __MM_UTIL_PRIVATE_H__
 #define __MM_UTIL_PRIVATE_H__
 
-#include <glib.h>
-#include <stdbool.h>
 #include <stdio.h>
-#include <stdlib.h>
+#include <glib.h>
 #include "mm_util_type.h"
 #include "mm_util_debug.h"
 #include "mm_util_image.h"
@@ -47,8 +45,6 @@ extern "C" {
 #define MMUTIL_SAFE_STRCPY(dst, src, n)  g_strlcpy(dst, src, n)
 #define MMUTIL_STRING_VALID(str)         (str != NULL && strlen(str) > 0)
 
-#define SAFE_STRLCPY(dst, src, n)      g_strlcpy(dst, src, n);
-
 /* for alignment */
 #define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
 #define MM_UTIL_ROUND_UP_4(num) (((num)+3)&~3)
@@ -86,7 +82,7 @@ typedef struct {
        bool lossless;
 } mm_util_enc_opt_t;
 
-gboolean mm_util_is_valid_color_format(mm_util_color_format_e color);
+bool mm_util_is_valid_color_format(mm_util_color_format_e color);
 
 // for using fp like jpeg
 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
@@ -100,8 +96,8 @@ int mm_util_file_write(const char *path, void *data, size_t size);
 int mm_util_ini_get_int(const char *category, const char *item, int default_value);
 
 // for testsuites
-gboolean mm_util_safe_str_to_uint(const char *str, unsigned int *number);
-gboolean mm_util_safe_str_to_valid_uint(const char *str, unsigned int min, unsigned int max, unsigned int *value);
+bool mm_util_safe_str_to_uint(const char *str, unsigned int *number);
+bool mm_util_safe_str_to_valid_uint(const char *str, unsigned int min, unsigned int max, unsigned int *value);
 
 #ifdef __cplusplus
 }
index dba0736..ca63484 100755 (executable)
 
 #include "mm_util_private.h"
 
-gboolean mm_image_is_valid_image(mm_util_image_h image)
+bool mm_image_is_valid_image(mm_util_image_h image)
 {
        mm_image_info_s *_image = (mm_image_info_s *)image;
 
-       mm_util_retvm_if(image == NULL, FALSE, "Invalid image");
-       mm_util_retvm_if(_image->width == 0, FALSE, "Invalid width");
-       mm_util_retvm_if(_image->height == 0, FALSE, "Invalid height");
-       mm_util_retvm_if(!IS_VALID_COLOR(_image->color), FALSE, "Invalid color [%d]", _image->color);
-       mm_util_retvm_if((_image->data == NULL) || (_image->size == 0), FALSE, "Invalid data [%zu, %p]", _image->size, _image->data);
+       mm_util_retvm_if(image == NULL, false, "Invalid image");
+       mm_util_retvm_if(_image->width == 0, false, "Invalid width");
+       mm_util_retvm_if(_image->height == 0, false, "Invalid height");
+       mm_util_retvm_if(!IS_VALID_COLOR(_image->color), false, "Invalid color [%d]", _image->color);
+       mm_util_retvm_if((_image->data == NULL) || (_image->size == 0), false, "Invalid data [%zu, %p]", _image->size, _image->data);
 
-       return TRUE;
+       return true;
 }
 
 void mm_image_debug_image(mm_util_image_h image, const char *message)
index 8688e7c..450e4af 100644 (file)
 
 #define IMAGE_UTIL_INI_PATH SYSCONFDIR"/multimedia/mmfw_image_util.ini"
 
-gboolean mm_util_is_valid_color_format(mm_util_color_format_e color)
+bool mm_util_is_valid_color_format(mm_util_color_format_e color)
 {
        if ((color < MM_UTIL_COLOR_YUV420) || (color >= MM_UTIL_COLOR_NUM)) {
-               return FALSE;
+               return false;
        }
-       return TRUE;
+       return true;
 }
 
 int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp)
@@ -154,35 +154,35 @@ int mm_util_ini_get_int(const char *category, const char *item, int default_valu
        return val;
 }
 
-gboolean mm_util_safe_str_to_uint(const char *str, unsigned int *number)
+bool mm_util_safe_str_to_uint(const char *str, unsigned int *number)
 {
        gint64 temp = 0;
 
        if (!str || strlen(str) == 0)
-               return FALSE;
+               return false;
 
        temp = g_ascii_strtoll(str, NULL, 10);
        if (errno != 0) {
                mm_util_stderror("g_ascii_strtoll");
-               return FALSE;
+               return false;
        }
 
        if (temp < 0 || temp > UINT_MAX)
-               return FALSE;
+               return false;
 
        *number  = (unsigned int)temp;
 
-       return TRUE;
+       return true;
 }
 
-gboolean mm_util_safe_str_to_valid_uint(const char *str, unsigned int min, unsigned int max, unsigned int *value)
+bool mm_util_safe_str_to_valid_uint(const char *str, unsigned int min, unsigned int max, unsigned int *value)
 {
        unsigned int converted = 0;
-       gboolean is_num = mm_util_safe_str_to_uint(str, &converted);
+       bool is_num = mm_util_safe_str_to_uint(str, &converted);
 
        if (!is_num || converted < min || converted > max)
-               return FALSE;
+               return false;
 
        *value = converted;
-       return TRUE;
+       return true;
 }
index 19c8a62..5753b7e 100644 (file)
@@ -119,21 +119,21 @@ static int __gif_generate_frame_buffer(GifFileType *gif_image, GifRowType **scre
        return MM_UTIL_ERROR_NONE;
 }
 
-static gboolean __gif_is_good_frame(GifFileType *gif_image)
+static bool __gif_is_good_frame(GifFileType *gif_image)
 {
        mm_util_debug("Frame pos: %d, %d size: %dx%d", gif_image->Image.Left, gif_image->Image.Top, gif_image->Image.Width, gif_image->Image.Height);
 
        if (gif_image->Image.Top < 0 || gif_image->Image.Left < 0 || gif_image->Image.Width <= 0 || gif_image->Image.Height <= 0) {
                mm_util_error("Frame has wrong dimensions");
-               return FALSE;
+               return false;
        }
 
        if (gif_image->Image.Left + gif_image->Image.Width > gif_image->SWidth || gif_image->Image.Top + gif_image->Image.Height > gif_image->SHeight) {
                mm_util_debug("Frame is not full screen frame");
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static int __gif_fill_frame_buffer(GifFileType *gif_image, GifRowType *frame_buffer)
@@ -221,7 +221,7 @@ static int __read_gif(const char *file_path, void *memory, const size_t src_size
        GifRecordType record_type = UNDEFINED_RECORD_TYPE;
        GifRowType *frame_buffer = NULL;
        GifFileType *GifFile;
-       gboolean is_found = FALSE;
+       bool is_found = false;
        ColorMapObject *ColorMap = NULL;
        gif_io_buf_s io_buf = { memory, src_size, 0 };
        void *image_buffer = NULL;
@@ -263,7 +263,7 @@ static int __read_gif(const char *file_path, void *memory, const size_t src_size
                                goto error;
                        }
 
-                       is_found = TRUE;
+                       is_found = true;
 
                        ret = __gif_fill_frame_buffer(GifFile, frame_buffer);
                        if (ret != MM_UTIL_ERROR_NONE) {
@@ -487,7 +487,7 @@ static int __gif_image_write_image(gif_file_s *gif_file, mm_image_info_s *gif_im
        mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "__gif_make_color_map failed");
 
        if (EGifPutImageDesc(gif_file->GifFile, 0, 0, gif_image->width, gif_image->height,
-               FALSE, color_map) == GIF_ERROR) {
+               false, color_map) == GIF_ERROR) {
                mm_util_error("EGifPutImageDesc failed due to %s", GifErrorString(gif_file->GifFile->Error));
                COLORMAP_FREE(color_map);
                g_free(intermediate_image);
@@ -553,7 +553,7 @@ static int __gif_image_write_ext_block(gif_file_s *gif_file, unsigned int delay_
 
        /* use fixed graphics control */
        graphic_control_block.DisposalMode = DISPOSAL_UNSPECIFIED;
-       graphic_control_block.UserInputFlag = FALSE;
+       graphic_control_block.UserInputFlag = false;
        graphic_control_block.TransparentColor = NO_TRANSPARENT_COLOR;
        graphic_control_block.DelayTime = delay_time;
 
@@ -666,7 +666,7 @@ static int __mm_util_gif_encode_start(mm_gif_file_h gif_file_h, unsigned int wid
        mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "__gif_encode_open_mem failed");
 
        /* To initialize data after GifFile opened */
-       EGifSetGifVersion(gif_file->GifFile, TRUE);
+       EGifSetGifVersion(gif_file->GifFile, true);
 
        /* Write screen description */
        if (EGifPutScreenDesc(gif_file->GifFile, width, height, 8 /* color_res */, 0 /* background_color */, NULL) == GIF_ERROR) {
index 62dbe13..8790ae5 100644 (file)
@@ -66,12 +66,12 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
-gboolean _get_arguments(int argc, char *argv[])
+bool _get_arguments(int argc, char *argv[])
 {
-       if (FALSE == mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
+       if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
                fprintf(stderr, "\t[GIF_testsuite] wrong mode(%s) for test\n", argv[1]);
                _print_help(argv[0]);
-               return FALSE;
+               return false;
        }
 
        g_path = g_strdup(argv[2]);
@@ -82,26 +82,26 @@ gboolean _get_arguments(int argc, char *argv[])
                if (argc < 4) {
                        fprintf(stderr, "\t[GIF_testsuite] not enough args\n");
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[3], &g_width)) {
+               if (!mm_util_safe_str_to_uint(argv[3], &g_width)) {
                        fprintf(stderr, "\t[GIF_testsuite] wrong width %s\n", argv[3]);
-                       return FALSE;
+                       return false;
                }
 
-               if (FALSE == mm_util_safe_str_to_uint(argv[4], &g_height)) {
+               if (!mm_util_safe_str_to_uint(argv[4], &g_height)) {
                        fprintf(stderr, "\t[GIF_testsuite] wrong height %s\n", argv[4]);
-                       return FALSE;
+                       return false;
                }
        } else {
                fprintf(stderr, "\t[GIF_testsuite] wrong mode for test %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-gboolean _test_decode(const mm_util_test_mode_e mode)
+bool _test_decode(const mm_util_test_mode_e mode)
 {
        int ret = 0;
        unsigned char *data = NULL;
@@ -112,50 +112,50 @@ gboolean _test_decode(const mm_util_test_mode_e mode)
                ret = mm_util_decode_from_gif_file(g_path, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_decode_from_gif_file failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_image_get_image failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(DECODE_FILE_PATH, data, size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(data);
-                       return FALSE;
+                       return false;
                }
                MMUTIL_SAFE_FREE(data);
        } 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) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_file_read failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
 
                ret = mm_util_decode_from_gif_memory(g_read_data, g_read_size, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_decode_from_gif_memory failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_image_get_image failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(DECODE_MEM_PATH, data, size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(data);
-                       return FALSE;
+                       return false;
                }
                MMUTIL_SAFE_FREE(data);
        }
 
-       return TRUE;
+       return true;
 }
 
-gboolean _test_encode(const mm_util_test_mode_e mode)
+bool _test_encode(const mm_util_test_mode_e mode)
 {
        int ret = 0;
        /* for encoding gif to memory */
@@ -163,18 +163,18 @@ gboolean _test_encode(const mm_util_test_mode_e mode)
        size_t encoded_size = 0;
 
        if ((mode != TEST_ENCODE_FILE) && (mode != TEST_ENCODE_BUFFER))
-               return TRUE;
+               return true;
 
        ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[GIF_testsuite] mm_util_file_read failed %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        ret = mm_image_create_image(g_width, g_height, MM_UTIL_COLOR_RGBA, (unsigned char *)g_read_data, g_read_size, &g_decoded_data);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[GIF_testsuite] mm_image_create_image failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        /* test encoding gif */
@@ -182,29 +182,29 @@ gboolean _test_encode(const mm_util_test_mode_e mode)
                ret = mm_util_encode_to_gif_file(&g_decoded_data, 1, ENCODE_FILE_PATH);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_encode_gif_to_file failed : %d\n", ret);
-                       return FALSE;
+                       return false;
                }
        } else if (mode == TEST_ENCODE_BUFFER) {
                ret = mm_util_encode_to_gif_memory(&g_decoded_data, 1, &encoded_data, &encoded_size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_encode_gif_to_memory failed : %d\n", ret);
                        MMUTIL_SAFE_FREE(encoded_data);
-                       return FALSE;
+                       return false;
                }
 
                ret = mm_util_file_write(ENCODE_MEM_PATH, encoded_data, encoded_size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[GIF_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(encoded_data);
-                       return FALSE;
+                       return false;
                }
        }
 
        MMUTIL_SAFE_FREE(encoded_data);
-       return TRUE;
+       return true;
 }
 
-gboolean _test_auto()
+bool _test_auto()
 {
        mm_util_test_mode_e test_mode = TEST_DECODE_FILE;
 
@@ -216,17 +216,17 @@ gboolean _test_auto()
                }
                /* test decoding gif */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_BUFFER)) {
-                       if (FALSE == _test_decode(test_mode)) {
+                       if (!_test_decode(test_mode)) {
                                fprintf(stderr, "\t[GIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
-                               return FALSE;
+                               return false;
                        }
                }
 
                /* test encoding gif */
                if ((test_mode == TEST_ENCODE_FILE) || (test_mode == TEST_ENCODE_BUFFER)) {
-                       if (FALSE == _test_encode(test_mode)) {
+                       if (!_test_encode(test_mode)) {
                                fprintf(stderr, "\t[GIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
-                               return FALSE;
+                               return false;
                        }
                }
 
@@ -237,7 +237,7 @@ gboolean _test_auto()
                test_mode++;
        }
 
-       return TRUE;
+       return true;
 }
 
 int main(int argc, char *argv[])
@@ -247,21 +247,21 @@ int main(int argc, char *argv[])
                return 0;
        }
 
-       if (FALSE == _get_arguments(argc, argv)) {
+       if (!_get_arguments(argc, argv)) {
                fprintf(stderr, "\t[GIF_testsuite] _get_arguments failed\n");
                goto out;
        }
 
        /* test all functions automatically */
        if (g_test_mode == TEST_AUTO) {
-               if (FALSE == _test_auto())
+               if (!_test_auto())
                        fprintf(stderr, "\t[GIF_testsuite] _test_auto failed\n");
                goto out;
        }
 
        /* test decoding gif */
        if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
-               if (FALSE == _test_decode(g_test_mode)) {
+               if (!_test_decode(g_test_mode)) {
                        fprintf(stderr, "\t[GIF_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
                        goto out;
                }
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
 
        /* test encoding gif */
        if ((g_test_mode == TEST_ENCODE_FILE) || (g_test_mode == TEST_ENCODE_BUFFER)) {
-               if (FALSE == _test_encode(g_test_mode)) {
+               if (!_test_encode(g_test_mode)) {
                        fprintf(stderr, "\t[GIF_testsuite] _test_encode(%s) failed\n", MODE_TO_STR[g_test_mode]);
                        goto out;
                }
index cf8c8bf..b85607d 100644 (file)
@@ -54,15 +54,15 @@ void FileInterface::Open(const char *path)
        fileSize = (size_t)size;
 }
 
-gboolean FileInterface::ReadData()
+bool FileInterface::ReadData()
 {
        if (!fp || fileSize == 0)
-               return FALSE;
+               return false;
 
        readData = (unsigned char *)calloc(1, fileSize);
        if (fread(readData, 1, fileSize, fp) != fileSize) {
-               return FALSE;
+               return false;
        }
        readDataSize = fileSize;
-       return TRUE;
+       return true;
 }
index 5284dda..c77e835 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <glib.h>
 
 class FileInterface {
        private:
@@ -33,7 +32,7 @@ class FileInterface {
 
                FileInterface(const char *path);
                ~FileInterface(void);
-               gboolean ReadData();
+               bool ReadData();
 };
 
 #endif /*__FILE_INTERFACE_H__*/
index dc6333f..73e72a7 100644 (file)
@@ -66,7 +66,7 @@ TEST(libmm_gif_Test, mm_util_decode_from_gif_file_n)
 TEST(libmm_gif_Test, mm_util_decode_from_gif_memory_p)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       gboolean err = TRUE;
+       bool err = true;
        mm_util_image_h decode_image = NULL;
 
        FileInterface IFile = FileInterface(DECODE_FILE_PATH);
@@ -83,7 +83,7 @@ TEST(libmm_gif_Test, mm_util_decode_from_gif_memory_p)
 TEST(libmm_gif_Test, mm_util_decode_from_gif_memory_n)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       gboolean err = TRUE;
+       bool err = true;
        mm_util_image_h decode_image = NULL;
 
        FileInterface IFile = FileInterface(DECODE_FILE_PATH);
@@ -181,4 +181,3 @@ int main(int argc, char **argv)
 
        return RUN_ALL_TESTS();
 }
-
index dc67657..5565d17 100644 (file)
@@ -97,12 +97,12 @@ static void __print_help(const char *argv0)
        g_print("\t\t\t e.g. %s 1 test.heif 7\n", argv0);
 }
 
-static gboolean __get_arguments(int argc, char *argv[])
+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]);
                __print_help(argv[0]);
-               return FALSE;
+               return false;
        }
 
        g_path = g_strdup(argv[2]);
@@ -117,19 +117,19 @@ static gboolean __get_arguments(int argc, char *argv[])
                        g_print("\t[HEIF_testsuite] color is default(%d)\n", g_color);
        } else {
                g_print("\t[HEIF_testsuite] wrong mode for test %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-static gboolean __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color, const char *path)
+static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color, const char *path)
 {
        int ret = 0;
 
        if (!path) {
                g_print("\t[HEIF_testsuite] No-Error\n");
-               return TRUE;
+               return true;
        }
 
        /* test decoding heif */
@@ -137,36 +137,36 @@ static gboolean __test_decode(const mm_util_test_mode_e mode, mm_util_color_form
                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);
-                       return FALSE;
+                       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);
-                       return FALSE;
+                       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);
-                       return FALSE;
+                       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);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-static gboolean __test_auto()
+static bool __test_auto()
 {
        mm_util_test_mode_e test_mode = TEST_DECODE_FILE;
        mm_util_color_format_e color = MM_UTIL_COLOR_YUV420;
-       gboolean result = FALSE;
+       bool result = false;
 
        while (test_mode <= TEST_DECODE_BUFFER) {
                g_print("\t[HEIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
@@ -184,7 +184,7 @@ static gboolean __test_auto()
                test_mode++;
        }
 
-       return TRUE;
+       return true;
 }
 
 int main(int argc, char *argv[])
index 6b1394e..2f26108 100644 (file)
@@ -81,4 +81,3 @@ int main(int argc, char **argv)
 
        return RUN_ALL_TESTS();
 }
-
index b8ab524..62ba1fc 100644 (file)
@@ -29,7 +29,7 @@
 #define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
 #define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
 
-typedef gboolean(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_type_e);
+typedef bool(*IMGPInfoFunc) (imgp_info_s *, const unsigned char *, unsigned char **, imgp_type_e);
 
 static int __check_valid_picture_size(unsigned int width, unsigned int height)
 {
@@ -39,9 +39,9 @@ static int __check_valid_picture_size(unsigned int width, unsigned int height)
        return MM_UTIL_ERROR_INVALID_PARAMETER;
 }
 
-static gboolean __mm_gst_can_resize_format(mm_util_color_format_e color_format)
+static bool __mm_gst_can_resize_format(mm_util_color_format_e color_format)
 {
-       gboolean _bool = FALSE;
+       bool _bool = false;
 
        mm_util_debug("color_format [%d]", color_format);
 
@@ -57,7 +57,7 @@ static gboolean __mm_gst_can_resize_format(mm_util_color_format_e color_format)
        case MM_UTIL_COLOR_BGRA:
        case MM_UTIL_COLOR_RGBA:
        case MM_UTIL_COLOR_BGRX:
-               _bool = TRUE;
+               _bool = true;
                break;
        default:
                mm_util_error("Not supported format");  //only not support NV12
@@ -66,9 +66,9 @@ static gboolean __mm_gst_can_resize_format(mm_util_color_format_e color_format)
        return _bool;
 }
 
-static gboolean __mm_gst_can_rotate_format(mm_util_color_format_e color_format)
+static bool __mm_gst_can_rotate_format(mm_util_color_format_e color_format)
 {
-       gboolean _bool = FALSE;
+       bool _bool = false;
 
        mm_util_debug("color_format [%d]", color_format);
 
@@ -79,7 +79,7 @@ static gboolean __mm_gst_can_rotate_format(mm_util_color_format_e color_format)
        case MM_UTIL_COLOR_ARGB:
        case MM_UTIL_COLOR_BGRA:
        case MM_UTIL_COLOR_RGBA:
-               _bool = TRUE;
+               _bool = true;
                break;
        default:
                mm_util_error("Not supported format");
@@ -100,7 +100,7 @@ static int __mm_util_get_image_size(mm_util_color_format_e format, unsigned int
        mm_util_fenter();
 
        mm_util_retvm_if(imgsize == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid imgsize");
-       mm_util_retvm_if(IS_VALID_COLOR(format) == FALSE, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid format(%u)", format);
+       mm_util_retvm_if(IS_VALID_COLOR(format) == false, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid format(%u)", format);
        mm_util_retvm_if(__check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width(%u) or height(%u)", width, height);
 
        switch (format) {
@@ -309,9 +309,9 @@ static IMGPInfoFunc __mm_util_initialize(GModule **module)
 static bool __mm_util_check_format(mm_util_color_format_e color_format)
 {
        if ((color_format >= MM_UTIL_COLOR_YUV420) && (color_format <= MM_UTIL_COLOR_BGRX))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 int mm_util_convert_colorspace(mm_util_image_h src, mm_util_color_format_e color, mm_util_image_h *dst)
@@ -417,7 +417,7 @@ int mm_util_resize_image(mm_util_image_h src, unsigned int width, unsigned int h
                goto ERROR;
        }
 
-       if (__mm_gst_can_resize_format(_imgp_info_s->src_format) == FALSE) {
+       if (__mm_gst_can_resize_format(_imgp_info_s->src_format) == false) {
                mm_util_error("Not supported format");
                ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
                goto ERROR;
@@ -506,7 +506,7 @@ int mm_util_rotate_image(mm_util_image_h src, mm_util_rotate_type_e angle, mm_ut
                goto ERROR;
        }
 
-       if (__mm_gst_can_rotate_format(_imgp_info_s->src_format) == FALSE) {
+       if (__mm_gst_can_rotate_format(_imgp_info_s->src_format) == false) {
                mm_util_error("Not supported format");
                ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
                goto ERROR;
index 764805b..2019022 100644 (file)
@@ -77,87 +77,87 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t9. ex: %s test.rgb crop 1920 1080 7 100 100 640 480 \n", argv0);
 }
 
-gboolean _get_arguments(int argc, char *argv[])
+bool _get_arguments(int argc, char *argv[])
 {
        unsigned int index = 1;
 
        g_args.path = g_strdup(argv[index++]);
        g_args.cmd = g_strdup(argv[index++]);
 
-       if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.width)) {
+       if (!mm_util_safe_str_to_uint(argv[index++], &g_args.width)) {
                fprintf(stderr, "\t[IMGP_testsuite] wrong src_width %s\n", argv[index-1]);
-               return FALSE;
+               return false;
        }
-       if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.height)) {
+       if (!mm_util_safe_str_to_uint(argv[index++], &g_args.height)) {
                fprintf(stderr, "\t[IMGP_testsuite] wrong src_height %s\n", argv[index-1]);
-               return FALSE;
+               return false;
        }
-       if (FALSE == mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_args.colorspace)) {
+       if (!mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_args.colorspace)) {
                fprintf(stderr, "\t[IMGP_testsuite] wrong src_format %s\n", argv[index-1]);
-               return FALSE;
+               return false;
        }
        if (strcmp(g_args.cmd, "convert") == 0) {
                if (argc < 7) {
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
 
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_args.cs)) {
+               if (!mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_args.cs)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong dst_format %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
        } else if (strcmp(g_args.cmd, "resize") == 0) {
                if (argc < 8) {
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
 
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.w)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.w)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong dst_width %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.h)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.h)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong dst_height %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
        } else if (strcmp(g_args.cmd, "rotate") == 0) {
                if (argc < 7) {
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
 
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_ROTATE_0, MM_UTIL_ROTATE_NUM - 1, &g_args.rot)) {
+               if (!mm_util_safe_str_to_valid_uint(argv[index++], MM_UTIL_ROTATE_0, MM_UTIL_ROTATE_NUM - 1, &g_args.rot)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong rotation %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
        } else if (strcmp(g_args.cmd, "crop") == 0) {
                if (argc < 10) {
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
 
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.x)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.x)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong start_x %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.y)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.y)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong start_y %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.w)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.w)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong dst_width %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[index++], &g_args.h)) {
+               if (!mm_util_safe_str_to_uint(argv[index++], &g_args.h)) {
                        fprintf(stderr, "\t[IMGP_testsuite] wrong dst_height %s\n", argv[index-1]);
-                       return FALSE;
+                       return false;
                }
        }
 
        fprintf(stderr, "\t[IMGP_testsuite] cmd: %s, w: %u, h: %u, cs:%u, rot:%u, x: %u, y: %u\n",
                                g_args.cmd, g_args.w, g_args.h, g_args.cs, g_args.rot, g_args.x, g_args.y);
 
-       return TRUE;
+       return true;
 }
 
 int main(int argc, char *argv[])
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
        memset(&g_transformed, 0, sizeof(g_transformed));
 
        /* get arguments */
-       if (FALSE == _get_arguments(argc, argv)) {
+       if (!_get_arguments(argc, argv)) {
                fprintf(stderr, "\t[IMGP_testsuite] _get_arguments failed\n");
                goto TEST_FAIL;
        }
@@ -252,4 +252,3 @@ TEST_FAIL:
 
        return 0;
 }
-
index 9352169..380854b 100644 (file)
@@ -192,4 +192,3 @@ int main(int argc, char **argv)
 
        return RUN_ALL_TESTS();
 }
-
index 0e94589..04e72f6 100644 (file)
@@ -53,9 +53,9 @@ static void __my_error_exit(j_common_ptr cinfo)
        longjmp(myerr->setjmp_buffer, 1); /* Return control to the setjmp point */
 }
 
-static gboolean __is_supported_color_format_with_libjpeg(mm_util_color_format_e color_format)
+static bool __is_supported_color_format_with_libjpeg(mm_util_color_format_e color_format)
 {
-       gboolean _bool = FALSE;
+       bool _bool = false;
 
        if (color_format == MM_UTIL_COLOR_RGB24 ||
                color_format == MM_UTIL_COLOR_RGBA ||
@@ -65,7 +65,7 @@ static gboolean __is_supported_color_format_with_libjpeg(mm_util_color_format_e
                color_format == MM_UTIL_COLOR_YUV422 ||
                color_format == MM_UTIL_COLOR_UYVY ||
                color_format == MM_UTIL_COLOR_GRAYSCALE) {
-               _bool = TRUE;
+               _bool = true;
        }
 
        if (!_bool)
@@ -74,13 +74,13 @@ static gboolean __is_supported_color_format_with_libjpeg(mm_util_color_format_e
        return _bool;
 }
 
-static gboolean __mm_util_is_supported_color_format(mm_util_color_format_e color_format)
+static bool __mm_util_is_supported_color_format(mm_util_color_format_e color_format)
 {
-       gboolean _bool = FALSE;
+       bool _bool = false;
 
        if (__is_supported_color_format_with_libjpeg(color_format) ||
                color_format == MM_UTIL_COLOR_NV12) {
-               _bool = TRUE;
+               _bool = true;
        }
 
        if (!_bool)
@@ -188,14 +188,14 @@ static void __jpeg_decode_set_common_params(j_decompress_ptr dinfo, mm_util_colo
        if (dinfo->image_width > ENC_MAX_LEN || dinfo->image_height > ENC_MAX_LEN) {
                dinfo->scale_num = 1;
                dinfo->scale_denom = 8;
-               dinfo->do_fancy_upsampling = FALSE;
-               dinfo->do_block_smoothing = FALSE;
+               dinfo->do_fancy_upsampling = false;
+               dinfo->do_block_smoothing = false;
                dinfo->dither_mode = JDITHER_ORDERED;
        } else if (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) {
                dinfo->scale_num = 1;
                dinfo->scale_denom = (unsigned int)downscale;
-               dinfo->do_fancy_upsampling = FALSE;
-               dinfo->do_block_smoothing = FALSE;
+               dinfo->do_fancy_upsampling = false;
+               dinfo->do_block_smoothing = false;
                dinfo->dither_mode = JDITHER_ORDERED;
        }
 
@@ -322,8 +322,8 @@ static int __mm_util_jpeg_encode(mm_util_jpeg_ctrl_format_e control_format, mm_u
                jpeg_set_defaults(&cinfo);
                mm_util_debug("jpeg_set_defaults");
 
-               cinfo.raw_data_in = TRUE; /* Supply downsampled data */
-               cinfo.do_fancy_downsampling = FALSE;
+               cinfo.raw_data_in = true; /* Supply downsampled data */
+               cinfo.do_fancy_downsampling = false;
 
                cinfo.comp_info[0].h_samp_factor = 2;
                if (_decoded->color == MM_UTIL_COLOR_YUV420)
@@ -335,11 +335,11 @@ static int __mm_util_jpeg_encode(mm_util_jpeg_ctrl_format_e control_format, mm_u
                cinfo.comp_info[2].h_samp_factor = 1;
                cinfo.comp_info[2].v_samp_factor = 1;
 
-               jpeg_set_quality(&cinfo, quality, TRUE);
+               jpeg_set_quality(&cinfo, quality, true);
                mm_util_debug("jpeg_set_quality");
                cinfo.dct_method = JDCT_FASTEST;
 
-               jpeg_start_compress(&cinfo, TRUE);
+               jpeg_start_compress(&cinfo, true);
                mm_util_debug("jpeg_start_compress");
 
                ret = __jpeg_encode_yuv(&cinfo, _width, _height, decoded);
@@ -354,9 +354,9 @@ static int __mm_util_jpeg_encode(mm_util_jpeg_ctrl_format_e control_format, mm_u
 
                jpeg_set_defaults(&cinfo);
                mm_util_debug("jpeg_set_defaults");
-               jpeg_set_quality(&cinfo, quality, TRUE);
+               jpeg_set_quality(&cinfo, quality, true);
                mm_util_debug("jpeg_set_quality");
-               jpeg_start_compress(&cinfo, TRUE);
+               jpeg_start_compress(&cinfo, true);
                mm_util_debug("jpeg_start_compress");
 
                while (cinfo.next_scanline < cinfo.image_height) {
@@ -409,7 +409,7 @@ static int __mm_util_jpeg_decode(mm_util_jpeg_ctrl_format_e control_format, FILE
        __jpeg_decode_open(&dinfo, control_format, fp, src, (unsigned long)size);
 
        /*read file parameters with jpeg_read_header() */
-       jpeg_read_header(&dinfo, TRUE);
+       jpeg_read_header(&dinfo, true);
        mm_util_debug("jpeg_read_header");
 
        /* set parameters for decompression */
@@ -578,7 +578,7 @@ int mm_util_decode_from_jpeg_file(const char *file_path, mm_util_color_format_e
        mm_util_fenter();
 
        mm_util_retvm_if(!MMUTIL_STRING_VALID(file_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid file_path");
-       mm_util_retvm_if((IS_VALID_COLOR(fmt) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+       mm_util_retvm_if((IS_VALID_COLOR(fmt) == false), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
        mm_util_retvm_if((!__mm_util_is_supported_color_format(fmt)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", fmt);
        mm_util_retvm_if(!decoded, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid image handle");
 
@@ -616,7 +616,7 @@ int mm_util_decode_from_jpeg_memory(void *memory, const size_t src_size, mm_util
 
        mm_util_retvm_if(!memory, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid jpeg image");
        mm_util_retvm_if(!src_size, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_size");
-       mm_util_retvm_if((IS_VALID_COLOR(fmt) == FALSE), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+       mm_util_retvm_if((IS_VALID_COLOR(fmt) == false), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
        mm_util_retvm_if((!__mm_util_is_supported_color_format(fmt)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", fmt);
        mm_util_retvm_if(!decoded, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid image handle");
 
index 28bb836..a23e110 100644 (file)
@@ -69,63 +69,63 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
-gboolean _get_arguments(int argc, char *argv[])
+bool _get_arguments(int argc, char *argv[])
 {
-       if (FALSE == mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
+       if (!mm_util_safe_str_to_valid_uint(argv[1], TEST_AUTO, TEST_NUM - 1, &g_test_mode)) {
                fprintf(stderr, "\t[JPEG_testsuite] wrong mode(%s) for test\n", argv[1]);
                _print_help(argv[0]);
-               return FALSE;
+               return false;
        }
 
        g_path = g_strdup(argv[2]);
 
        if (g_test_mode == TEST_AUTO) {
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
+               if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
                        fprintf(stderr, "\t[JPEG_testsuite] color is default(%d)\n", g_color);
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[4], 1, 100, &g_quality))
+               if (!mm_util_safe_str_to_valid_uint(argv[4], 1, 100, &g_quality))
                        fprintf(stderr, "\t[JPEG_testsuite] quality is default(%d)\n", g_quality);
                /* min: MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, max: MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8 */
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[5], 1, 8, &g_downscale))
+               if (!mm_util_safe_str_to_valid_uint(argv[5], 1, 8, &g_downscale))
                        fprintf(stderr, "\t[JPEG_testsuite] downscale is default(%d)\n", g_downscale);
        } else if (g_test_mode == TEST_DECODE_FILE) {
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
+               if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
                        fprintf(stderr, "\t[JPEG_testsuite] color is default(%d)\n", g_color);
        } else if (g_test_mode == TEST_DECODE_BUFFER) {
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
+               if (!mm_util_safe_str_to_valid_uint(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
                        fprintf(stderr, "\t[JPEG_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) {
                        fprintf(stderr, "\t[JPEG_testsuite] not enough args\n");
                        _print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[3], &g_width)) {
+               if (!mm_util_safe_str_to_uint(argv[3], &g_width)) {
                        fprintf(stderr, "\t[JPEG_testsuite] wrong width %s\n", argv[3]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_uint(argv[4], &g_height)) {
+               if (!mm_util_safe_str_to_uint(argv[4], &g_height)) {
                        fprintf(stderr, "\t[JPEG_testsuite] wrong height %s\n", argv[4]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[5], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color)) {
+               if (!mm_util_safe_str_to_valid_uint(argv[5], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color)) {
                        fprintf(stderr, "\t[JPEG_testsuite] wrong color %s\n", argv[5]);
-                       return FALSE;
+                       return false;
                }
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[6], 1, 100, &g_quality))
+               if (!mm_util_safe_str_to_valid_uint(argv[6], 1, 100, &g_quality))
                        fprintf(stderr, "\t[JPEG_testsuite] quality is default(%d)\n", g_quality);
 
                /* min: MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1, max: MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8 */
-               if (FALSE == mm_util_safe_str_to_valid_uint(argv[7], 1, 8, &g_downscale))
+               if (!mm_util_safe_str_to_valid_uint(argv[7], 1, 8, &g_downscale))
                        fprintf(stderr, "\t[JPEG_testsuite] downscale is default(%d)\n", g_downscale);
        } else {
                fprintf(stderr, "\t[JPEG_testsuite] wrong mode for test %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-gboolean _test_decode(const mm_util_test_mode_e mode)
+bool _test_decode(const mm_util_test_mode_e mode)
 {
        int ret = 0;
        unsigned char *data = NULL;
@@ -136,50 +136,50 @@ gboolean _test_decode(const mm_util_test_mode_e mode)
                ret = mm_util_decode_from_jpeg_file(g_path, g_color, g_downscale, &g_decoded_data);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_decode_from_jpeg_file failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_image_get_image failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(DECODE_FILE_PATH, data, size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(data);
-                       return FALSE;
+                       return false;
                }
                MMUTIL_SAFE_FREE(data);
        } 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) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_file_read failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
 
                ret = mm_util_decode_from_jpeg_memory(g_read_data, g_read_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 failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_image_get_image(g_decoded_data, &g_width, &g_height, NULL, &data, &size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_image_get_image failed %d\n", ret);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(DECODE_MEM_PATH, data, size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(data);
-                       return FALSE;
+                       return false;
                }
                MMUTIL_SAFE_FREE(data);
        }
 
-       return TRUE;
+       return true;
 }
 
-gboolean _test_encode(const mm_util_test_mode_e mode)
+bool _test_encode(const mm_util_test_mode_e mode)
 {
        int ret = 0;
        /* for encoding jpeg to memory */
@@ -187,18 +187,18 @@ gboolean _test_encode(const mm_util_test_mode_e mode)
        size_t encoded_size = 0;
 
        if ((mode != TEST_ENCODE_FILE) && (mode != TEST_ENCODE_BUFFER))
-               return TRUE;
+               return true;
 
        ret = mm_util_file_read(g_path, &g_read_data, &g_read_size);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[JPEG_testsuite] mm_util_file_read failed %d\n", ret);
-               return FALSE;
+               return false;
        }
        ret = mm_image_create_image(g_width, g_height, g_color, (unsigned char *)g_read_data,
                        g_read_size, &g_decoded_data);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[JPEG_testsuite] mm_image_create_image failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        /* test encoding jpeg */
@@ -206,28 +206,28 @@ gboolean _test_encode(const mm_util_test_mode_e mode)
                ret = mm_util_jpeg_encode_to_file(g_decoded_data, (int)g_quality, ENCODE_FILE_PATH);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_jpeg_encode_to_file failed : %d\n", ret);
-                       return FALSE;
+                       return false;
                }
        } else if (mode == TEST_ENCODE_BUFFER) {
                ret = mm_util_encode_to_jpeg_memory(g_decoded_data, (int)g_quality, &encoded_data, &encoded_size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_jpeg_encode_to_file failed : %d\n", ret);
                        MMUTIL_SAFE_FREE(encoded_data);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(ENCODE_MEM_PATH, encoded_data, encoded_size);
                if (ret != MM_UTIL_ERROR_NONE) {
                        fprintf(stderr, "\t[JPEG_testsuite] mm_util_file_write failed %d\n", ret);
                        MMUTIL_SAFE_FREE(encoded_data);
-                       return FALSE;
+                       return false;
                }
        }
 
        MMUTIL_SAFE_FREE(encoded_data);
-       return TRUE;
+       return true;
 }
 
-gboolean _test_auto()
+bool _test_auto()
 {
        mm_util_test_mode_e test_mode = TEST_DECODE_FILE;
 
@@ -239,17 +239,17 @@ gboolean _test_auto()
                }
                /* test decoding jpeg */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_BUFFER)) {
-                       if (FALSE == _test_decode(test_mode)) {
+                       if (!_test_decode(test_mode)) {
                                fprintf(stderr, "\t[JPEG_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
-                               return FALSE;
+                               return false;
                        }
                }
 
                /* test encoding jpeg */
                if ((test_mode == TEST_ENCODE_FILE) || (test_mode == TEST_ENCODE_BUFFER)) {
-                       if (FALSE == _test_encode(test_mode)) {
+                       if (!_test_encode(test_mode)) {
                                fprintf(stderr, "\t[JPEG_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST FAIL\n", MODE_TO_STR[test_mode]);
-                               return FALSE;
+                               return false;
                        }
                }
 
@@ -260,7 +260,7 @@ gboolean _test_auto()
                test_mode++;
        }
 
-       return TRUE;
+       return true;
 }
 
 int main(int argc, char *argv[])
@@ -270,21 +270,21 @@ int main(int argc, char *argv[])
                return 0;
        }
 
-       if (FALSE == _get_arguments(argc, argv)) {
+       if (!_get_arguments(argc, argv)) {
                fprintf(stderr, "\t[JPEG_testsuite] _get_arguments failed\n");
                goto out;
        }
 
        /* test all functions automatically */
        if (g_test_mode == TEST_AUTO) {
-               if (FALSE == _test_auto())
+               if (!_test_auto())
                        fprintf(stderr, "\t[JPEG_testsuite] _test_auto failed\n");
                goto out;
        }
 
        /* test decoding jpeg */
        if ((g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_BUFFER)) {
-               if (FALSE == _test_decode(g_test_mode)) {
+               if (!_test_decode(g_test_mode)) {
                        fprintf(stderr, "\t[JPEG_testsuite] _test_decode(%s) failed\n", MODE_TO_STR[g_test_mode]);
                        goto out;
                }
@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
 
        /* test encoding jpeg */
        if ((g_test_mode == TEST_ENCODE_FILE) || (g_test_mode == TEST_ENCODE_BUFFER)) {
-               if (FALSE == _test_encode(g_test_mode)) {
+               if (!_test_encode(g_test_mode)) {
                        fprintf(stderr, "\t[JPEG_testsuite] _test_encode(%s) failed\n", MODE_TO_STR[g_test_mode]);
                        goto out;
                }
index cf8c8bf..b85607d 100644 (file)
@@ -54,15 +54,15 @@ void FileInterface::Open(const char *path)
        fileSize = (size_t)size;
 }
 
-gboolean FileInterface::ReadData()
+bool FileInterface::ReadData()
 {
        if (!fp || fileSize == 0)
-               return FALSE;
+               return false;
 
        readData = (unsigned char *)calloc(1, fileSize);
        if (fread(readData, 1, fileSize, fp) != fileSize) {
-               return FALSE;
+               return false;
        }
        readDataSize = fileSize;
-       return TRUE;
+       return true;
 }
index 5284dda..c77e835 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <glib.h>
 
 class FileInterface {
        private:
@@ -33,7 +32,7 @@ class FileInterface {
 
                FileInterface(const char *path);
                ~FileInterface(void);
-               gboolean ReadData();
+               bool ReadData();
 };
 
 #endif /*__FILE_INTERFACE_H__*/
index 659a3f5..99c5ce9 100644 (file)
@@ -69,7 +69,7 @@ TEST(libmm_jpeg_Test, mm_util_decode_from_jpeg_file_n)
 TEST(libmm_jpeg_Test, mm_util_decode_from_jpeg_memory_p)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       gboolean err = TRUE;
+       bool err = true;
        mm_util_image_h decode_image = NULL;
 
        FileInterface IFile = FileInterface(DECODE_FILE_PATH);
@@ -87,7 +87,7 @@ TEST(libmm_jpeg_Test, mm_util_decode_from_jpeg_memory_p)
 TEST(libmm_jpeg_Test, mm_util_decode_from_jpeg_memory_n)
 {
        int ret = MM_UTIL_ERROR_NONE;
-       gboolean err = TRUE;
+       bool err = true;
        mm_util_image_h decode_image = NULL;
 
        FileInterface IFile = FileInterface(DECODE_FILE_PATH);
@@ -180,4 +180,3 @@ int main(int argc, char **argv)
 
        return RUN_ALL_TESTS();
 }
-
index b753d6b..1ce9ff6 100644 (file)
@@ -81,14 +81,14 @@ static void __print_help(const char *argv0)
        g_print("\t\t\t e.g. %s %d test.jxl 1920 1280 7\n", argv0, TEST_ENCODE_FILE);
 }
 
-static gboolean __get_arguments(int argc, char *argv[])
+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]);
                __print_help(argv[0]);
-               return FALSE;
+               return false;
        }
 
        g_path = g_strdup(argv[2]);
@@ -106,22 +106,22 @@ static gboolean __get_arguments(int argc, char *argv[])
                if (argc < 5) {
                        g_print("\t[JPEG_testsuite] not enough args\n");
                        __print_help(argv[0]);
-                       return FALSE;
+                       return false;
                }
 
                if (!mm_util_safe_str_to_uint(argv[3], &g_width)) {
                        g_print("\t[JXL_testsuite] wrong width %s\n", argv[3]);
-                       return FALSE;
+                       return false;
                }
 
                if (!mm_util_safe_str_to_uint(argv[4], &g_height)) {
                        g_print("\t[JXL_testsuite] wrong height %s\n", argv[4]);
-                       return FALSE;
+                       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]);
-                       return FALSE;
+                       return false;
                }
 
                // optional : lossless
@@ -131,29 +131,29 @@ static gboolean __get_arguments(int argc, char *argv[])
                        g_lossless = (lossless == 1) ? true : false;
        } else {
                g_print("\t[JXL_testsuite] wrong mode for test %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-static gboolean __get_decoded_data(void)
+static bool __get_decoded_data(void)
 {
        int ret = 0;
 
        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);
-               return FALSE;
+               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);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __set_enc_opt(bool lossless)
@@ -182,7 +182,7 @@ static void __set_enc_opt(bool lossless)
        g_print("\t[JXL_testsuite] __set_enc_opt lossless: %s\n", (lossless) ? "lossless" : "lossy");
 }
 
-static gboolean __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
+static bool __test_decode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
 {
        int ret = 0;
 
@@ -190,60 +190,60 @@ static gboolean __test_decode(const mm_util_test_mode_e mode, mm_util_color_form
        MMUTIL_SAFE_IMAGE_FREE(g_decoded_data);
 
        if ((mode != TEST_DECODE_FILE) && (mode != TEST_DECODE_BUFFER))
-               return TRUE;
+               return true;
 
        /* test decoding jxl */
        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);
-                       return FALSE;
+                       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);
-                       return FALSE;
+                       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);
-                       return FALSE;
+                       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]);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
-static gboolean __test_encode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
+static bool __test_encode(const mm_util_test_mode_e mode, mm_util_color_format_e color)
 {
        int ret = 0;
        void *encoded_data = NULL;
        size_t encoded_size = 0;
 
        if ((mode != TEST_ENCODE_FILE) && (mode != TEST_ENCODE_BUFFER))
-               return TRUE;
+               return true;
 
        /* test encoding jxl */
        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);
-                       return FALSE;
+                       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);
                        MMUTIL_SAFE_FREE(encoded_data);
-                       return FALSE;
+                       return false;
                }
                ret = mm_util_file_write(g_test_filename[mode][color], encoded_data, encoded_size);
                if (ret != MM_UTIL_ERROR_NONE)
@@ -252,13 +252,13 @@ static gboolean __test_encode(const mm_util_test_mode_e mode, mm_util_color_form
                MMUTIL_SAFE_FREE(encoded_data);
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __test_auto(void)
 {
        mm_util_color_format_e color = 0;
-       gboolean result = FALSE;
+       bool result = false;
 
        /* test for both decoding & encoding */
        for (color = 0; color < MM_UTIL_COLOR_NUM; color++) {
index b329105..e82d03b 100644 (file)
@@ -360,7 +360,7 @@ static int __mm_util_write_image_to_file(Image *image, mm_util_enc_opt_t *option
        _image_info = CloneImageInfo(0);
        mm_util_retvm_if(!_image_info, MM_UTIL_ERROR_INVALID_OPERATION, "Error: CloneImageInfo failed.");
 
-       SAFE_STRLCPY(image->filename, out_path, sizeof(image->filename));
+       MMUTIL_SAFE_STRCPY(image->filename, out_path, sizeof(image->filename));
 
        DeleteImageProfile(image, "EXIF");
        DeleteImageProfile(image, "8BIM");
index 5f28a77..d83669a 100644 (file)
@@ -67,7 +67,7 @@ static void __decode_func(gpointer data, gpointer user_data)
        g_queue_push_tail(g_queue_images, image);
 }
 
-static gboolean __decode_files_in_queue()
+static bool __decode_files_in_queue()
 {
        if (g_queue_images)
                g_queue_free_full(g_queue_images, mm_image_destroy_image);
@@ -78,12 +78,12 @@ static gboolean __decode_files_in_queue()
 
        if (g_queue_images->length == 0) {
                g_print("No valid image\n");
-               return FALSE;
+               return false;
        }
 
        g_print("%u valid image have been decoded.\n", g_queue_images->length);
 
-       return TRUE;
+       return true;
 }
 
 static int __sort_compare(gconstpointer a, gconstpointer b, gpointer user_data)
@@ -99,7 +99,7 @@ static int __sort_compare(gconstpointer a, gconstpointer b, gpointer user_data)
        return g_ascii_strcasecmp(_a, _b);
 }
 
-static gboolean __set_input_dir(const char *path)
+static bool __set_input_dir(const char *path)
 {
        GDir *dir = NULL;
        const gchar *filename = NULL;
@@ -109,7 +109,7 @@ static gboolean __set_input_dir(const char *path)
        if (!dir) {
                g_print("invalid dir %s (%s)\n", path, g_error ? g_error->message : "none");
                g_error_free(g_error);
-               return FALSE;
+               return false;
        }
 
        if (g_queue_files)
@@ -125,16 +125,16 @@ static gboolean __set_input_dir(const char *path)
 
        if (g_queue_files->length == 0) {
                g_print("\tNo test file in directory(%s)!\n", path);
-               return FALSE;
+               return false;
        }
 
        /* decode files of dir */
        if (!__decode_files_in_queue()) {
                g_print("Fail to decode files from dir! %s\n", path);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __print_help(const char *argv0)
@@ -144,21 +144,21 @@ static void __print_help(const char *argv0)
        fprintf(stderr, "\t\t2. support jpeg/png/gif/bmp/webp files to animation webp\n");
 }
 
-static gboolean __get_arguments(int argc, char *argv[])
+static bool __get_arguments(int argc, char *argv[])
 {
        g_path = g_strdup(argv[1]);
 
        if (!MMUTIL_STRING_VALID(g_path)) {
                fprintf(stderr, "\t[WEBP_testsuite] invalid path %s\n", argv[1]);
-               return FALSE;
+               return false;
        }
 
        if (!__set_input_dir(g_path)) {
                fprintf(stderr, "\t[WEBP_testsuite] __set_input_dir failed\n");
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 static void __add_image(gpointer data, gpointer user_data)
@@ -203,7 +203,7 @@ END:
        return ret;
 }
 
-static gboolean __test_encode_to_file()
+static bool __test_encode_to_file()
 {
        int ret = 0;
        mm_util_webp_anim_enc_h anim_enc = NULL;
@@ -211,7 +211,7 @@ static gboolean __test_encode_to_file()
        ret = __webp_encode_setup(&anim_enc);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[WEBP_testsuite] __webp_encode_setup failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        g_queue_foreach(g_queue_images, __add_image, anim_enc);
@@ -228,7 +228,7 @@ END:
        return (ret == MM_UTIL_ERROR_NONE);
 }
 
-static gboolean __test_encode_to_buffer()
+static bool __test_encode_to_buffer()
 {
        int ret = 0;
        mm_util_webp_anim_enc_h anim_enc = NULL;
@@ -239,7 +239,7 @@ static gboolean __test_encode_to_buffer()
        ret = __webp_encode_setup(&anim_enc);
        if (ret != MM_UTIL_ERROR_NONE) {
                fprintf(stderr, "\t[WEBP_testsuite] __webp_encode_setup failed : %d\n", ret);
-               return FALSE;
+               return false;
        }
 
        g_queue_foreach(g_queue_images, __add_image, anim_enc);
@@ -293,4 +293,3 @@ out:
 
        return 0;
 }
-