Replace deprecated image-util APIs to new one 95/305795/3 accepted/tizen/unified/20240213.172014 accepted/tizen/unified/toolchain/20240311.065517 accepted/tizen/unified/x/20240219.013810
authorhjkim <backto.kim@samsung.com>
Thu, 8 Feb 2024 03:25:50 +0000 (12:25 +0900)
committerhjkim <backto.kim@samsung.com>
Thu, 8 Feb 2024 09:04:50 +0000 (18:04 +0900)
Change-Id: I755853daf252d18247860064e910e137dbc1a048

common/ctsvc_vcard.c
packaging/contacts-service.spec
server/db/ctsvc_db_utils.c

index d05c8ea..67faab3 100644 (file)
@@ -1273,7 +1273,7 @@ static inline int __ctsvc_vcard_put_email_type(int type, char *label, char **buf
        char *type_str = NULL;
        if (CONTACTS_EMAIL_TYPE_HOME == type) {
                type_str = "HOME";
-       } 
+       }
                /* LCOV_EXCL_START */
        else if (CONTACTS_EMAIL_TYPE_WORK == type) {
                type_str = "WORK";
@@ -1322,7 +1322,7 @@ static inline int __ctsvc_vcard_put_url_type(int type, char *label, char **buf,
 
        if (CONTACTS_URL_TYPE_HOME == type) {
                type_str = "HOME";
-       } 
+       }
                /* LCOV_EXCL_START */
        else if (CONTACTS_URL_TYPE_WORK == type) {
                type_str = "WORK";
@@ -1596,10 +1596,11 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb(
        }
 
        image_util_decode_h dh = NULL;
+       image_util_image_h decoded_image = NULL;
        do {
-               unsigned long l_width = 0;
-               unsigned long l_height = 0;
-               unsigned long long ll_size_decode = 0;
+               unsigned int _width = 0;
+               unsigned int _height = 0;
+               size_t _size_decode = 0;
 
                ret = image_util_decode_create(&dh);
                if (IMAGE_UTIL_ERROR_NONE != ret)
@@ -1610,19 +1611,23 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb(
                ret = image_util_decode_set_colorspace(dh, colorspace);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_decode_set_output_buffer(dh, (unsigned char **)&buffer);
+               ret = image_util_decode_run2(dh, &decoded_image);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_decode_run(dh, &l_width, &l_height, &ll_size_decode);
+               ret = image_util_get_image(decoded_image, &_width, &_height, NULL, &buffer, &_size_decode);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
 
-               width = (int)l_width;
-               height = (int)l_height;
-               size_decode = (unsigned int)ll_size_decode;
+               width = (int)_width;
+               height = (int)_height;
+               size_decode = (unsigned int)_size_decode;
        } while (0);
        if (dh)
                ret = image_util_decode_destroy(dh);
+
+       if (decoded_image)
+               ret = image_util_destroy_image(decoded_image);
+
        if (IMAGE_UTIL_ERROR_NONE != ret || 0 == width || 0 == height) {
                /* LCOV_EXCL_START */
                info->ret = CONTACTS_ERROR_SYSTEM;
@@ -1696,30 +1701,29 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb(
        }
 
        image_util_encode_h eh = NULL;
+       image_util_image_h image = NULL;
        do {
-               unsigned long long ll_size_encode = 0;
+               size_t size_encode = 0;
 
-               ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
-               if (IMAGE_UTIL_ERROR_NONE != ret)
-                       break;
-               ret = image_util_encode_set_input_buffer(eh, buffer);
+               ret = image_util_create_image(width, height, colorspace, buffer, size, &image);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_set_resolution(eh, width, height);
-               if (IMAGE_UTIL_ERROR_NONE != ret)
-                       break;
-               ret = image_util_encode_set_colorspace(eh, colorspace);
+
+               ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
                ret = image_util_encode_set_quality(eh, CTSVC_IMAGE_ENCODE_QUALITY);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_set_output_buffer(eh, info->image);
+               ret = image_util_encode_run_to_buffer(eh, image, info->image, &size_encode);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_run(eh, &ll_size_encode);
-               *(info->image_size) = (unsigned int)ll_size_encode;
+               *(info->image_size) = (unsigned int)size_encode;
        } while (0);
+
+       if (image)
+               image_util_destroy_image(image);
+
        if (eh)
                ret = image_util_encode_destroy(eh);
        free(buffer);
index e30e56a..356c809 100644 (file)
@@ -1,6 +1,6 @@
 Name:       contacts-service
 Summary:    Contacts Service
-Version:    0.13.78
+Version:    0.13.79
 Release:    0
 Group:      Social & Content/Service
 License:    Apache-2.0
index ac4fcd5..195ef42 100644 (file)
@@ -315,10 +315,11 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
        }
 
        image_util_decode_h dh = NULL;
+       image_util_image_h decoded_image = NULL;
        do {
-               unsigned long l_width = 0;
-               unsigned long l_height = 0;
-               unsigned long long ll_size_decode = 0;
+               unsigned int _width = 0;
+               unsigned int _height = 0;
+               size_t _size_decode = 0;
 
                ret = image_util_decode_create(&dh);
                if (IMAGE_UTIL_ERROR_NONE != ret)
@@ -329,19 +330,23 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
                ret = image_util_decode_set_colorspace(dh, colorspace);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_decode_set_output_buffer(dh, (unsigned char **)&buffer);
+               ret = image_util_decode_run2(dh, &decoded_image);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_decode_run(dh, &l_width, &l_height, &ll_size_decode);
+               image_util_get_image(decoded_image, &_width, &_height, NULL, &buffer, &_size_decode);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
 
-               width = (int)l_width;
-               height = (int)l_height;
-               size_decode = (unsigned int)ll_size_decode;
+               width = (int)_width;
+               height = (int)_height;
+               size_decode = (unsigned int)_size_decode;
        } while (0);
        if (dh)
                ret = image_util_decode_destroy(dh);
+
+       if (decoded_image)
+               ret = image_util_destroy_image(decoded_image);
+
        if (IMAGE_UTIL_ERROR_NONE != ret || 0 == width || 0 == height) {
                /* LCOV_EXCL_START */
                info->ret = CONTACTS_ERROR_SYSTEM;
@@ -455,29 +460,25 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb(
        }
 
        image_util_encode_h eh = NULL;
+       image_util_image_h image = NULL;
        do {
-               unsigned long long ll_size_encode = 0;
-
-               ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
-               if (IMAGE_UTIL_ERROR_NONE != ret)
-                       break;
-               ret = image_util_encode_set_input_buffer(eh, buffer);
+               ret = image_util_create_image(width, height, colorspace, buffer, size, &image);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_set_resolution(eh, width, height);
-               if (IMAGE_UTIL_ERROR_NONE != ret)
-                       break;
-               ret = image_util_encode_set_colorspace(eh, colorspace);
+               ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
                ret = image_util_encode_set_quality(eh, CTSVC_IMAGE_ENCODE_QUALITY);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_set_output_path(eh, info->dest);
+               ret = image_util_encode_run_to_file(eh, image, info->dest);
                if (IMAGE_UTIL_ERROR_NONE != ret)
                        break;
-               ret = image_util_encode_run(eh, &ll_size_encode);
        } while (0);
+
+       if (image)
+               image_util_destroy_image(image);
+
        if (eh)
                ret = image_util_encode_destroy(eh);
        free(buffer);