From: Abhimanyu Swami Date: Thu, 5 Oct 2023 20:10:58 +0000 (+0530) Subject: Improve coverage X-Git-Tag: accepted/tizen/unified/20231010.162033^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f808affeaf8980ac1f7dc86c920ea37771ae957e;p=platform%2Fcore%2Fpim%2Fcontacts-service.git Improve coverage Change-Id: I9cf46a4b1125a9b8821fb4b494aa7d63cc9e43c6 Signed-off-by: Abhimanyu Swami --- diff --git a/client/ctsvc_client_noti.c b/client/ctsvc_client_noti.c index e6fab58..aea9e6c 100644 --- a/client/ctsvc_client_noti.c +++ b/client/ctsvc_client_noti.c @@ -47,7 +47,6 @@ static int __ipc_pubsub_ref = 0; static pims_ipc_h __ipc = NULL; static GSList *__db_change_subscribe_list = NULL; -/* LCOV_EXCL_START */ static void _cnoti_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data) { diff --git a/client/ctsvc_client_service.c b/client/ctsvc_client_service.c index f862d05..ea02ba9 100644 --- a/client/ctsvc_client_service.c +++ b/client/ctsvc_client_service.c @@ -128,6 +128,7 @@ EXPORT_API int contacts_connect_on_thread(void) if (CONTACTS_ERROR_INVALID_PARAMETER == ret) return CONTACTS_ERROR_INTERNAL; return ret; + /* LCOV_EXCL_STOP */ } } else if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ diff --git a/common/ctsvc_image_util.c b/common/ctsvc_image_util.c index 3a24a6b..2658346 100644 --- a/common/ctsvc_image_util.c +++ b/common/ctsvc_image_util.c @@ -203,18 +203,22 @@ static void _image_transform_completed_cb(media_packet_h *dst, struct image_transform *info = user_data; if (NULL == info) { + /* LCOV_EXCL_START */ ERR("NULL == info"); media_packet_destroy(*dst); return; + /* LCOV_EXCL_STOP */ } if(true == info->timeout) { + /* LCOV_EXCL_START */ media_packet_destroy(*dst); g_mutex_unlock(&info->mutex); g_mutex_clear(&info->mutex); g_cond_clear(&info->cond); free(info); return; + /* LCOV_EXCL_STOP */ } if (IMAGE_UTIL_ERROR_NONE == error) { diff --git a/common/ctsvc_localize_utils.c b/common/ctsvc_localize_utils.c index d234ee8..673e373 100644 --- a/common/ctsvc_localize_utils.c +++ b/common/ctsvc_localize_utils.c @@ -206,7 +206,7 @@ int ctsvc_check_language_type(const char *src) if (src && src[0]) { length = ctsvc_check_utf8(src[0]); - RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8() Fail"); + RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8() Fail"); /* LCOV_EXCL_LINE */ strncpy(temp, src, length); diff --git a/common/ctsvc_query.c b/common/ctsvc_query.c index 6a611c0..939ca03 100644 --- a/common/ctsvc_query.c +++ b/common/ctsvc_query.c @@ -135,8 +135,8 @@ EXPORT_API int contacts_query_set_sort(contacts_query_h query, unsigned int prop query_s = (ctsvc_query_s*)query; find = __ctsvc_query_property_check(query_s->properties, query_s->property_count, QUERY_SORTKEY, property_id); - RETVM_IF(false == find, CONTACTS_ERROR_INVALID_PARAMETER, - "property_id(%d) is not supported on view_uri(%s)", property_id, query_s->view_uri); + RETVM_IF(false == find, CONTACTS_ERROR_INVALID_PARAMETER, /* LCOV_EXCL_LINE */ + "property_id(%d) is not supported on view_uri(%s)", property_id, query_s->view_uri); /* LCOV_EXCL_LINE */ query_s->sort_property_id = property_id; query_s->sort_asc = asc; diff --git a/common/ctsvc_record.c b/common/ctsvc_record.c index e27b92a..d563995 100644 --- a/common/ctsvc_record.c +++ b/common/ctsvc_record.c @@ -1,4 +1,4 @@ -/* + /* * Contacts Service * * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved. @@ -120,7 +120,7 @@ static const ctsvc_record_plugin_cb_s *__ctsvc_record_get_plugin_cb(int r_type) case CTSVC_RECORD_SIP: return &sip_plugin_cbs; default: - return NULL; + return NULL; /* LCOV_EXCL_LINE */ } } @@ -229,7 +229,7 @@ EXPORT_API int contacts_record_create(const char *view_uri, contacts_record_h *o #ifdef _CONTACTS_IPC_CLIENT ctsvc_view_uri_deinit(); #endif - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_destroy(contacts_record_h record, bool delete_child) @@ -247,7 +247,7 @@ EXPORT_API int contacts_record_destroy(contacts_record_h record, bool delete_chi return s_record->plugin_cbs->destroy(record, delete_child); } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_clone(contacts_record_h record, contacts_record_h *out_record) @@ -267,7 +267,7 @@ EXPORT_API int contacts_record_clone(contacts_record_h record, contacts_record_h #endif return s_record->plugin_cbs->clone(record, out_record); } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_uri_p(contacts_record_h record, const char **out_str) @@ -277,8 +277,8 @@ EXPORT_API int contacts_record_get_uri_p(contacts_record_h record, const char ** ctsvc_record_s *temp = (ctsvc_record_s*)(record); - RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ + RETV_IF(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ *out_str = (temp->view_uri); @@ -291,10 +291,10 @@ EXPORT_API int contacts_record_get_str(contacts_record_h record, unsigned int pr CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE); ctsvc_record_s *s_record; - RETV_IF(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == out_str, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ *out_str = NULL; - RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ s_record = (ctsvc_record_s*)record; __CHECK_PROJECTED_PROPERTY(); @@ -302,7 +302,7 @@ EXPORT_API int contacts_record_get_str(contacts_record_h record, unsigned int pr if (s_record->plugin_cbs && s_record->plugin_cbs->get_str) return s_record->plugin_cbs->get_str(record, property_id, out_str); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_lli(contacts_record_h record, unsigned int property_id, long long int *value) @@ -310,10 +310,10 @@ EXPORT_API int contacts_record_get_lli(contacts_record_h record, unsigned int pr CHECK_CONTACT_SUPPORTED(CONTACT_FEATURE); ctsvc_record_s *s_record; - RETV_IF(NULL == value, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == value, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ *value = 0; - RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); + RETV_IF(NULL == record, CONTACTS_ERROR_INVALID_PARAMETER); /* LCOV_EXCL_LINE */ s_record = (ctsvc_record_s*)record; __CHECK_PROJECTED_PROPERTY(); @@ -321,7 +321,7 @@ EXPORT_API int contacts_record_get_lli(contacts_record_h record, unsigned int pr if (s_record->plugin_cbs && s_record->plugin_cbs->get_lli) return s_record->plugin_cbs->get_lli(record, property_id, value); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_double(contacts_record_h record, unsigned int property_id, double *value) @@ -340,7 +340,7 @@ EXPORT_API int contacts_record_get_double(contacts_record_h record, unsigned int if (s_record->plugin_cbs && s_record->plugin_cbs->get_double) return s_record->plugin_cbs->get_double(record, property_id, value); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_str_p(contacts_record_h record, unsigned int property_id, char **out_str) @@ -378,7 +378,7 @@ EXPORT_API int contacts_record_get_int(contacts_record_h record, unsigned int pr if (s_record->plugin_cbs && s_record->plugin_cbs->get_int) return s_record->plugin_cbs->get_int(record, property_id, out_value); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_set_str(contacts_record_h record, unsigned int property_id, const char *value) @@ -414,7 +414,7 @@ int ctsvc_record_set_str(contacts_record_h record, unsigned int property_id, con return ret; } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_bool(contacts_record_h record, @@ -434,7 +434,7 @@ EXPORT_API int contacts_record_get_bool(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->get_bool) return s_record->plugin_cbs->get_bool(record, property_id, value); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_set_bool(contacts_record_h record, @@ -463,7 +463,7 @@ int ctsvc_record_set_bool(contacts_record_h record, unsigned int property_id, bo return ret; } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_set_int(contacts_record_h record, unsigned int property_id, @@ -476,8 +476,8 @@ EXPORT_API int contacts_record_set_int(contacts_record_h record, unsigned int pr #ifdef _CONTACTS_IPC_CLIENT if (CTSVC_RECORD_RESULT == ((ctsvc_record_s*)record)->r_type) { - ERR("Can not set int to result record"); - return CONTACTS_ERROR_INVALID_PARAMETER; + ERR("Can not set int to result record"); /* LCOV_EXCL_LINE */ + return CONTACTS_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */ } #endif return ctsvc_record_set_int(record, property_id, value); @@ -499,7 +499,7 @@ int ctsvc_record_set_int(contacts_record_h record, unsigned int property_id, int } return ret; } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_set_lli(contacts_record_h record, unsigned int property_id, @@ -529,7 +529,7 @@ int ctsvc_record_set_lli(contacts_record_h record, unsigned int property_id, return ret; } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_set_double(contacts_record_h record, unsigned int property_id, @@ -560,7 +560,7 @@ int ctsvc_record_set_double(contacts_record_h record, unsigned int property_id, return ret; } - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } /* Record get/set child records */ @@ -577,7 +577,7 @@ EXPORT_API int contacts_record_add_child_record(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->add_child_record) return s_record->plugin_cbs->add_child_record(record, property_id, child_record); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_remove_child_record(contacts_record_h record, @@ -593,7 +593,7 @@ EXPORT_API int contacts_record_remove_child_record(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->remove_child_record) return s_record->plugin_cbs->remove_child_record(record, property_id, child_record); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_child_record_count(contacts_record_h record, @@ -611,7 +611,7 @@ EXPORT_API int contacts_record_get_child_record_count(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->get_child_record_count) return s_record->plugin_cbs->get_child_record_count(record, property_id, count); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_get_child_record_at_p(contacts_record_h record, @@ -629,7 +629,7 @@ EXPORT_API int contacts_record_get_child_record_at_p(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->get_child_record_at_p) return s_record->plugin_cbs->get_child_record_at_p(record, property_id, index, out_record); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } EXPORT_API int contacts_record_clone_child_record_list(contacts_record_h record, @@ -647,7 +647,7 @@ EXPORT_API int contacts_record_clone_child_record_list(contacts_record_h record, if (s_record->plugin_cbs && s_record->plugin_cbs->clone_child_record_list) return s_record->plugin_cbs->clone_child_record_list(record, property_id, out_list); - __INVALID_PARAMETER_ERROR_HANDLING(); + __INVALID_PARAMETER_ERROR_HANDLING(); /* LCOV_EXCL_LINE */ } int ctsvc_record_set_projection_flags(contacts_record_h record, diff --git a/common/ctsvc_record_contact.c b/common/ctsvc_record_contact.c index 2db6e22..dd8c5e4 100644 --- a/common/ctsvc_record_contact.c +++ b/common/ctsvc_record_contact.c @@ -1424,7 +1424,6 @@ static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int proper return CONTACTS_ERROR_NONE; } -/* LCOV_EXCL_START */ static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int property_id, int *out) { ctsvc_simple_contact_s *contact = (ctsvc_simple_contact_s*)record; diff --git a/common/ctsvc_record_my_profile.c b/common/ctsvc_record_my_profile.c index f7e9bc9..b290268 100644 --- a/common/ctsvc_record_my_profile.c +++ b/common/ctsvc_record_my_profile.c @@ -147,6 +147,7 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record) return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(my_profile->extensions); free(my_profile->images); @@ -165,6 +166,7 @@ static int __ctsvc_my_profile_create(contacts_record_h *out_record) free(my_profile->sips); free(my_profile); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } static int __ctsvc_my_profile_destroy(contacts_record_h record, bool delete_child) @@ -230,8 +232,10 @@ static int __ctsvc_my_profile_get_int(contacts_record_h record, unsigned int pro *out = my_profile->changed_time; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(my_profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -256,8 +260,10 @@ static int __ctsvc_my_profile_set_int(contacts_record_h record, unsigned int pro my_profile->addressbook_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in valuecontact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -277,8 +283,10 @@ static int __ctsvc_my_profile_get_str_real(contacts_record_h record, *out_str = GET_STR(copy, my_profile->uid); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(my_profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -347,8 +355,10 @@ static int __ctsvc_my_profile_get_record_list_p(contacts_record_h record, *list = (contacts_list_h)contact->sips; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -383,9 +393,11 @@ static int __ctsvc_my_profile_get_child_record_at_p(contacts_record_h record, contacts_list_get_count(list, &count); if (count < index) { + /* LCOV_EXCL_START */ ERR("The index(%d) is greather than total length(%d)", index, count); *out_record = NULL; return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { return ctsvc_list_get_nth_record_p(list, index, out_record); } @@ -404,8 +416,10 @@ static int __ctsvc_my_profile_clone_child_record_list(contacts_record_h record, contacts_list_get_count(list, &count); if (count <= 0) { + /* LCOV_EXCL_START */ *out_list = NULL; return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } ctsvc_list_clone(list, out_list); @@ -469,8 +483,10 @@ static int __ctsvc_my_profile_reset_child_record_id(contacts_record_h child_reco ((ctsvc_sip_s *)record)->id = 0; break; default: + /* LCOV_EXCL_START */ ERR("record(%d) is not child of contact", record->r_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -488,13 +504,17 @@ static int __ctsvc_my_profile_add_child_record(contacts_record_h record, return ret; if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) { + /* LCOV_EXCL_START */ ERR("This type(%d) of child_record can not be added anymore", s_record->r_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CTSVC_RECORD_IMAGE == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) { + /* LCOV_EXCL_START */ ERR("This type(%d) of child_record can not be added anymore", s_record->r_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_my_profile_reset_child_record_id(child_record); @@ -546,8 +566,10 @@ static int __ctsvc_my_profile_get_child_record_id(contacts_record_h child_record case CTSVC_RECORD_SIP: return ((ctsvc_sip_s *)record)->id; default: + /* LCOV_EXCL_START */ ERR("record(%d) is not child of contact", record->r_type); return 0; + /* LCOV_EXCL_STOP */ } return 0; } @@ -589,8 +611,10 @@ static int __ctsvc_my_profile_set_str(contacts_record_h record, unsigned int pro FREEandSTRDUP(my_profile->uid, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(my_profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -661,9 +685,11 @@ static int __ctsvc_my_profile_clone(contacts_record_h record, int ret = ctsvc_record_copy_base(&(out_data->base), &(src_data->base)); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_record_copy_base() Fail"); __ctsvc_my_profile_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; diff --git a/common/ctsvc_socket.c b/common/ctsvc_socket.c index ec8101f..5920f8a 100644 --- a/common/ctsvc_socket.c +++ b/common/ctsvc_socket.c @@ -58,18 +58,18 @@ int ctsvc_socket_init(void) wrn = snprintf(sock_file, sizeof(sock_file), CTSVC_SOCK_PATH"/%s", uid, CTSVC_SOCKET_FILE); if (wrn < 0){ - WARN("Error writing in sock file (%s)", sock_file); + WARN("Error writing in sock file (%s)", sock_file); /* LCOV_EXCL_LINE */ } bzero(&caddr, sizeof(caddr)); caddr.sun_family = AF_UNIX; wrn = snprintf(caddr.sun_path, sizeof(caddr.sun_path), "%s", sock_file); if (wrn < 0){ - WARN("Error writing in unix socket path (%s)", caddr.sun_path); + WARN("Error writing in unix socket path (%s)", caddr.sun_path); /* LCOV_EXCL_LINE */ } __ctsvc_sockfd = socket(PF_UNIX, SOCK_STREAM, 0); - RETVM_IF(-1 == __ctsvc_sockfd, CONTACTS_ERROR_IPC, - "socket() Fail(errno = %d)", errno); + RETVM_IF(-1 == __ctsvc_sockfd, CONTACTS_ERROR_IPC, /* LCOV_EXCL_LINE */ + "socket() Fail(errno = %d)", errno); /* LCOV_EXCL_LINE */ ret = connect(__ctsvc_sockfd, (struct sockaddr *)&caddr, sizeof(caddr)); if (-1 == ret) { @@ -101,7 +101,6 @@ void ctsvc_socket_final(void) __ctsvc_sockfd = -1; } -/* LCOV_EXCL_START */ static inline int __ctsvc_safe_write(int fd, const char *buf, int buf_size) { int ret, writed = 0; @@ -219,21 +218,26 @@ static void __ctsvc_remove_invalid_msg(int fd, int size) while (size) { if (sizeof(dummy) < size) { + ret = read(fd, dummy, sizeof(dummy)); if (-1 == ret) { + /* LCOV_EXCL_START */ if (EINTR == errno) continue; else return; + /* LCOV_EXCL_STOP */ } size -= ret; } else { ret = read(fd, dummy, size); if (-1 == ret) { + /* LCOV_EXCL_START */ if (EINTR == errno) continue; else return; + /* LCOV_EXCL_STOP */ } size -= ret; } diff --git a/common/ctsvc_vcard.c b/common/ctsvc_vcard.c index 288a28e..538d528 100644 --- a/common/ctsvc_vcard.c +++ b/common/ctsvc_vcard.c @@ -44,6 +44,7 @@ #define SMART_STRDUP(src) (src && *src) ? strdup(src) : NULL #define CTSVC_VCARD_PHOTO_MAX_SIZE 1024*1024 +/* LCOV_EXCL_START */ #define CTSVC_VCARD_APPEND_STR(buf, buf_size, len, str) do { \ if ((len = __ctsvc_vcard_append_str(buf, buf_size, len, str, false)) < 0) { \ ERR("__ctsvc_vcard_append_str() Fail"); \ @@ -57,7 +58,7 @@ return CONTACTS_ERROR_OUT_OF_MEMORY; \ } \ } while (0) - +/* LCOV_EXCL_STOP */ #define CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, content) do { \ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";CHARSET=UTF-8"); \ @@ -200,8 +201,6 @@ static void __ctsvc_vcard_initial(void) } }; -/* LCOV_EXCL_START */ - static int __ctsvc_vcard_append_str(char **buf, int *buf_size, int len, const char *str, bool need_conversion) { int len_temp = 0; @@ -367,7 +366,7 @@ static inline int __ctsvc_vcard_add_folding(char **buf, int *buf_size, int buf_l buf_copy = calloc(1, *buf_size); if (NULL == buf_copy) { - ERR("calloc() Fail"); + ERR("calloc() Fail"); /* LCOV_EXCL_LINE */ return 0; } @@ -717,20 +716,20 @@ static inline int __ctsvc_vcard_put_company_logo(const char *path, char **buf, i type = __ctsvc_vcard_get_image_type((const char *)suffix); fd = open(path, O_RDONLY); - RETVM_IF(fd < 0, CONTACTS_ERROR_SYSTEM, "System : Open Fail(%d)", errno); + RETVM_IF(fd < 0, CONTACTS_ERROR_SYSTEM, "System : Open Fail(%d)", errno); /* LCOV_EXCL_LINE */ read_len = 0; while ((ret = read(fd, image+read_len, sizeof(image)-read_len))) { if (-1 == ret) { if (EINTR == errno) - continue; + continue; /* LCOV_EXCL_LINE */ else break; } read_len += ret; } close(fd); - RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : read() Fail(%d)", errno); + RETVM_IF(ret < 0, CONTACTS_ERROR_SYSTEM, "System : read() Fail(%d)", errno); /* LCOV_EXCL_LINE */ buf_image = g_base64_encode(image, read_len); if (buf_image) { @@ -805,7 +804,7 @@ static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list, char CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ORG]); len = __ctsvc_vcard_put_company_type(company->type, SAFE_STR(company->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";CHARSET=UTF-8"); CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ":"); @@ -849,7 +848,7 @@ static inline int __ctsvc_vcard_append_company(ctsvc_list_s *company_list, char if (company->logo) { len = __ctsvc_vcard_put_company_logo(company->logo, buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ } } @@ -934,7 +933,7 @@ static inline int __ctsvc_vcard_append_postals(ctsvc_list_s *address_list, char CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_ADR]); len = __ctsvc_vcard_put_postal_type(address->type, SAFE_STR(address->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ if (address->is_default) CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF"); @@ -1086,7 +1085,7 @@ static int __ctsvc_vcard_check_utf8(char c) else if ((c & (char)0xfe) == (char)0xfc) return 6; else - return CONTACTS_ERROR_INVALID_PARAMETER; + return CONTACTS_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */ } static void __ctsvc_vcard_get_clean_number_for_export(char *str, char *dest) @@ -1208,7 +1207,7 @@ static inline int __ctsvc_vcard_append_numbers(ctsvc_list_s *number_list, char * CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_TEL]); len = __ctsvc_vcard_put_number_type(number->type, SAFE_STR(number->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ if (number->is_default) CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF"); @@ -1268,7 +1267,7 @@ static inline int __ctsvc_vcard_append_emails(ctsvc_list_s *email_list, char **b CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_EMAIL]); len = __ctsvc_vcard_put_email_type(email->type, SAFE_STR(email->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ if (email->is_default) CTSVC_VCARD_APPEND_STR(buf, buf_size, len, ";PREF"); @@ -1312,7 +1311,7 @@ static inline int __ctsvc_vcard_append_webs(ctsvc_list_s *url_list, char **buf, CTSVC_VCARD_APPEND_STR(buf, buf_size, len, content_name[CTSVC_VCARD_VALUE_URL]); len = __ctsvc_vcard_put_url_type(url->type, SAFE_STR(url->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, url->url); } @@ -1517,7 +1516,7 @@ static inline int __ctsvc_vcard_append_relationships(ctsvc_list_s *relationship_ CTSVC_VCARD_APPEND_STR(buf, buf_size, len, "X-TIZEN-RELATIONSHIP"); len = __ctsvc_vcard_put_relationship_type(relationship->type, SAFE_STR(relationship->label), buf, buf_size, len); - RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); + RETV_IF(len < 0, CONTACTS_ERROR_OUT_OF_MEMORY); /* LCOV_EXCL_LINE */ CTSVC_VCARD_APPEND_CONTENT(buf, buf_size, len, relationship->name); } } @@ -1638,9 +1637,11 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb( media_format_unref(fmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ free(buffer); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } free(buffer); buffer = buffer_temp; @@ -2594,26 +2595,30 @@ static inline char* __ctsvc_vcard_translate_charset(char *src, int len) temp_size = (src_len+1) * sizeof(UChar); temp = malloc(temp_size); if (NULL == temp) { + /* LCOV_EXCL_START */ ERR("malloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } conv = ucnv_open(enc, &err); - WARN_IF(U_FAILURE(err), "ucnv_open() Fail(%d), enc=%s", err, enc); + WARN_IF(U_FAILURE(err), "ucnv_open() Fail(%d), enc=%s", err, enc); /* LCOV_EXCL_LINE */ ucnv_toUChars(conv, temp, temp_size, val, src_len, &err); - WARN_IF(U_FAILURE(err), "ucnv_toUChars() Fail(%d), enc=%s", err, enc); + WARN_IF(U_FAILURE(err), "ucnv_toUChars() Fail(%d), enc=%s", err, enc); /* LCOV_EXCL_LINE */ ucnv_close(conv); dest_size = temp_size*2; dest = malloc(dest_size); if (NULL == dest) { + /* LCOV_EXCL_START */ ERR("malloc() Fail"); free(temp); return NULL; + /* LCOV_EXCL_STOP */ } conv = ucnv_open("UTF-8", &err); - WARN_IF(U_FAILURE(err), "ucnv_open() Fail(%d), enc=%s", err, enc); + WARN_IF(U_FAILURE(err), "ucnv_open() Fail(%d), enc=%s", err, enc); /* LCOV_EXCL_LINE */ ucnv_fromUChars(conv, dest, dest_size, temp, u_strlen(temp), &err); - WARN_IF(U_FAILURE(err), "ucnv_fromUChars() Fail(%d), enc=%s", err, enc); + WARN_IF(U_FAILURE(err), "ucnv_fromUChars() Fail(%d), enc=%s", err, enc); /* LCOV_EXCL_LINE */ ucnv_close(conv); free(temp); @@ -2701,8 +2706,10 @@ static char* __ctsvc_vcard_get_val(int ver, char *src, char **prefix, char **des *cursor = '\0'; *dest = strdup(src); if (NULL == *dest) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } if (CTSVC_VCARD_VER_2_1 != ver) __ctsvc_vcard_remove_folding(*dest); @@ -2806,7 +2813,7 @@ static inline int __ctsvc_vcard_get_display_name(ctsvc_list_s *name_list, char * contacts_list_get_count((contacts_list_h)name_list, &count); if (count <= 0) { ret = contacts_record_create(_contacts_name._uri, &name); - RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret); + RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create is Fail(%d)", ret); /* LCOV_EXCL_LINE */ contacts_list_add((contacts_list_h)name_list, name); } else { contacts_list_get_current_record_p((contacts_list_h)name_list, &name); @@ -2898,7 +2905,7 @@ static inline int __ctsvc_vcard_get_phonetic_name(ctsvc_list_s *name_list, int t contacts_list_get_count((contacts_list_h)name_list, &count); if (count <= 0) { ret = contacts_record_create(_contacts_name._uri, &name); - RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); + RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); /* LCOV_EXCL_LINE */ contacts_list_add((contacts_list_h)name_list, name); } else { contacts_list_get_current_record_p((contacts_list_h)name_list, &name); @@ -2933,6 +2940,7 @@ static inline int __ctsvc_vcard_get_nickname(ctsvc_list_s *nickname_list, char * contacts_record_h nickname = NULL; ret = contacts_record_create(_contacts_nickname._uri, &nickname); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ GList *cursor = NULL; ERR("contacts_record_create() Fail(%d)", ret); for (cursor = nickname_list->records; cursor; cursor = cursor->next) @@ -2942,6 +2950,7 @@ static inline int __ctsvc_vcard_get_nickname(ctsvc_list_s *nickname_list, char * nickname_list->cursor = NULL; nickname_list->count = 0; return ret; + /* LCOV_EXCL_STOP */ } contacts_record_set_str(nickname, _contacts_nickname.name, __ctsvc_vcard_remove_escape_char(start)); contacts_list_add((contacts_list_h)nickname_list, nickname); @@ -2971,8 +2980,10 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_ buf = g_base64_decode(temp+1, &size); if ((0 == size) || (NULL == buf)) { + /* LCOV_EXCL_START */ g_free(buf); return CONTACTS_ERROR_NONE; + /* LCOV_EXCL_STOP */ } gettimeofday(&tv, NULL); @@ -2991,6 +3002,7 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_ while (0 < size) { ret = write(fd, buf, size); if (ret <= 0) { + /* LCOV_EXCL_START */ if (EINTR == errno) { continue; } else { @@ -3001,6 +3013,7 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_ return CONTACTS_ERROR_FILE_NO_SPACE; /* No space */ else return CONTACTS_ERROR_SYSTEM; /* IO error */ + /* LCOV_EXCL_STOP */ } } size -= ret; @@ -3034,8 +3047,10 @@ static inline void __ctsvc_vcard_get_event_type(contacts_record_h event, char *v while (temp) { lower = strdup(temp); if (NULL == lower) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } lower_temp = lower; while (*lower_temp) { @@ -3064,8 +3079,10 @@ static inline int __ctsvc_vcard_get_event(ctsvc_list_s *event_list, int type, ch date = __ctsvc_get_content_value(val); if (NULL == date) { + /* LCOV_EXCL_START */ ERR("vcard"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } dest = src = date; @@ -3080,14 +3097,18 @@ static inline int __ctsvc_vcard_get_event(ctsvc_list_s *event_list, int type, ch } *dest = '\0'; if ('\0' == *date) { + /* LCOV_EXCL_START */ ERR("date(%s)", date); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_event._uri, &event); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_set_int(event, _contacts_event.date, atoi(date)); @@ -3167,7 +3188,7 @@ static inline int __ctsvc_vcard_get_company_value(ctsvc_list_s *company_list, in company = __ctsvc_vcard_get_company_empty_record(company_list, property_id); if (NULL == company) { int ret = contacts_record_create(_contacts_company._uri, &company); - RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); + RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); /* LCOV_EXCL_LINE */ contacts_list_add((contacts_list_h)company_list, company); } @@ -3221,7 +3242,7 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha company = __ctsvc_vcard_get_company_empty_record(company_list, _contacts_company.logo); if (NULL == company) { ret = contacts_record_create(_contacts_company._uri, &company); - RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); + RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "contacts_record_create() Fail(%d)", ret); /* LCOV_EXCL_LINE */ contacts_list_add((contacts_list_h)company_list, company); } @@ -3253,6 +3274,7 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha while (0 < size) { ret = write(fd, buf, size); if (ret <= 0) { + /* LCOV_EXCL_START */ if (EINTR == errno) { continue; } else { @@ -3264,6 +3286,7 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha else return CONTACTS_ERROR_SYSTEM; /* IO error */ } + /* LCOV_EXCL_STOP */ } size -= ret; } @@ -3374,8 +3397,10 @@ static inline void __ctsvc_vcard_get_url_type(contacts_record_h url, char *val) while (temp) { lower = strdup(temp); if (NULL == lower) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } lower_temp = lower; while (*lower_temp) { @@ -3629,8 +3654,10 @@ static inline bool __ctsvc_vcard_get_email_type(contacts_record_h email, char *v while (temp) { lower = strdup(temp); if (NULL == lower) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } lower_temp = lower; while (*lower_temp) { @@ -3691,8 +3718,10 @@ static inline bool __ctsvc_vcard_get_postal_type(contacts_record_h address, char while (temp) { lower = strdup(temp); if (NULL == lower) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } lower_temp = lower; while (*lower_temp) { @@ -3756,7 +3785,7 @@ static inline int __ctsvc_vcard_get_address(ctsvc_list_s *address_list, char *pr CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->postalcode, text, text_temp, separator); CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->country, text, text_temp, separator); - ERR("invalid ADR type"); + ERR("invalid ADR type"); /* LCOV_EXCL_LINE */ } while (0); if (((ctsvc_address_s*)address)->pobox || ((ctsvc_address_s*)address)->extended @@ -3765,9 +3794,11 @@ static inline int __ctsvc_vcard_get_address(ctsvc_list_s *address_list, char *pr || ((ctsvc_address_s*)address)->country) { contacts_record_set_bool(address, _contacts_address.is_default, __ctsvc_vcard_get_postal_type(address, prefix)); } else { + /* LCOV_EXCL_START */ ERR("Invalid vcard"); contacts_record_destroy(address, true); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } contacts_list_add((contacts_list_h)address_list, address); } @@ -3867,8 +3898,10 @@ static inline void __ctsvc_vcard_get_relationship_type(contacts_record_h relatio while (temp) { lower = strdup(temp); if (NULL == lower) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } lower_temp = lower; while (*lower_temp) { @@ -3952,9 +3985,11 @@ static char* __ctsvc_vcard_decode_base64_val(char *val) dest = calloc((src-val)+size+1, sizeof(char)); if (NULL == dest) { + /* LCOV_EXCL_START */ g_free(decoded_str); ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } snprintf(dest, (src-val)+1, "%s", val); @@ -4110,18 +4145,21 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor free(prefix); return CONTACTS_ERROR_NONE; default: + /* LCOV_EXCL_START */ ERR("__ctsvc_vcard_check_content_type() Fail(%d)", type); free(val); free(prefix); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } free(val); free(prefix); cursor = new_start; } - + /* LCOV_EXCL_START */ ERR("Invalid vcard"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static inline int __ctsvc_vcard_check_version(const char *src) @@ -4191,8 +4229,10 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont temp_display_len += 7; temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -4280,9 +4320,11 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; reverse_display = calloc(1, display_len); if (NULL == reverse_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); return; + /* LCOV_EXCL_STOP */ } snprintf(reverse_display, display_len, "%s %s", name->prefix, temp_display); free(temp_display); @@ -4316,9 +4358,11 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont /* make reverse_temp_display_name */ temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(reverse_display); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -4357,10 +4401,12 @@ static inline void __ctsvc_vcard_make_contact_display_name(ctsvc_contact_s *cont display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; display = calloc(1, display_len); if (NULL == display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); free(reverse_display); return; + /* LCOV_EXCL_STOP */ } snprintf(display, display_len, "%s %s", name->prefix, temp_display); free(temp_display); @@ -4479,9 +4525,11 @@ static int __ctsvc_vcard_parse(const void *vcard_stream, contacts_record_h *reco ret = __ctsvc_vcard_get_contact(ver, vcard, (contacts_record_h*)&contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_vcard_get_contact() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_vcard_make_contact_display_name(contact); __ctsvc_vcard_update_contact_has_properties(contact); @@ -4580,9 +4628,11 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G vcard_len += (vcard_cursor - pos_start); vcard_object = calloc(vcard_len + 1, sizeof(char)); if (NULL == vcard_object) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); __contacts_vcard_free_sub_vcard_info_list(sub_vcard_list); return NULL; + /* LCOV_EXCL_STOP */ } vcard_len = 0; @@ -4603,9 +4653,11 @@ static const char* __contacts_vcard_parse_get_vcard_object(const char *cursor, G /* sub vcard */ sub_vcard_info_s *sub_vcard_info = calloc(1, sizeof(sub_vcard_info_s)); if (NULL == sub_vcard_info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); __contacts_vcard_free_sub_vcard_info_list(sub_vcard_list); return NULL; + /* LCOV_EXCL_STOP */ } sub_vcard_info->pos_start = vcard_cursor; @@ -4653,14 +4705,16 @@ EXPORT_API int contacts_vcard_parse_to_contacts(const char *vcard_stream, contac for (vcard_cursor = list_vcard_object; vcard_cursor; vcard_cursor = vcard_cursor->next) { vcard_object = vcard_cursor->data; if (NULL == vcard_object) - continue; + continue; /* LCOV_EXCL_LINE */ ret = __ctsvc_vcard_parse(vcard_object, &record); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_vcard_parse() Fail(%d)", ret); __contacts_vcard_free_vcard_object_list(list_vcard_object); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } if (NULL == list) @@ -4749,10 +4803,12 @@ EXPORT_API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_na ret = _ctsvc_safe_add(&len, (unsigned int)written_len); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ free(stream); fclose(file); ERR("_ctsvc_safe_add() Fail(len:%d, written_len:%d)", len, written_len); return ret; + /* LCOV_EXCL_STOP */ } if (STRING_EQUAL == strncmp(line, "END:VCARD", 9)) { @@ -4773,15 +4829,17 @@ EXPORT_API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_na char *vcard_object = vcard_cursor->data; if (NULL == vcard_object) - continue; + continue; /* LCOV_EXCL_LINE */ ret = __ctsvc_vcard_parse(vcard_object, &record); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("vcard stream parsing error"); free(stream); fclose(file); __contacts_vcard_free_vcard_object_list(list_vcard_object); return ret; + /* LCOV_EXCL_STOP */ } if (false == cb(record, data)) { diff --git a/server/ctsvc_ipc_server.c b/server/ctsvc_ipc_server.c index 5e0722f..6f40f4b 100644 --- a/server/ctsvc_ipc_server.c +++ b/server/ctsvc_ipc_server.c @@ -2200,7 +2200,7 @@ void ctsvc_ipc_server_db_search_records_with_range_for_snippet(pims_ipc_h ipc, /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; - /* LCOV_EXCL_START */ + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { diff --git a/server/ctsvc_localize_ch.c b/server/ctsvc_localize_ch.c index 7646388..a97ab78 100644 --- a/server/ctsvc_localize_ch.c +++ b/server/ctsvc_localize_ch.c @@ -2125,7 +2125,7 @@ static const char* const pinyin_spell_table[] = { "xie", "yu"}; #define DUOYINZI_SEPERATOR '|' -/* LCOV_EXCL_START */ + static inline int __ctsvc_get_pinyinspell(UChar src, char spell[CHINESE_DUOYINZI_MAX_COUNT][CHINESE_PINYIN_SPELL_MAX_LEN]) { int offset, len, i, j; diff --git a/server/ctsvc_localize_jp.c b/server/ctsvc_localize_jp.c index e40ae71..524deaa 100644 --- a/server/ctsvc_localize_jp.c +++ b/server/ctsvc_localize_jp.c @@ -78,7 +78,6 @@ static inline bool is_japanese(UChar src) } } -/* LCOV_EXCL_START */ int ctsvc_convert_japanese_to_hiragana_unicode(UChar *src, UChar *dest, int dest_size) { int i, j = 0, len = 0; diff --git a/server/ctsvc_server_phonelog.c b/server/ctsvc_server_phonelog.c index e5f2fda..d43cc20 100644 --- a/server/ctsvc_server_phonelog.c +++ b/server/ctsvc_server_phonelog.c @@ -49,7 +49,6 @@ int ctsvc_phone_log_reset_statistics_by_sim(int sim_slot_no) int sim_info_id; RETVM_IF(false == ctsvc_server_have_telephony_feature(), CONTACTS_ERROR_NOT_SUPPORTED, "Telephony feature disabled"); -/* LCOV_EXCL_START */ sim_info_id = ctsvc_server_sim_get_info_id_by_sim_slot_no(sim_slot_no); if (sim_info_id <= 0) { /* LCOV_EXCL_START */ diff --git a/server/ctsvc_server_sim.c b/server/ctsvc_server_sim.c index c97c9da..eeac0d3 100644 --- a/server/ctsvc_server_sim.c +++ b/server/ctsvc_server_sim.c @@ -124,7 +124,6 @@ static TapiHandle* __ctsvc_server_sim_get_tapi_handle(ctsvc_sim_info_s *info) return info->handle; } -/* LCOV_EXCL_START */ static inline void __ctsvc_server_sim_set_return_data(void *data) { greturn_data = data; diff --git a/server/ctsvc_server_socket.c b/server/ctsvc_server_socket.c index 0100d09..7bbfd6f 100644 --- a/server/ctsvc_server_socket.c +++ b/server/ctsvc_server_socket.c @@ -58,7 +58,6 @@ struct client_info { /* key : socket_fd, value : struct client_info* */ static GHashTable *_client_info_table = NULL; -/* LCOV_EXCL_START */ static inline int __ctsvc_server_socket_safe_write(int fd, char *buf, int buf_size) { int ret, writed = 0; diff --git a/server/ctsvc_server_sqlite.c b/server/ctsvc_server_sqlite.c index 92c0412..2b81ed2 100644 --- a/server/ctsvc_server_sqlite.c +++ b/server/ctsvc_server_sqlite.c @@ -53,7 +53,6 @@ static sqlite3 *server_db; -/* LCOV_EXCL_START */ int ctsvc_server_db_open(sqlite3 **db, int *sqlite_error) { CTS_FN_CALL; @@ -63,73 +62,93 @@ int ctsvc_server_db_open(sqlite3 **db, int *sqlite_error) do { ret = db_util_open(CTSVC_DB_PATH, &server_db, 0); if (ret != SQLITE_OK || NULL == server_db) { + /* LCOV_EXCL_START */ ERR("db_util_open() Fail(%d), server_db(%s)", ret, sqlite3_errmsg(server_db)); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(server_db, "_DATA_DELETE_", 2, SQLITE_UTF8, NULL, ctsvc_db_data_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(server_db, "_DATA_IMAGE_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_image_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(server_db, "_DATA_COMPANY_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_company_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } #ifdef ENABLE_LOG_FEATURE ret = sqlite3_create_function(server_db, "_PHONE_LOG_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_phone_log_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } #endif /* ENABLE_LOG_FEATURE */ ret = sqlite3_create_function(server_db, "_PERSON_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_person_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(server_db, "_GROUP_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_group_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(server_db, "_NUMBER_COMPARE_", 4, SQLITE_UTF8, NULL, ctsvc_db_phone_number_equal_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_collation(server_db, "_NAME_SORT_", SQLITE_UTF8, (void *)SQLITE_UTF8, ctsvc_db_group_name_sort_callback); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_collation() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (0); if (ret != SQLITE_OK || NULL == server_db) { + /* LCOV_EXCL_START */ if (sqlite_error) *sqlite_error = ret; return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } } diff --git a/server/ctsvc_server_update.c b/server/ctsvc_server_update.c index 03fd247..5fa20e5 100644 --- a/server/ctsvc_server_update.c +++ b/server/ctsvc_server_update.c @@ -37,7 +37,7 @@ #define CTSVC_SCHEMA_VERSION 104 #ifdef ENABLE_LOG_FEATURE -/* LCOV_EXCL_START */ + static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal_num, char *minmatch, int person_id, int *find_number_type) { diff --git a/server/db/ctsvc_db_plugin_contact_helper.c b/server/db/ctsvc_db_plugin_contact_helper.c index 9a2e0da..96d1f4c 100644 --- a/server/db/ctsvc_db_plugin_contact_helper.c +++ b/server/db/ctsvc_db_plugin_contact_helper.c @@ -62,7 +62,6 @@ #define CTSVC_CONTACT_INITIAL_DATA_MAX_LEN 128 -/* LCOV_EXCL_START */ int ctsvc_contact_add_image_file(int parent_id, int img_id, char *src_img, char *dest, int dest_size) { diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index aff6587..f28036c 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -97,7 +97,6 @@ typedef enum { static contacts_db_status_e __db_status = CONTACTS_DB_STATUS_NORMAL; -/* LCOV_EXCL_START */ static const char * __ctsvc_db_get_property_field_name(const property_info_s *properties, int count, db_query_property_type_e property_type, unsigned int property_id) { @@ -121,7 +120,7 @@ static const char * __ctsvc_db_get_property_field_name(const property_info_s *pr return p->fields; } - return NULL; + return NULL; /* LCOV_EXCL_LINE */ #if 0 } else if (property_id == CTSVC_PROPERTY_PERSON_DISPLAY_NAME_INDEX) { if (property_type != QUERY_PROJECTION) @@ -202,8 +201,10 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_ snprintf(out_cond, sizeof(out_cond), "%s <> %d", field_name, filter->value.i); break; case CONTACTS_MATCH_NONE: + /* LCOV_EXCL_START */ snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name); break; + /* LCOV_EXCL_STOP */ default: /* LCOV_EXCL_START */ ERR("Invalid : match rule(%d) is not supported", filter->match);