remove duplicate codes and unused headers 14/266814/2
authorJiyong Min <jiyong.min@samsung.com>
Fri, 19 Nov 2021 03:07:49 +0000 (12:07 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Fri, 19 Nov 2021 03:09:27 +0000 (12:09 +0900)
Change-Id: I27efd59dacb934ebe3d812e663467cc25bdd8fd5

packaging/libheif.spec
test/heif_testsuite.c

index ec41e2b..2c22b55 100644 (file)
@@ -65,4 +65,3 @@ rm -rf %{buildroot}
 %{_includedir}/*
 %{_libdir}/*.so
 %{_libdir}/pkgconfig/*
-
index 120471f..8429ed6 100644 (file)
@@ -25,9 +25,6 @@
 #include <magick/api.h>
 
 #include <heif.h>
-#include <heif_source.h>
-#include <heif_extractor.h>
-#include <heif_decoder.h>
 
 typedef enum {
        TEST_AUTO,
@@ -313,9 +310,9 @@ static bool __test_get_info(int mode)
                }
 
                ret = heif_get_image_info_from_buffer((unsigned char *)((void *)buffer), (size_t)size, &image_info);
+               g_free(buffer);
                if (ret != LIBHEIF_ERROR_NONE) {
                        g_print("\t[HEIF_TEST] heif_get_image_info_from_buffer fail %d\n", ret);
-                       g_free(buffer);
                        return false;
                }
 
@@ -327,7 +324,6 @@ static bool __test_get_info(int mode)
                        result = false;
                }
 
-               g_free(buffer);
                break;
 
        default:
@@ -376,9 +372,9 @@ static bool __test_decode(int mode)
                }
 
                ret = heif_decode_image_from_buffer((unsigned char *)((void *)buffer), (size_t)size, g_color, &image);
+               g_free(buffer);
                if (ret != LIBHEIF_ERROR_NONE) {
                        g_print("\t[HEIF_TEST] heif_decode_image_from_buffer fail %d\n", ret);
-                       g_free(buffer);
                        return false;
                }
 
@@ -392,7 +388,6 @@ static bool __test_decode(int mode)
                if (ret != LIBHEIF_ERROR_NONE)
                        g_print("\t[HEIF_TEST] __save_to_image fail %d\n", ret);
 
-               g_free(buffer);
                break;
 
        default:
@@ -400,7 +395,7 @@ static bool __test_decode(int mode)
                return false;
        }
 
-       heif_decoder_destroy_image(image);
+       heif_image_free(image);
        return true;
 }
 
@@ -441,9 +436,9 @@ static bool __test_thumb(int mode)
                }
 
                ret = heif_decode_thumb_from_buffer((unsigned char *)((void *)buffer), (size_t)size, g_color, &thumbnail);
+               g_free(buffer);
                if (ret != LIBHEIF_ERROR_NONE) {
                        g_print("\t[HEIF_TEST] heif_decode_thumb_from_buffer fail %d\n", ret);
-                       g_free(buffer);
                        return false;
                }
 
@@ -457,7 +452,6 @@ static bool __test_thumb(int mode)
                if (ret != LIBHEIF_ERROR_NONE)
                        g_print("\t[HEIF_TEST] __save_to_image fail %d\n", ret);
 
-               g_free(buffer);
                break;
 
        default:
@@ -465,7 +459,7 @@ static bool __test_thumb(int mode)
                return false;
        }
 
-       heif_decoder_destroy_image(thumbnail);
+       heif_image_free(thumbnail);
        return true;
 }