From: Jongkyu Koo Date: Mon, 25 Sep 2017 00:56:35 +0000 (+0900) Subject: improve line coverage X-Git-Tag: accepted/tizen/unified/20170926.061905^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fpim%2Fcontacts-service.git;a=commitdiff_plain;h=c7f07c22ca0b7c3172e05d67ed6f4e98b7b4141d improve line coverage Change-Id: Iff50e4f07edb70e3c137cbc8c432c4191522a92c Signed-off-by: Jongkyu Koo --- diff --git a/client/ctsvc_client_handle.c b/client/ctsvc_client_handle.c index aa9d878..9120501 100644 --- a/client/ctsvc_client_handle.c +++ b/client/ctsvc_client_handle.c @@ -81,6 +81,7 @@ int ctsvc_client_handle_get_p(contacts_h *p_contact) ctsvc_mutex_unlock(CTS_MUTEX_HANDLE); if (NULL == contact) { + /* LCOV_EXCL_START */ ret = _client_handle_get_key(ctsvc_client_get_pid(), key, sizeof(key)); RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "_client_handle_get_key() Fail(%d)", ret); @@ -88,6 +89,7 @@ int ctsvc_client_handle_get_p(contacts_h *p_contact) contact = g_hash_table_lookup(_ctsvc_handle_table, key); ctsvc_mutex_unlock(CTS_MUTEX_HANDLE); RETVM_IF(NULL == contact, CONTACTS_ERROR_NO_DATA, "g_hash_table_lookup(%s) Fail", key); + /* LCOV_EXCL_STOP */ } *p_contact = contact; return CONTACTS_ERROR_NONE; diff --git a/client/ctsvc_client_service_helper.c b/client/ctsvc_client_service_helper.c index 0c24ae7..af207f5 100644 --- a/client/ctsvc_client_service_helper.c +++ b/client/ctsvc_client_service_helper.c @@ -95,9 +95,11 @@ int ctsvc_client_connect(contacts_h contact) if (0 == base->connection_count) { ret = ctsvc_ipc_connect(contact, ctsvc_client_get_pid()); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_connect() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } } base->connection_count++; @@ -105,17 +107,21 @@ int ctsvc_client_connect(contacts_h contact) if (0 == _ctsvc_connection) { ret = ctsvc_socket_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_socket_init() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_inotify_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_init() Fail(%d)", ret); ctsvc_socket_final(); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_view_uri_init(); } else { @@ -143,9 +149,11 @@ int ctsvc_client_disconnect(contacts_h contact) if (1 == base->connection_count) { ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_pid(), _ctsvc_connection); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); ERR("ctsvc_ipc_disconnect() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_inotify_unsubscribe_ipc_ready(); } @@ -160,9 +168,11 @@ int ctsvc_client_disconnect(contacts_h contact) } else if (1 < _ctsvc_connection) { DBG("connection count is %d", _ctsvc_connection); } else { + /* LCOV_EXCL_START */ DBG("call contacts_connect(), connection count is %d", _ctsvc_connection); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } _ctsvc_connection--; @@ -188,9 +198,11 @@ int ctsvc_client_connect_on_thread(contacts_h contact) if (0 == base->connection_count) { ret = ctsvc_ipc_connect(contact, ctsvc_client_get_tid()); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_connect() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } } base->connection_count++; @@ -198,17 +210,21 @@ int ctsvc_client_connect_on_thread(contacts_h contact) if (0 == _ctsvc_connection_on_thread) { ret = ctsvc_socket_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_socket_init() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_inotify_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_init() Fail(%d)", ret); ctsvc_socket_final(); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_view_uri_init(); } else if (0 < _ctsvc_connection_on_thread) { @@ -237,9 +253,11 @@ int ctsvc_client_disconnect_on_thread(contacts_h contact) ret = ctsvc_ipc_disconnect(contact, ctsvc_client_get_tid(), _ctsvc_connection_on_thread); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_disconnect() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_inotify_unsubscribe_ipc_ready(); } @@ -255,10 +273,12 @@ int ctsvc_client_disconnect_on_thread(contacts_h contact) } else if (1 < _ctsvc_connection_on_thread) { DBG("connection count is %d", _ctsvc_connection_on_thread); } else { + /* LCOV_EXCL_START */ DBG("call contacts_connect_on_thread(), connection count is %d", _ctsvc_connection_on_thread); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } _ctsvc_connection_on_thread--; diff --git a/client/ctsvc_client_utils.c b/client/ctsvc_client_utils.c index 3f7fda4..eccd3e1 100644 --- a/client/ctsvc_client_utils.c +++ b/client/ctsvc_client_utils.c @@ -47,17 +47,22 @@ bool ctsvc_client_is_in_system_session() ret = sd_pid_get_slice(getpid(), &slice); if (0 <= ret && slice) { if (STRING_EQUAL == strncmp(slice, CTSVC_SYSTEM_SLICE, strlen(CTSVC_SYSTEM_SLICE))) { + /* LCOV_EXCL_START */ free(slice); return TRUE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("sd_pid_get_slice() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } free(slice); return FALSE; } +/* LCOV_EXCL_START */ int ctsvc_client_get_active_uid(uid_t *uid) { int active_user_count = 0; @@ -77,3 +82,4 @@ int ctsvc_client_get_active_uid(uid_t *uid) free(active_user_list); return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_STOP */ diff --git a/common/ctsvc_image_util.c b/common/ctsvc_image_util.c index 8c0ed70..2046c03 100644 --- a/common/ctsvc_image_util.c +++ b/common/ctsvc_image_util.c @@ -250,8 +250,10 @@ static void _image_transform_completed_cb(media_packet_h *dst, info->size = size; info->ret = CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("transform_run() Fail(%d)", error); info->ret = CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } media_packet_destroy(*dst); g_mutex_lock(&info->mutex); @@ -288,6 +290,7 @@ static int _ctsvc_image_util_transform_run(transformation_h transform, g_mutex_unlock(&info->mutex); g_mutex_clear(&info->mutex); g_cond_clear(&info->cond); + free(info); return CONTACTS_ERROR_SYSTEM; /* LCOV_EXCL_STOP */ } @@ -295,8 +298,10 @@ static int _ctsvc_image_util_transform_run(transformation_h transform, end_time = g_get_monotonic_time() + 4000 * G_TIME_SPAN_MILLISECOND; if (!g_cond_wait_until(&info->cond, &info->mutex, end_time)) { /* timeout has passed */ + /* LCOV_EXCL_START */ ERR("g_cond_wait_until() return FALSE"); info->ret = CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } g_mutex_unlock(&info->mutex); g_mutex_clear(&info->mutex); diff --git a/common/ctsvc_inotify.c b/common/ctsvc_inotify.c index 52415db..d163995 100644 --- a/common/ctsvc_inotify.c +++ b/common/ctsvc_inotify.c @@ -300,8 +300,10 @@ static int __ctsvc_noti_get_file_path(const char *view_uri, char **path) *path = ctsvc_inotify_makepath(file); if (NULL == *path) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_makepath() fail"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -313,8 +315,10 @@ int ctsvc_inotify_subscribe_ipc_ready(void (*cb)(void *), void *user_data) struct socket_init_noti_info *noti_info = NULL; if (NULL == noti_path) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_makepath() fail"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } if (NULL == _ctsvc_socket_init_noti_table) @@ -371,8 +375,10 @@ int ctsvc_inotify_unsubscribe_ipc_ready() struct socket_init_noti_info *noti_info = NULL; if (NULL == noti_path) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_makepath() fail"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } noti_info = g_hash_table_lookup(_ctsvc_socket_init_noti_table, noti_path); @@ -411,8 +417,10 @@ int ctsvc_inotify_subscribe(const char *view_uri, contacts_db_changed_cb cb, voi ret = __ctsvc_noti_get_file_path(view_uri, &path); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_noti_get_file_path() fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } wd = __ctsvc_inotify_get_wd(__inoti_fd, path); @@ -510,8 +518,10 @@ int ctsvc_inotify_unsubscribe(const char *view_uri, contacts_db_changed_cb cb, v ret = __ctsvc_noti_get_file_path(view_uri, &path); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_noti_get_file_path() fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } wd = __ctsvc_inotify_get_wd(__inoti_fd, path); @@ -533,9 +543,11 @@ int ctsvc_inotify_unsubscribe(const char *view_uri, contacts_db_changed_cb cb, v return inotify_rm_watch(__inoti_fd, wd); } + /* LCOV_EXCL_START */ ret = __ctsvc_inotify_watch(__inoti_fd, path); free(path); return ret; + /* LCOV_EXCL_STOP */ } static void __clear_nslot_list(gpointer data, gpointer user_data) @@ -589,8 +601,10 @@ static char* __ctsvc_inotify_get_username(uid_t uid) int ret = getpwuid_r(uid, &pwd, tmp, sizeof(tmp), &pwd_result); if (ret != 0 || pwd_result == NULL) { + /* LCOV_EXCL_START */ ERR("getpwuid_r() fail"); return NULL; + /* LCOV_EXCL_STOP */ } return SAFE_STRDUP(pwd.pw_name); @@ -609,8 +623,10 @@ char* ctsvc_inotify_makepath(const char *file) #ifdef _CONTACTS_IPC_CLIENT if (ctsvc_client_is_in_system_session()) { + /* LCOV_EXCL_START */ if (CONTACTS_ERROR_NONE != ctsvc_client_get_active_uid(&uid)) return NULL; + /* LCOV_EXCL_STOP */ } #endif @@ -625,9 +641,11 @@ char* ctsvc_inotify_makepath(const char *file) if (user_name) { snprintf(path, path_len, CTSVC_NOTI_PATH"/%s", user_name, file); } else { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_get_username() fail"); free(path); return NULL; + /* LCOV_EXCL_STOP */ } free(user_name); diff --git a/common/ctsvc_record.h b/common/ctsvc_record.h index f6e272f..cf9f1b9 100644 --- a/common/ctsvc_record.h +++ b/common/ctsvc_record.h @@ -37,8 +37,10 @@ static inline int ctsvc_record_copy_base(ctsvc_record_s *dest, ctsvc_record_s *s if (src->properties_flags) { dest->properties_flags = calloc(dest->property_max_count, sizeof(char)); if (NULL == dest->properties_flags) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (dest->properties_flags) memcpy(dest->properties_flags, src->properties_flags, sizeof(char)*dest->property_max_count); diff --git a/common/ctsvc_record_group.c b/common/ctsvc_record_group.c index 484628a..800d1ca 100644 --- a/common/ctsvc_record_group.c +++ b/common/ctsvc_record_group.c @@ -107,9 +107,11 @@ static int __ctsvc_group_clone(contacts_record_h record, contacts_record_h *out_ 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_group_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -128,8 +130,10 @@ static int __ctsvc_group_get_int(contacts_record_h record, unsigned int property *out = group->addressbook_id; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -158,8 +162,10 @@ static int __ctsvc_group_get_str_real(contacts_record_h record, unsigned int pro *out_str = GET_STR(copy, group->extra_data); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -190,8 +196,10 @@ static int __ctsvc_group_set_int(contacts_record_h record, unsigned int property group->addressbook_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -226,8 +234,10 @@ static int __ctsvc_group_set_str(contacts_record_h record, unsigned int property FREEandSTRDUP(group->extra_data, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -240,8 +250,10 @@ static int __ctsvc_group_get_bool(contacts_record_h record, unsigned int propert *value = group->is_read_only; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -258,8 +270,10 @@ static int __ctsvc_group_set_bool(contacts_record_h record, unsigned int propert group->is_read_only = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_record_person.c b/common/ctsvc_record_person.c index e061d8c..b13dd88 100644 --- a/common/ctsvc_record_person.c +++ b/common/ctsvc_record_person.c @@ -116,9 +116,11 @@ static int __ctsvc_person_clone(contacts_record_h record, contacts_record_h *out 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_person_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -143,8 +145,10 @@ static int __ctsvc_person_get_int(contacts_record_h record, unsigned int propert *out = person->snippet_type; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -159,8 +163,10 @@ static int __ctsvc_person_get_double(contacts_record_h record, unsigned int prop break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -198,8 +204,10 @@ static int __ctsvc_person_get_str_real(contacts_record_h record, unsigned int pr *out_str = GET_STR(copy, person->snippet_string); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -231,8 +239,10 @@ static int __ctsvc_person_get_bool(contacts_record_h record, unsigned int proper *value = person->has_email; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(company)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -260,8 +270,10 @@ static int __ctsvc_person_set_int(contacts_record_h record, unsigned int propert person->snippet_type = value; break; default: + /* LCOV_EXCL_START */ ERR("This field(0x%0x) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -301,8 +313,10 @@ static int __ctsvc_person_set_str(contacts_record_h record, unsigned int propert FREEandSTRDUP(person->snippet_string, str); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -319,8 +333,10 @@ static int __ctsvc_person_set_bool(contacts_record_h record, unsigned int proper person->is_favorite = value; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(person)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_record_phonelog.c b/common/ctsvc_record_phonelog.c index 69d45da..bc0ab36 100644 --- a/common/ctsvc_record_phonelog.c +++ b/common/ctsvc_record_phonelog.c @@ -100,9 +100,11 @@ static int __ctsvc_phonelog_clone(contacts_record_h record, contacts_record_h *o 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_phonelog_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -133,8 +135,10 @@ static int __ctsvc_phonelog_get_int(contacts_record_h record, unsigned int prope *out = phonelog->sim_slot_no; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(phonelog)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -151,8 +155,10 @@ static int __ctsvc_phonelog_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, phonelog->extra_data2); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(phonelog)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -216,8 +222,10 @@ static int __ctsvc_phonelog_set_int(contacts_record_h record, unsigned int prope phonelog->sim_slot_no = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(phonelog)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -238,8 +246,10 @@ static int __ctsvc_phonelog_set_str(contacts_record_h record, unsigned int prope FREEandSTRDUP(phonelog->extra_data2, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(phonelog)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_record_result.c b/common/ctsvc_record_result.c index 8e85527..1aff57c 100644 --- a/common/ctsvc_record_result.c +++ b/common/ctsvc_record_result.c @@ -105,9 +105,11 @@ static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out ctsvc_result_value_s *src = cursor->data; ctsvc_result_value_s *dest = calloc(1, sizeof(ctsvc_result_value_s)); if (NULL == dest) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); __ctsvc_result_destroy((contacts_record_h)out_data, true); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } dest->property_id = src->property_id; @@ -136,9 +138,11 @@ static int __ctsvc_result_clone(contacts_record_h record, contacts_record_h *out 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_result_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -232,8 +236,10 @@ static int __ctsvc_result_set_int(contacts_record_h record, unsigned int propert data = calloc(1, sizeof(ctsvc_result_value_s)); if (NULL == data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } data->property_id = property_id; data->type = CTSVC_VIEW_DATA_TYPE_INT; @@ -267,16 +273,20 @@ static int __ctsvc_result_set_bool(contacts_record_h record, unsigned int proper data->value.b = value; return CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("use another get_type API, (type : %d)", data->type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } data = calloc(1, sizeof(ctsvc_result_value_s)); if (NULL == data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } data->property_id = property_id; data->type = CTSVC_VIEW_DATA_TYPE_BOOL; @@ -309,8 +319,10 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2; full_path = calloc(1, str_len); if (NULL == full_path) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str); } @@ -328,8 +340,10 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert data = calloc(1, sizeof(ctsvc_result_value_s)); if (NULL == data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } data->property_id = property_id; data->type = CTSVC_VIEW_DATA_TYPE_STR; @@ -340,9 +354,11 @@ static int __ctsvc_result_set_str(contacts_record_h record, unsigned int propert str_len = strlen(CTSVC_CONTACT_IMG_FULL_LOCATION) + strlen(str) + 2; full_path = calloc(1, str_len); if (NULL == full_path) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(full_path, str_len, "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, str); } @@ -371,8 +387,10 @@ static int __ctsvc_result_get_bool(contacts_record_h record, unsigned int proper *out_value = data->value.b; return CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("use another get_type API, (type : %d)", data->type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } diff --git a/common/ctsvc_record_sdn.c b/common/ctsvc_record_sdn.c index db6b43a..4885398 100644 --- a/common/ctsvc_record_sdn.c +++ b/common/ctsvc_record_sdn.c @@ -93,15 +93,19 @@ static int __ctsvc_sdn_clone(contacts_record_h record, contacts_record_h *out_re 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_sdn_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; return CONTACTS_ERROR_NONE; } +/* Can't find the SIM include SDN */ +/* LCOV_EXCL_START */ static int __ctsvc_sdn_get_int(contacts_record_h record, unsigned int property_id, int *out) { ctsvc_sdn_s *sdn = (ctsvc_sdn_s*)record; @@ -187,4 +191,5 @@ static int __ctsvc_sdn_set_str(contacts_record_h record, unsigned int property_i } return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_STOP */ diff --git a/common/ctsvc_record_speeddial.c b/common/ctsvc_record_speeddial.c index e252cb9..3c1f31e 100644 --- a/common/ctsvc_record_speeddial.c +++ b/common/ctsvc_record_speeddial.c @@ -100,9 +100,11 @@ static int __ctsvc_speeddial_clone(contacts_record_h record, contacts_record_h * 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_speeddial_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -127,8 +129,10 @@ static int __ctsvc_speeddial_get_int(contacts_record_h record, unsigned int prop *out = speeddial->person_id; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(speeddial)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -151,8 +155,10 @@ static int __ctsvc_speeddial_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, speeddial->label); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(speeddial)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -191,8 +197,10 @@ static int __ctsvc_speeddial_set_int(contacts_record_h record, unsigned int prop speeddial->number_id = value; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(speeddial)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -219,8 +227,10 @@ static int __ctsvc_speeddial_set_str(contacts_record_h record, unsigned int prop FREEandSTRDUP(speeddial->label, str); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(speeddial)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_record_updated_info.c b/common/ctsvc_record_updated_info.c index 3b2d9bb..091acde 100644 --- a/common/ctsvc_record_updated_info.c +++ b/common/ctsvc_record_updated_info.c @@ -90,9 +90,11 @@ static int __ctsvc_updated_info_clone(contacts_record_h record, contacts_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_updated_info_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -120,8 +122,10 @@ static int __ctsvc_updated_info_get_int(contacts_record_h record, unsigned int p *out = updated_info->last_changed_type; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(updated_info)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -155,8 +159,10 @@ static int __ctsvc_updated_info_set_int(contacts_record_h record, unsigned int p updated_info->last_changed_type = value; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(updated_info)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -170,8 +176,10 @@ static int __ctsvc_updated_info_get_bool(contacts_record_h record, unsigned int *out = updated_info->image_changed; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(updated_info)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -186,8 +194,10 @@ static int __ctsvc_updated_info_set_bool(contacts_record_h record, unsigned int updated_info->image_changed = value; break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(updated_info)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_socket.c b/common/ctsvc_socket.c index 201439f..d4b23cc 100644 --- a/common/ctsvc_socket.c +++ b/common/ctsvc_socket.c @@ -47,8 +47,10 @@ int ctsvc_socket_init(void) #ifdef _CONTACTS_IPC_CLIENT if (ctsvc_client_is_in_system_session()) { + /* LCOV_EXCL_START */ if (CONTACTS_ERROR_NONE != ctsvc_client_get_active_uid(&uid)) return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } #endif @@ -64,10 +66,12 @@ int ctsvc_socket_init(void) ret = connect(__ctsvc_sockfd, (struct sockaddr *)&caddr, sizeof(caddr)); if (-1 == ret) { + /* LCOV_EXCL_START */ ERR("connect() Fail(errno = %d)", errno); close(__ctsvc_sockfd); __ctsvc_sockfd = -1; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } __ctsvc_conn_refcnt++; diff --git a/common/ctsvc_vcard.c b/common/ctsvc_vcard.c index 585d24a..01fcb0e 100644 --- a/common/ctsvc_vcard.c +++ b/common/ctsvc_vcard.c @@ -695,8 +695,10 @@ static inline int __ctsvc_vcard_put_company_logo(const char *path, char **buf, i g_free(buf_image); if (len < 0) { + /* LCOV_EXCL_START */ ERR("__ctsvc_vcard_append_str() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } } return len; @@ -1487,15 +1489,19 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb( ret = ctsvc_image_util_get_mimetype(colorspace, &mimetype); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ info->ret = CONTACTS_ERROR_SYSTEM; return true; + /* LCOV_EXCL_STOP */ } ret = image_util_decode_jpeg(info->src, colorspace, (unsigned char **)&buffer, &width, &height, &size_decode); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ info->ret = CONTACTS_ERROR_SYSTEM; return true; + /* LCOV_EXCL_STOP */ } size = (uint64_t)size_decode; @@ -1522,19 +1528,23 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb( fmt = ctsvc_image_util_create_media_format(mimetype, width, height); if (NULL == fmt) { + /* LCOV_EXCL_START */ ERR("_ctsvc_image_create_media_format() Fail"); info->ret = CONTACTS_ERROR_SYSTEM; free(buffer); return false; + /* LCOV_EXCL_STOP */ } packet = ctsvc_image_util_create_media_packet(fmt, buffer, (unsigned int)size); if (NULL == packet) { + /* LCOV_EXCL_START */ ERR("_ctsvc_image_create_media_packet() Fail"); media_format_unref(fmt); info->ret = CONTACTS_ERROR_SYSTEM; free(buffer); return false; + /* LCOV_EXCL_STOP */ } ret = ctsvc_image_util_resize(packet, resized_width, resized_height, &buffer_temp, @@ -1559,9 +1569,11 @@ static bool _ctsvc_vcard_image_util_supported_jpeg_colorspace_cb( CTSVC_IMAGE_ENCODE_QUALITY, info->image, info->image_size); free(buffer); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_encode_jpeg_to_memory", ret); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } info->ret = CONTACTS_ERROR_NONE; @@ -1606,15 +1618,19 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf, img_buf_size = CTSVC_VCARD_PHOTO_MAX_SIZE * sizeof(unsigned char); image = calloc(1, img_buf_size); if (NULL == image) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } fd = open(data->path, O_RDONLY); if (fd < 0) { + /* LCOV_EXCL_START */ ERR("System : Open Fail(%d)", errno); free(image); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } read_len = 0; @@ -1629,9 +1645,11 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf, } close(fd); if (ret < 0) { + /* LCOV_EXCL_START */ ERR("System : read() Fail(%d)", errno); free(image); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } @@ -1661,8 +1679,10 @@ static inline int __ctsvc_vcard_put_photo(ctsvc_list_s *image_list, char **buf, g_free(buf_image); if (len < 0) { + /* LCOV_EXCL_START */ ERR("__ctsvc_vcard_append_str() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } } } @@ -1845,32 +1865,42 @@ static int __ctsvc_vcard_make(ctsvc_contact_s *contact, char **vcard_stream) buf = calloc(1, buf_size); if (NULL == buf) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_start_vcard_3_0(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_contact(contact, &buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_end_vcard(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_add_folding(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *vcard_stream = buf; @@ -1887,32 +1917,42 @@ static int __ctsvc_vcard_make_from_my_profile(ctsvc_my_profile_s *my_profile, ch buf = calloc(1, buf_size); if (NULL == buf) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_start_vcard_3_0(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_my_profile(my_profile, &buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_end_vcard(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_add_folding(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *vcard_stream = buf; @@ -2100,31 +2140,41 @@ static int __ctsvc_vcard_make_from_person(ctsvc_person_s *person, ctsvc_list_s * buf = calloc(1, buf_size); if (NULL == buf) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_start_vcard_3_0(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_person(person, list_contacts, &buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_append_end_vcard(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = __ctsvc_vcard_add_folding(&buf, &buf_size, len); if (len < 0) { + /* LCOV_EXCL_START */ free(buf); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *vcard_stream = buf; @@ -2795,9 +2845,11 @@ static inline int __ctsvc_vcard_get_photo(contacts_record_h contact, ctsvc_list_ fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660); if (fd < 0) { + /* LCOV_EXCL_START */ g_free(buf); ERR("System : open Fail(%d)", errno); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } while (0 < size) { @@ -3055,9 +3107,11 @@ static inline int __ctsvc_vcard_get_company_logo(ctsvc_list_s *company_list, cha fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660); if (fd < 0) { + /* LCOV_EXCL_START */ g_free(buf); ERR("System : open Fail(%d)", errno); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } while (0 < size) { @@ -3817,10 +3871,12 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor if (base64_encoded) { char *temp = __ctsvc_vcard_decode_base64_val(val); if (NULL == temp) { + /* LCOV_EXCL_START */ ERR("__ctsvc_vcard_decode_base64_val() Fail"); free(prefix); free(val); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } free(val); val = temp; @@ -4484,8 +4540,10 @@ EXPORT_API int contacts_vcard_parse_to_contacts(const char *vcard_stream, contac static int _ctsvc_safe_add(unsigned int *total, unsigned int value) { if (UINT_MAX - *total < value) { + /* LCOV_EXCL_START */ ERR("overflow occurs when %d + %d", *total, value); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } *total += value; @@ -4515,9 +4573,11 @@ EXPORT_API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_na buf_size = CTSVC_VCARD_MAX_SIZE; stream = malloc(CTSVC_VCARD_MAX_SIZE); if (NULL == stream) { + /* LCOV_EXCL_START */ ERR("Out of memory : malloc() Fail"); fclose(file); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } while (fgets(line, sizeof(line), file)) { @@ -4532,17 +4592,21 @@ EXPORT_API int contacts_vcard_parse_to_contact_foreach(const char *vcard_file_na if (new_stream) { stream = new_stream; } else { + /* LCOV_EXCL_START */ free(stream); fclose(file); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } } written_len = snprintf(stream + len, buf_size - len, "%s", line); if (written_len < 0) { + /* LCOV_EXCL_START */ free(stream); fclose(file); ERR("snprintf() Fail(%d)", written_len); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = _ctsvc_safe_add(&len, (unsigned int)written_len); diff --git a/common/ctsvc_view.c b/common/ctsvc_view.c index b1f4f64..14e4892 100644 --- a/common/ctsvc_view.c +++ b/common/ctsvc_view.c @@ -1378,8 +1378,10 @@ void ctsvc_view_uri_deinit() #endif if (NULL == __ctsvc_view_uri_hash) { + /* LCOV_EXCL_START */ ERR("contacts-service is not initialized"); return; + /* LCOV_EXCL_STOP */ } g_hash_table_destroy(__ctsvc_view_uri_hash); @@ -1393,8 +1395,10 @@ ctsvc_record_type_e ctsvc_view_get_record_type(const char *view_uri) ctsvc_record_type_e type = CTSVC_RECORD_INVALID; if (NULL == __ctsvc_view_uri_hash) { + /* LCOV_EXCL_START */ ERR("contacts-service is not initialized"); return type; + /* LCOV_EXCL_STOP */ } view_uri_info = g_hash_table_lookup(__ctsvc_view_uri_hash, view_uri); @@ -1409,8 +1413,10 @@ const char* ctsvc_view_get_uri(const char *view_uri) view_uri_info_s *view_uri_info = NULL; if (NULL == __ctsvc_view_uri_hash) { + /* LCOV_EXCL_START */ ERR("contacts-service is not initialized"); return NULL; + /* LCOV_EXCL_STOP */ } view_uri_info = g_hash_table_lookup(__ctsvc_view_uri_hash, view_uri); @@ -1425,8 +1431,10 @@ const property_info_s* ctsvc_view_get_all_property_infos(const char *view_uri, u view_uri_info_s *view_uri_info = NULL; if (NULL == __ctsvc_view_uri_hash) { + /* LCOV_EXCL_START */ ERR("contacts-service is not initialized"); return NULL; + /* LCOV_EXCL_STOP */ } view_uri_info = g_hash_table_lookup(__ctsvc_view_uri_hash, view_uri); diff --git a/common/ipc/ctsvc_ipc_activity.c b/common/ipc/ctsvc_ipc_activity.c index 0fc3389..ea9687e 100644 --- a/common/ipc/ctsvc_ipc_activity.c +++ b/common/ipc/ctsvc_ipc_activity.c @@ -52,8 +52,10 @@ static int __ctsvc_ipc_unmarshal_activity(pims_ipc_data_h ipc_data, const char * } while (0); + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_activity() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_activity(const contacts_record_h record, @@ -86,9 +88,10 @@ static int __ctsvc_ipc_marshal_activity(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } diff --git a/common/ipc/ctsvc_ipc_activity_photo.c b/common/ipc/ctsvc_ipc_activity_photo.c index 1238123..2289b6d 100644 --- a/common/ipc/ctsvc_ipc_activity_photo.c +++ b/common/ipc/ctsvc_ipc_activity_photo.c @@ -43,8 +43,10 @@ static int __ctsvc_ipc_unmarshal_activity_photo(pims_ipc_data_h ipc_data, } while (0); + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_activity_photo() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_activity_photo(const contacts_record_h record, @@ -68,10 +70,10 @@ static int __ctsvc_ipc_marshal_activity_photo(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_activity_photo_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_address.c b/common/ipc/ctsvc_ipc_address.c index db06be9..6e8c750 100644 --- a/common/ipc/ctsvc_ipc_address.c +++ b/common/ipc/ctsvc_ipc_address.c @@ -57,10 +57,10 @@ static int __ctsvc_ipc_unmarshal_address(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_address() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_address(const contacts_record_h record, @@ -100,9 +100,10 @@ static int __ctsvc_ipc_marshal_address(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_address_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_addressbook.c b/common/ipc/ctsvc_ipc_addressbook.c index 2af7ae5..e5b047c 100644 --- a/common/ipc/ctsvc_ipc_addressbook.c +++ b/common/ipc/ctsvc_ipc_addressbook.c @@ -42,8 +42,10 @@ static int __ctsvc_ipc_unmarshal_addressbook(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_addressbook() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_addressbook(const contacts_record_h record, @@ -67,9 +69,10 @@ static int __ctsvc_ipc_marshal_addressbook(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_addressbook_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_company.c b/common/ipc/ctsvc_ipc_company.c index 498cbd9..1b4f06d 100644 --- a/common/ipc/ctsvc_ipc_company.c +++ b/common/ipc/ctsvc_ipc_company.c @@ -63,8 +63,10 @@ static int __ctsvc_ipc_unmarshal_company(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_company() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_company(const contacts_record_h record, @@ -108,8 +110,10 @@ static int __ctsvc_ipc_marshal_company(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_company_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_contact.c b/common/ipc/ctsvc_ipc_contact.c index 5f529e6..67c8776 100644 --- a/common/ipc/ctsvc_ipc_contact.c +++ b/common/ipc/ctsvc_ipc_contact.c @@ -112,8 +112,10 @@ static int __ctsvc_ipc_unmarshal_contact(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_contact() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_contact(const contacts_record_h record, @@ -208,8 +210,10 @@ static int __ctsvc_ipc_marshal_contact(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_contact_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_email.c b/common/ipc/ctsvc_ipc_email.c index 5749ce3..f1db25e 100644 --- a/common/ipc/ctsvc_ipc_email.c +++ b/common/ipc/ctsvc_ipc_email.c @@ -46,9 +46,10 @@ static int __ctsvc_ipc_unmarshal_email(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_email() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_email(const contacts_record_h record, @@ -76,9 +77,10 @@ static int __ctsvc_ipc_marshal_email(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_email_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_event.c b/common/ipc/ctsvc_ipc_event.c index 2b57184..33378e6 100644 --- a/common/ipc/ctsvc_ipc_event.c +++ b/common/ipc/ctsvc_ipc_event.c @@ -47,9 +47,10 @@ static int __ctsvc_ipc_unmarshal_event(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_event() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_event(const contacts_record_h record, @@ -78,9 +79,10 @@ static int __ctsvc_ipc_marshal_event(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_event_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_extension.c b/common/ipc/ctsvc_ipc_extension.c index 893c8eb..4d81cf9 100644 --- a/common/ipc/ctsvc_ipc_extension.c +++ b/common/ipc/ctsvc_ipc_extension.c @@ -62,9 +62,10 @@ static int __ctsvc_ipc_unmarshal_extension(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_extension() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_extension(const contacts_record_h record, @@ -108,9 +109,10 @@ static int __ctsvc_ipc_marshal_extension(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_extension_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_group.c b/common/ipc/ctsvc_ipc_group.c index e433cee..a409910 100644 --- a/common/ipc/ctsvc_ipc_group.c +++ b/common/ipc/ctsvc_ipc_group.c @@ -52,9 +52,10 @@ static int __ctsvc_ipc_unmarshal_group(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_group() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_group(const contacts_record_h record, @@ -87,9 +88,10 @@ static int __ctsvc_ipc_marshal_group(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_grouprelation.c b/common/ipc/ctsvc_ipc_grouprelation.c index 45d575e..af90e8d 100644 --- a/common/ipc/ctsvc_ipc_grouprelation.c +++ b/common/ipc/ctsvc_ipc_grouprelation.c @@ -42,9 +42,10 @@ static int __ctsvc_ipc_unmarshal_group_relation(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_group_relation() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_group_relation(const contacts_record_h record, @@ -68,9 +69,10 @@ static int __ctsvc_ipc_marshal_group_relation(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_group_relation_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_image.c b/common/ipc/ctsvc_ipc_image.c index 73e2bdc..83c7140 100644 --- a/common/ipc/ctsvc_ipc_image.c +++ b/common/ipc/ctsvc_ipc_image.c @@ -45,9 +45,10 @@ static int __ctsvc_ipc_unmarshal_image(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_image() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_image(const contacts_record_h record, @@ -74,9 +75,10 @@ static int __ctsvc_ipc_marshal_image(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_image_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_marshal.c b/common/ipc/ctsvc_ipc_marshal.c index 7dafe3e..eb33377 100644 --- a/common/ipc/ctsvc_ipc_marshal.c +++ b/common/ipc/ctsvc_ipc_marshal.c @@ -60,15 +60,6 @@ extern ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_url_plugin_cb; extern ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_image_plugin_cb; extern ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_sip_plugin_cb; -static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(ctsvc_record_type_e type); - - -static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_s *filter); -static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s *filter, pims_ipc_data_h ipc_data); -static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s *filter); -static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s *filter, pims_ipc_data_h ipc_data); - - static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(ctsvc_record_type_e type) { switch (type) { @@ -133,11 +124,14 @@ static ctsvc_ipc_marshal_record_plugin_cb_s* __ctsvc_ipc_marshal_get_plugin_cb(c case CTSVC_RECORD_SIP: return (&_ctsvc_ipc_record_sip_plugin_cb); default: + /* LCOV_EXCL_START */ ASSERT_NOT_REACHED("Unimplemented IPC module (%d)", type); return NULL; + /* LCOV_EXCL_STOP */ } } +#ifdef _CONTACTS_IPC_SERVER static void __ctsvc_ipc_unmarshal_composite_filter_free(ctsvc_composite_filter_s *filter) { if (filter->filters) { @@ -162,6 +156,55 @@ static void __ctsvc_ipc_unmarshal_composite_filter_free(ctsvc_composite_filter_s free(filter->view_uri); } +static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s *filter) +{ + filter->filter_type = filter_type; + if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->property_id)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_unmarshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP*/ + } + if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->match)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_unmarshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + switch (filter->filter_type) { + case CTSVC_FILTER_STR: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_string(ipc_data, &filter->value.s)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_unmarshal_string() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_INT: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->value.i)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_unmarshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_BOOL: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &filter->value.b)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_unmarshal_bool() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_DOUBLE: + case CTSVC_FILTER_LLI: + default: + break; + } + return CONTACTS_ERROR_NONE; +} + + static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_s *filter) { unsigned int size = 0; @@ -178,44 +221,56 @@ static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data /* filters */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int*)&filter_type)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (filter_type == CTSVC_FILTER_COMPOSITE) { ctsvc_composite_filter_s *com_filter = NULL; com_filter = calloc(1, sizeof(ctsvc_composite_filter_s)); if (com_filter == NULL) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, com_filter)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail"); free(com_filter); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } filter->filters = g_slist_append(filter->filters, com_filter); } else { ctsvc_attribute_filter_s *attr_filter = NULL; attr_filter = calloc(1, sizeof(ctsvc_attribute_filter_s)); if (attr_filter == NULL) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_attribute_filter(ipc_data, filter_type, attr_filter)) { + /* LCOV_EXCL_START */ free(attr_filter); ERR("__ctsvc_ipc_unmarshal_attribute_filter() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } filter->filters = g_slist_append(filter->filters, attr_filter); } @@ -223,16 +278,20 @@ static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data /* filters */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int *)&op)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); __ctsvc_ipc_unmarshal_composite_filter_free(filter); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } filter->filter_ops = g_slist_append(filter->filter_ops, (void*)op); } @@ -243,18 +302,78 @@ static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data return CONTACTS_ERROR_NONE; } +#else /* _CONTACTS_IPC_SERVER */ + +static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s *filter, pims_ipc_data_h ipc_data) +{ + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->property_id), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->match), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + switch (filter->filter_type) { + case CTSVC_FILTER_STR: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string((filter->value.s), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_string() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_INT: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->value.i), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_int() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_BOOL: + if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool((filter->value.b), ipc_data)) { + /* LCOV_EXCL_START */ + ERR("ctsvc_ipc_marshal_bool() Fail"); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + break; + case CTSVC_FILTER_DOUBLE: + case CTSVC_FILTER_LLI: + default: + break; + } + + return CONTACTS_ERROR_NONE; +} + static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s *filter, pims_ipc_data_h ipc_data) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type), ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* view_uri */ int length = strlen(filter->view_uri); if (pims_ipc_data_put(ipc_data, (void*)filter->view_uri, length+1) < 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_put() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* filter->filters */ if (filter->filters) { @@ -263,29 +382,37 @@ static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s * ctsvc_filter_s *child_filter; if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } while (cursor) { child_filter = cursor->data; if (child_filter->filter_type == CTSVC_FILTER_COMPOSITE) { if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter((ctsvc_composite_filter_s*)child_filter, ipc_data)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_marshal_composite_filter() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else { if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_attribute_filter((ctsvc_attribute_filter_s*)child_filter, ipc_data)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_marshal_attribute_filter() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } cursor = g_slist_next(cursor); } } else { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } @@ -294,108 +421,35 @@ static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s * GSList *cursor = filter->filter_ops; if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } while (cursor) { contacts_filter_operator_e op = (contacts_filter_operator_e)cursor->data; if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(op, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cursor = g_slist_next(cursor); } } else { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } return CONTACTS_ERROR_NONE; } - -static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s *filter) -{ - filter->filter_type = filter_type; - if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->property_id)) { - ERR("ctsvc_ipc_unmarshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->match)) { - ERR("ctsvc_ipc_unmarshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - switch (filter->filter_type) { - case CTSVC_FILTER_STR: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_string(ipc_data, &filter->value.s)) { - ERR("ctsvc_ipc_unmarshal_string() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_INT: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &filter->value.i)) { - ERR("ctsvc_ipc_unmarshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_BOOL: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &filter->value.b)) { - ERR("ctsvc_ipc_unmarshal_bool() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_DOUBLE: - case CTSVC_FILTER_LLI: - default: - break; - } - return CONTACTS_ERROR_NONE; -} - -static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s *filter, pims_ipc_data_h ipc_data) -{ - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type), ipc_data)) { - ERR("ctsvc_ipc_marshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->property_id), ipc_data)) { - ERR("ctsvc_ipc_marshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->match), ipc_data)) { - ERR("ctsvc_ipc_marshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - switch (filter->filter_type) { - case CTSVC_FILTER_STR: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string((filter->value.s), ipc_data)) { - ERR("ctsvc_ipc_marshal_string() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_INT: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->value.i), ipc_data)) { - ERR("ctsvc_ipc_marshal_int() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_BOOL: - if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool((filter->value.b), ipc_data)) { - ERR("ctsvc_ipc_marshal_bool() Fail"); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - break; - case CTSVC_FILTER_DOUBLE: - case CTSVC_FILTER_LLI: - default: - break; - } - - return CONTACTS_ERROR_NONE; -} +#endif /* _CONTACTS_IPC_SERVER */ int ctsvc_ipc_marshal_handle(const contacts_h contact, pims_ipc_data_h ipc_data) { @@ -441,22 +495,28 @@ int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_h RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER); if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record_common(ipc_data, &common)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record_common() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } plugin_cb = __ctsvc_ipc_marshal_get_plugin_cb(common.r_type); if (NULL == plugin_cb || NULL == plugin_cb->unmarshal_record) { + /* LCOV_EXCL_START */ ERR("Invalid parameter"); free(common.properties_flags); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(common.view_uri, precord); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail"); free(common.properties_flags); return ret; + /* LCOV_EXCL_STOP */ } precord_common = (ctsvc_record_s*)(*precord); @@ -466,9 +526,11 @@ int ctsvc_ipc_unmarshal_record(const pims_ipc_data_h ipc_data, contacts_record_h ret = plugin_cb->unmarshal_record(ipc_data, common.view_uri, *precord); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ contacts_record_destroy(*precord, true); *precord = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return ret; @@ -482,8 +544,10 @@ int ctsvc_ipc_marshal_record(const contacts_record_h record, pims_ipc_data_h ipc RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER); if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record_common(common, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record_common() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s *plugin_cb = __ctsvc_ipc_marshal_get_plugin_cb(common->r_type); @@ -510,8 +574,10 @@ int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char **ppbufchar) tmp = pims_ipc_data_get(ipc_data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } length = *(int*)tmp; @@ -525,8 +591,10 @@ int ctsvc_ipc_unmarshal_string(const pims_ipc_data_h ipc_data, char **ppbufchar) if (str) { *ppbufchar = strdup(str); if (NULL == *ppbufchar) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } return ret; @@ -541,8 +609,10 @@ int ctsvc_ipc_unmarshal_int(const pims_ipc_data_h data, int *pout) void *tmp = pims_ipc_data_get(data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { *pout = *(int*)tmp; } @@ -558,8 +628,10 @@ int ctsvc_ipc_unmarshal_unsigned_int(const pims_ipc_data_h data, unsigned int *p void *tmp = pims_ipc_data_get(data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { *pout = *(unsigned int*)tmp; } @@ -575,8 +647,10 @@ int ctsvc_ipc_unmarshal_double(const pims_ipc_data_h data, double *pout) void *tmp = pims_ipc_data_get(data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { *pout = *(double*)tmp; } @@ -592,8 +666,10 @@ int ctsvc_ipc_unmarshal_bool(const pims_ipc_data_h data, bool *pout) void *tmp = pims_ipc_data_get(data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { *pout = *(bool*)tmp; } @@ -610,23 +686,29 @@ int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_reco tmp = pims_ipc_data_get(ipc_data, &size); if (tmp == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { common->r_type = *(ctsvc_record_type_e*)tmp; } str = (char*)pims_ipc_data_get(ipc_data, &size); if (NULL == str) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } common->view_uri = ctsvc_view_get_uri(str); tmp = pims_ipc_data_get(ipc_data, &size); if (NULL == tmp) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } common->property_max_count = *(unsigned int*)tmp; @@ -634,23 +716,29 @@ int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_reco unsigned char *tmp_properties_flags; tmp_properties_flags = (unsigned char*)pims_ipc_data_get(ipc_data, &size); if (NULL == tmp_properties_flags) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } common->properties_flags = calloc(common->property_max_count, sizeof(char)); if (common->properties_flags == NULL) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } memcpy(common->properties_flags, tmp_properties_flags, sizeof(char)*common->property_max_count); } tmp = pims_ipc_data_get(ipc_data, &size); if (NULL == tmp) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_get() Fail"); free(common->properties_flags); common->properties_flags = NULL; return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } common->property_flag = *(unsigned char*)tmp; @@ -728,8 +816,10 @@ int ctsvc_ipc_marshal_record_common(const ctsvc_record_s *common, pims_ipc_data_ int length = strlen(common->view_uri); if (pims_ipc_data_put(ipc_data, (void*)common->view_uri, length+1) < 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_put() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (pims_ipc_data_put(ipc_data, (void*)&common->property_max_count, sizeof(unsigned int)) < 0) @@ -737,8 +827,10 @@ int ctsvc_ipc_marshal_record_common(const ctsvc_record_s *common, pims_ipc_data_ if (0 < common->property_max_count) { if (pims_ipc_data_put(ipc_data, (void*)common->properties_flags, sizeof(unsigned char)*common->property_max_count) < 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_put() Fail"); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } } @@ -748,6 +840,7 @@ int ctsvc_ipc_marshal_record_common(const ctsvc_record_s *common, pims_ipc_data_ return CONTACTS_ERROR_NONE; } +#ifdef _CONTACTS_IPC_SERVER int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *out_query) { ctsvc_query_s *query = NULL; @@ -764,16 +857,20 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h * ret = contacts_query_create(str, out_query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_query_create() Fail"); return ret; + /* LCOV_EXCL_STOP */ } query = (ctsvc_query_s*)*out_query; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) { + /* LCOV_EXCL_START */ ERR("contacts_query_create() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (0 == count) { @@ -782,10 +879,12 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h * ctsvc_composite_filter_s *filter = NULL; filter = calloc(1, sizeof(ctsvc_composite_filter_s)); if (NULL == filter) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } filter->filter_type = CTSVC_FILTER_COMPOSITE; filter->properties = (property_info_s*)ctsvc_view_get_all_property_infos(query->view_uri, &filter->property_count); @@ -793,41 +892,51 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h * /* for filter_type */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, query->filter)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->projection_count))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (0 < query->projection_count) { query->projection = malloc(sizeof(unsigned int)*query->projection_count); if (query->projection == NULL) { + /* LCOV_EXCL_START */ ERR("malloc() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } for (i = 0; i < query->projection_count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->projection[i]))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } } else { @@ -835,29 +944,37 @@ int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h * } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->sort_property_id))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &(query->sort_asc))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_bool() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data, &(query->distinct))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_bool() Fail"); contacts_query_destroy(*out_query); *out_query = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } +#else /* _CONTACTS_IPC_SERVER */ + int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_data) { ctsvc_query_s *que = NULL; @@ -871,55 +988,74 @@ int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_da /* view_uri */ length = strlen(que->view_uri); if (pims_ipc_data_put(ipc_data, (void*)que->view_uri, length+1) < 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_put() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (que->filter) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(1, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter(que->filter, ipc_data)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_marshal_composite_filter() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection_count, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_unsigned_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } for (i = 0; i < que->projection_count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection[i], ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_unsigned_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->sort_property_id, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_unsigned_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->sort_asc, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_bool() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->distinct, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_bool() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } +#endif /* _CONTACTS_IPC_SERVER */ int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h *list) { @@ -931,55 +1067,69 @@ int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h *li RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER); if (CONTACTS_ERROR_NONE != contacts_list_create(list)) { + /* LCOV_EXCL_START */ ERR("contacts_list_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &(count))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } unsigned int i = 0; for (i = 0; i < count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != contacts_list_add(*list, record)) { + /* LCOV_EXCL_START */ ERR("contacts_list_add() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &deleted_count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } i = 0; for (i = 0; i < deleted_count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list, record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_list_append_deleted_record() Fail"); contacts_list_destroy(*list, true); *list = NULL; return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -997,37 +1147,49 @@ int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER); if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &(count))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != contacts_list_add(*list, record)) { + /* LCOV_EXCL_START */ ERR("contacts_list_add() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &deleted_count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } i = 0; for (i = 0; i < deleted_count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list, record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_list_append_deleted_record() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } @@ -1045,12 +1207,16 @@ int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data) /* count */ if (CONTACTS_ERROR_NONE != contacts_list_get_count(list, &count)) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_count() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } contacts_list_first(list); @@ -1058,12 +1224,16 @@ int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data) unsigned int i = 0; for (i = 0; i < count; i++) { if (CONTACTS_ERROR_NONE != contacts_list_get_current_record_p(list, &record)) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == contacts_list_next(list)) @@ -1072,23 +1242,31 @@ int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data) /* count */ if (ctsvc_list_get_deleted_count(list, &deleted_count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_list_get_deleted_count() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(deleted_count, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } i = 0; for (i = 0; i < deleted_count; i++) { if (CONTACTS_ERROR_NONE != ctsvc_list_get_deleted_nth_record_p(list, i, &record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_list_get_deleted_nth_record_p() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record, ipc_data)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } diff --git a/common/ipc/ctsvc_ipc_marshal.h b/common/ipc/ctsvc_ipc_marshal.h index 60aff22..2fe76e1 100644 --- a/common/ipc/ctsvc_ipc_marshal.h +++ b/common/ipc/ctsvc_ipc_marshal.h @@ -72,8 +72,12 @@ int ctsvc_ipc_marshal_double(const double in, pims_ipc_data_h ipc_data); * marsharl : view_uri + other * unmarshal : view_uri를 먼저 get 하고 난 이후 나머지를 .. */ + +#ifdef _CONTACTS_IPC_SERVER int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *query); +#else int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_data); +#endif int ctsvc_ipc_unmarshal_list(const pims_ipc_data_h ipc_data, contacts_list_h *list); int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_h *list); int ctsvc_ipc_marshal_list(const contacts_list_h list, pims_ipc_data_h ipc_data); diff --git a/common/ipc/ctsvc_ipc_messenger.c b/common/ipc/ctsvc_ipc_messenger.c index fc7aab1..31b934d 100644 --- a/common/ipc/ctsvc_ipc_messenger.c +++ b/common/ipc/ctsvc_ipc_messenger.c @@ -43,9 +43,10 @@ static int __ctsvc_ipc_unmarshal_messenger(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_messenger() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_messenger(const contacts_record_h record, @@ -71,9 +72,10 @@ static int __ctsvc_ipc_marshal_messenger(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_messenger_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_my_profile.c b/common/ipc/ctsvc_ipc_my_profile.c index 1a69d4f..de74756 100644 --- a/common/ipc/ctsvc_ipc_my_profile.c +++ b/common/ipc/ctsvc_ipc_my_profile.c @@ -76,9 +76,10 @@ static int __ctsvc_ipc_unmarshal_my_profile(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_my_profile() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_my_profile(const contacts_record_h record, @@ -136,9 +137,10 @@ static int __ctsvc_ipc_marshal_my_profile(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_my_profile_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_name.c b/common/ipc/ctsvc_ipc_name.c index 2547b7e..8d13689 100644 --- a/common/ipc/ctsvc_ipc_name.c +++ b/common/ipc/ctsvc_ipc_name.c @@ -62,9 +62,10 @@ static int __ctsvc_ipc_unmarshal_name(pims_ipc_data_h ipc_data, const char *view return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_name() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_name(const contacts_record_h record, @@ -108,9 +109,10 @@ static int __ctsvc_ipc_marshal_name(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_name_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_nickname.c b/common/ipc/ctsvc_ipc_nickname.c index e4f4ecc..f650cec 100644 --- a/common/ipc/ctsvc_ipc_nickname.c +++ b/common/ipc/ctsvc_ipc_nickname.c @@ -43,9 +43,10 @@ static int __ctsvc_ipc_unmarshal_nickname(pims_ipc_data_h ipc_data, const char * return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_nickname() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_nickname(const contacts_record_h record, @@ -71,9 +72,10 @@ static int __ctsvc_ipc_marshal_nickname(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_nickname_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_note.c b/common/ipc/ctsvc_ipc_note.c index 729362a..4d86f11 100644 --- a/common/ipc/ctsvc_ipc_note.c +++ b/common/ipc/ctsvc_ipc_note.c @@ -40,9 +40,10 @@ static int __ctsvc_ipc_unmarshal_note(pims_ipc_data_h ipc_data, const char *view return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_note() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_note(const contacts_record_h record, @@ -63,9 +64,10 @@ static int __ctsvc_ipc_marshal_note(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_note_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_number.c b/common/ipc/ctsvc_ipc_number.c index f68af81..42b3936 100644 --- a/common/ipc/ctsvc_ipc_number.c +++ b/common/ipc/ctsvc_ipc_number.c @@ -46,9 +46,10 @@ static int __ctsvc_ipc_unmarshal_number(pims_ipc_data_h ipc_data, const char *vi return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_number() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_number(const contacts_record_h record, @@ -75,9 +76,10 @@ static int __ctsvc_ipc_marshal_number(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_number_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_person.c b/common/ipc/ctsvc_ipc_person.c index ee27770..ec720d0 100644 --- a/common/ipc/ctsvc_ipc_person.c +++ b/common/ipc/ctsvc_ipc_person.c @@ -68,9 +68,10 @@ static int __ctsvc_ipc_unmarshal_person(pims_ipc_data_h ipc_data, const char *vi return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_person() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_person(const contacts_record_h record, @@ -120,9 +121,10 @@ static int __ctsvc_ipc_marshal_person(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_person_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_phonelog.c b/common/ipc/ctsvc_ipc_phonelog.c index 5324a59..ccdc6d8 100644 --- a/common/ipc/ctsvc_ipc_phonelog.c +++ b/common/ipc/ctsvc_ipc_phonelog.c @@ -49,9 +49,10 @@ static int __ctsvc_ipc_unmarshal_phonelog(pims_ipc_data_h ipc_data, const char * return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_phonelog() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_phonelog(const contacts_record_h record, @@ -82,9 +83,10 @@ static int __ctsvc_ipc_marshal_phonelog(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_phonelog_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_profile.c b/common/ipc/ctsvc_ipc_profile.c index d5588ad..cf70683 100644 --- a/common/ipc/ctsvc_ipc_profile.c +++ b/common/ipc/ctsvc_ipc_profile.c @@ -56,9 +56,10 @@ static int __ctsvc_ipc_unmarshal_profile(pims_ipc_data_h ipc_data, const char *v return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_profile() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_profile(const contacts_record_h record, @@ -96,9 +97,10 @@ static int __ctsvc_ipc_marshal_profile(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_profile_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_relationship.c b/common/ipc/ctsvc_ipc_relationship.c index fbc1b4e..a7e1011 100644 --- a/common/ipc/ctsvc_ipc_relationship.c +++ b/common/ipc/ctsvc_ipc_relationship.c @@ -43,9 +43,10 @@ static int __ctsvc_ipc_unmarshal_relationship(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_relationship() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_relationship(const contacts_record_h record, @@ -70,9 +71,10 @@ static int __ctsvc_ipc_marshal_relationship(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_relationship_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_result.c b/common/ipc/ctsvc_ipc_result.c index de1debe..0f0b61b 100644 --- a/common/ipc/ctsvc_ipc_result.c +++ b/common/ipc/ctsvc_ipc_result.c @@ -28,38 +28,50 @@ static int __ctsvc_ipc_unmarshal_search_value(pims_ipc_data_h ipc_data, ret = ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->property_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->type); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_STR) == true) { if (ctsvc_ipc_unmarshal_string(ipc_data, &pvalue->value.s) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_string() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) { if (ctsvc_ipc_unmarshal_bool(ipc_data, &pvalue->value.b) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_bool() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) { if (ctsvc_ipc_unmarshal_int(ipc_data, &pvalue->value.i) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) { return CONTACTS_ERROR_NONE; } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) { return CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ASSERT_NOT_REACHED("invalid parameter (property:%d)", pvalue->property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -68,38 +80,50 @@ static int __ctsvc_ipc_marshal_search_value(const ctsvc_result_value_s *pvalue, pims_ipc_data_h ipc_data) { if (ctsvc_ipc_marshal_int(pvalue->property_id, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_marshal_int(pvalue->type, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_STR) == true) { if (ctsvc_ipc_marshal_string(pvalue->value.s, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_BOOL) == true) { if (ctsvc_ipc_marshal_bool(pvalue->value.b, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_INT) == true) { if (ctsvc_ipc_marshal_int(pvalue->value.i, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_DOUBLE) == true) { return CONTACTS_ERROR_NONE; } else if (CTSVC_VIEW_CHECK_DATA_TYPE(pvalue->property_id, CTSVC_VIEW_DATA_TYPE_LLI) == true) { return CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ASSERT_NOT_REACHED("invalid parameter (property:%d)", pvalue->property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -115,21 +139,28 @@ static int __ctsvc_ipc_unmarshal_result(pims_ipc_data_h ipc_data, const char *vi unsigned int count = 0; if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_unsigned_int() fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } unsigned int i = 0; for (i = 0; i < count; i++) { ctsvc_result_value_s *value_data = NULL; value_data = calloc(1, sizeof(ctsvc_result_value_s)); - if (value_data == NULL) + if (value_data == NULL) { + /* LCOV_EXCL_START */ + ERR("calloc() fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; - + /* LCOV_EXCL_STOP */ + } if (__ctsvc_ipc_unmarshal_search_value(ipc_data, value_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_search_value() Fail"); free(value_data); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } result_p->values = g_slist_append(result_p->values, value_data); } @@ -148,8 +179,10 @@ static int __ctsvc_ipc_marshal_result(const contacts_record_h record, if (result_p->values) { unsigned int count = g_slist_length(result_p->values); if (ctsvc_ipc_marshal_unsigned_int(count, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } GSList *cursor = result_p->values; @@ -160,15 +193,19 @@ static int __ctsvc_ipc_marshal_result(const contacts_record_h record, continue; } if (__ctsvc_ipc_marshal_search_value(value_data, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cursor = g_slist_next(cursor); } } else { if (ctsvc_ipc_marshal_int(0, ipc_data) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } diff --git a/common/ipc/ctsvc_ipc_sdn.c b/common/ipc/ctsvc_ipc_sdn.c index 69c24af..2559565 100644 --- a/common/ipc/ctsvc_ipc_sdn.c +++ b/common/ipc/ctsvc_ipc_sdn.c @@ -20,7 +20,8 @@ #include "ctsvc_ipc_marshal.h" #include "contacts_record.h" - +/* Can't find the SIM include SDN */ +/* LCOV_EXCL_START */ static int __ctsvc_ipc_unmarshal_sdn(pims_ipc_data_h ipc_data, const char *view_uri, contacts_record_h record) { @@ -70,6 +71,7 @@ static int __ctsvc_ipc_marshal_sdn(const contacts_record_h record, ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; } +/* LCOV_EXCL_STOP */ ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_sdn_plugin_cb = { .unmarshal_record = __ctsvc_ipc_unmarshal_sdn, diff --git a/common/ipc/ctsvc_ipc_simple_contact.c b/common/ipc/ctsvc_ipc_simple_contact.c index c1e7199..27808aa 100644 --- a/common/ipc/ctsvc_ipc_simple_contact.c +++ b/common/ipc/ctsvc_ipc_simple_contact.c @@ -60,9 +60,10 @@ static int __ctsvc_ipc_unmarshal_simple_contact(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_simple_contact() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_simple_contact(const contacts_record_h record, @@ -105,9 +106,10 @@ static int __ctsvc_ipc_marshal_simple_contact(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_simple_contact_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_sip.c b/common/ipc/ctsvc_ipc_sip.c index 9e20f17..bf2c765 100644 --- a/common/ipc/ctsvc_ipc_sip.c +++ b/common/ipc/ctsvc_ipc_sip.c @@ -46,9 +46,10 @@ static int __ctsvc_ipc_unmarshal_sip(pims_ipc_data_h ipc_data, const char* view_ return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_unmarshal fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_sip(const contacts_record_h record, pims_ipc_data_h ipc_data) @@ -66,7 +67,8 @@ static int __ctsvc_ipc_marshal_sip(const contacts_record_h record, pims_ipc_data return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } diff --git a/common/ipc/ctsvc_ipc_speeddial.c b/common/ipc/ctsvc_ipc_speeddial.c index 045d2f0..e1a2e0c 100644 --- a/common/ipc/ctsvc_ipc_speeddial.c +++ b/common/ipc/ctsvc_ipc_speeddial.c @@ -51,9 +51,10 @@ static int __ctsvc_ipc_unmarshal_speeddial(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_speeddial() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, @@ -86,9 +87,10 @@ static int __ctsvc_ipc_marshal_speeddial(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_speeddial_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_updated_info.c b/common/ipc/ctsvc_ipc_updated_info.c index 1f3cf15..ac52013 100644 --- a/common/ipc/ctsvc_ipc_updated_info.c +++ b/common/ipc/ctsvc_ipc_updated_info.c @@ -45,9 +45,10 @@ static int __ctsvc_ipc_unmarshal_updated_info(pims_ipc_data_h ipc_data, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_updated_info() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_updated_info(const contacts_record_h record, @@ -74,9 +75,10 @@ static int __ctsvc_ipc_marshal_updated_info(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_updated_info_plugin_cb = { diff --git a/common/ipc/ctsvc_ipc_url.c b/common/ipc/ctsvc_ipc_url.c index 3863ee0..e3bcdc9 100644 --- a/common/ipc/ctsvc_ipc_url.c +++ b/common/ipc/ctsvc_ipc_url.c @@ -43,9 +43,10 @@ static int __ctsvc_ipc_unmarshal_url(pims_ipc_data_h ipc_data, const char *view_ return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("__ctsvc_ipc_unmarshal_url() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_ipc_marshal_url(const contacts_record_h record, @@ -70,9 +71,10 @@ static int __ctsvc_ipc_marshal_url(const contacts_record_h record, return CONTACTS_ERROR_NONE; } while (0); - + /* LCOV_EXCL_START */ ERR("_ctsvc_ipc_marshal() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ctsvc_ipc_marshal_record_plugin_cb_s _ctsvc_ipc_record_url_plugin_cb = {