From c9f620c302f812bc7aa3c591de49ae2d0b6f587e Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Tue, 5 Jul 2016 11:24:28 +0900 Subject: [PATCH] add commnet LCOV_EXCL Change-Id: I0a7a30c22dff6f29d67c18cf92f05aaea26a5696 --- CMakeLists.txt | 2 +- client/ctsvc_client_activity.c | 4 + client/ctsvc_client_activity_helper.c | 24 + client/ctsvc_client_db_helper.c | 364 ++++++++++++++ client/ctsvc_client_db_notification.c | 8 + client/ctsvc_client_group_helper.c | 44 ++ client/ctsvc_client_handle.c | 2 + client/ctsvc_client_ipc.c | 36 ++ client/ctsvc_client_noti.c | 31 ++ client/ctsvc_client_person_helper.c | 102 ++++ client/ctsvc_client_phonelog_helper.c | 40 ++ client/ctsvc_client_service.c | 11 + client/ctsvc_client_service_helper.c | 2 + client/ctsvc_client_setting.c | 48 ++ common/ctsvc_filter.c | 26 +- common/ctsvc_handle.c | 2 + common/ctsvc_image_util.c | 40 ++ common/ctsvc_inotify.c | 18 + common/ctsvc_list.c | 6 + common/ctsvc_localize_ch.c | 4 + common/ctsvc_localize_jp.c | 14 + common/ctsvc_mutex.c | 2 + common/ctsvc_normalize.c | 52 ++ common/ctsvc_query.c | 2 + common/ctsvc_record.c | 2 + common/ctsvc_record_addressbook.c | 10 + common/ctsvc_record_contact.c | 242 +++++++++ server/ctsvc_ipc_server.c | 581 ++++++++++++++++++++++ server/ctsvc_ipc_server2.c | 304 +++++++++++ server/ctsvc_notification.c | 4 + server/ctsvc_number_utils.c | 30 ++ server/ctsvc_schema_recovery.c | 6 + server/ctsvc_server.c | 5 + server/ctsvc_server_activity.c | 4 + server/ctsvc_server_bg.c | 28 ++ server/ctsvc_server_change_subject.c | 14 + server/ctsvc_server_group.c | 28 ++ server/ctsvc_server_person.c | 138 ++++- server/ctsvc_server_phonelog.c | 14 +- server/ctsvc_server_service.c | 4 + server/ctsvc_server_sim.c | 70 +++ server/ctsvc_server_socket.c | 42 ++ server/ctsvc_server_sqlite.c | 68 +++ server/ctsvc_server_update.c | 16 + server/ctsvc_server_utils.c | 7 +- server/ctsvc_utils_string.c | 18 + server/db/ctsvc_db_access_control.c | 28 ++ server/db/ctsvc_db_init.c | 14 + server/db/ctsvc_db_plugin_activity.c | 30 ++ server/db/ctsvc_db_plugin_activity_photo.c | 30 ++ server/db/ctsvc_db_plugin_activity_photo_helper.c | 4 + server/db/ctsvc_db_plugin_address.c | 38 ++ server/db/ctsvc_db_plugin_address_helper.c | 2 + server/db/ctsvc_db_plugin_addressbook.c | 28 ++ server/db/ctsvc_db_plugin_addressbook_helper.c | 24 + server/db/ctsvc_db_plugin_company.c | 46 ++ server/db/ctsvc_db_plugin_company_helper.c | 14 + server/db/ctsvc_db_plugin_contact.c | 202 ++++++++ server/db/ctsvc_db_plugin_contact_helper.c | 114 +++++ server/db/ctsvc_db_plugin_email.c | 46 ++ server/db/ctsvc_db_plugin_email_helper.c | 2 + server/db/ctsvc_db_plugin_event.c | 46 ++ server/db/ctsvc_db_plugin_event_helper.c | 2 + server/db/ctsvc_db_plugin_extension.c | 46 ++ server/db/ctsvc_db_plugin_extension_helper.c | 2 + server/db/ctsvc_db_plugin_group.c | 48 ++ server/db/ctsvc_db_plugin_grouprelation.c | 12 + server/db/ctsvc_db_plugin_image.c | 56 +++ server/db/ctsvc_db_plugin_image_helper.c | 8 + server/db/ctsvc_db_plugin_messenger.c | 46 ++ server/db/ctsvc_db_plugin_messenger_helper.c | 2 + server/db/ctsvc_db_plugin_my_profile.c | 116 +++++ server/db/ctsvc_db_plugin_name.c | 48 ++ server/db/ctsvc_db_plugin_name_helper.c | 10 + server/db/ctsvc_db_plugin_nickname.c | 46 ++ server/db/ctsvc_db_plugin_nickname_helper.c | 2 + server/db/ctsvc_db_plugin_note.c | 46 ++ server/db/ctsvc_db_plugin_note_helper.c | 2 + server/db/ctsvc_db_plugin_number.c | 46 ++ server/db/ctsvc_db_plugin_number_helper.c | 4 + server/db/ctsvc_db_plugin_person.c | 44 ++ server/db/ctsvc_db_plugin_person_helper.c | 38 ++ server/db/ctsvc_db_plugin_phonelog.c | 24 + server/db/ctsvc_db_plugin_profile.c | 46 ++ server/db/ctsvc_db_plugin_profile_helper.c | 2 + server/db/ctsvc_db_plugin_relationship.c | 46 ++ server/db/ctsvc_db_plugin_relationship_helper.c | 2 + server/db/ctsvc_db_plugin_sdn.c | 8 + server/db/ctsvc_db_plugin_simple_contact.c | 8 + server/db/ctsvc_db_plugin_sip.c | 64 ++- server/db/ctsvc_db_plugin_sip_helper.c | 2 + server/db/ctsvc_db_plugin_speeddial.c | 28 ++ server/db/ctsvc_db_plugin_url.c | 46 ++ server/db/ctsvc_db_query.c | 462 +++++++++++------ server/db/ctsvc_db_sqlite.c | 40 ++ server/db/ctsvc_db_utils.c | 60 ++- 96 files changed, 4463 insertions(+), 186 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55b8ee4..3996e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ INCLUDE(FindPkgConfig) EXECUTE_PROCESS(COMMAND build-util/generator.sh) -SET(EXTRA_CFLAGS "-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections") +SET(EXTRA_CFLAGS "-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections ") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror-implicit-function-declaration ") #SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") #SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -march=armv7-a -msoft-float -O2") diff --git a/client/ctsvc_client_activity.c b/client/ctsvc_client_activity.c index 68f2f3c..68bd2dd 100644 --- a/client/ctsvc_client_activity.c +++ b/client/ctsvc_client_activity.c @@ -29,8 +29,10 @@ API int contacts_activity_delete_by_contact_id(int contact_id) ret = ctsvc_client_handle_get_p(&contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_get_p() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_client_activity_delete_by_contact_id(contact, contact_id); @@ -45,8 +47,10 @@ API int contacts_activity_delete_by_account_id(int account_id) ret = ctsvc_client_handle_get_p(&contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_get_p() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_client_activity_delete_by_account_id(contact, account_id); diff --git a/client/ctsvc_client_activity_helper.c b/client/ctsvc_client_activity_helper.c index 0d8db3f..35b68c9 100644 --- a/client/ctsvc_client_activity_helper.c +++ b/client/ctsvc_client_activity_helper.c @@ -44,31 +44,39 @@ int ctsvc_client_activity_delete_by_contact_id(contacts_h contact, int contact_i /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(contact_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ ret = ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_CONTACT_ID, indata, &outdata); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail(%d)", ret); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); @@ -78,15 +86,19 @@ int ctsvc_client_activity_delete_by_contact_id(contacts_h contact, int contact_i /* check result */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -109,31 +121,39 @@ int ctsvc_client_activity_delete_by_account_id(contacts_h contact, int account_i /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(account_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ ret = ctsvc_ipc_call(CTSVC_IPC_ACTIVITY_MODULE, CTSVC_IPC_SERVER_ACTIVITY_DELETE_BY_ACCOUNT_ID, indata, &outdata); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail(%d)", ret); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); @@ -141,16 +161,20 @@ int ctsvc_client_activity_delete_by_account_id(contacts_h contact, int account_i if (outdata) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } diff --git a/client/ctsvc_client_db_helper.c b/client/ctsvc_client_db_helper.c index 0bf9307..044c56e 100644 --- a/client/ctsvc_client_db_helper.c +++ b/client/ctsvc_client_db_helper.c @@ -53,54 +53,68 @@ int ctsvc_client_db_insert_record(contacts_h contact, contacts_record_h record, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_record(record, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_INSERT_RECORD, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); if (id) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, id)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } } @@ -125,50 +139,64 @@ int ctsvc_client_db_get_record(contacts_h contact, const char *view_uri, int id, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_RECORD, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(outdata, out_record)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -188,46 +216,58 @@ int ctsvc_client_db_update_record(contacts_h contact, contacts_record_h record) /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_record(record, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_UPDATE_RECORD, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record); int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -248,51 +288,65 @@ int ctsvc_client_db_delete_record(contacts_h contact, const char *view_uri, int /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_DELETE_RECORD, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -315,52 +369,66 @@ int ctsvc_client_db_replace_record(contacts_h contact, contacts_record_h record, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_record(record, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_record() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_REPLACE_RECORD, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -384,57 +452,73 @@ int ctsvc_client_db_get_all_records(contacts_h contact, const char *view_uri, in /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_ALL_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -456,57 +540,73 @@ int ctsvc_client_db_get_records_with_query(contacts_h contact, contacts_query_h /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_query(query, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_RECORDS_WITH_QUERY, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -531,45 +631,57 @@ int ctsvc_client_db_get_count(contacts_h contact, const char *view_uri, int *out /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_COUNT, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, out_count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -593,45 +705,57 @@ int ctsvc_client_db_get_count_with_query(contacts_h contact, contacts_query_h qu /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_query(query, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_COUNT_WITH_QUERY, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, out_count)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -656,46 +780,58 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_list(list, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_INSERT_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); @@ -705,23 +841,29 @@ int ctsvc_client_db_insert_records(contacts_h contact, contacts_list_h list, int int c; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &c)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } id = calloc(c, sizeof(int)); if (NULL == id) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } for (i = 0; i < c; i++) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &(id[i]))) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); free(id); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } *ids = id; @@ -745,46 +887,58 @@ int ctsvc_client_db_update_records(contacts_h contact, contacts_list_h list) indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_list(list, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_UPDATE_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -807,62 +961,78 @@ int ctsvc_client_db_delete_records(contacts_h contact, const char *view_uri, int indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(count, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { ret = ctsvc_ipc_marshal_int(ids[i], indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } } if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_DELETE_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -888,61 +1058,77 @@ int ctsvc_client_db_replace_records(contacts_h contact, contacts_list_h list, in /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_list(list, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(count, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { ret = ctsvc_ipc_marshal_int(ids[i], indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } } if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_REPLACE_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -968,62 +1154,80 @@ int ctsvc_client_db_get_changes_by_version(contacts_h contact, const char *view_ /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(addressbook_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(contacts_db_version, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_CHANGES_BY_VERSION, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, record_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, current_contacts_db_version)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -1046,38 +1250,48 @@ int ctsvc_client_db_get_current_version(contacts_h contact, int *contacts_db_ver /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_CURRENT_VERSION, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, contacts_db_version)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -1107,82 +1321,106 @@ int ctsvc_client_db_search_records_for_snippet(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(start_match ? start_match : CTSVC_DEFAULT_START_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(end_match ? end_match : CTSVC_DEFAULT_END_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(token_number, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_FOR_SNIPPET, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -1214,86 +1452,112 @@ int ctsvc_client_db_search_records_with_range_for_snippet(contacts_h contact, indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(range, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(start_match ? start_match : CTSVC_DEFAULT_START_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(end_match ? end_match : CTSVC_DEFAULT_END_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(token_number, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (0 != ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_RANGE_FOR_SNIPPET, indata, &outdata)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -1324,81 +1588,105 @@ int ctsvc_client_db_search_records_with_query_for_snippet(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_query(query, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(start_match ? start_match : CTSVC_DEFAULT_START_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(end_match ? end_match : CTSVC_DEFAULT_END_MATCH, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(token_number, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_QUERY_FOR_SNIPPET, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -1422,62 +1710,80 @@ int ctsvc_client_db_search_records(contacts_h contact, const char *view_uri, con /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -1501,66 +1807,86 @@ int ctsvc_client_db_search_records_with_range(contacts_h contact, const char *vi indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(view_uri, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(range, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (0 != ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_RANGE, indata, &outdata)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -1584,61 +1910,79 @@ int ctsvc_client_db_search_records_with_query(contacts_h contact, contacts_query /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_query(query, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_query() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_string(keyword, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(offset, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_SEARCH_RECORDS_WITH_QUERY, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_list(outdata, out_list)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -1682,6 +2026,7 @@ static void __ctsvc_client_db_free_cb_info(status_callback_info_s *cb_info) free(cb_info); } +/* LCOV_EXCL_START */ static void __ctsvc_db_status_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data) { @@ -1701,6 +2046,7 @@ static void __ctsvc_db_status_subscriber_callback(pims_ipc_h ipc, pims_ipc_data_ cb_info->cb(status, cb_info->user_data); } } +/* LCOV_EXCL_STOP */ int ctsvc_client_db_get_status(contacts_h contact, contacts_db_status_e *status) { @@ -1715,35 +2061,45 @@ int ctsvc_client_db_get_status(contacts_h contact, contacts_db_status_e *status) /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_DB_MODULE, CTSVC_IPC_SERVER_DB_GET_STATUS, indata, &outdata) != 0) { pims_ipc_data_destroy(indata); + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int*)status)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -1763,8 +2119,10 @@ int ctsvc_client_db_add_status_changed_cb(contacts_h contact, ret = ctsvc_ipc_create_for_change_subscription(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); @@ -1772,16 +2130,20 @@ int ctsvc_client_db_add_status_changed_cb(contacts_h contact, if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(), CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_IPC_SERVER_DB_STATUS_CHANGED, __ctsvc_db_status_subscriber_callback, NULL) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_subscribe error\n"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } cb_info = calloc(1, sizeof(status_callback_info_s)); if (NULL == cb_info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } cb_info->user_data = user_data; cb_info->cb = cb; @@ -1802,8 +2164,10 @@ int ctsvc_client_db_remove_status_changed_cb(contacts_h contact, ret = ctsvc_ipc_destroy_for_change_subscription(false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); diff --git a/client/ctsvc_client_db_notification.c b/client/ctsvc_client_db_notification.c index 18b0dc2..bcecd90 100644 --- a/client/ctsvc_client_db_notification.c +++ b/client/ctsvc_client_db_notification.c @@ -56,8 +56,10 @@ static int _client_noti_check_read_permission(const char *view_uri) || STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_SIP, strlen(CTSVC_VIEW_URI_SIP))) { ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, @@ -65,8 +67,10 @@ static int _client_noti_check_read_permission(const char *view_uri) } else if (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PHONELOG, strlen(CTSVC_VIEW_URI_PHONELOG))) { ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_PHONELOG_READ, &result); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, @@ -90,8 +94,10 @@ API int contacts_db_add_changed_cb(const char *view_uri, contacts_db_changed_cb ret = ctsvc_inotify_subscribe(view_uri, cb, user_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_subscribe(%s) Fail(%d)", view_uri, ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -107,8 +113,10 @@ API int contacts_db_remove_changed_cb(const char *view_uri, contacts_db_changed_ ret = ctsvc_inotify_unsubscribe(view_uri, cb, user_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_unsubscribe(%s) Fail(%d)", view_uri, ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; diff --git a/client/ctsvc_client_group_helper.c b/client/ctsvc_client_group_helper.c index c2101f7..bd97121 100644 --- a/client/ctsvc_client_group_helper.c +++ b/client/ctsvc_client_group_helper.c @@ -43,52 +43,66 @@ int ctsvc_client_group_add_contact(contacts_h contact, int group_id, int contact /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(group_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(contact_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_ADD_CONTACT, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -112,53 +126,67 @@ int ctsvc_client_group_remove_contact(contacts_h contact, int group_id, int cont /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(group_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(contact_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_REMOVE_CONTACT, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -182,58 +210,74 @@ int ctsvc_client_group_set_group_order(contacts_h contact, int group_id, int pre /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(group_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(previous_group_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(next_group_id, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_GROUP_MODULE, CTSVC_IPC_SERVER_GROUP_SET_GROUP_ORDER, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } diff --git a/client/ctsvc_client_handle.c b/client/ctsvc_client_handle.c index 032b0da..aa9d878 100644 --- a/client/ctsvc_client_handle.c +++ b/client/ctsvc_client_handle.c @@ -54,8 +54,10 @@ int ctsvc_client_handle_get_p_with_id(unsigned int id, contacts_h *p_contact) ctsvc_mutex_unlock(CTS_MUTEX_HANDLE); if (NULL == contact) { + /* LCOV_EXCL_START */ ERR("g_hash_table_lookup() Fail. key[%s]", key); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } *p_contact = contact; diff --git a/client/ctsvc_client_ipc.c b/client/ctsvc_client_ipc.c index b2eac42..8d78188 100644 --- a/client/ctsvc_client_ipc.c +++ b/client/ctsvc_client_ipc.c @@ -69,6 +69,7 @@ static pims_ipc_h _ctsvc_get_ipc_handle() return ipc_data->ipc; } +/* LCOV_EXCL_START */ bool ctsvc_ipc_is_busy() { bool ret = false; @@ -85,6 +86,7 @@ bool ctsvc_ipc_is_busy() return ret; } +/* LCOV_EXCL_STOP */ static int _ctsvc_ipc_create(pims_ipc_h *p_ipc) { @@ -94,6 +96,7 @@ static int _ctsvc_ipc_create(pims_ipc_h *p_ipc) CTSVC_IPC_SERVICE); pims_ipc_h ipc = pims_ipc_create(sock_file); if (NULL == ipc) { + /* LCOV_EXCL_START */ if (errno == EACCES) { ERR("pims_ipc_create() Fail(%d)", CONTACTS_ERROR_PERMISSION_DENIED); return CONTACTS_ERROR_PERMISSION_DENIED; @@ -101,6 +104,7 @@ static int _ctsvc_ipc_create(pims_ipc_h *p_ipc) ERR("pims_ipc_create() Fail(%d)", CONTACTS_ERROR_IPC_NOT_AVALIABLE); return CONTACTS_ERROR_IPC_NOT_AVALIABLE; } + /* LCOV_EXCL_STOP */ } *p_ipc = ipc; @@ -132,24 +136,30 @@ static int _ctsvc_ipc_connect(contacts_h contact, pims_ipc_h ipc) /* Access control : put cookie to indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() return NULL"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ ret = pims_ipc_call(ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CONNECT, indata, &outdata); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("pims_ipc_call() Fail(%d)", ret); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); @@ -162,10 +172,12 @@ static int _ctsvc_ipc_connect(contacts_h contact, pims_ipc_h ipc) return ret; } +/* LCOV_EXCL_START */ static void _ctsvc_ipc_disconnected_cb(void *user_data) { ctsvc_ipc_set_disconnected(true); } +/* LCOV_EXCL_STOP */ int ctsvc_ipc_connect(contacts_h contact, unsigned int handle_id) { @@ -185,8 +197,10 @@ int ctsvc_ipc_connect(contacts_h contact, unsigned int handle_id) if (NULL == ipc_data) { ipc_data = calloc(1, sizeof(struct ctsvc_ipc_s)); if (NULL == ipc_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = _ctsvc_ipc_create(&(ipc_data->ipc)); if (CONTACTS_ERROR_NONE != ret) { @@ -220,23 +234,29 @@ int ctsvc_ipc_disconnect(contacts_h contact, unsigned int handle_id, indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = pims_ipc_call(ipc_data->ipc, CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_DISCONNECT, indata, &outdata); if (0 != ret) { pims_ipc_data_destroy(indata); + /* LCOV_EXCL_START */ ERR("pims_ipc_call() Fail(%d)", ret); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); @@ -245,15 +265,19 @@ int ctsvc_ipc_disconnect(contacts_h contact, unsigned int handle_id, pims_ipc_data_destroy(outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } if (1 == connection_count) g_hash_table_remove(_ctsvc_ipc_table, ipc_key); } else { + /* LCOV_EXCL_START */ ERR("pims_ipc_call out data is NULL"); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return ret; @@ -320,39 +344,49 @@ int ctsvc_ipc_client_check_permission(int permission, bool *result) indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(permission, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_call(CTSVC_IPC_MODULE, CTSVC_IPC_SERVER_CHECK_PERMISSION, indata, &outdata); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail(%d)", ret); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret && result) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(outdata, result)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_bool() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -361,6 +395,7 @@ int ctsvc_ipc_client_check_permission(int permission, bool *result) return ret; } +/* LCOV_EXCL_START */ int ctsvc_ipc_set_disconnected_cb(pims_ipc_h ipc, void (*cb)(void *), void *user_data) { return pims_ipc_add_server_disconnected_cb(ipc, cb, user_data); @@ -411,4 +446,5 @@ void ctsvc_ipc_recovery() CTS_FN_CALL; g_hash_table_foreach(_ctsvc_ipc_table, _ctsvc_ipc_recovery_foreach_cb, NULL); } +/* LCOV_EXCL_STOP */ diff --git a/client/ctsvc_client_noti.c b/client/ctsvc_client_noti.c index debbeaf..9ef7d4b 100644 --- a/client/ctsvc_client_noti.c +++ b/client/ctsvc_client_noti.c @@ -46,6 +46,7 @@ static int __ipc_pubsub_ref = 0; static pims_ipc_h __ipc = NULL; static GSList *__db_change_subscribe_list = NULL; +/* LCOV_EXCL_START */ static void _cnoti_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data) { @@ -59,9 +60,11 @@ static void _cnoti_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, } if (NULL == str) { + /* LCOV_EXCL_START */ ERR("There is no changed data"); free(str); return; + /* LCOV_EXCL_STOP */ } if (info) { @@ -75,6 +78,7 @@ static void _cnoti_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, free(str); } +/* LCOV_EXCL_START */ int _cnoti_recover_for_change_subscription() { GSList *it = NULL; @@ -96,6 +100,7 @@ int _cnoti_recover_for_change_subscription() return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_STOP */ /* This API should be called in CTS_MUTEX_PIMS_IPC_PUBSUB mutex */ @@ -120,9 +125,11 @@ int ctsvc_ipc_create_for_change_subscription() getuid(), CTSVC_IPC_SERVICE); __ipc = pims_ipc_create_for_subscribe(sock_file); if (NULL == __ipc) { + /* LCOV_EXCL_START */ ERR("pims_ipc_create_for_subscribe() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } __ipc_pubsub_ref++; @@ -130,6 +137,7 @@ int ctsvc_ipc_create_for_change_subscription() return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_START */ int ctsvc_ipc_recover_for_change_subscription() { int ret; @@ -165,6 +173,7 @@ int ctsvc_ipc_recover_for_change_subscription() ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect) { @@ -185,10 +194,12 @@ int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect) } else if (1 < __ipc_pubsub_ref) { DBG("ctsvc pubsub ipc ref count : %d", __ipc_pubsub_ref); } else { + /* LCOV_EXCL_START */ DBG("System : please call connection APIs, connection count is (%d)", __ipc_pubsub_ref); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } __ipc_pubsub_ref--; @@ -212,8 +223,10 @@ API int contacts_db_add_changed_cb_with_info(const char *view_uri, if (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PHONELOG, strlen(CTSVC_VIEW_URI_PHONELOG))) { ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_PHONELOG_READ, &result); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, @@ -221,22 +234,28 @@ API int contacts_db_add_changed_cb_with_info(const char *view_uri, } else if (STRING_EQUAL == strncmp(view_uri, CTSVC_VIEW_URI_PERSON, strlen(CTSVC_VIEW_URI_PERSON))) { ret = ctsvc_ipc_client_check_permission(CTSVC_PERMISSION_CONTACT_READ, &result); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_client_check_permission() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)"); } else { + /* LCOV_EXCL_START */ ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON, CTSVC_VIEW_URI_PHONELOG); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_create_for_change_subscription(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); @@ -254,17 +273,21 @@ API int contacts_db_add_changed_cb_with_info(const char *view_uri, if (NULL == info) { info = calloc(1, sizeof(subscribe_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (pims_ipc_subscribe(__ipc, CTSVC_IPC_SUBSCRIBE_MODULE, (char*)view_uri, _cnoti_subscribe_cb, (void*)info) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_subscribe() Fail"); free(info); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } info->view_uri = strdup(view_uri); __db_change_subscribe_list = g_slist_append(__db_change_subscribe_list, info); @@ -273,18 +296,22 @@ API int contacts_db_add_changed_cb_with_info(const char *view_uri, for (l = info->callbacks; l; l = l->next) { db_callback_info_s *cb_info = l->data; if (cb_info->cb == cb && cb_info->user_data == user_data) { + /* LCOV_EXCL_START */ ERR("The same callback(%s) is already exist", view_uri); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } cb_info = calloc(1, sizeof(db_callback_info_s)); if (NULL == cb_info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } cb_info->user_data = user_data; cb_info->cb = cb; @@ -306,15 +333,19 @@ API int contacts_db_remove_changed_cb_with_info(const char *view_uri, if (STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PHONELOG) && STRING_EQUAL != strcmp(view_uri, CTSVC_VIEW_URI_PERSON)) { + /* LCOV_EXCL_START */ ERR("We support this API for only %s and %s", CTSVC_VIEW_URI_PERSON, CTSVC_VIEW_URI_PHONELOG); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_destroy_for_change_subscription(false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); diff --git a/client/ctsvc_client_person_helper.c b/client/ctsvc_client_person_helper.c index 88ff1b2..f124e81 100644 --- a/client/ctsvc_client_person_helper.c +++ b/client/ctsvc_client_person_helper.c @@ -43,14 +43,18 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } bool success = false; @@ -64,9 +68,11 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int } while (0); if (success == false) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } /* @@ -85,26 +91,32 @@ int ctsvc_client_person_link_person(contacts_h contact, int base_person_id, int /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_LINK_PERSON, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -133,62 +145,78 @@ int ctsvc_client_person_unlink_contact(contacts_h contact, int person_id, int co /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(contact_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_UNLINK_CONTACT, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); if (unlinked_person_id) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, unlinked_person_id)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } } @@ -213,54 +241,68 @@ int ctsvc_client_person_reset_usage(contacts_h contact, int person_id, /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int((int)type, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_RESET_USAGE, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -286,60 +328,76 @@ int ctsvc_client_person_set_favorite_order(contacts_h contact, int person_id, /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(previous_person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(next_person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ ret = ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_SET_FAVORITE_ORDER, indata, &outdata); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -366,58 +424,74 @@ int ctsvc_client_person_set_default_property(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_unsigned_int(property, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_unsigned_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_SET_DEFAULT_PROPERTY, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -443,52 +517,66 @@ int ctsvc_client_person_get_default_property(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_unsigned_int(property, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_unsigned_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PERSON_MODULE, CTSVC_IPC_SERVER_PERSON_GET_DEFAULT_PROPERTY, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE && id) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, id)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -512,29 +600,37 @@ int ctsvc_client_person_get_aggregation_suggestions(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(person_id, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(limit, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ @@ -542,24 +638,30 @@ int ctsvc_client_person_get_aggregation_suggestions(contacts_h contact, indata, &outdata); pims_ipc_data_destroy(indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail(%d)", ret); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (outdata) { ret = ctsvc_ipc_unmarshal_int(outdata, &ret_val); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret_val) { ret = ctsvc_ipc_unmarshal_list(outdata, out_list); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list() Fail(%d)"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); diff --git a/client/ctsvc_client_phonelog_helper.c b/client/ctsvc_client_phonelog_helper.c index 8c718cd..9d64fdb 100644 --- a/client/ctsvc_client_phonelog_helper.c +++ b/client/ctsvc_client_phonelog_helper.c @@ -47,40 +47,50 @@ int ctsvc_client_phone_log_reset_statistics(contacts_h contact) /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_RESET_STATISTICS, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -110,49 +120,61 @@ int ctsvc_client_phone_log_reset_statistics_by_sim(contacts_h contact, /* make indata */ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(sim_slot_no, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } /* ipc call */ if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_RESET_STATISTICS_BY_SIM, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } @@ -181,22 +203,28 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_ indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_handle(contact, indata); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_handle() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(op, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int fail"); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } switch (op) { @@ -208,9 +236,11 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_ } ret = ctsvc_ipc_marshal_string(number, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string fail"); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } break; case CONTACTS_PHONE_LOG_DELETE_BY_MESSAGE_EXTRA_DATA1: @@ -218,38 +248,48 @@ int ctsvc_client_phone_log_delete(contacts_h contact, contacts_phone_log_delete_ extra_data1 = va_arg(args, int); ret = ctsvc_ipc_marshal_int(extra_data1, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int fail"); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } break; default: + /* LCOV_EXCL_START */ ERR("operation is not proper (%d)", ret); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_PHONELOG_MODULE, CTSVC_IPC_SERVER_PHONELOG_DELETE, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call() Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = 0; if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &transaction_ver)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ctsvc_client_ipc_set_change_version(contact, transaction_ver); } diff --git a/client/ctsvc_client_service.c b/client/ctsvc_client_service.c index ab2ad21..f92dea5 100644 --- a/client/ctsvc_client_service.c +++ b/client/ctsvc_client_service.c @@ -35,14 +35,18 @@ API int contacts_connect_with_flags(unsigned int flags) if (CONTACTS_ERROR_NO_DATA == ret) { ret = ctsvc_client_handle_create(id, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_create() Fail(%d)", ret); if (CONTACTS_ERROR_INVALID_PARAMETER == ret) return CONTACTS_ERROR_INTERNAL; return ret; + /* LCOV_EXCL_STOP */ } } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_client_connect_with_flags(contact, flags); @@ -64,14 +68,18 @@ API int contacts_connect(void) if (CONTACTS_ERROR_NO_DATA == ret) { ret = ctsvc_client_handle_create(id, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_create() Fail(%d)", ret); if (CONTACTS_ERROR_INVALID_PARAMETER == ret) return CONTACTS_ERROR_INTERNAL; return ret; + /* LCOV_EXCL_STOP */ } } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_client_connect(contact); if ((CONTACTS_ERROR_IPC_NOT_AVALIABLE == ret) @@ -111,14 +119,17 @@ API int contacts_connect_on_thread(void) if (CONTACTS_ERROR_NO_DATA == ret) { ret = ctsvc_client_handle_create(id, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_create() Fail(%d)", ret); if (CONTACTS_ERROR_INVALID_PARAMETER == ret) return CONTACTS_ERROR_INTERNAL; return ret; } } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_client_connect_on_thread(contact); diff --git a/client/ctsvc_client_service_helper.c b/client/ctsvc_client_service_helper.c index 4cc18ba..0c24ae7 100644 --- a/client/ctsvc_client_service_helper.c +++ b/client/ctsvc_client_service_helper.c @@ -72,6 +72,7 @@ int ctsvc_client_connect_with_flags(contacts_h contact, unsigned int flags) return ret; } +/* LCOV_EXCL_START */ static void _ctsvc_ipc_initialized_cb(void *user_data) { CTS_FN_CALL; @@ -81,6 +82,7 @@ static void _ctsvc_ipc_initialized_cb(void *user_data) ctsvc_ipc_recover_for_change_subscription(); } } +/* LCOV_EXCL_STOP */ int ctsvc_client_connect(contacts_h contact) { diff --git a/client/ctsvc_client_setting.c b/client/ctsvc_client_setting.c index 3ad2eaa..e37e21d 100644 --- a/client/ctsvc_client_setting.c +++ b/client/ctsvc_client_setting.c @@ -86,21 +86,27 @@ API int contacts_setting_get_name_sorting_order( if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_GET_NAME_SORTING_ORDER, NULL, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call Fail"); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, (int*)name_sorting_order)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } pims_ipc_data_destroy(outdata); @@ -123,30 +129,38 @@ API int contacts_setting_set_name_display_order( indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(name_display_order, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_DISPLAY_ORDER, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(outdata); } @@ -168,30 +182,38 @@ API int contacts_setting_set_name_sorting_order( indata = pims_ipc_data_create(0); if (indata == NULL) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(name_sorint_order, indata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail(%d)", ret); pims_ipc_data_destroy(indata); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_call(CTSVC_IPC_SETTING_MODULE, CTSVC_IPC_SERVER_SETTING_SET_NAME_SORTING_ORDER, indata, &outdata) != 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_call Fail"); pims_ipc_data_destroy(indata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); if (outdata) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(outdata, &ret)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); pims_ipc_data_destroy(outdata); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(outdata); } @@ -199,6 +221,7 @@ API int contacts_setting_set_name_sorting_order( return ret; } +/* LCOV_EXCL_START */ static void _csetting_name_display_order_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data) { @@ -218,7 +241,9 @@ static void _csetting_name_display_order_subscribe_cb(pims_ipc_h ipc, } } } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ static void _csetting_name_sorting_order_subscribe_cb(pims_ipc_h ipc, pims_ipc_data_h data, void *user_data) { @@ -239,7 +264,9 @@ static void _csetting_name_sorting_order_subscribe_cb(pims_ipc_h ipc, } } } +/* LCOV_EXCL_STOP */ +/* LCOV_EXCL_START */ int ctsvc_setting_recover_for_change_subscription() { GSList *it; @@ -263,8 +290,10 @@ int ctsvc_setting_recover_for_change_subscription() if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(), CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_SETTING_SORTING_ORDER_CHANGED, _csetting_name_sorting_order_subscribe_cb, NULL) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_subscribe() Fail"); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } break; } @@ -272,6 +301,7 @@ int ctsvc_setting_recover_for_change_subscription() return CONTACTS_ERROR_NONE; } +/* LCOV_EXCL_STOP */ API int contacts_setting_add_name_display_order_changed_cb( contacts_setting_name_display_order_changed_cb cb, void *user_data) @@ -289,8 +319,10 @@ API int contacts_setting_add_name_display_order_changed_cb( ret = ctsvc_ipc_create_for_change_subscription(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); @@ -299,9 +331,11 @@ API int contacts_setting_add_name_display_order_changed_cb( if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(), CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_SETTING_DISPLAY_ORDER_CHANGED, _csetting_name_display_order_subscribe_cb, NULL) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_subscribe() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } @@ -316,9 +350,11 @@ API int contacts_setting_add_name_display_order_changed_cb( cb_info = calloc(1, sizeof(ctsvc_name_display_order_changed_cb_info_s)); if (NULL == cb_info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } cb_info->user_data = user_data; cb_info->cb = cb; @@ -337,8 +373,10 @@ API int contacts_setting_remove_name_display_order_changed_cb( ret = ctsvc_ipc_destroy_for_change_subscription(false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); @@ -381,8 +419,10 @@ API int contacts_setting_add_name_sorting_order_changed_cb( ret = ctsvc_ipc_create_for_change_subscription(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); @@ -391,26 +431,32 @@ API int contacts_setting_add_name_sorting_order_changed_cb( if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(), CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_SETTING_SORTING_ORDER_CHANGED, _csetting_name_sorting_order_subscribe_cb, NULL) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_subscribe() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_IPC; + /* LCOV_EXCL_STOP */ } } for (l = __setting_name_sorting_order_subscribe_list; l; l = l->next) { ctsvc_name_sorting_order_changed_cb_info_s *cb_info = l->data; if (cb_info->cb == cb && cb_info->user_data == user_data) { + /* LCOV_EXCL_START */ ERR("The same callback(%x) is already exist", cb); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } cb_info = calloc(1, sizeof(ctsvc_name_sorting_order_changed_cb_info_s)); if (NULL == cb_info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } cb_info->user_data = user_data; cb_info->cb = cb; @@ -428,8 +474,10 @@ API int contacts_setting_remove_name_sorting_order_changed_cb( ret = ctsvc_ipc_destroy_for_change_subscription(false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB); diff --git a/common/ctsvc_filter.c b/common/ctsvc_filter.c index ab6e587..6545337 100644 --- a/common/ctsvc_filter.c +++ b/common/ctsvc_filter.c @@ -120,34 +120,46 @@ static int _filter_create_attribute(ctsvc_composite_filter_s *com_filter, "property_id(%d) is not supported on view_uri(%s)", property_id, com_filter->view_uri); if (type == CTSVC_VIEW_DATA_TYPE_INT && CTSVC_FILTER_INT != filter_type) { - ERR("use contacts_filter_add_int() (%d)", filter_type); + /* LCOV_EXCL_START */ + ERR("use contacts_filter_add_int() (%d)", filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (type == CTSVC_VIEW_DATA_TYPE_STR && CTSVC_FILTER_STR != filter_type) { - ERR("use contacts_filter_add_str() (%d)", filter_type); + /* LCOV_EXCL_START */ + ERR("use contacts_filter_add_str() (%d)", filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (type == CTSVC_VIEW_DATA_TYPE_BOOL && CTSVC_FILTER_BOOL != filter_type) { - ERR("use contacts_filter_add_bool() (%d)", filter_type); + /* LCOV_EXCL_START */ + ERR("use contacts_filter_add_bool() (%d)", filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (type == CTSVC_VIEW_DATA_TYPE_LLI && CTSVC_FILTER_LLI != filter_type) { - ERR("use contacts_filter_add_lli() (%d)", filter_type); + /* LCOV_EXCL_START */ + ERR("use contacts_filter_add_lli() (%d)", filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE && CTSVC_FILTER_DOUBLE != filter_type) { - ERR("use contacts_filter_add_double() (%d)", filter_type); + /* LCOV_EXCL_START */ + ERR("use contacts_filter_add_double() (%d)", filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } filter = calloc(1, sizeof(ctsvc_attribute_filter_s)); if (NULL == filter) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } filter->filter_type = filter_type; filter->property_id = property_id; @@ -309,8 +321,10 @@ static int __ctsvc_attribute_filter_clone(ctsvc_attribute_filter_s *src, ctsvc_attribute_filter_s *out; out = calloc(1, sizeof(ctsvc_attribute_filter_s)); if (NULL == out) { - ERR("calloc() Fail"); + /* LCOV_EXCL_START */ + ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } out->filter_type = src->filter_type; out->property_id = src->property_id; diff --git a/common/ctsvc_handle.c b/common/ctsvc_handle.c index 1926a58..7377cfa 100644 --- a/common/ctsvc_handle.c +++ b/common/ctsvc_handle.c @@ -25,8 +25,10 @@ int ctsvc_handle_create(contacts_h *contact) RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER); ctsvc_base_s *base = calloc(1, sizeof(ctsvc_base_s)); if (NULL == base) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *contact = (contacts_h)base; return CONTACTS_ERROR_NONE; diff --git a/common/ctsvc_image_util.c b/common/ctsvc_image_util.c index 58cfe04..8c0ed70 100644 --- a/common/ctsvc_image_util.c +++ b/common/ctsvc_image_util.c @@ -71,8 +71,10 @@ int ctsvc_image_util_get_mimetype(image_util_colorspace_e colorspace, case IMAGE_UTIL_COLORSPACE_YV12: /* not supported */ case IMAGE_UTIL_COLORSPACE_I420: /* not supported */ default: + /* LCOV_EXCL_START */ ERR("Not supported %d", colorspace); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *p_mimetype = mimetype; return CONTACTS_ERROR_NONE; @@ -86,43 +88,55 @@ media_format_h ctsvc_image_util_create_media_format(int mimetype, int width, ret = media_format_create(&fmt); if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_create() Fail(%d)", ret); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_format_set_video_mime(fmt, mimetype); if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_set_video_mime() Fail(%d)", ret); media_format_unref(fmt); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_format_set_video_width(fmt, width); if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_set_video_width() Fail(%d)", ret); media_format_unref(fmt); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_format_set_video_height(fmt, height); if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_set_video_height() Fail(%d)", ret); media_format_unref(fmt); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_format_set_video_avg_bps(fmt, 2000000); /* image_util guide */ if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_set_video_avg_bps() Fail(%d)", ret); media_format_unref(fmt); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_format_set_video_max_bps(fmt, 15000000); /* image_util guide */ if (MEDIA_FORMAT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_format_set_video_max_bps() Fail(%d)", ret); media_format_unref(fmt); return NULL; + /* LCOV_EXCL_STOP */ } return fmt; @@ -148,22 +162,28 @@ media_packet_h ctsvc_image_util_create_media_packet(media_format_h fmt, ret = media_packet_create_alloc(fmt, _ctsvc_image_packet_create_alloc_finalize_cb, NULL, &packet); if (MEDIA_PACKET_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_packet_create_alloc() Fail(%d)", ret); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_packet_get_buffer_size(packet, &mp_buffer_size); if (MEDIA_PACKET_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_packet_get_buffer_size() Fail(%d)", ret); media_packet_destroy(packet); return NULL; + /* LCOV_EXCL_STOP */ } ret = media_packet_get_buffer_data_ptr(packet, &mp_buffer); if (MEDIA_PACKET_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret); media_packet_destroy(packet); return NULL; + /* LCOV_EXCL_STOP */ } if (mp_buffer) @@ -190,6 +210,7 @@ static void _image_transform_completed_cb(media_packet_h *dst, if (IMAGE_UTIL_ERROR_NONE == error) { ret = media_packet_get_buffer_size(*dst, &size); if (MEDIA_PACKET_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_packet_get_buffer_size() Fail(%d)", ret); info->ret = CONTACTS_ERROR_SYSTEM; media_packet_destroy(*dst); @@ -197,10 +218,12 @@ static void _image_transform_completed_cb(media_packet_h *dst, g_cond_signal(&info->cond); g_mutex_unlock(&info->mutex); return; + /* LCOV_EXCL_STOP */ } ret = media_packet_get_buffer_data_ptr(*dst, &buffer); if (MEDIA_PACKET_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("media_packet_get_buffer_data_ptr() Fail(%d)", ret); info->ret = CONTACTS_ERROR_SYSTEM; media_packet_destroy(*dst); @@ -208,10 +231,12 @@ static void _image_transform_completed_cb(media_packet_h *dst, g_cond_signal(&info->cond); g_mutex_unlock(&info->mutex); return; + /* LCOV_EXCL_STOP */ } info->buffer = calloc(1, (size_t)size); if (NULL == info->buffer) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); info->ret = CONTACTS_ERROR_SYSTEM; media_packet_destroy(*dst); @@ -219,6 +244,7 @@ static void _image_transform_completed_cb(media_packet_h *dst, g_cond_signal(&info->cond); g_mutex_unlock(&info->mutex); return; + /* LCOV_EXCL_STOP */ } memcpy(info->buffer, buffer, (size_t)size); info->size = size; @@ -245,8 +271,10 @@ static int _ctsvc_image_util_transform_run(transformation_h transform, info = calloc(1, sizeof(struct image_transform)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } g_cond_init(&info->cond); @@ -255,11 +283,13 @@ static int _ctsvc_image_util_transform_run(transformation_h transform, g_mutex_lock(&info->mutex); ret = image_util_transform_run(transform, packet, _image_transform_completed_cb, info); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_run() Fail(%d)", ret); g_mutex_unlock(&info->mutex); g_mutex_clear(&info->mutex); g_cond_clear(&info->cond); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } end_time = g_get_monotonic_time() + 4000 * G_TIME_SPAN_MILLISECOND; @@ -273,10 +303,12 @@ static int _ctsvc_image_util_transform_run(transformation_h transform, g_cond_clear(&info->cond); if (CONTACTS_ERROR_NONE != info->ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_run() Fail(%d)", info->ret); free(info->buffer); free(info); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } *p_size = info->size; @@ -294,15 +326,19 @@ int ctsvc_image_util_rotate(media_packet_h packet, image_util_rotation_e rotatio ret = image_util_transform_create(&transform); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_create() Fail(%d)", ret); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = image_util_transform_set_rotation(transform, rotation); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_set_rotation() Fail(%d)", ret); image_util_transform_destroy(transform); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = _ctsvc_image_util_transform_run(transform, packet, p_buffer, p_size); @@ -319,15 +355,19 @@ int ctsvc_image_util_resize(media_packet_h packet, int width, int height, ret = image_util_transform_create(&transform); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_create() Fail(%d)", ret); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = image_util_transform_set_resolution(transform, width, height); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_transform_set_resolution() Fail(%d)", ret); image_util_transform_destroy(transform); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = _ctsvc_image_util_transform_run(transform, packet, p_buffer, p_size); diff --git a/common/ctsvc_inotify.c b/common/ctsvc_inotify.c index 4a9cebf..0d2dd31 100644 --- a/common/ctsvc_inotify.c +++ b/common/ctsvc_inotify.c @@ -173,11 +173,13 @@ int ctsvc_inotify_init(void) __inoti_handler = __ctsvc_inotify_attach_handler(__inoti_fd); if (__inoti_handler <= 0) { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_attach_handler() Fail"); close(__inoti_fd); __inoti_fd = -1; __inoti_handler = 0; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } __ctsvc_inoti_ref++; @@ -259,8 +261,10 @@ static inline const char* __ctsvc_noti_get_file_path(const char *view_uri) return CTSVC_NOTI_SIP_CHANGED; case CTSVC_RECORD_RESULT: default: + /* LCOV_EXCL_START */ ERR("The type(%s) is not supported", view_uri); return NULL; + /* LCOV_EXCL_STOP */ } return NULL; } @@ -278,22 +282,28 @@ int ctsvc_inotify_subscribe_ipc_ready(void (*cb)(void *), void *user_data) if (NULL == noti_info) { int wd = __ctsvc_inotify_get_wd(__inoti_fd, noti_path); if (-1 == wd) { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_get_wd() Fail(noti_path=%s, errno : %d)", noti_path, errno); if (errno == EACCES) return CONTACTS_ERROR_PERMISSION_DENIED; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } int ret = __ctsvc_inotify_watch(__inoti_fd, noti_path); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_watch() Fail"); return ret; + /* LCOV_EXCL_STOP */ } noti_info = calloc(1, sizeof(struct socket_init_noti_info)); if (NULL == noti_info) { + /* LCOV_EXCL_START */ ERR("calloc() return NULL"); return ret; + /* LCOV_EXCL_STOP */ } noti_info->wd = wd; @@ -314,8 +324,10 @@ int ctsvc_inotify_unsubscribe_ipc_ready() noti_info = g_hash_table_lookup(_ctsvc_socket_init_noti_table, noti_path); if (NULL == noti_info) { + /* LCOV_EXCL_START */ ERR("g_hash_table_lookup() return NULL"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (1 == noti_info->subscribe_count) { @@ -348,10 +360,12 @@ int ctsvc_inotify_subscribe(const char *view_uri, void *cb, void *data) wd = __ctsvc_inotify_get_wd(__inoti_fd, path); if (-1 == wd) { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno); if (errno == EACCES) return CONTACTS_ERROR_PERMISSION_DENIED; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } for (it = __noti_list; it; it = it->next) { @@ -369,8 +383,10 @@ int ctsvc_inotify_subscribe(const char *view_uri, void *cb, void *data) if (same_noti) { __ctsvc_inotify_watch(__inoti_fd, path); + /* LCOV_EXCL_START */ ERR("The same callback(%s) is already exist", view_uri); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_inotify_watch(__inoti_fd, path); @@ -438,10 +454,12 @@ int ctsvc_inotify_unsubscribe(const char *view_uri, void *cb, void *user_data) wd = __ctsvc_inotify_get_wd(__inoti_fd, path); if (-1 == wd) { + /* LCOV_EXCL_START */ ERR("__ctsvc_inotify_get_wd() Fail(errno : %d)", errno); if (errno == EACCES) return CONTACTS_ERROR_PERMISSION_DENIED; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_del_noti(&__noti_list, wd, view_uri, cb, user_data); diff --git a/common/ctsvc_list.c b/common/ctsvc_list.c index e5d2727..97bce95 100644 --- a/common/ctsvc_list.c +++ b/common/ctsvc_list.c @@ -161,8 +161,10 @@ int ctsvc_list_remove_child(contacts_list_h list, contacts_record_h record, if (insert_delete_list) { err = contacts_record_clone(record, &delete_record); if (CONTACTS_ERROR_NONE != err) { + /* LCOV_EXCL_START */ ERR("contacts_record_clone() Fail(%d)", err); return err; + /* LCOV_EXCL_STOP */ } s_list->deleted_records = g_list_append(s_list->deleted_records, delete_record); @@ -341,9 +343,11 @@ int ctsvc_list_clone(contacts_list_h list, contacts_list_h *out_list) for (cursor = list_s->records; cursor; cursor = cursor->next) { err = contacts_record_clone(cursor->data, &new_record); if (CONTACTS_ERROR_NONE != err) { + /* LCOV_EXCL_START */ ERR("contacts_record_clone() Fail(%d)", err); contacts_list_destroy(new_list, true); return err; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(new_list, new_record); } @@ -352,9 +356,11 @@ int ctsvc_list_clone(contacts_list_h list, contacts_list_h *out_list) for (cursor = list_s->deleted_records; cursor; cursor = cursor->next) { err = contacts_record_clone(cursor->data, &new_record); if (CONTACTS_ERROR_NONE != err) { + /* LCOV_EXCL_START */ ERR("contacts_record_clone() Fail(%d)", err); contacts_list_destroy(new_list, true); return err; + /* LCOV_EXCL_STOP */ } ((ctsvc_list_s*)new_list)->deleted_records = g_list_prepend(((ctsvc_list_s*)new_list)->deleted_records, new_record); diff --git a/common/ctsvc_localize_ch.c b/common/ctsvc_localize_ch.c index 5f7bf54..a97ab78 100644 --- a/common/ctsvc_localize_ch.c +++ b/common/ctsvc_localize_ch.c @@ -2180,8 +2180,10 @@ bool ctsvc_has_chinese(const char *src) u_strFromUTF8(temp, array_sizeof(temp), NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 Fail(%s)", u_errorName(status)); return false; + /* LCOV_EXCL_STOP */ } return __ctsvc_has_chinese(temp); @@ -2212,8 +2214,10 @@ int ctsvc_convert_chinese_to_pinyin(const char *src, pinyin_name_s **name, int * u_strFromUTF8(temp_result, array_sizeof(temp_result), NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 Fail(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } len = u_strlen(temp_result); diff --git a/common/ctsvc_localize_jp.c b/common/ctsvc_localize_jp.c index 1270c6f..95626e4 100644 --- a/common/ctsvc_localize_jp.c +++ b/common/ctsvc_localize_jp.c @@ -144,56 +144,70 @@ int ctsvc_convert_japanese_to_hiragana(const char *src, char **dest) u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status); if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } status = U_ZERO_ERROR; tmp_result = calloc(1, sizeof(UChar) * (size + 1)); if (NULL == tmp_result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 Fail(%s)", u_errorName(status)); free(tmp_result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } result = calloc(1, sizeof(UChar) * (size + 1)); if (NULL == result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ctsvc_convert_japanese_to_hiragana_unicode(tmp_result, result, size + 1); u_strToUTF8(NULL, 0, &size, result, -1, &status); if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) { + /* LCOV_EXCL_START */ ERR("u_strToUTF8 to get the dest length Fail(%s)", u_errorName(status)); free(tmp_result); free(result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } status = U_ZERO_ERROR; *dest = calloc(1, sizeof(char)*(size+1)); if (NULL == *dest) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); free(result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strToUTF8(*dest, size + 1, &size, result, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strToUTF8 Fail(%s)", u_errorName(status)); free(tmp_result); free(result); free(*dest); *dest = NULL; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } free(tmp_result); diff --git a/common/ctsvc_mutex.c b/common/ctsvc_mutex.c index 10b3a0a..805f257 100644 --- a/common/ctsvc_mutex.c +++ b/common/ctsvc_mutex.c @@ -78,9 +78,11 @@ static inline pthread_mutex_t* __ctsvc_mutex_get_mutex(int type) ret_val = &cynara_mutex; break; default: + /* LCOV_EXCL_START */ ERR("unknown type(%d)", type); ret_val = NULL; break; + /* LCOV_EXCL_STOP */ } return ret_val; } diff --git a/common/ctsvc_normalize.c b/common/ctsvc_normalize.c index 70910e0..f78b170 100644 --- a/common/ctsvc_normalize.c +++ b/common/ctsvc_normalize.c @@ -60,9 +60,11 @@ static int __ctsvc_remove_special_char(const char *src, char *dest, int dest_siz int s_pos = 0, d_pos = 0, char_type, src_size; if (NULL == src) { + /* LCOV_EXCL_START */ ERR("The parameter(src) is NULL"); dest[d_pos] = '\0'; return 0; + /* LCOV_EXCL_STOP */ } src_size = strlen(src); @@ -74,9 +76,11 @@ static int __ctsvc_remove_special_char(const char *src, char *dest, int dest_siz d_pos += char_type; s_pos += char_type; } else { + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); dest[d_pos] = '\0'; return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } @@ -93,8 +97,10 @@ static inline int __ctsvc_collation_str(const char *src, char **dest) char *region = strdup(ctsvc_get_langset()); if (NULL == region) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } char *dot = strchr(region, '.'); @@ -103,35 +109,43 @@ static inline int __ctsvc_collation_str(const char *src, char **dest) collator = ucol_open(region, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("ucol_open Fail(%s)", u_errorName(status)); free(region); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } /* TODO: ucol_setAttribute is not called */ if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("ucol_setAttribute Fail(%s)", u_errorName(status)); free(region); ucol_close(collator); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } u_strFromUTF8(NULL, 0, &size, src, strlen(src), &status); if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 to get the dest length Fail(%s)", u_errorName(status)); free(region); ucol_close(collator); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } status = U_ZERO_ERROR; tmp_result = calloc(1, sizeof(UChar) * (size + 1)); u_strFromUTF8(tmp_result, size + 1, NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8 Fail(%s)", u_errorName(status)); free(region); free(tmp_result); ucol_close(collator); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } size = ucol_getSortKey(collator, tmp_result, -1, NULL, 0); @@ -167,8 +181,10 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) tmp_result = calloc(1, sizeof(UChar)*(tmp_size+1)); if (NULL == tmp_result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strFromUTF8(tmp_result, tmp_size + 1, &tmp_size, src, -1, &status); @@ -177,27 +193,35 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) free(tmp_result); tmp_result = calloc(1, sizeof(UChar) * (tmp_size + 1)); if (NULL == tmp_result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strFromUTF8(tmp_result, tmp_size + 1, NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8()Fail(%s)", u_errorName(status)); free(tmp_result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } else if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8() Fail(%s)", u_errorName(status)); free(tmp_result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } tmp_upper = calloc(1, sizeof(UChar)*(tmp_size+1)); if (NULL == tmp_upper) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } upper_size = u_strToUpper(tmp_upper, tmp_size+1, tmp_result, -1, NULL, &status); @@ -206,31 +230,39 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) free(tmp_upper); tmp_upper = calloc(1, sizeof(UChar) * (upper_size + 1)); if (NULL == tmp_upper) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strFromUTF8(tmp_upper, upper_size + 1, NULL, src, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8()Fail(%s)", u_errorName(status)); free(tmp_result); free(tmp_upper); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } else if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strToUpper() Fail(%s)", u_errorName(status)); free(tmp_result); free(tmp_upper); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } result = calloc(1, sizeof(UChar)*(size+1)); if (NULL == result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); free(tmp_upper); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } size = unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status); @@ -239,26 +271,32 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) free(result); result = calloc(1, sizeof(UChar)*(size + 1)); if (NULL == result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); free(tmp_upper); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("unorm_normalize() Fail(%s)", u_errorName(status)); free(tmp_result); free(tmp_upper); free(result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } else if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("unorm_normalize() Fail(%s)", u_errorName(status)); free(tmp_result); free(tmp_upper); free(result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ctsvc_check_language(result); @@ -272,11 +310,13 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) UChar *temp_result = NULL; temp_result = calloc(1, sizeof(UChar)*(size+1)); if (NULL == temp_result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); free(tmp_upper); free(result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } bool replaced = false; @@ -301,15 +341,18 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) status = U_ZERO_ERROR; *dest = calloc(1, sizeof(char) * (size+1)); if (NULL == *dest) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(tmp_result); free(tmp_upper); free(result); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } u_strToUTF8(*dest, size+1, NULL, result, -1, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strToUTF8() Fail(%s)", u_errorName(status)); free(*dest); *dest = NULL; @@ -317,6 +360,7 @@ static int __ctsvc_normalize_str(const char *src, char **dest, bool is_index) free(tmp_upper); free(result); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } free(tmp_result); free(tmp_upper); @@ -332,8 +376,10 @@ static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *de u_strFromUTF8(dest, dest_size, &size, src, strlen(src), &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8() Fail(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } *str_size = size; @@ -380,8 +426,10 @@ int ctsvc_get_halfwidth_string(const char *src, char **dest, int *dest_size) int ustr_size = 0; if (CONTACTS_ERROR_NONE != __ctsvc_convert_halfwidth_ascii_and_symbol(src, unicodes, LARGE_BUFFER_SIZE, &ustr_size)) { + /* LCOV_EXCL_START */ ERR("__ctsvc_convert_halfwidth_ascii_and_symbol() Fail"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } UErrorCode status = 0; @@ -394,6 +442,7 @@ int ctsvc_get_halfwidth_string(const char *src, char **dest, int *dest_size) u_strToUTF8(*dest, size+1, dest_size, unicodes, ustr_size, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strToUTF8() Fail(%s)", u_errorName(status)); free(*dest); @@ -401,6 +450,7 @@ int ctsvc_get_halfwidth_string(const char *src, char **dest, int *dest_size) *dest_size = 0; return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -464,8 +514,10 @@ int ctsvc_normalize_index(const char *src, char **dest) memset(first_str, 0x00, sizeof(first_str)); strncpy(first_str, src, length); if (length != strlen(first_str)) { + /* LCOV_EXCL_START */ ERR("length : %d, first_str : %s, strlne : %d", length, first_str, strlen(first_str)); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } ret = __ctsvc_normalize_str(first_str, dest, true); diff --git a/common/ctsvc_query.c b/common/ctsvc_query.c index 3a9289c..629ed75 100644 --- a/common/ctsvc_query.c +++ b/common/ctsvc_query.c @@ -87,8 +87,10 @@ API int contacts_query_set_projection(contacts_query_h query, unsigned int prope query_s->projection = calloc(count, sizeof(unsigned int)); if (NULL == query_s->projection) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } memcpy(query_s->projection, property_ids, sizeof(unsigned int) * count); query_s->projection_count = count; diff --git a/common/ctsvc_record.c b/common/ctsvc_record.c index 025bc5a..362d2a5 100644 --- a/common/ctsvc_record.c +++ b/common/ctsvc_record.c @@ -631,8 +631,10 @@ int ctsvc_record_set_projection_flags(contacts_record_h record, _record->properties_flags = calloc(property_max_count, sizeof(char)); if (NULL == _record->properties_flags) { + /* LCOV_EXCL_START */ ERR("calloc fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } _record->property_max_count = property_max_count; diff --git a/common/ctsvc_record_addressbook.c b/common/ctsvc_record_addressbook.c index 2768817..7452965 100644 --- a/common/ctsvc_record_addressbook.c +++ b/common/ctsvc_record_addressbook.c @@ -87,9 +87,11 @@ static int __ctsvc_addressbook_clone(contacts_record_h record, contacts_record_h int ret = ctsvc_record_copy_base(&(dest->base), &(src->base)); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_record_copy_base() Fail"); free(dest); return ret; + /* LCOV_EXCL_STOP */ } dest->id = src->id; @@ -112,8 +114,10 @@ static int __ctsvc_addressbook_get_str_real(contacts_record_h record, *out_str = GET_STR(copy, addressbook->name); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(addressbook)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -139,8 +143,10 @@ static int __ctsvc_addressbook_set_str(contacts_record_h record, FREEandSTRDUP(addressbook->name, str); break; default: + /* LCOV_EXCL_START */ ERR("This field(%d) is not supported in value(addressbook)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -161,8 +167,10 @@ static int __ctsvc_addressbook_get_int(contacts_record_h record, *out = addressbook->mode; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(addressbook)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -191,8 +199,10 @@ static int __ctsvc_addressbook_set_int(contacts_record_h record, addressbook->account_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(addressbook)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/common/ctsvc_record_contact.c b/common/ctsvc_record_contact.c index 1c5c399..edeb604 100644 --- a/common/ctsvc_record_contact.c +++ b/common/ctsvc_record_contact.c @@ -683,9 +683,11 @@ static int __ctsvc_activity_create(contacts_record_h *out_record) activity->photos = calloc(1, sizeof(ctsvc_list_s)); if (NULL == activity->photos) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(activity); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } activity->photos->l_type = CTSVC_RECORD_ACTIVITY_PHOTO; @@ -1312,6 +1314,7 @@ static int __ctsvc_contact_create(contacts_record_h *out_record) return CONTACTS_ERROR_NONE; } while (0); + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(contact->extensions); free(contact->images); @@ -1331,6 +1334,7 @@ static int __ctsvc_contact_create(contacts_record_h *out_record) free(contact->sips); free(contact); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } static int __ctsvc_contact_destroy(contacts_record_h record, bool delete_child) @@ -1412,8 +1416,10 @@ static int __ctsvc_contact_get_int(contacts_record_h record, unsigned int proper *out = contact->link_mode; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1439,8 +1445,10 @@ static int __ctsvc_simple_contact_get_int(contacts_record_h record, unsigned int *out = contact->changed_time; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(simple contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1457,8 +1465,10 @@ static int __ctsvc_name_get_int(contacts_record_h record, unsigned int property_ *out = name->contact_id; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(name)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1478,8 +1488,10 @@ static int __ctsvc_company_get_int(contacts_record_h record, unsigned int proper *out = company->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(company)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1496,8 +1508,10 @@ static int __ctsvc_note_get_int(contacts_record_h record, unsigned int property_ *out = note->contact_id; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(note)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1517,8 +1531,10 @@ static int __ctsvc_number_get_int(contacts_record_h record, unsigned int propert *out = number->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1538,8 +1554,10 @@ static int __ctsvc_email_get_int(contacts_record_h record, unsigned int property *out = email->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1559,8 +1577,10 @@ static int __ctsvc_url_get_int(contacts_record_h record, unsigned int property_i *out = url->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(url)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1586,8 +1606,10 @@ static int __ctsvc_event_get_int(contacts_record_h record, unsigned int property *out = event->calendar_type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1604,8 +1626,10 @@ static int __ctsvc_nickname_get_int(contacts_record_h record, unsigned int prope *out = nickname->contact_id; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(nickname)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1625,8 +1649,10 @@ static int __ctsvc_address_get_int(contacts_record_h record, unsigned int proper *out = address->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1646,8 +1672,10 @@ static int __ctsvc_messenger_get_int(contacts_record_h record, unsigned int prop *out = messenger->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(messenger)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1667,8 +1695,10 @@ static int __ctsvc_group_relation_get_int(contacts_record_h record, unsigned int *out = group->group_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; } @@ -1688,8 +1718,10 @@ static int __ctsvc_activity_get_int(contacts_record_h record, unsigned int prope *out = activity->timestamp; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1754,9 +1786,11 @@ static int __ctsvc_activity_get_child_record_at_p(contacts_record_h record, contacts_list_get_count((contacts_list_h)s_activity->photos, &count); if (count < index) { + /* LCOV_EXCL_START */ ERR("The index(%d) is greather than total length(%d)", index, count); *out_record = NULL; return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } return ctsvc_list_get_nth_record_p((contacts_list_h)s_activity->photos, index, out_record); @@ -1795,8 +1829,10 @@ static int __ctsvc_activity_photo_get_int(contacts_record_h record, unsigned int *out = photo->sort_index; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1816,8 +1852,10 @@ static int __ctsvc_profile_get_int(contacts_record_h record, unsigned int proper *out = profile->order; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1837,8 +1875,10 @@ static int __ctsvc_relationship_get_int(contacts_record_h record, unsigned int p *out = relationship->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(relationship)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1858,8 +1898,10 @@ static int __ctsvc_image_get_int(contacts_record_h record, unsigned int property *out = image->type; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1879,8 +1921,10 @@ static int __ctsvc_extension_get_int(contacts_record_h record, unsigned int prop *out = extension->data1; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(extension)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1900,8 +1944,10 @@ static int __ctsvc_sip_get_int(contacts_record_h record, unsigned int property_i *out = sip->type; break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : property_id(%d) is not supported in value(sip)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1945,8 +1991,10 @@ static int __ctsvc_contact_set_int(contacts_record_h record, unsigned int proper contact->link_mode = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value (contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1975,8 +2023,10 @@ static int __ctsvc_simple_contact_set_int(contacts_record_h record, unsigned int contact->addressbook_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(simple contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -1997,8 +2047,10 @@ static int __ctsvc_name_set_int(contacts_record_h record, unsigned int property_ name->contact_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(name)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2027,8 +2079,10 @@ static int __ctsvc_company_set_int(contacts_record_h record, unsigned int proper company->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(company)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2049,8 +2103,10 @@ static int __ctsvc_note_set_int(contacts_record_h record, unsigned int property_ note->contact_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(note)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2075,8 +2131,10 @@ static int __ctsvc_number_set_int(contacts_record_h record, unsigned int propert number->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2105,8 +2163,10 @@ static int __ctsvc_email_set_int(contacts_record_h record, unsigned int property email->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2135,8 +2195,10 @@ static int __ctsvc_url_set_int(contacts_record_h record, unsigned int property_i url->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(url)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2172,8 +2234,10 @@ static int __ctsvc_event_set_int(contacts_record_h record, unsigned int property event->calendar_type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2194,8 +2258,10 @@ static int __ctsvc_nickname_set_int(contacts_record_h record, unsigned int prope nickname->contact_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(nickname)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2223,8 +2289,10 @@ static int __ctsvc_address_set_int(contacts_record_h record, unsigned int proper address->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2253,8 +2321,10 @@ static int __ctsvc_messenger_set_int(contacts_record_h record, unsigned int prop messenger->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(messenger)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2281,8 +2351,10 @@ static int __ctsvc_group_relation_set_int(contacts_record_h record, unsigned int group->group_id = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group relation)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2307,8 +2379,10 @@ static int __ctsvc_activity_set_int(contacts_record_h record, unsigned int prope activity->timestamp = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2331,8 +2405,10 @@ static int __ctsvc_activity_photo_set_int(contacts_record_h record, unsigned int photo->sort_index = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2357,8 +2433,10 @@ static int __ctsvc_profile_set_int(contacts_record_h record, unsigned int proper profile->order = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2386,8 +2464,10 @@ static int __ctsvc_relationship_set_int(contacts_record_h record, unsigned int p relationship->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(relationship)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2415,8 +2495,10 @@ static int __ctsvc_image_set_int(contacts_record_h record, unsigned int property image->type = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2441,8 +2523,10 @@ static int __ctsvc_extension_set_int(contacts_record_h record, unsigned int prop extension->data1 = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(extension)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2469,8 +2553,10 @@ static int __ctsvc_sip_set_int(contacts_record_h record, unsigned int property_i sip->type = value; break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : property_id(0x%x) is not supported in value(sip)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2498,8 +2584,10 @@ static int __ctsvc_contact_get_str_real(contacts_record_h record, unsigned int p *out_str = GET_STR(copy, contact->message_alert); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2569,8 +2657,10 @@ static int __ctsvc_contact_get_record_list_p(contacts_record_h record, *list = (contacts_list_h)contact->sips; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2605,9 +2695,11 @@ static int __ctsvc_contact_get_child_record_at_p(contacts_record_h record, contacts_list_get_count(list, &count); if (count < index) { + /* LCOV_EXCL_START */ ERR("The index(%d) is greather than total length(%d)", index, count); *out_record = NULL; return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } else { return ctsvc_list_get_nth_record_p(list, index, out_record); } @@ -2692,8 +2784,10 @@ static int __ctsvc_contact_reset_child_record_id(contacts_record_h child_record) ((ctsvc_sip_s *)record)->id = 0; break; default: + /* LCOV_EXCL_START */ ERR("record(%d) is not child of contact", record->r_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2738,8 +2832,10 @@ static int __ctsvc_contact_get_child_record_id(contacts_record_h child_record) case CTSVC_RECORD_SIP: return ((ctsvc_sip_s *)record)->id; default: + /* LCOV_EXCL_START */ ERR("record(%d) is not child of contact", record->r_type); return 0; + /* LCOV_EXCL_STOP */ } return 0; } @@ -2756,8 +2852,10 @@ static int __ctsvc_contact_add_child_record(contacts_record_h record, return ret; if (CTSVC_RECORD_NAME == s_record->r_type && 1 == ((ctsvc_list_s*)list)->count) { + /* LCOV_EXCL_START */ ERR("This type(%d) of child_record can not be added anymore", s_record->r_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_contact_reset_child_record_id(child_record); @@ -2811,8 +2909,10 @@ static int __ctsvc_simple_contact_get_str_real(contacts_record_h record, *out_str = GET_STR(copy, contact->message_alert); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(simple_contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2857,8 +2957,10 @@ static int __ctsvc_name_get_str_real(contacts_record_h record, unsigned int prop *out_str = GET_STR(copy, name->phonetic_last); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(name)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2909,8 +3011,10 @@ static int __ctsvc_company_get_str_real(contacts_record_h record, unsigned int p *out_str = GET_STR(copy, company->phonetic_name); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(company)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2934,8 +3038,10 @@ static int __ctsvc_note_get_str_real(contacts_record_h record, unsigned int prop *out_str = GET_STR(copy, note->note); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(note)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2962,8 +3068,10 @@ static int __ctsvc_number_get_str_real(contacts_record_h record, unsigned int pr *out_str = GET_STR(copy, number->number); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -2990,8 +3098,10 @@ static int __ctsvc_email_get_str_real(contacts_record_h record, unsigned int pro *out_str = GET_STR(copy, email->label); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3018,8 +3128,10 @@ static int __ctsvc_url_get_str_real(contacts_record_h record, unsigned int prope *out_str = GET_STR(copy, url->label); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(url)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3043,8 +3155,10 @@ static int __ctsvc_event_get_str_real(contacts_record_h record, unsigned int pro *out_str = GET_STR(copy, event->label); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3068,8 +3182,10 @@ static int __ctsvc_nickname_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, nickname->nickname); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(nickname)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3114,8 +3230,10 @@ static int __ctsvc_address_get_str_real(contacts_record_h record, unsigned int p *out_str = GET_STR(copy, address->extended); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3142,8 +3260,10 @@ static int __ctsvc_messenger_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, messenger->im_id); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(messenger)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3168,8 +3288,10 @@ static int __ctsvc_group_relation_get_str_real(contacts_record_h record, *out_str = GET_STR(copy, group_relation->group_name); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group_relation)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3203,8 +3325,10 @@ static int __ctsvc_activity_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, activity->uri); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3228,8 +3352,10 @@ static int __ctsvc_activity_photo_get_str_real(contacts_record_h record, unsigne *out_str = GET_STR(copy, photo->photo_url); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3274,8 +3400,10 @@ static int __ctsvc_profile_get_str_real(contacts_record_h record, unsigned int p *out_str = GET_STR(copy, profile->extra_data); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3302,8 +3430,10 @@ static int __ctsvc_relationship_get_str_real(contacts_record_h record, unsigned *out_str = GET_STR(copy, relationship->name); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(relationship)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3330,8 +3460,10 @@ static int __ctsvc_image_get_str_real(contacts_record_h record, unsigned int pro *out_str = GET_STR(copy, image->path); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3385,8 +3517,10 @@ static int __ctsvc_extension_get_str_real(contacts_record_h record, unsigned int *out_str = GET_STR(copy, extension->data12); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(extension)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3413,8 +3547,10 @@ static int __ctsvc_sip_get_str_real(contacts_record_h record, unsigned int prope *out_str = GET_STR(copy, sip->label); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : property_id(%d) is not supported in value(sip)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3464,8 +3600,10 @@ static int __ctsvc_contact_set_str(contacts_record_h record, unsigned int proper FREEandSTRDUP(contact->message_alert, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3505,8 +3643,10 @@ static int __ctsvc_simple_contact_set_str(contacts_record_h record, unsigned int FREEandSTRDUP(contact->message_alert, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(simple_contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3549,8 +3689,10 @@ static int __ctsvc_name_set_str(contacts_record_h record, unsigned int property_ FREEandSTRDUP(name->phonetic_last, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(name)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3605,8 +3747,10 @@ static int __ctsvc_company_set_str(contacts_record_h record, unsigned int proper FREEandSTRDUP(company->phonetic_name, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(company)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3621,8 +3765,10 @@ static int __ctsvc_note_set_str(contacts_record_h record, unsigned int property_ FREEandSTRDUP(note->note, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(note)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3641,8 +3787,10 @@ static int __ctsvc_number_set_str(contacts_record_h record, unsigned int propert FREEandSTRDUP(number->number, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3661,8 +3809,10 @@ static int __ctsvc_email_set_str(contacts_record_h record, unsigned int property FREEandSTRDUP(email->label, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3681,8 +3831,10 @@ static int __ctsvc_url_set_str(contacts_record_h record, unsigned int property_i FREEandSTRDUP(url->label, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(url)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3697,8 +3849,10 @@ static int __ctsvc_event_set_str(contacts_record_h record, unsigned int property FREEandSTRDUP(event->label, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3713,8 +3867,10 @@ static int __ctsvc_nickname_set_str(contacts_record_h record, unsigned int prope FREEandSTRDUP(nickname->nickname, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(nickname)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3757,8 +3913,10 @@ static int __ctsvc_address_set_str(contacts_record_h record, unsigned int proper FREEandSTRDUP(address->extended, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3777,8 +3935,10 @@ static int __ctsvc_messenger_set_str(contacts_record_h record, unsigned int prop FREEandSTRDUP(messenger->im_id, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(messenger)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3797,8 +3957,10 @@ static int __ctsvc_group_relation_set_str(contacts_record_h record, unsigned int return CONTACTS_ERROR_INVALID_PARAMETER; */ default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(group_relation)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3825,8 +3987,10 @@ static int __ctsvc_activity_set_str(contacts_record_h record, unsigned int prope FREEandSTRDUP(activity->uri, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3842,8 +4006,10 @@ static int __ctsvc_activity_photo_set_str(contacts_record_h record, unsigned int FREEandSTRDUP(photo->photo_url, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(activity)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3887,8 +4053,10 @@ static int __ctsvc_profile_set_str(contacts_record_h record, unsigned int proper FREEandSTRDUP(profile->extra_data, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(profile)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3908,8 +4076,10 @@ static int __ctsvc_relationship_set_str(contacts_record_h record, unsigned int p FREEandSTRDUP(relationship->name, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(relationship)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3934,8 +4104,10 @@ static int __ctsvc_image_set_str(contacts_record_h record, unsigned int property FREEandSTRDUP(image->path, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -3991,8 +4163,10 @@ static int __ctsvc_extension_set_str(contacts_record_h record, unsigned int prop FREEandSTRDUP(extension->data12, str); break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(extension)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4012,8 +4186,10 @@ static int __ctsvc_sip_set_str(contacts_record_h record, unsigned int property_i FREEandSTRDUP(sip->label, str); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : property_id(%d) is not supported in value(sip)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4032,8 +4208,10 @@ static int __ctsvc_contact_get_bool(contacts_record_h record, unsigned int prope *value = contact->has_email; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4052,8 +4230,10 @@ static int __ctsvc_simple_contact_get_bool(contacts_record_h record, unsigned in *value = contact->has_email; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4067,8 +4247,10 @@ static int __ctsvc_number_get_bool(contacts_record_h record, unsigned int proper *value = number->is_default; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4081,8 +4263,10 @@ static int __ctsvc_email_get_bool(contacts_record_h record, unsigned int propert *value = email->is_default; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4095,8 +4279,10 @@ static int __ctsvc_event_get_bool(contacts_record_h record, unsigned int propert *value = event->is_leap_month; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4109,8 +4295,10 @@ static int __ctsvc_image_get_bool(contacts_record_h record, unsigned int propert *value = image->is_default; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4123,8 +4311,10 @@ static int __ctsvc_address_get_bool(contacts_record_h record, unsigned int prope *value = address->is_default; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4151,8 +4341,10 @@ static int __ctsvc_contact_set_bool(contacts_record_h record, unsigned int prope break; */ default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(contact)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4167,8 +4359,10 @@ static int __ctsvc_number_set_bool(contacts_record_h record, unsigned int proper number->is_default = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(number)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4183,8 +4377,10 @@ static int __ctsvc_email_set_bool(contacts_record_h record, unsigned int propert email->is_default = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(email)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4199,8 +4395,10 @@ static int __ctsvc_event_set_bool(contacts_record_h record, unsigned int propert event->is_leap_month = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(event)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4215,8 +4413,10 @@ static int __ctsvc_image_set_bool(contacts_record_h record, unsigned int propert image->is_default = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(0x%x) is not supported in value(image)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4231,8 +4431,10 @@ static int __ctsvc_address_set_bool(contacts_record_h record, unsigned int prope address->is_default = value; break; default: + /* LCOV_EXCL_START */ ERR("property_id(%d) is not supported in value(address)", property_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -4321,9 +4523,11 @@ static int __ctsvc_contact_clone(contacts_record_h record, contacts_record_h *ou 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_contact_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4354,9 +4558,11 @@ static int __ctsvc_activity_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_activity_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4379,9 +4585,11 @@ static int __ctsvc_activity_photo_clone(contacts_record_h record, contacts_recor 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_activity_photo_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4412,9 +4620,11 @@ static int __ctsvc_address_clone(contacts_record_h record, contacts_record_h *ou 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_address_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4450,9 +4660,11 @@ static int __ctsvc_company_clone(contacts_record_h record, contacts_record_h *ou 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_company_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4477,9 +4689,11 @@ static int __ctsvc_email_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_email_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4505,9 +4719,11 @@ static int __ctsvc_event_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_event_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4541,9 +4757,11 @@ static int __ctsvc_extension_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_extension_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4566,9 +4784,11 @@ static int __ctsvc_group_relation_clone(contacts_record_h record, contacts_recor 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_relation_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4592,9 +4812,11 @@ static int __ctsvc_messenger_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_messenger_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4628,9 +4850,11 @@ static int __ctsvc_name_clone(contacts_record_h record, contacts_record_h *out_r 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_name_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4654,9 +4878,11 @@ static int __ctsvc_nickname_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_nickname_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4678,9 +4904,11 @@ static int __ctsvc_note_clone(contacts_record_h record, contacts_record_h *out_r 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_note_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4706,9 +4934,11 @@ static int __ctsvc_number_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_number_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4738,9 +4968,11 @@ static int __ctsvc_profile_clone(contacts_record_h record, contacts_record_h *ou 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_profile_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4765,9 +4997,11 @@ static int __ctsvc_relationship_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_relationship_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4795,9 +5029,11 @@ static int __ctsvc_image_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_image_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4831,9 +5067,11 @@ static int __ctsvc_simple_contact_clone(contacts_record_h record, contacts_recor 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_simple_contact_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4857,9 +5095,11 @@ static int __ctsvc_url_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_url_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; @@ -4884,9 +5124,11 @@ static int __ctsvc_sip_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_sip_destroy((contacts_record_h)out_data, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = (contacts_record_h)out_data; diff --git a/server/ctsvc_ipc_server.c b/server/ctsvc_ipc_server.c index 0fb14db..25b30dd 100644 --- a/server/ctsvc_ipc_server.c +++ b/server/ctsvc_ipc_server.c @@ -42,13 +42,17 @@ void ctsvc_ipc_server_connect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ipc_d if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("There is no indata Fail"); ret = CONTACTS_ERROR_SYSTEM; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_connect(); @@ -65,15 +69,19 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { ERR("outdata is NULL"); @@ -90,9 +98,11 @@ void ctsvc_ipc_server_disconnect(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ip if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } @@ -102,17 +112,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -128,15 +144,19 @@ void ctsvc_ipc_server_check_permission(pims_ipc_h ipc, pims_ipc_data_h indata, bool result = false; if (NULL == indata) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_INVALID_PARAMETER; ERR("check permission Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &permission); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } result = ctsvc_have_permission(ipc, permission); @@ -144,26 +164,32 @@ void ctsvc_ipc_server_check_permission(pims_ipc_h ipc, pims_ipc_data_h indata, ERROR_RETURN: *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(result, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_bool() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } } ctsvc_server_start_timeout(); @@ -179,25 +205,33 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_record(indata, &record); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); record = NULL; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_insert_record(record, &id); @@ -205,33 +239,43 @@ void ctsvc_ipc_server_db_insert_record(pims_ipc_h ipc, pims_ipc_data_h indata, p if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (ctsvc_ipc_marshal_int(id, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -239,17 +283,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -272,28 +322,38 @@ void ctsvc_ipc_server_db_get_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_string Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_record(view_uri, id, &record); @@ -302,28 +362,36 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { DBG("no data"); } else if (CONTACTS_ERROR_NONE == ret) { if (ctsvc_ipc_marshal_record(record, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_record() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -343,23 +411,31 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_record(indata, &record); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_update_record(record); @@ -367,24 +443,30 @@ void ctsvc_ipc_server_db_update_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } @@ -395,17 +477,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -426,28 +514,38 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_delete_record(view_uri, id); @@ -455,24 +553,30 @@ void ctsvc_ipc_server_db_delete_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } @@ -483,17 +587,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -514,30 +624,40 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_record(indata, &record); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); record = NULL; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_replace_record Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } @@ -546,29 +666,37 @@ void ctsvc_ipc_server_db_replace_record(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -576,17 +704,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -609,34 +743,46 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); ret = CONTACTS_ERROR_IPC; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_all_records(view_uri, offset, limit, &list); @@ -644,14 +790,18 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -660,13 +810,17 @@ void ctsvc_ipc_server_db_get_all_records(pims_ipc_h ipc, pims_ipc_data_h indata, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -675,17 +829,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -708,33 +868,45 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_query(indata, &query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_records_with_query(query, offset, limit, &list); @@ -742,14 +914,18 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -758,12 +934,16 @@ void ctsvc_ipc_server_db_get_records_with_query(pims_ipc_h ipc, pims_ipc_data_h ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -771,17 +951,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -803,23 +989,31 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_count(view_uri, &count); @@ -827,14 +1021,18 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -843,12 +1041,16 @@ void ctsvc_ipc_server_db_get_count(pims_ipc_h ipc, pims_ipc_data_h indata, ret = ctsvc_ipc_marshal_int(count, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -856,17 +1058,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -886,23 +1094,31 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_query(indata, &query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_count_with_query(query, &count); @@ -910,14 +1126,18 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -926,12 +1146,16 @@ void ctsvc_ipc_server_db_get_count_with_query(pims_ipc_h ipc, pims_ipc_data_h in ret = ctsvc_ipc_marshal_int(count, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -939,17 +1163,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -971,18 +1201,24 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_list(indata, &list); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (list) { @@ -991,13 +1227,17 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata, do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); contacts_list_first(list); @@ -1008,48 +1248,60 @@ void ctsvc_ipc_server_db_insert_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } /* marshal : id_count+property_id+[ids]*id_count */ /* id_count */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(id_count, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } for (i = 0; i < id_count; i++) { /* marshal ids */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ids[i], *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1057,17 +1309,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1087,18 +1345,24 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_list(indata, &list); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (list) { @@ -1107,13 +1371,17 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata, do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); contacts_list_first(list); @@ -1124,28 +1392,36 @@ void ctsvc_ipc_server_db_update_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1153,17 +1429,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1185,40 +1467,54 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_string Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &count); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (count <= 0) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_INVALID_PARAMETER; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ids = (int*)malloc(sizeof(int)*count); for (i = 0; i < count; i++) { ret = ctsvc_ipc_unmarshal_int(indata, &ids[i]); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_delete_records(uri, ids, count); @@ -1226,27 +1522,36 @@ void ctsvc_ipc_server_db_delete_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); + goto DATA_FREE; + /* LCOV_EXCL_STOP */ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1255,17 +1560,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1288,38 +1599,50 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_list(indata, &list); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_list Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &count); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (count <= 0) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_INVALID_PARAMETER; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ids = (int*)malloc(sizeof(int)*count); for (i = 0; i < count; i++) { ret = ctsvc_ipc_unmarshal_int(indata, &ids[i]); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_repalce_records Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (list) { @@ -1328,13 +1651,17 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata, do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_write_permission(((ctsvc_record_s*)record)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); contacts_list_first(list); @@ -1345,27 +1672,35 @@ void ctsvc_ipc_server_db_replace_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1373,17 +1708,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1407,33 +1748,45 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_string Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &address_book_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &contacts_db_version); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_changes_by_version(view_uri, address_book_id, contacts_db_version, @@ -1442,14 +1795,18 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1457,23 +1814,29 @@ void ctsvc_ipc_server_db_get_changes_by_version(pims_ipc_h ipc, pims_ipc_data_h } else if (CONTACTS_ERROR_NONE == ret) { ret = ctsvc_ipc_marshal_list(record_list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list Fail"); pims_ipc_data_destroy(*outdata); *outdata = NULL; ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_marshal_int(current_contacts_db_version, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); pims_ipc_data_destroy(*outdata); *outdata = NULL; ret = CONTACTS_ERROR_OUT_OF_MEMORY; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1481,17 +1844,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1511,15 +1880,19 @@ void ctsvc_ipc_server_db_get_current_version(pims_ipc_h ipc, pims_ipc_data_h ind if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ) && !ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_READ)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_current_version(&contacts_db_version); @@ -1528,14 +1901,18 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1543,12 +1920,16 @@ ERROR_RETURN: } else if (CONTACTS_ERROR_NONE == ret) { ret = ctsvc_ipc_marshal_int(contacts_db_version, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -1574,52 +1955,72 @@ void ctsvc_ipc_server_db_search_records_for_snippet(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &start_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &end_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &token_number); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_search_records_for_snippet(view_uri, keyword, offset, limit, @@ -1628,14 +2029,18 @@ void ctsvc_ipc_server_db_search_records_for_snippet(pims_ipc_h ipc, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1644,12 +2049,16 @@ void ctsvc_ipc_server_db_search_records_for_snippet(pims_ipc_h ipc, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1657,17 +2066,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1696,57 +2111,79 @@ void ctsvc_ipc_server_db_search_records_with_range_for_snippet(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &range); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &start_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &end_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &token_number); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_START */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_search_records_with_range_for_snippet(view_uri, keyword, offset, @@ -1755,14 +2192,18 @@ void ctsvc_ipc_server_db_search_records_with_range_for_snippet(pims_ipc_h ipc, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1771,12 +2212,16 @@ void ctsvc_ipc_server_db_search_records_with_range_for_snippet(pims_ipc_h ipc, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1784,17 +2229,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -1823,52 +2274,72 @@ void ctsvc_ipc_server_db_search_records_with_query_for_snippet(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_query(indata, &query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &start_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &end_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &token_number); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_search_records_with_query_for_snippet(query, keyword, offset, limit, @@ -1877,14 +2348,18 @@ void ctsvc_ipc_server_db_search_records_with_query_for_snippet(pims_ipc_h ipc, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1893,12 +2368,16 @@ void ctsvc_ipc_server_db_search_records_with_query_for_snippet(pims_ipc_h ipc, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -1906,17 +2385,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -1941,37 +2426,51 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_search_records(view_uri, keyword, offset, limit, &list); @@ -1979,14 +2478,18 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -1995,12 +2498,16 @@ void ctsvc_ipc_server_db_search_records(pims_ipc_h ipc, pims_ipc_data_h indata, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -2008,17 +2515,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -2044,42 +2557,58 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &view_uri); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &range); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_search_records_with_range(view_uri, keyword, offset, limit, range, @@ -2088,14 +2617,18 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -2104,12 +2637,16 @@ void ctsvc_ipc_server_db_search_records_with_range(pims_ipc_h ipc, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -2117,17 +2654,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: @@ -2153,38 +2696,52 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_query(indata, &query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_string(indata, &keyword); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &offset); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, ctsvc_required_read_permission(((ctsvc_query_s*)query)->view_uri))) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } @@ -2193,14 +2750,18 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -2209,12 +2770,16 @@ void ctsvc_ipc_server_db_search_records_with_query(pims_ipc_h ipc, ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } goto DATA_FREE; @@ -2222,17 +2787,23 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -2253,8 +2824,10 @@ void ctsvc_ipc_server_db_get_status(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } @@ -2264,25 +2837,33 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(status, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); diff --git a/server/ctsvc_ipc_server2.c b/server/ctsvc_ipc_server2.c index 1d4984f..09ca1f9 100644 --- a/server/ctsvc_ipc_server2.c +++ b/server/ctsvc_ipc_server2.c @@ -51,22 +51,30 @@ void ctsvc_ipc_activity_delete_by_contact_id(pims_ipc_h ipc, pims_ipc_data_h ind if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &contact_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_server_db_insert_record() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_activity_delete_by_contact_id(contact_id); @@ -76,28 +84,36 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -114,22 +130,30 @@ void ctsvc_ipc_activity_delete_by_account_id(pims_ipc_h ipc, pims_ipc_data_h ind if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &account_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_activity_delete_by_account_id() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_activity_delete_by_account_id(account_id); @@ -138,27 +162,35 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -176,27 +208,37 @@ void ctsvc_ipc_group_add_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims_ip if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &group_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &contact_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_group_add_contact() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_group_add_contact(group_id, contact_id); @@ -206,27 +248,35 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -244,27 +294,37 @@ void ctsvc_ipc_group_remove_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pims if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &group_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &contact_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_group_remove_contact() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } @@ -275,27 +335,35 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -314,32 +382,44 @@ void ctsvc_ipc_group_set_group_order(pims_ipc_h ipc, pims_ipc_data_h indata, pim if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &group_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &previous_group_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &next_group_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_group_link_group() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_group_set_group_order(group_id, previous_group_id, next_group_id); @@ -349,26 +429,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -386,27 +474,37 @@ void ctsvc_ipc_person_link_person(pims_ipc_h ipc, pims_ipc_data_h indata, pims_i if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &base_person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_link_person() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_link_person(base_person_id, person_id); @@ -416,26 +514,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -452,27 +558,37 @@ void ctsvc_ipc_person_unlink_contact(pims_ipc_h ipc, pims_ipc_data_h indata, pim if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &contact_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_link_person() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } int unlinked_person_id; @@ -483,33 +599,43 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(unlinked_person_id, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -526,29 +652,39 @@ void ctsvc_ipc_person_reset_usage(pims_ipc_h ipc, pims_ipc_data_h indata, pims_i if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } int temp = 0; ret = ctsvc_ipc_unmarshal_int(indata, &temp); type = (int)temp; if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_link_person() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_reset_usage(person_id, type); @@ -558,26 +694,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -595,32 +739,44 @@ void ctsvc_ipc_person_set_favorite_order(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &previous_person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &next_person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_link_person() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_set_favorite_order(person_id, previous_person_id, next_person_id); @@ -630,26 +786,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -668,32 +832,44 @@ void ctsvc_ipc_person_set_default_property(pims_ipc_h ipc, pims_ipc_data_h indat if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &property); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_set_default_property() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_set_default_property(property, person_id, id); @@ -703,26 +879,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -741,27 +925,37 @@ void ctsvc_ipc_person_get_default_property(pims_ipc_h ipc, pims_ipc_data_h indat if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_unsigned_int(indata, &op); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_get_default_property() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_get_default_property(op, person_id, &id); @@ -771,23 +965,31 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (return value)"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(id, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (id)"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -807,27 +1009,37 @@ void ctsvc_ipc_person_get_aggregation_suggestions(pims_ipc_h ipc, pims_ipc_data_ if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &limit); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_get_aggregation_suggestions() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_get_aggregation_suggestions(person_id, limit, &list); @@ -837,14 +1049,18 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -853,12 +1069,16 @@ ERROR_RETURN: ret = ctsvc_ipc_marshal_list(list, *outdata); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_list() Fail(%d)", ret); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -877,14 +1097,18 @@ void ctsvc_ipc_phone_log_reset_statistics(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_phone_log_reset_statistics(); @@ -893,26 +1117,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -930,20 +1162,26 @@ void ctsvc_ipc_phone_log_reset_statistics_by_sim(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, &sim_slot_no); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_phone_log_reset_statistics_by_sim(sim_slot_no); @@ -952,26 +1190,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) { int transaction_ver = ctsvc_get_transaction_ver(); if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(transaction_ver, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } DATA_FREE: ctsvc_handle_destroy(contact); @@ -992,16 +1238,20 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata, if (indata) { ret = ctsvc_ipc_unmarshal_handle(indata, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_handle Fail(%d)", ret); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_ipc_unmarshal_int(indata, (int*)&op); if (ret != CONTACTS_ERROR_NONE) { ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } @@ -1010,8 +1260,10 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata, case CONTACTS_PHONE_LOG_DELETE_BY_ADDRESS: ret = ctsvc_ipc_unmarshal_string(indata, &number); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_string() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_phone_log_delete(op, number); break; @@ -1019,15 +1271,19 @@ void ctsvc_ipc_phone_log_delete(pims_ipc_h ipc, pims_ipc_data_h indata, case CONTACTS_PHONE_LOG_DELETE_BY_EMAIL_EXTRA_DATA1: ret = ctsvc_ipc_unmarshal_int(indata, &extra_data1); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_phone_log_delete(op, extra_data1); break; default: + /* LCOV_EXCL_START */ ERR("the operation is not proper (op : %d)", op); ret = CONTACTS_ERROR_INVALID_PARAMETER; break; + /* LCOV_EXCL_STOP */ } } @@ -1035,22 +1291,28 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } if (ret == CONTACTS_ERROR_NONE) { int transaction_ver = ctsvc_get_transaction_ver(); if (ctsvc_ipc_marshal_int(transaction_ver, *outdata) != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); goto DATA_FREE; + /* LCOV_EXCL_STOP */ } } } @@ -1070,8 +1332,10 @@ void ctsvc_ipc_setting_get_name_display_order(pims_ipc_h ipc, pims_ipc_data_h in contacts_name_display_order_e order; if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_READ)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_setting_get_name_display_order(&order); @@ -1080,26 +1344,34 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (return value)"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(order, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (id)"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } ctsvc_server_start_timeout(); @@ -1123,25 +1395,33 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (return value)"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(order, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail (id)"); return; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } ctsvc_server_start_timeout(); @@ -1157,17 +1437,23 @@ void ctsvc_ipc_setting_set_name_display_order(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_int(indata, &order); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_set_default_property() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_setting_set_name_display_order((contacts_name_display_order_e)order); @@ -1176,19 +1462,25 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } ctsvc_server_start_timeout(); @@ -1204,17 +1496,23 @@ void ctsvc_ipc_setting_set_name_sorting_order(pims_ipc_h ipc, if (indata) { ret = ctsvc_ipc_unmarshal_int(indata, &order); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_unmarshal_int() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_person_set_default_property() Fail"); goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_CONTACT_WRITE)) { + /* LCOV_EXCL_START */ ret = CONTACTS_ERROR_PERMISSION_DENIED; goto ERROR_RETURN; + /* LCOV_EXCL_STOP */ } ret = ctsvc_setting_set_name_sorting_order((contacts_name_sorting_order_e)order); @@ -1223,19 +1521,25 @@ ERROR_RETURN: if (outdata) { *outdata = pims_ipc_data_create(0); if (NULL == *outdata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) { + /* LCOV_EXCL_START */ pims_ipc_data_destroy(*outdata); *outdata = NULL; ERR("ctsvc_ipc_marshal_int() Fail"); ctsvc_server_start_timeout(); return; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("outdata is NULL"); + /* LCOV_EXCL_STOP */ } ctsvc_server_start_timeout(); diff --git a/server/ctsvc_notification.c b/server/ctsvc_notification.c index 2c9fb1e..be28056 100644 --- a/server/ctsvc_notification.c +++ b/server/ctsvc_notification.c @@ -559,13 +559,17 @@ void ctsvc_db_data_delete_callback(sqlite3_context *context, API int contacts_db_add_status_changed_cb( contacts_db_status_changed_cb cb, void *user_data) { + /* LCOV_EXCL_START */ ERR("Please use contacts-service2 instead of contacts-service3"); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } API int contacts_db_remove_status_changed_cb( contacts_db_status_changed_cb cb, void *user_data) { + /* LCOV_EXCL_START */ ERR("Please use contacts-service2 instead of contacts-service3"); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } diff --git a/server/ctsvc_number_utils.c b/server/ctsvc_number_utils.c index fcb4317..2a453bc 100644 --- a/server/ctsvc_number_utils.c +++ b/server/ctsvc_number_utils.c @@ -296,9 +296,11 @@ char* ctsvc_get_network_cc(bool reload) ret = tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &state); if (ret != TAPI_API_SUCCESS) { + /* LCOV_EXCL_START */ ERR("tel_get_property_int Fail(%d)", ret); tel_deinit(handle); return NULL; + /* LCOV_EXCL_STOP */ } if (state == TAPI_NETWORK_SERVICE_TYPE_UNKNOWN @@ -311,8 +313,10 @@ char* ctsvc_get_network_cc(bool reload) ret = tel_get_property_string(handle, TAPI_PROP_NETWORK_PLMN, &temp); if (ret != TAPI_API_SUCCESS) { + /* LCOV_EXCL_START */ ERR("tel_get_property_string Fail(%d)", ret); return NULL; + /* LCOV_EXCL_STOP */ } if (temp) { @@ -347,7 +351,9 @@ void* ctsvc_init_tapi_handle_for_cc() TAPI_PROP_NETWORK_PLMN, _numutil_network_cc_changed, NULL); WARN_IF(ret != TAPI_API_SUCCESS, "tel_register_noti_event Fail(%d)", ret); } else { + /* LCOV_EXCL_START */ ERR("tel_init() Fail"); + /* LCOV_EXCL_STOP */ } return handle_for_cc; @@ -391,7 +397,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 3: @@ -411,7 +419,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 4: @@ -431,7 +441,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 5: @@ -451,7 +463,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 6: @@ -471,7 +485,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 8: @@ -491,7 +507,9 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 9: @@ -511,13 +529,17 @@ static inline int _numutil_has_country_code(const char *src, int len) ret += 1; break; default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); + /* LCOV_EXCL_STOP */ } break; case 0: default: + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); return 0; + /* LCOV_EXCL_STOP */ } return ret; @@ -894,8 +916,10 @@ static int _numutil_minmatch_number(const char *src, char *dest, int dest_size, while (0 <= (len-d_pos-1) && temp_number[len-d_pos-1] && d_pos < min_match) { if (dest_size-d_pos == 0) { + /* LCOV_EXCL_START */ ERR("Destination string buffer is not enough(%s)", src); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } dest[d_pos] = temp_number[len-d_pos-1]; @@ -927,8 +951,10 @@ int ctsvc_get_minmatch_number(const char *src, char *dest, int dest_size, int mi ret = _numutil_minmatch_number(src, dest, dest_size, min_match); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("_numutil_minmatch_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -943,8 +969,10 @@ static bool _numutil_is_phonenumber_halfwidth(const char *keyword) /* TODO: finally, we try to check the number with regular expression. */ for (i = 0; i < len; i++) { if ((keyword[i] < '0' || '9' < keyword[i]) && keyword[i] != '+') { + /* LCOV_EXCL_START */ ERR("keyword[%d]: %c is not number)", i, keyword[i]); return false; + /* LCOV_EXCL_STOP */ } } return true; @@ -1090,9 +1118,11 @@ void ctsvc_db_phone_number_equal_callback(sqlite3_context *context, char *number2; if (argc < 4) { + /* LCOV_EXCL_START */ sqlite3_result_int(context, 0); ERR("argc invalid"); return; + /* LCOV_EXCL_STOP */ } number1 = (char*)sqlite3_value_text(argv[0]); diff --git a/server/ctsvc_schema_recovery.c b/server/ctsvc_schema_recovery.c index b7f1904..60b6cc6 100644 --- a/server/ctsvc_schema_recovery.c +++ b/server/ctsvc_schema_recovery.c @@ -56,8 +56,10 @@ static inline int __ctsvc_server_remake_db_file() ret = sqlite3_exec(db, schema_query, NULL, 0, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("remake contacts DB file is Fail : %s", errmsg); sqlite3_free(errmsg); + /* LCOV_EXCL_STOP */ } ctsvc_server_db_close(); @@ -80,17 +82,21 @@ static int __ctsvc_server_check_table() CTS_TABLE_CONTACTS); ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_step(stmt); if (SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("contacts table does not exist in contacts DB file : %s", sqlite3_errmsg(db)); sqlite3_finalize(stmt); ctsvc_server_db_close(); return CTSVC_ERR_NO_TABLE; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); diff --git a/server/ctsvc_server.c b/server/ctsvc_server.c index e6fda6c..d9a8471 100644 --- a/server/ctsvc_server.c +++ b/server/ctsvc_server.c @@ -247,8 +247,10 @@ static int __server_main(void) ret = ctsvc_connect(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_connect fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ctsvc_set_client_access_info(NULL, NULL); ctsvc_server_bg_add_cb(); @@ -271,8 +273,10 @@ static int __server_main(void) return 0; } while (0); + /* LCOV_EXCL_START */ ERR("pims_ipc_svc_register error"); return -1; + /* LCOV_EXCL_STOP */ } void ctsvc_server_quit(void) @@ -305,6 +309,7 @@ int main(int argc, char *argv[]) { CTS_FN_CALL; INFO("Start contacts-service"); + setenv("GCOV_PREFIX", "/tmp/server", 1); int ret; if (getuid() == 0) { /* root */ diff --git a/server/ctsvc_server_activity.c b/server/ctsvc_server_activity.c index 616ea52..26f850b 100644 --- a/server/ctsvc_server_activity.c +++ b/server/ctsvc_server_activity.c @@ -39,9 +39,11 @@ int ctsvc_activity_delete_by_contact_id(int contact_id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_STOP */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_activity_noti(); @@ -67,9 +69,11 @@ int ctsvc_activity_delete_by_account_id(int account_id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_activity_noti(); diff --git a/server/ctsvc_server_bg.c b/server/ctsvc_server_bg.c index 8ce9422..8109900 100644 --- a/server/ctsvc_server_bg.c +++ b/server/ctsvc_server_bg.c @@ -140,10 +140,12 @@ static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s *data) ret = ctsvc_query_exec(query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("DB Fail"); ctsvc_end_trans(false); g_slist_free(list); return ret; + /* LCOV_EXCL_STOP */ } cursor = g_slist_next(cursor); } @@ -194,10 +196,12 @@ static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s *data) ret = ctsvc_query_exec(query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("DB Fail"); ctsvc_end_trans(false); g_slist_free(list); return ret; + /* LCOV_EXCL_STOP */ } cursor = g_slist_next(cursor); } @@ -219,18 +223,22 @@ static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_s *data) data->current_contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB Fail"); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d", data->current_contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB Fail"); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); @@ -240,19 +248,23 @@ static int __ctsvc_server_bg_contact_delete_step4(__ctsvc_delete_data_s *data) static bool __ctsvc_server_bg_contact_delete_step(int ret, __ctsvc_delete_data_s *data) { if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) { + /* LCOV_EXCL_START */ if (data->contact_ids) g_slist_free(data->contact_ids); ERR("Fail(%d)", ret); return false; + /* LCOV_EXCL_STOP */ } switch (data->step) { case STEP_1: if (ret == CONTACTS_ERROR_NO_DATA) { + /* LCOV_EXCL_START */ if (data->contact_ids) g_slist_free(data->contact_ids); ERR("step_1 no_data"); return false; + /* LCOV_EXCL_STOP */ } data->step = STEP_2; break; @@ -300,10 +312,12 @@ static bool __ctsvc_server_db_delete_run(__ctsvc_delete_data_s *data) ret = __ctsvc_server_bg_contact_delete_step4(data); break; default: + /* LCOV_EXCL_START */ ERR("invalid step"); if (data->contact_ids) g_slist_free(data->contact_ids); return false; + /* LCOV_EXCL_STOP */ } return __ctsvc_server_bg_contact_delete_step(ret, data); @@ -337,8 +351,10 @@ static process_stat* __ctsvc_get_cpu_stat() result = calloc(1, sizeof(process_stat)); if (NULL == result) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } for (i = 0; i < 10; i++) { if (i < 3) @@ -388,25 +404,31 @@ static gpointer __ctsvc_server_bg_delete(gpointer user_data) while (1) { callback_data = calloc(1, sizeof(__ctsvc_delete_data_s)); if (callback_data == NULL) { + /* LCOV_EXCL_START */ ERR("calloc fail"); continue; + /* LCOV_EXCL_STOP */ } callback_data->step = STEP_1; ret = ctsvc_connect(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_connect() fail(%d)", ret); free(callback_data); continue; + /* LCOV_EXCL_STOP */ } ctsvc_set_client_access_info(NULL, NULL); ctsvc_server_stop_timeout(); while (1) { if (__ctsvc_cpu_is_busy()) { /* sleep 1 sec in function */ + /* LCOV_EXCL_START */ ERR("Now CPU is busy.. waiting"); sleep(CTSVC_SERVER_BG_DELETE_STEP_TIME*59); /* sleep 60 sec(1 min) totally */ continue; + /* LCOV_EXCL_STOP */ } if (__ctsvc_server_db_delete_run(callback_data) == false) { DBG("end"); @@ -420,7 +442,9 @@ static gpointer __ctsvc_server_bg_delete(gpointer user_data) ret = ctsvc_disconnect(); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("contacts_disconnect Fail(%d)", ret); + /* LCOV_EXCL_STOP */ ctsvc_server_start_timeout(); g_mutex_lock(&__ctsvc_server_bg_delete_mutex); @@ -488,9 +512,13 @@ void ctsvc_server_bg_add_cb() if (ACCOUNT_ERROR_NONE == ret) { ret = account_subscribe_notification(account, __ctsvc_server_account_delete_cb, NULL); if (ACCOUNT_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("account_subscribe_notification() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("account_subscribe_create() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } } diff --git a/server/ctsvc_server_change_subject.c b/server/ctsvc_server_change_subject.c index 422f8a8..de87e8a 100644 --- a/server/ctsvc_server_change_subject.c +++ b/server/ctsvc_server_change_subject.c @@ -45,20 +45,26 @@ static gboolean __ctsvc_publish_changes_with_data(const char *view_uri, char *da indata = pims_ipc_data_create(0); if (NULL == indata) { + /* LCOV_EXCL_START */ ERR("pims_ipc_data_create error\n"); return false; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string(data, indata)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_string() Fail"); pims_ipc_data_destroy(indata); return false; + /* LCOV_EXCL_STOP */ } if (pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, (char*)view_uri, indata) != 0) { + /* LCOV_EXCL_START */ ERR("pims_ipc_svc_publish error (%s)\n", view_uri); pims_ipc_data_destroy(indata); return false; + /* LCOV_EXCL_STOP */ } pims_ipc_data_destroy(indata); @@ -155,13 +161,17 @@ void ctsvc_change_subject_publish_setting(const char *setting_id, int value) RETM_IF(NULL == indata, "pims_ipc_data_create() Fail"); if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(value, indata)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); pims_ipc_data_destroy(indata); return; + /* LCOV_EXCL_STOP */ } if (pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, (char*)setting_id, indata) != 0) + /* LCOV_EXCL_START */ ERR("pims_ipc_svc_publish error (%s)", setting_id); + /* LCOV_EXCL_STOP */ pims_ipc_data_destroy(indata); } @@ -175,15 +185,19 @@ void ctsvc_change_subject_publish_status(contacts_db_status_e status) RETM_IF(NULL == indata, "pims_ipc_data_create() Fail"); if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(status, indata)) { + /* LCOV_EXCL_START */ ERR("ctsvc_ipc_marshal_int() Fail"); pims_ipc_data_destroy(indata); return; + /* LCOV_EXCL_STOP */ } ret = pims_ipc_svc_publish(CTSVC_IPC_SUBSCRIBE_MODULE, CTSVC_IPC_SERVER_DB_STATUS_CHANGED, indata); if (0 != ret) + /* LCOV_EXCL_START */ ERR("pims_ipc_svc_publish(service status) Fail(%d)", ret); + /* LCOV_EXCL_STOP */ pims_ipc_data_destroy(indata); } diff --git a/server/ctsvc_server_group.c b/server/ctsvc_server_group.c index 32f6712..131ecad 100644 --- a/server/ctsvc_server_group.c +++ b/server/ctsvc_server_group.c @@ -113,38 +113,48 @@ int ctsvc_group_add_contact(int group_id, int contact_id) "SELECT addressbook_id from "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } /* DOING JOB */ do { int changed = ctsvc_group_add_contact_in_transaction(group_id, contact_id); if (changed < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_group_add_contact_in_transaction() Fail(%d)", changed); ret = changed; break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ret = CONTACTS_ERROR_DB; break; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -210,38 +220,48 @@ int ctsvc_group_remove_contact(int group_id, int contact_id) "SELECT addressbook_id from "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } /* DOING JOB */ do { int changed = ctsvc_group_remove_contact_in_transaction(group_id, contact_id); if (changed < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_group_remove_contact_in_transaction() Fail(%d)", changed); ret = changed; break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ret = CONTACTS_ERROR_DB; break; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -269,13 +289,17 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr "SELECT addressbook_id from "CTS_TABLE_GROUPS" WHERE group_id = %d", group_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : group_id (%d) is not exist", group_id); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT group_prio, addressbook_id FROM "CTS_TABLE_GROUPS" WHERE group_id = ?"); @@ -327,17 +351,21 @@ int ctsvc_group_set_group_order(int group_id, int previous_group_id, int next_gr ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_group_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } diff --git a/server/ctsvc_server_person.c b/server/ctsvc_server_person.c index 6357007..4b7311e 100644 --- a/server/ctsvc_server_person.c +++ b/server/ctsvc_server_person.c @@ -70,12 +70,14 @@ static inline int __ctsvc_get_person_default_number_value(int id, contacts_recor ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ctsvc_stmt_finalize(stmt); ERR("ctsvc_stmt_step() Fail(%d)", ret); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_number._uri, (contacts_record_h*)&number); @@ -94,7 +96,9 @@ static inline int __ctsvc_get_person_default_number_value(int id, contacts_recor *record = (contacts_record_h)number; ret = CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail"); + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -120,12 +124,14 @@ static inline int __ctsvc_get_person_default_email_value(int id, contacts_record ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ctsvc_stmt_finalize(stmt); ERR("ctsvc_stmt_step() Fail(%d)", ret); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_email._uri, (contacts_record_h*)&email); @@ -142,7 +148,9 @@ static inline int __ctsvc_get_person_default_email_value(int id, contacts_record *record = (contacts_record_h)email; ret = CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail"); + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -169,12 +177,14 @@ static inline int __ctsvc_get_person_default_image_value(int id, contacts_record ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ctsvc_stmt_finalize(stmt); ERR("ctsvc_stmt_step() Fail(%d)", ret); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_image._uri, (contacts_record_h*)&image); @@ -191,7 +201,9 @@ static inline int __ctsvc_get_person_default_image_value(int id, contacts_record *record = (contacts_record_h)image; ret = CONTACTS_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail"); + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -219,8 +231,10 @@ static int __ctsvc_get_person_value(int op_code, RETVM_IF(ret != CONTACTS_ERROR_NONE, ret, "__ctsvc_get_person_default_image_value() Fail(%d)", ret); break; default: + /* LCOV_EXCL_START */ ERR("The op_code(%d) is not supported", op_code); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (NULL == *record) @@ -251,21 +265,27 @@ static inline int __ctsvc_put_person_default_name(int person_id, int contact_id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } else { ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; } else { return CONTACTS_ERROR_NONE; } + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("contact(%d) does not belong to person(%d), to person(%d)", contact_id, person_id, ret); ret = CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } return ret; @@ -292,16 +312,20 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) CONTACTS_DATA_TYPE_IMAGE, person_id, id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } is_default = ctsvc_stmt_get_int(stmt, 0); @@ -317,10 +341,12 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) CONTACTS_DATA_TYPE_IMAGE, person_id); ret = ctsvc_query_exec(query); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); free(image_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* unset is_default of all data of person if the data is not default */ @@ -331,10 +357,12 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); free(image_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } thumbnail_path = ctsvc_utils_make_thumbnail(image_path); @@ -349,10 +377,12 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) "UPDATE "CTS_TABLE_DATA" SET is_primary_default=1, is_default=1 WHERE id=%d ", id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); free(thumbnail_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* update person's image_thumbnail_path */ @@ -360,20 +390,24 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) "UPDATE "CTS_TABLE_PERSONS" SET image_thumbnail_path=? WHERE person_id=%d ", person_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(thumbnail_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_bind_text(stmt, 1, thumbnail_path); ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); free(thumbnail_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -383,20 +417,24 @@ static inline int __ctsvc_put_person_default_image(int person_id, int id) "UPDATE "CTS_TABLE_CONTACTS" SET image_thumbnail_path=? WHERE contact_id=%d ", contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(thumbnail_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_bind_text(stmt, 1, thumbnail_path); ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); free(thumbnail_path); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); } @@ -428,9 +466,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } is_default = ctsvc_stmt_get_int(stmt, 0); @@ -450,9 +490,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat ret = ctsvc_query_exec(query); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* unset is_default of all data of person if the data is not default */ @@ -464,9 +506,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } @@ -476,9 +520,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (datatype == CONTACTS_DATA_TYPE_NUMBER) @@ -493,9 +539,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat "SELECT name_contact_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person_id); ret = ctsvc_query_get_first_int_result(query, &name_contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (name_contact_id != contact_id) { @@ -504,9 +552,11 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat "SELECT display_name_source FROM "CTS_TABLE_CONTACTS" WHERE contact_id = %d", name_contact_id); ret = ctsvc_query_get_first_int_result(query, &org_source_type); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (org_source_type <= source_type) { @@ -515,17 +565,21 @@ static inline int __ctsvc_put_person_default_data(int person_id, int id, int dat CTS_TABLE_PERSONS, contact_id, person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } } ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -598,13 +652,17 @@ int ctsvc_person_aggregate(int person_id) RETVM_IF(NULL == stmt, ret, "ctsvc_query_prepare() Fail(%d)", ret); if (1 != ctsvc_stmt_step(stmt)) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail\n"); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_person._uri, (contacts_record_h*)&person); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_record_create() Fail\n"); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } person->person_id = ctsvc_stmt_get_int(stmt, 0); person->name_contact_id = ctsvc_stmt_get_int(stmt, 1); @@ -658,10 +716,12 @@ int ctsvc_person_aggregate(int person_id) CTS_TABLE_CONTACTS, CTS_TABLE_ACTIVITIES, person->person_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(image_thumbnail_path); contacts_record_destroy((contacts_record_h)person, true); return ret; + /* LCOV_EXCL_STOP */ } if (1 == ctsvc_stmt_step(stmt)) { @@ -722,6 +782,7 @@ int ctsvc_person_aggregate(int person_id) CTS_TABLE_CONTACTS, person_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(image_thumbnail_path); free(ringtone_path); @@ -729,6 +790,7 @@ int ctsvc_person_aggregate(int person_id) free(message_alert); free(status); return ret; + /* LCOV_EXCL_STOP */ } link_count = 0; @@ -825,6 +887,7 @@ int ctsvc_person_aggregate(int person_id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(addressbook_ids); free(image_thumbnail_path); @@ -833,6 +896,7 @@ int ctsvc_person_aggregate(int person_id) free(message_alert); free(status); return ret; + /* LCOV_EXCL_STOP */ } if (addressbook_ids) @@ -850,6 +914,7 @@ int ctsvc_person_aggregate(int person_id) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); free(addressbook_ids); @@ -859,6 +924,7 @@ int ctsvc_person_aggregate(int person_id) free(message_alert); free(status); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -875,8 +941,10 @@ int ctsvc_person_aggregate(int person_id) "DELETE FROM "CTS_TABLE_FAVORITES" WHERE person_id = %d", person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -971,9 +1039,11 @@ int ctsvc_person_link_person(int base_person_id, int person_id) CTS_TABLE_CONTACTS, base_person_id, person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_person_aggregate(base_person_id); @@ -1001,9 +1071,11 @@ int ctsvc_person_link_person(int base_person_id, int person_id) CTS_TABLE_PERSONS, person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* *#ifdef _CONTACTS_IPC_SERVER @@ -1017,17 +1089,21 @@ int ctsvc_person_link_person(int base_person_id, int person_id) "INSERT INTO "CTS_TABLE_FAVORITES" values(%d, %f)", base_person_id, favorite_prio); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -1062,9 +1138,11 @@ static int __ctsvc_update_primary_default_data(int person_id) ret = ctsvc_query_prepare(query, &stmt_number); if (NULL == stmt_number) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (1 == ctsvc_stmt_step(stmt_number)) { @@ -1102,9 +1180,11 @@ static int __ctsvc_update_primary_default_data(int person_id) ret = ctsvc_query_prepare(query, &stmt_email); if (NULL == stmt_email) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (1 == ctsvc_stmt_step(stmt_email)) { @@ -1142,9 +1222,11 @@ static int __ctsvc_update_primary_default_data(int person_id) ret = ctsvc_query_prepare(query, &stmt_image); if (NULL == stmt_image) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (1 == ctsvc_stmt_step(stmt_image)) { @@ -1191,25 +1273,31 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_i } if (link_count == 1) { + /* LCOV_EXCL_START */ ERR("This person(%d) has one contact(%d)", person_id, contact_id); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_get(contact_id, (contacts_record_h*)&record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_get() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* create new person */ id = ctsvc_db_insert_person(record); if (id < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_insert_person() Fail(%d)", id); ctsvc_end_trans(false); contacts_record_destroy(record, true); return id; + /* LCOV_EXCL_STOP */ } /* insert statistic info for new person */ @@ -1219,10 +1307,12 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_i CTS_TABLE_CONTACT_STAT, id, CTS_TABLE_CONTACT_STAT, person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } is_favorite = __ctsvc_get_person_favorite_info(person_id, &priority); @@ -1233,19 +1323,23 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_i CTS_TABLE_CONTACTS, id, contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } /* update bsae person info */ ret = ctsvc_person_aggregate(person_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_person_aggregate(%d) Fail(%d)", person_id, ret); ctsvc_end_trans(false); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } if (is_favorite && ((ctsvc_contact_s*)record)->is_favorite) { @@ -1253,10 +1347,12 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_i "INSERT OR REPLACE INTO "CTS_TABLE_FAVORITES" values(%d, %f)", id, priority); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } } contacts_record_destroy(record, true); @@ -1273,8 +1369,10 @@ int ctsvc_person_unlink_contact(int person_id, int contact_id, int *out_person_i ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -1321,15 +1419,19 @@ int ctsvc_person_reset_usage(int person_id, contacts_usage_type_e type) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -1377,17 +1479,21 @@ int ctsvc_person_set_favorite_order(int person_id, int front_person_id, int back ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -1419,9 +1525,11 @@ int ctsvc_person_set_default_property(contacts_person_property_e property, int p break; } if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_person_set_default_property() Fail(%d) : person property (%d)", ret, property); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } #ifdef _CONTACTS_IPC_SERVER @@ -1554,11 +1662,11 @@ static void __ctsvc_collate_names(contacts_record_h record, GSList **names) if (name && comp_name_len <= strlen(name)) { if (CTSVC_SORT_KOREAN == contact->display_name_language) { /*compare first name*/ strncpy(comp_name, name + (strlen(name) -comp_name_len), - comp_name_len); - } else { /*compare last name*/ + comp_name_len); + } else { /*compare last name*/ comp_name_len = strcspn(name, ", "); strncpy(comp_name, name, comp_name_len); - } + } if (NULL == *names || NULL == g_slist_find(*names, comp_name)) *names = g_slist_append(*names, strdup(comp_name)); @@ -1586,9 +1694,11 @@ static int __ctsvc_get_person_info_by_person_id(int person_id, GSList **nums, GS int contact_id = 0; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -1597,8 +1707,10 @@ static int __ctsvc_get_person_info_by_person_id(int person_id, GSList **nums, GS ctsvc_stmt_finalize(stmt); if (NULL == contact_ids) { + /* LCOV_EXCL_START */ ERR("Fail to get contacts by person_id"); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } for (cursor = contact_ids; cursor; cursor = cursor->next) { @@ -1738,22 +1850,26 @@ int ctsvc_person_get_aggregation_suggestions(int person_id, int limit, contacts_ ret = __ctsvc_get_person_info_by_person_id(person_id, &nums, &emails, &names); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_get_person_info_by_person_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } sub_query = calloc(1, sub_size); if (NULL == sub_query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); g_slist_free_full(nums, free); g_slist_free_full(emails, free); g_slist_free_full(names, free); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (nums) { - __ctsvc_make_sub_query_by_num(nums, person_id, &sub_query, &sub_size, &sub_len); - g_slist_free_full(nums, free); + __ctsvc_make_sub_query_by_num(nums, person_id, &sub_query, &sub_size, &sub_len); + g_slist_free_full(nums, free); } if (emails) { @@ -1776,9 +1892,11 @@ int ctsvc_person_get_aggregation_suggestions(int person_id, int limit, contacts_ query_size = CTS_SQL_MIN_LEN + sub_len; query = calloc(1, query_size); if (NULL == query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(sub_query); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(query, query_size, @@ -1787,20 +1905,24 @@ int ctsvc_person_get_aggregation_suggestions(int person_id, int limit, contacts_ sub_query); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare fail(%d)", ret); free(sub_query); free(query); return ret; + /* LCOV_EXCL_STOP */ } sub_len = 0; while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); free(sub_query); free(query); return ret; + /* LCOV_EXCL_STOP */ } id = ctsvc_stmt_get_int(stmt, 0); score = ctsvc_stmt_get_int(stmt, 1); @@ -1852,25 +1974,31 @@ int ctsvc_person_get_aggregation_suggestions(int person_id, int limit, contacts_ ret = ctsvc_query_prepare(query, &stmt); free(query); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_person_create_record_from_stmt(stmt, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); diff --git a/server/ctsvc_server_phonelog.c b/server/ctsvc_server_phonelog.c index c927f4a..c809b9d 100644 --- a/server/ctsvc_server_phonelog.c +++ b/server/ctsvc_server_phonelog.c @@ -52,8 +52,10 @@ int ctsvc_phone_log_reset_statistics_by_sim(int sim_slot_no) sim_info_id = ctsvc_server_sim_get_info_id_by_sim_slot_no(sim_slot_no); if (sim_info_id <= 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_sim_get_info_id_by_sim_slot_no() Fail(%d)", sim_info_id); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_PHONELOG_STAT @@ -96,17 +98,21 @@ int ctsvc_phone_log_delete(contacts_phone_log_delete_e op, ...) extra_data1, CONTACTS_PLOG_TYPE_EMAIL_RECEIVED, CONTACTS_PLOG_TYPE_EMAIL_SENT); break; default: + /* LCOV_EXCL_START */ ERR("the operation is not proper (op : %d)", op); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_begin_trans(); RETVM_IF(ret, ret, "ctsvc_begin_trans() Fail(%d)", ret); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_phonelog_noti(); ret = ctsvc_end_trans(true); @@ -133,7 +139,7 @@ void ctsvc_db_phone_log_delete_callback(sqlite3_context *context, } static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, - char *minmatch, int person_id, int *find_number_type) + char *minmatch, int person_id, int *find_number_type) { int ret; int find_person_id = -1; @@ -162,6 +168,7 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, ret = ctsvc_query_prepare(query, &stmt); if (stmt == NULL) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare fail(%d)", ret); if (bind_text) { for (cursor = bind_text; cursor; cursor = cursor->next) @@ -169,6 +176,7 @@ static int __ctsvc_db_phone_log_find_person_id(char *number, char *normal_num, g_slist_free(bind_text); } return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -265,6 +273,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, ret = ctsvc_query_prepare(query, &get_log); if (get_log == NULL) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); if (bind_text) { for (cursor = bind_text; cursor; cursor = cursor->next) @@ -272,6 +281,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, g_slist_free(bind_text); } return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -286,6 +296,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, "UPDATE "CTS_TABLE_PHONELOGS" SET person_id=?, number_type = ? WHERE id = ?"); ret = ctsvc_query_prepare(query, &update_log); if (update_log == NULL) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_stmt_finalize(get_log); @@ -295,6 +306,7 @@ int ctsvc_db_phone_log_update_person_id(const char *number, int old_person_id, g_slist_free(bind_text); } return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } while ((ret = ctsvc_stmt_step(get_log))) { diff --git a/server/ctsvc_server_service.c b/server/ctsvc_server_service.c index f73fb2e..43483fc 100644 --- a/server/ctsvc_server_service.c +++ b/server/ctsvc_server_service.c @@ -43,9 +43,11 @@ int ctsvc_connect() if (0 == ctsvc_connection) { ret = ctsvc_inotify_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_inotify_init() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_plugin_init(); ctsvc_view_uri_init(); @@ -59,9 +61,11 @@ int ctsvc_connect() if (0 == thread_connection) { ret = ctsvc_db_init(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_init() Fail(%d)", ret); ctsvc_mutex_unlock(CTS_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } } thread_connection++; diff --git a/server/ctsvc_server_sim.c b/server/ctsvc_server_sim.c index e3a140a..6a9e2e0 100644 --- a/server/ctsvc_server_sim.c +++ b/server/ctsvc_server_sim.c @@ -110,8 +110,10 @@ static TapiHandle* __ctsvc_server_sim_get_tapi_handle(ctsvc_sim_info_s *info) vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady); if (0 == bReady) { + /* LCOV_EXCL_START */ ERR("telephony is not ready "); return NULL; + /* LCOV_EXCL_STOP */ } else { info->handle = tel_init(info->cp_name); RETVM_IF(NULL == info->handle, NULL, "tel_init() Fail"); @@ -155,8 +157,10 @@ static sim_contact_s * __ctsvc_server_sim_record_clone(TelSimPbRecord_t *sim_rec { sim_contact_s *record = calloc(1, sizeof(sim_contact_s)); if (NULL == record) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } record->sim_index = sim_record->index; @@ -378,23 +382,29 @@ static int __ctsvc_server_sim_insert_records_to_db(ctsvc_sim_info_s *info) /* insert contacts to DB */ ret = contacts_list_create(&list); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_create() Fail(%d)", ret); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } for (cursor = info->import_contacts, i = 0; cursor; i++) { record = cursor->data; ret = __ctsvc_server_sim_ctsvc_record_clone(record, DEFAULT_ADDRESS_BOOK_ID, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_server_sim_ctsvc_record_clone() Fail(%d)", ret); contacts_list_destroy(list, true); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } ret = contacts_list_add(list, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_add() Fail(%d)", ret); contacts_list_destroy(list, true); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } cursor = cursor->next; } @@ -404,9 +414,11 @@ static int __ctsvc_server_sim_insert_records_to_db(ctsvc_sim_info_s *info) if (0 < count) { ret = ctsvc_db_insert_records(list, NULL, NULL); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_insert_records() Fail(%d)", ret); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } } @@ -424,20 +436,24 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, ctsvc_sim_info_s *info; if (NULL == sim_info) { + /* LCOV_EXCL_START */ ERR("sim_info is NULL, result = %d", access_rt); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } info = __ctsvc_server_sim_get_info_by_tapi_handle(handle); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("__ctsvc_server_sim_get_info_by_tapi_handle() Fail"); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } if (TAPI_SIM_PB_INVALID_INDEX == access_rt) { @@ -447,6 +463,7 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, DBG("TAPI_SIM_PB_INVALID_INDEX : start_index = %d", start_index); start_index++; if (info->file_record[TAPI_PB_3G_NAME].index_max < start_index) { + /* LCOV_EXCL_START */ ERR("start_index is invalid start_index = %d, total = %d", start_index, info->file_record[TAPI_PB_3G_NAME].index_max); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_INTERNAL, 0, NULL); @@ -454,27 +471,32 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, __ctsvc_server_sim_destroy_import_contacts(info); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } ret = tel_read_sim_pb_record(handle, info->sim_type, start_index, __ctsvc_server_sim_import_contact_cb, (void*)start_index); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("SIM phonebook access Fail(%d) start_indext(%d)", access_rt, start_index); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_destroy_import_contacts(info); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } return; } if (TAPI_SIM_PB_SUCCESS != access_rt) { + /* LCOV_EXCL_START */ ERR("SIM phonebook access Fail(%d)", access_rt); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_destroy_import_contacts(info); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } switch (sim_info->phonebook_type) { @@ -486,12 +508,14 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, case TAPI_SIM_PB_FDN: case TAPI_SIM_PB_SDN: default: + /* LCOV_EXCL_START */ ERR("Unknown storage type(%d)", sim_info->phonebook_type); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_destroy_import_contacts(info); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) { @@ -500,12 +524,14 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result, sim_info->next_index, __ctsvc_server_sim_import_contact_cb, NULL); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_read_sim_pb_record() Fail(%d)", ret); ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL); WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret); __ctsvc_server_sim_destroy_import_contacts(info); __ctsvc_server_sim_set_return_data(NULL); return; + /* LCOV_EXCL_STOP */ } } else { /* insert imported contact to DB */ @@ -544,9 +570,11 @@ int ctsvc_server_sim_import_contact(void *data, int sim_slot_no) ret = tel_read_sim_pb_record(__ctsvc_server_sim_get_tapi_handle(info), info->sim_type, 1, __ctsvc_server_sim_import_contact_cb, NULL); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_read_sim_pb_record = %d", ret); __ctsvc_server_sim_set_return_data(NULL); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -583,9 +611,11 @@ static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void __ctsvc_server_sim_sdn_read_cb, info); RETM_IF(TAPI_API_SUCCESS != ret, "tel_read_sim_pb_record() Fail(%d)", ret); } + /* LCOV_EXCL_START */ ERR("SIM phonebook access Fail(%d)", access_rt); ctsvc_server_trim_memory(); return; + /* LCOV_EXCL_STOP */ } switch (sim_info->phonebook_type) { @@ -597,9 +627,11 @@ static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void case TAPI_SIM_PB_3GSIM: case TAPI_SIM_PB_FDN: default: + /* LCOV_EXCL_START */ ERR("Not SDN type(%d)", sim_info->phonebook_type); ctsvc_server_trim_memory(); return; + /* LCOV_EXCL_STOP */ } if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) { @@ -607,9 +639,11 @@ static void __ctsvc_server_sim_sdn_read_cb(TapiHandle *handle, int result, void ret = tel_read_sim_pb_record(handle, sim_info->phonebook_type, sim_info->next_index, __ctsvc_server_sim_sdn_read_cb, info); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_read_sim_pb_record() Fail(%d)", ret); ctsvc_server_trim_memory(); return; + /* LCOV_EXCL_STOP */ } } else { ctsvc_server_trim_memory(); @@ -630,12 +664,16 @@ static void __ctsvc_server_sim_sdn_count_cb(TapiHandle *handle, int result, void if (0 < ps->UsedRecordCount) { ret = tel_read_sim_pb_record(info->handle, TAPI_SIM_PB_SDN, 1, __ctsvc_server_sim_sdn_read_cb, info); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_read_sim_pb_record() Fail(%d)", ret); ctsvc_server_trim_memory(); return; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("ps->UsedRecordCount:0. No SDN!!!!"); + /* LCOV_EXCL_STOP */ } ctsvc_server_trim_memory(); } @@ -652,37 +690,47 @@ static int __ctsvc_server_sim_sdn_read(ctsvc_sim_info_s *info) ret = tel_get_sim_init_info(info->handle, &sim_status, &card_changed); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_get_sim_init_info() Fail(%d)", ret); DBG("sim_status = %d, card_changed = %d", sim_status, card_changed); ctsvc_server_trim_memory(); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } if (TAPI_SIM_STATUS_CARD_NOT_PRESENT == sim_status || TAPI_SIM_STATUS_CARD_REMOVED == sim_status) { ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret); ctsvc_server_trim_memory(); return ret; + /* LCOV_EXCL_STOP */ } } else if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED == sim_status) { ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret); ctsvc_server_trim_memory(); return ret; + /* LCOV_EXCL_STOP */ } ret = tel_get_sim_pb_count(info->handle, TAPI_SIM_PB_SDN, __ctsvc_server_sim_sdn_count_cb, info); if (TAPI_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ ERR("tel_get_sim_pb_meta_info() Fail(%d)", ret); ctsvc_server_trim_memory(); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("sim_status Fail(%d)", sim_status); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -738,8 +786,10 @@ static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result, info->file_record[CTSVC_2GSIM_NAME].text_max, info->file_record[CTSVC_2GSIM_NAME].used_count); } else { + /* LCOV_EXCL_START */ ERR("sim_type [%d]error ", info->sim_type); return; + /* LCOV_EXCL_STOP */ } if (false == info->initialized) { @@ -783,8 +833,10 @@ static int __ctsvc_server_sim_get_type_and_iccid(ctsvc_sim_info_s *info) } else if (TAPI_SIM_CARD_TYPE_GSM == cardtype) { info->sim_type = TAPI_SIM_PB_ADN; } else { + /* LCOV_EXCL_START */ ERR("cardtype(%d)is invalid!!!", cardtype); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } /* set iccid : unique info of SIM */ @@ -811,8 +863,10 @@ static int __ctsvc_server_sim_init_meta_info(ctsvc_sim_info_s *info) } else if (TAPI_SIM_PB_ADN == info->sim_type) { ret = tel_get_sim_pb_meta_info(info->handle, info->sim_type, __ctsvc_server_sim_get_meta_info_cb, info); } else { + /* LCOV_EXCL_START */ ERR("info->sim_type is invalid(%d) stop sim init !!!", info->sim_type); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } RETVM_IF(TAPI_API_SUCCESS != ret, CONTACTS_ERROR_SYSTEM, @@ -842,7 +896,9 @@ static void __ctsvc_server_sim_noti_pb_status(TapiHandle *handle, const char *no info->initialized = false; __ctsvc_server_sim_destroy_import_contacts(info); } else { + /* LCOV_EXCL_START */ ERR("This noti did not control !!!"); + /* LCOV_EXCL_STOP */ } } @@ -888,8 +944,10 @@ static void __ctsvc_server_sim_status_events_cb(TapiHandle *handle, const char * ctsvc_sim_info_s *info = (ctsvc_sim_info_s *)user_data; if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED != status) { + /* LCOV_EXCL_START */ ERR("sim is not ready (%d)", status); return; + /* LCOV_EXCL_STOP */ } INFO("sim is Ready"); @@ -926,9 +984,11 @@ static int __ctsvc_server_sim_init_info() int card_changed = 0; ctsvc_sim_info_s *info = calloc(1, sizeof(ctsvc_sim_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); g_strfreev(cp_name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } info->cp_name = strdup(cp_name[cp_index]); INFO("SIM cp_name[%d] : %s", cp_index, info->cp_name); @@ -949,18 +1009,24 @@ static int __ctsvc_server_sim_init_info() __ctsvc_server_sim_get_tapi_handle(info); if (NULL == info->handle) { + /* LCOV_EXCL_START */ ERR("__ctsvc_server_sim_get_tapi_handle() Fail"); continue; + /* LCOV_EXCL_STOP */ } __ctsvc_sim_info = g_slist_append(__ctsvc_sim_info, (void*)info); cp_index++; ret = tel_get_sim_init_info(info->handle, &status, &card_changed); if (TAPI_API_SUCCESS != ret || TAPI_SIM_STATUS_SIM_INIT_COMPLETED != status) { + /* LCOV_EXCL_START */ ERR("tel_get_sim_init_info() ret(%d), status(%d)", ret, status); ret = tel_register_noti_event(info->handle, TAPI_NOTI_SIM_STATUS, __ctsvc_server_sim_status_events_cb, info); + /* LCOV_EXCL_STOP */ if (TAPI_API_SUCCESS != ret) + /* LCOV_EXCL_START */ ERR("tel_register_noti_event() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } else { __ctsvc_server_sim_get_info(info); } @@ -977,8 +1043,10 @@ static void __ctsvc_server_telephony_ready_cb(keynode_t *key, void *data) vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady); if (0 == bReady) { + /* LCOV_EXCL_START */ ERR("telephony is not ready "); return; + /* LCOV_EXCL_STOP */ } INFO("telephony is Ready"); @@ -997,10 +1065,12 @@ int ctsvc_server_sim_init() vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady); if (0 == bReady) { + /* LCOV_EXCL_START */ ERR("telephony is not ready "); vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, __ctsvc_server_telephony_ready_cb, NULL); __ctsvc_tapi_cb = true; return CONTACTS_ERROR_NONE; + /* LCOV_EXCL_STOP */ } return __ctsvc_server_sim_init_info(); diff --git a/server/ctsvc_server_socket.c b/server/ctsvc_server_socket.c index bf83bf7..a66d63e 100644 --- a/server/ctsvc_server_socket.c +++ b/server/ctsvc_server_socket.c @@ -135,9 +135,11 @@ static void __ctsvc_server_socket_import_sim(GIOChannel *src, int size) if (0 < size) { g_io_channel_read_chars(src, receiver, size, &len, &gerr); if (gerr) { + /* LCOV_EXCL_START */ ERR("g_io_channel_read_chars() Fail(%s)", gerr->message); g_error_free(gerr); return; + /* LCOV_EXCL_STOP */ } DBG("Receiver = %s(%d), read_size = %d", receiver, len, size); } @@ -151,8 +153,10 @@ static void __ctsvc_server_socket_import_sim(GIOChannel *src, int size) } if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_sim_import_contact() Fail(%d)", ret); ctsvc_server_socket_return(src, ret, 0, NULL); + /* LCOV_EXCL_STOP */ } } @@ -168,9 +172,11 @@ static void __ctsvc_server_socket_get_sim_init_status(GIOChannel *src, int size) if (0 < size) { g_io_channel_read_chars(src, receiver, size, &len, &gerr); if (gerr) { + /* LCOV_EXCL_START */ ERR("g_io_channel_read_chars() Fail(%s)", gerr->message); g_error_free(gerr); return; + /* LCOV_EXCL_STOP */ } DBG("Receiver = %s(%d), read_size = %d", receiver, len, size); } @@ -184,8 +190,10 @@ static void __ctsvc_server_socket_get_sim_init_status(GIOChannel *src, int size) } if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_socket_get_sim_init_status() Fail(%d)", ret); ctsvc_server_socket_return(src, ret, 0, NULL); + /* LCOV_EXCL_STOP */ } } @@ -217,8 +225,10 @@ static void __ctsvc_server_socket_read_flush(GIOChannel *src, int size) g_io_channel_read_chars(src, receiver, size, &len, &gerr); if (gerr) { + /* LCOV_EXCL_START */ ERR("g_io_channel_read_chars() Fail(%s)", gerr->message); g_error_free(gerr); + /* LCOV_EXCL_STOP */ } } @@ -231,10 +241,12 @@ static int _ctsvc_server_initialize_cynara() ret = cynara_initialize(&_cynara, NULL); ctsvc_mutex_unlock(CTS_MUTEX_CYNARA); if (CYNARA_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ char errmsg[1024] = {0}; cynara_strerror(ret, errmsg, sizeof(errmsg)); ERR("cynara_initialize() Fail(%d,%s)", ret, errmsg); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -248,9 +260,11 @@ static void _ctsvc_server_finalize_cynara() _cynara = NULL; ctsvc_mutex_unlock(CTS_MUTEX_CYNARA); if (CYNARA_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ char errmsg[1024] = {0}; cynara_strerror(ret, errmsg, sizeof(errmsg)); ERR("cynara_finish() Fail(%d,%s)", ret, errmsg); + /* LCOV_EXCL_STOP */ } } @@ -296,10 +310,12 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit bool have_telephony_feature = false; have_telephony_feature = ctsvc_server_have_telephony_feature(); if (false == have_telephony_feature) { + /* LCOV_EXCL_START */ ERR("Telephony feature disabled"); __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]); /* sim_id */ ctsvc_server_socket_return(src, CONTACTS_ERROR_NOT_SUPPORTED, 0, NULL); return TRUE; + /* LCOV_EXCL_STOP */ } ctsvc_mutex_lock(CTS_MUTEX_SOCKET_CLIENT_INFO); @@ -316,25 +332,31 @@ static gboolean __ctsvc_server_socket_request_handler(GIOChannel *src, GIOCondit switch (msg.type) { case CTSVC_SOCKET_MSG_TYPE_REQUEST_IMPORT_SIM: if (false == have_write_permission) { + /* LCOV_EXCL_START */ ERR("write permission denied"); __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]); /* sim_id */ ctsvc_server_socket_return(src, CONTACTS_ERROR_PERMISSION_DENIED, 0, NULL); return TRUE; + /* LCOV_EXCL_STOP */ } __ctsvc_server_socket_import_sim(src, msg.attach_sizes[0]); break; case CTSVC_SOCKET_MSG_TYPE_REQUEST_SIM_INIT_COMPLETE: if (false == have_read_permission) { + /* LCOV_EXCL_START */ ERR("read permission denied"); __ctsvc_server_socket_read_flush(src, msg.attach_sizes[0]); /* sim_id */ ctsvc_server_socket_return(src, CONTACTS_ERROR_PERMISSION_DENIED, 0, NULL); return TRUE; + /* LCOV_EXCL_STOP */ } __ctsvc_server_socket_get_sim_init_status(src, msg.attach_sizes[0]); break; default: + /* LCOV_EXCL_START */ ERR("Unknown request type(%d)", msg.type); break; + /* LCOV_EXCL_STOP */ } return TRUE; } @@ -359,39 +381,49 @@ static int _ctsvc_server_create_client_info(int fd, struct client_info **p_info) struct client_info *info = calloc(1, sizeof(struct client_info)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() return NULL"); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = cynara_creds_socket_get_client(fd, CLIENT_METHOD_SMACK, &(info->smack)); if (CYNARA_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ cynara_strerror(ret, errmsg, sizeof(errmsg)); ERR("cynara_creds_socket_get_client() Fail(%d,%s)", ret, errmsg); _ctsvc_server_destroy_client_info(info); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = cynara_creds_socket_get_user(fd, USER_METHOD_UID, &(info->uid)); if (CYNARA_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ cynara_strerror(ret, errmsg, sizeof(errmsg)); ERR("cynara_creds_socket_get_user() Fail(%d,%s)", ret, errmsg); _ctsvc_server_destroy_client_info(info); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = cynara_creds_socket_get_pid(fd, &pid); if (CYNARA_API_SUCCESS != ret) { + /* LCOV_EXCL_START */ cynara_strerror(ret, errmsg, sizeof(errmsg)); ERR("cynara_creds_socket_get_pid() Fail(%d,%s)", ret, errmsg); _ctsvc_server_destroy_client_info(info); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } info->client_session = cynara_session_from_pid(pid); if (NULL == info->client_session) { + /* LCOV_EXCL_START */ ERR("cynara_session_from_pid() return NULL"); _ctsvc_server_destroy_client_info(info); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } *p_info = info; @@ -418,7 +450,9 @@ static gboolean __ctsvc_server_socket_handler(GIOChannel *src, struct client_info *info = NULL; ret = _ctsvc_server_create_client_info(client_sockfd, &info); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("_create_client_info() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ else g_hash_table_insert(_client_info_table, GINT_TO_POINTER(client_sockfd), info); @@ -452,24 +486,32 @@ int ctsvc_server_socket_init(void) ret = bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)); if (-1 == ret) { + /* LCOV_EXCL_START */ close(sockfd); ERR("bind() Fail(errno = %d)", errno); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = chown(sock_file, getuid(), CTS_SECURITY_FILE_GROUP); if (0 != ret) + /* LCOV_EXCL_START */ ERR("chown(%s) Fail(%d)", sock_file, ret); + /* LCOV_EXCL_STOP */ ret = chmod(sock_file, CTS_SECURITY_DEFAULT_PERMISSION); if (0 != ret) + /* LCOV_EXCL_START */ ERR("chmod(%s) Fail(%d)", sock_file, ret); + /* LCOV_EXCL_STOP */ ret = listen(sockfd, 30); if (-1 == ret) { + /* LCOV_EXCL_START */ close(sockfd); ERR("listen() Fail(errno = %d)", errno); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } gio = g_io_channel_unix_new(sockfd); diff --git a/server/ctsvc_server_sqlite.c b/server/ctsvc_server_sqlite.c index e69f2ec..f456762 100644 --- a/server/ctsvc_server_sqlite.c +++ b/server/ctsvc_server_sqlite.c @@ -126,8 +126,10 @@ int ctsvc_server_begin_trans(void) } if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } @@ -169,8 +171,10 @@ int ctsvc_server_end_trans(bool success) } while ((SQLITE_BUSY == ret || SQLITE_LOCKED == ret) && i < CTS_COMMIT_TRY_MAX); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(ROLLBACK) Fail(%d) : DB lock", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } else { INFO("rollback end"); return CONTACTS_ERROR_NONE; @@ -195,88 +199,104 @@ int ctsvc_server_update_sort(int prev_sort_primary, int prev_sort_secondary, int CTS_TABLE_CONTACTS, prev_sort_primary, CTSVC_SORT_PRIMARY); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET display_name_language=%d WHERE display_name_language = %d", CTS_TABLE_CONTACTS, prev_sort_secondary, CTSVC_SORT_SECONDARY); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET display_name_language=%d WHERE display_name_language=%d", CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET display_name_language=%d WHERE display_name_language =%d", CTS_TABLE_CONTACTS, CTSVC_SORT_SECONDARY, new_sort_secondary); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d", CTS_TABLE_CONTACTS, prev_sort_primary, CTSVC_SORT_PRIMARY); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d", CTS_TABLE_CONTACTS, prev_sort_secondary, CTSVC_SORT_SECONDARY); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d", CTS_TABLE_CONTACTS, CTSVC_SORT_PRIMARY, new_sort_primary); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE %s SET reverse_display_name_language=%d WHERE reverse_display_name_language = %d", CTS_TABLE_CONTACTS, CTSVC_SORT_SECONDARY, new_sort_secondary); ret = sqlite3_exec(db, query, NULL, NULL, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec(%s) Fail(%d, %s)", query, ret, errmsg); sqlite3_free(errmsg); ctsvc_server_end_trans(false); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = ctsvc_server_set_default_sort(new_sort_primary); @@ -316,9 +336,11 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number, ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } sqlite3_bind_text(stmt, 1, name, strlen(name), SQLITE_STATIC); @@ -327,10 +349,12 @@ int ctsvc_server_insert_sdn_contact(const char *name, const char *number, ret = sqlite3_step(stmt); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); sqlite3_finalize(stmt); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); ctsvc_server_db_close(); @@ -355,16 +379,20 @@ int ctsvc_server_delete_sdn_contact(int sim_slot_no) ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_step(stmt); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); sqlite3_finalize(stmt); ctsvc_server_db_close(); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); @@ -384,17 +412,21 @@ int ctsvc_server_update_collation() ret = ctsvc_server_db_open(&db); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_db_open() Fail(%d)", ret); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_server_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_begin_trans() Fail(%d)", ret); ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -402,11 +434,13 @@ int ctsvc_server_update_collation() "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0"); ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ctsvc_server_end_trans(false); ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -414,12 +448,14 @@ int ctsvc_server_update_collation() "WHERE contact_id = ?"); ret = sqlite3_prepare_v2(db, query, strlen(query), &update_stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); sqlite3_finalize(stmt); ctsvc_server_end_trans(false); ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } while (SQLITE_ROW == (ret = sqlite3_step(stmt))) { @@ -449,6 +485,7 @@ int ctsvc_server_update_collation() free(reverse_sortkey); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db)); sqlite3_finalize(stmt); sqlite3_finalize(update_stmt); @@ -456,6 +493,7 @@ int ctsvc_server_update_collation() ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } sqlite3_reset(update_stmt); @@ -463,6 +501,7 @@ int ctsvc_server_update_collation() } if (SQLITE_ROW != ret && SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); sqlite3_finalize(update_stmt); sqlite3_finalize(stmt); @@ -470,6 +509,7 @@ int ctsvc_server_update_collation() ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(update_stmt); @@ -506,8 +546,10 @@ int ctsvc_server_get_sim_id(const char *unique_id, int *sim_id) "WHERE unique_id = '%s'", unique_id); ret = ctsvc_query_get_first_int_result(query, &id); if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NO_DATA == ret) { @@ -515,8 +557,10 @@ int ctsvc_server_get_sim_id(const char *unique_id, int *sim_id) "INSERT INTO "CTS_TABLE_SIM_INFO" (unique_id) VALUES('%s')", unique_id); ret = ctsvc_query_exec(query); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } id = ctsvc_db_get_last_insert_id(); } @@ -546,9 +590,11 @@ static int __ctsvc_server_db_get_contact_data(sqlite3 *db, int id, ctsvc_contact ret = sqlite3_step(stmt); if (SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } do { @@ -591,8 +637,10 @@ static int __ctsvc_server_get_contact_id_list(sqlite3* db, GList** contact_id_li int ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } int contact_id = 0; @@ -607,10 +655,12 @@ static int __ctsvc_server_get_contact_id_list(sqlite3* db, GList** contact_id_li } if (SQLITE_ROW != ret && SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); g_list_free(list); sqlite3_finalize(stmt); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } list = g_list_reverse(list); @@ -637,26 +687,32 @@ int ctsvc_server_update_sort_name() ret = ctsvc_server_db_open(&db); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_db_open() Fail(%d)", ret); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_server_get_contact_id_list(db, &contact_id_list); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_server_get_contact_id_list() Fail(%d)", ret); ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_server_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_begin_trans() Fail(%d)", ret); g_list_free(contact_id_list); ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } /* Update sort_name, sortkey, display_name_language of contact table */ @@ -668,9 +724,11 @@ int ctsvc_server_update_sort_name() "WHERE contact_id = ?"); ret = sqlite3_prepare_v2(db, query, strlen(query), &update_stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ret = CONTACTS_ERROR_DB; goto DATA_FREE; + /* LCOV_EXCL_STOP */ } /* Update name of search_index table */ @@ -679,9 +737,11 @@ int ctsvc_server_update_sort_name() CTS_TABLE_SEARCH_INDEX); ret = sqlite3_prepare_v2(db, query, strlen(query), &search_name_stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_propare_v2(%s) Fail(%s)", query, sqlite3_errmsg(db)); ret = CONTACTS_ERROR_DB; goto DATA_FREE; + /* LCOV_EXCL_STOP */ } int count = 0; @@ -696,10 +756,12 @@ int ctsvc_server_update_sort_name() contacts_record_create(_contacts_contact._uri, (contacts_record_h*)&contact); ret = __ctsvc_server_db_get_contact_data(db, contact_id, contact); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db)); contacts_record_destroy((contacts_record_h)contact, true); ret = CONTACTS_ERROR_DB; goto DATA_FREE; + /* LCOV_EXCL_STOP */ } /* update sort_name, sortkey, display_name_language(sort group) */ @@ -719,10 +781,12 @@ int ctsvc_server_update_sort_name() ret = sqlite3_step(update_stmt); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db)); contacts_record_destroy((contacts_record_h)contact, true); ret = CONTACTS_ERROR_DB; goto DATA_FREE; + /* LCOV_EXCL_STOP */ } sqlite3_reset(update_stmt); @@ -734,10 +798,12 @@ int ctsvc_server_update_sort_name() ret = sqlite3_step(search_name_stmt); free(search_name); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step(%s) Fail(%d, %s)", query, ret, sqlite3_errmsg(db)); contacts_record_destroy((contacts_record_h)contact, true); ret = CONTACTS_ERROR_DB; goto DATA_FREE; + /* LCOV_EXCL_STOP */ } sqlite3_reset(search_name_stmt); } @@ -752,6 +818,7 @@ int ctsvc_server_update_sort_name() usleep(100*1000); ret = ctsvc_server_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_server_begin_trans() Fail(%d)", ret); g_list_free(contact_id_list); if (update_stmt) @@ -761,6 +828,7 @@ int ctsvc_server_update_sort_name() ctsvc_server_db_close(); ctsvc_db_set_status(CONTACTS_DB_STATUS_NORMAL); return ret; + /* LCOV_EXCL_STOP */ } } } diff --git a/server/ctsvc_server_update.c b/server/ctsvc_server_update.c index a8810ce..0cf980d 100644 --- a/server/ctsvc_server_update.c +++ b/server/ctsvc_server_update.c @@ -64,6 +64,7 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal ret = sqlite3_prepare_v2(__db, query, sizeof(query), &stmt, NULL); if (stmt == NULL) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2 Fail(%d)", ret); if (bind_text) { for (cursor = bind_text; cursor; cursor = cursor->next, i++) @@ -71,6 +72,7 @@ static int __ctsvc_server_find_person_id_of_phonelog(sqlite3 *__db, char *normal g_slist_free(bind_text); } return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -123,8 +125,10 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db) "WHERE log_type < %d", CONTACTS_PLOG_TYPE_EMAIL_RECEIVED); ret = sqlite3_prepare_v2(__db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db)); return; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -132,9 +136,11 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db) "minmatch=?, person_id=?, number_type=? WHERE id = ?"); ret = sqlite3_prepare_v2(__db, query, strlen(query), &update_stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db)); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } while (SQLITE_ROW == (ret = sqlite3_step(stmt))) { @@ -184,17 +190,21 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db) "WHERE datatype = %d", CONTACTS_DATA_TYPE_NUMBER); ret = sqlite3_prepare_v2(__db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db)); return; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_DATA" SET data4=?, data5=?, data6=? WHERE id = ?"); ret = sqlite3_prepare_v2(__db, query, strlen(query), &update_stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(__db)); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } while (SQLITE_ROW == (ret = sqlite3_step(stmt))) { @@ -217,8 +227,10 @@ static void __ctsvc_server_number_info_update(sqlite3 *__db) sqlite3_bind_int(update_stmt, 4, id); ret = sqlite3_step(update_stmt); if (SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s)", ret, sqlite3_errmsg(__db)); break; + /* LCOV_EXCL_STOP */ } sqlite3_reset(update_stmt); } @@ -240,14 +252,18 @@ static int __ctsvc_server_get_db_version(sqlite3 *db, int *version) snprintf(query, sizeof(query), "PRAGMA user_version;"); ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(db)); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_step(stmt); if (SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%s)", sqlite3_errmsg(db)); sqlite3_finalize(stmt); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } *version = sqlite3_column_int(stmt, 0); sqlite3_finalize(stmt); diff --git a/server/ctsvc_server_utils.c b/server/ctsvc_server_utils.c index 5a4965a..8a29a71 100644 --- a/server/ctsvc_server_utils.c +++ b/server/ctsvc_server_utils.c @@ -84,6 +84,7 @@ static void* __ctsvc_server_update_language_on_thread(void *data) old_secondary_sort = ctsvc_get_secondary_sort(); if (old_primary_sort < 0 || old_secondary_sort < 0) { + /* LCOV_EXCL_START */ ERR("old_primary_sort (%d), old_secondary_sort(%d)", old_primary_sort, old_secondary_sort); free(info->langset); free(info->new_langset); @@ -91,6 +92,7 @@ static void* __ctsvc_server_update_language_on_thread(void *data) ret = vconf_notify_key_changed(VCONFKEY_LANGSET, __ctsvc_server_change_language_cb, NULL); WARN_IF(ret < 0, "vconf_notify_key_changed(%s) Fail(%d)", VCONFKEY_LANGSET, ret); return NULL; + /* LCOV_EXCL_STOP */ } ctsvc_server_stop_timeout(); @@ -151,8 +153,10 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data) new_langset = vconf_keynode_get_str(key); if (NULL == new_langset) { + /* LCOV_EXCL_START */ ERR("vconf_keynode_get_str() Fail"); return; + /* LCOV_EXCL_STOP */ } langset = ctsvc_get_langset(); INFO("%s --> %s", langset, new_langset); @@ -160,8 +164,10 @@ static void __ctsvc_server_change_language_cb(keynode_t *key, void *data) if (STRING_EQUAL != strcmp(langset, new_langset)) { cts_language_update_thread_info_s *info = calloc(1, sizeof(cts_language_update_thread_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } ret = vconf_ignore_key_changed(VCONFKEY_LANGSET, __ctsvc_server_change_language_cb); @@ -228,7 +234,6 @@ static gboolean _timeout_cb(gpointer user_data) ctsvc_server_quit(); return TRUE; } - void ctsvc_server_start_timeout(void) { int timeout = ctsvc_server_get_timeout_sec(); diff --git a/server/ctsvc_utils_string.c b/server/ctsvc_utils_string.c index 8fee2da..83b47ed 100644 --- a/server/ctsvc_utils_string.c +++ b/server/ctsvc_utils_string.c @@ -83,9 +83,11 @@ static int __ctsvc_copy_and_remove_special_char(const char *src, char *dest, int int s_pos = 0, d_pos = 0, char_type, src_size; if (NULL == src) { + /* LCOV_EXCL_START */ ERR("The parameter(src) is NULL"); dest[d_pos] = '\0'; return 0; + /* LCOV_EXCL_STOP */ } src_size = strlen(src); @@ -97,9 +99,11 @@ static int __ctsvc_copy_and_remove_special_char(const char *src, char *dest, int d_pos += char_type; s_pos += char_type; } else { + /* LCOV_EXCL_START */ ERR("The parameter(src:%s) has invalid character set", src); dest[d_pos] = '\0'; return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } @@ -119,21 +123,27 @@ static int __ctsvc_normalize_str_to_unicode(const char *src, int src_size, UChar u_strFromUTF8(tmp_result, dest_size, &size, src, src_size, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strFromUTF8() Failed(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } u_strToUpper(tmp_result, dest_size, tmp_result, -1, NULL, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("u_strToUpper() Failed(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } size = unorm_normalize(tmp_result, -1, UNORM_NFD, 0, (UChar *)dest, dest_size, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("unorm_normalize() Failed(%s)", u_errorName(status)); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = ctsvc_check_language(dest); @@ -174,8 +184,10 @@ static bool __ctsvc_compare_pinyin_letter(const char *haystack, int haystack_lan ret = ctsvc_convert_chinese_to_pinyin(temp, &pinyinname, &size); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_convert_chinese_to_pinyin Fail(%d)", ret); return false; + /* LCOV_EXCL_STOP */ } for (k = 0; k < size; k++) { @@ -491,8 +503,10 @@ static char *_strrchr_with_nth(char *ori, char *s, int c, int nth) char *cursor = s; while (*cursor) { if (cursor <= ori) { + /* LCOV_EXCL_START */ ERR("over"); return ori; + /* LCOV_EXCL_STOP */ } if (*cursor == c) @@ -526,8 +540,10 @@ char *ctsvc_utils_get_modified_str(char *temp, bool is_snippet, const char *keyw char *pos_at = strstr(temp, "@"); if (NULL == pos_at) { + /* LCOV_EXCL_START */ ERR("Invalid value[%s]", temp); return NULL; + /* LCOV_EXCL_STOP */ } DBG("[%s]", temp); *pos_at = '\0'; @@ -568,8 +584,10 @@ char *ctsvc_utils_get_modified_str(char *temp, bool is_snippet, const char *keyw mod_temp = calloc(len_full, sizeof(char)); if (NULL == mod_temp) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } char *keyword_start = NULL; diff --git a/server/db/ctsvc_db_access_control.c b/server/db/ctsvc_db_access_control.c index b409b6e..7fd0016 100644 --- a/server/db/ctsvc_db_access_control.c +++ b/server/db/ctsvc_db_access_control.c @@ -90,6 +90,7 @@ int ctsvc_have_file_read_permission(const char *path) RETV_IF(NULL == path, CONTACTS_ERROR_INVALID_PARAMETER); if (0 != access(path, F_OK|R_OK)) { + /* LCOV_EXCL_START */ ERR("access(%s) Fail(%d)", path, errno); switch (errno) { case EACCES: @@ -97,6 +98,7 @@ int ctsvc_have_file_read_permission(const char *path) default: return CONTACTS_ERROR_SYSTEM; } + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -128,16 +130,20 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info) "SELECT count(addressbook_id) FROM "CTS_TABLE_ADDRESSBOOKS); ret = ctsvc_query_get_first_int_result(query, &count); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR(" ctsvc_query_get_first_int_result() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id, mode, smack_label FROM "CTS_TABLE_ADDRESSBOOKS); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } while ((ret = ctsvc_stmt_step(stmt))) { @@ -146,9 +152,11 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info) char *temp = NULL; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } id = ctsvc_stmt_get_int(stmt, 0); @@ -157,8 +165,10 @@ static void __ctsvc_set_permission_info(ctsvc_permission_info_s *info) ctsvc_writable_info_s *wi = calloc(1, sizeof(ctsvc_writable_info_s)); if (NULL == wi) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); break; + /* LCOV_EXCL_STOP */ } if (!smack_enabled) { /* smack disabled */ @@ -242,9 +252,11 @@ void ctsvc_set_client_access_info(pims_ipc_h ipc, const char *smack) if (NULL == info) { info = calloc(1, sizeof(ctsvc_permission_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("Thread(0x%x), calloc() Fail", thread_id); ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); return; + /* LCOV_EXCL_STOP */ } __thread_list = g_list_append(__thread_list, info); } @@ -319,15 +331,19 @@ bool ctsvc_have_ab_write_permission(int addressbook_id, bool allow_readonly) thread_id = (unsigned int)pthread_self(); find = __ctsvc_find_access_info(thread_id); if (NULL == find) { + /* LCOV_EXCL_START */ ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); ERR("can not found access info"); return false; + /* LCOV_EXCL_STOP */ } if (NULL == find->writable_list) { + /* LCOV_EXCL_START */ ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); ERR("there is no write access info"); return false; + /* LCOV_EXCL_STOP */ } GList *cursor = find->writable_list; @@ -346,9 +362,11 @@ bool ctsvc_have_ab_write_permission(int addressbook_id, bool allow_readonly) cursor = g_list_next(cursor); } + /* LCOV_EXCL_START */ ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); ERR("Thread(0x%x), Does not have write permission of addressbook(%d)", thread_id, addressbook_id); return false; + /* LCOV_EXCL_STOP */ } int ctsvc_get_write_permitted_addressbook_ids(int **addressbook_ids, int *count) @@ -362,23 +380,29 @@ int ctsvc_get_write_permitted_addressbook_ids(int **addressbook_ids, int *count) thread_id = (unsigned int)pthread_self(); find = __ctsvc_find_access_info(thread_id); if (NULL == find) { + /* LCOV_EXCL_START */ ERR("__ctsvc_find_access_info() Fail"); ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (NULL == find->writable_list) { + /* LCOV_EXCL_START */ ERR("No permission info"); ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } int book_count = g_list_length(find->writable_list); int *book_ids = calloc(book_count, sizeof(int)); if (NULL == book_ids) { + /* LCOV_EXCL_START */ ERR("Thread(0x%x), calloc() Fail", thread_id); ctsvc_mutex_unlock(CTS_MUTEX_ACCESS_CONTROL); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } int i = 0; GList *cursor = find->writable_list; @@ -433,15 +457,19 @@ int ctsvc_is_owner(int addressbook_id) "WHERE addressbook_id = %d", addressbook_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ret = CONTACTS_ERROR_PERMISSION_DENIED; diff --git a/server/db/ctsvc_db_init.c b/server/db/ctsvc_db_init.c index 3ab305c..425e223 100644 --- a/server/db/ctsvc_db_init.c +++ b/server/db/ctsvc_db_init.c @@ -188,7 +188,9 @@ int ctsvc_db_get_table_name(const char *view_uri, const char **out_table) return CONTACTS_ERROR_NONE; } } else { + /* LCOV_EXCL_START */ ERR("Please check contact_connect()"); + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_INVALID_PARAMETER; @@ -205,7 +207,9 @@ int ctsvc_required_read_permission(const char *view_uri) if (db_view_info) return db_view_info->read_permission; } else { + /* LCOV_EXCL_START */ ERR("Please check contact_connect()"); + /* LCOV_EXCL_STOP */ } return CTSVC_PERMISSION_CONTACT_NONE; @@ -222,7 +226,9 @@ int ctsvc_required_write_permission(const char *view_uri) if (db_view_info) return db_view_info->write_permission; } else { + /* LCOV_EXCL_START */ ERR("Please check contact_connect()"); + /* LCOV_EXCL_STOP */ } return CTSVC_PERMISSION_CONTACT_NONE; @@ -239,7 +245,9 @@ bool ctsvc_should_ab_access_control(const char *view_uri) if (db_view_info) return db_view_info->need_ab_access_control; } else { + /* LCOV_EXCL_START */ ERR("Please check contact_connect()"); + /* LCOV_EXCL_STOP */ } return false; @@ -932,15 +940,19 @@ int ctsvc_db_init() int ret = CONTACTS_ERROR_NONE; ret = ctsvc_db_open(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_open() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } #ifdef _CONTACTS_IPC_SERVER ret = __ctsvc_db_create_views(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_create_views() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } #endif @@ -952,8 +964,10 @@ int ctsvc_db_deinit() int ret = CONTACTS_ERROR_NONE; ret = ctsvc_db_close(); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_close() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; diff --git a/server/db/ctsvc_db_plugin_activity.c b/server/db/ctsvc_db_plugin_activity.c index 5a46b6a..35e0738 100644 --- a/server/db/ctsvc_db_plugin_activity.c +++ b/server/db/ctsvc_db_plugin_activity.c @@ -59,22 +59,28 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact id (%d)", activity->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } ret = ctsvc_is_owner(addressbook_id); if (CONTACTS_ERROR_NONE != ret) { if (CONTACTS_ERROR_PERMISSION_DENIED == ret) + /* LCOV_EXCL_START */ ERR("Does not have permission of address_book (%d)", addressbook_id); else ERR("ctsvc_is_owner() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "INSERT INTO "CTS_TABLE_ACTIVITIES"(" @@ -85,9 +91,11 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (activity->source_name) @@ -101,10 +109,12 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } activity_id = ctsvc_db_get_last_insert_id(); @@ -123,8 +133,10 @@ static int __ctsvc_db_activity_insert_record(contacts_record_h record, int *id) photo = (ctsvc_activity_photo_s*)record; ret = ctsvc_db_activity_photo_insert((contacts_record_h)photo, activity_id, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next((contacts_list_h)activity->photos)); } @@ -184,12 +196,14 @@ static int __ctsvc_db_activity_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_activity_value_set(stmt, &record); @@ -204,8 +218,10 @@ static int __ctsvc_db_activity_get_record(int id, contacts_record_h *out_record) static int __ctsvc_db_activity_update_record(contacts_record_h record) { + /* LCOV_EXCL_START */ ERR("Invalid operation : activity can not update, only insert/delete"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_activity_delete_record(int id) @@ -222,28 +238,34 @@ static int __ctsvc_db_activity_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTSVC_DB_VIEW_ACTIVITY" WHERE id = %d)", id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : id (%d)", id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_is_owner(addressbook_id); if (CONTACTS_ERROR_NONE != ret) { if (CONTACTS_ERROR_PERMISSION_DENIED == ret) + /* LCOV_EXCL_START */ ERR("Does not have permission of address_book (%d)", addressbook_id); else ERR("ctsvc_is_owner Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_ACTIVITIES" WHERE id = %d", id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_activity_noti(); @@ -282,18 +304,22 @@ static int __ctsvc_db_activity_get_all_records(int offset, int limit, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } activity_id = ctsvc_stmt_get_int(stmt, 0); ret = ctsvc_db_get_record(_contacts_activity._uri, activity_id, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_db_get_record() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); } @@ -334,8 +360,10 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in if (false == had_activity_id) { s_query->projection = realloc(s_query->projection, s_query->projection_count+1); if (NULL == s_query->projection) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_ACTIVITY_ID; s_query->projection_count++; @@ -348,10 +376,12 @@ static int __ctsvc_db_activity_get_records_with_query(contacts_query_h query, in while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_activity._uri, &record); diff --git a/server/db/ctsvc_db_plugin_activity_photo.c b/server/db/ctsvc_db_plugin_activity_photo.c index af672ac..a29dc01 100644 --- a/server/db/ctsvc_db_plugin_activity_photo.c +++ b/server/db/ctsvc_db_plugin_activity_photo.c @@ -41,8 +41,10 @@ static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -50,6 +52,7 @@ static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int "WHERE contact_id = (SELECT contact_id from "CTS_TABLE_ACTIVITIES" WHERE id = %d)", activity_photo->activity_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id); @@ -58,19 +61,24 @@ static int __ctsvc_db_activity_photo_insert_record(contacts_record_h record, int ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; } + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_activity_photo_insert(record, activity_photo->activity_id, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_activity_photo_insert() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); @@ -99,12 +107,14 @@ static int __ctsvc_db_activity_photo_get_record(int id, contacts_record_h *out_r ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_activity_photo_get_value_from_stmt(stmt, out_record); @@ -125,8 +135,10 @@ static int __ctsvc_db_activity_photo_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -136,22 +148,28 @@ static int __ctsvc_db_activity_photo_update_record(contacts_record_h record) ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : activity_id (%d) is not exist", activity_photo->activity_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_activity_photo_update(record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); @@ -168,8 +186,10 @@ static int __ctsvc_db_activity_photo_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -179,22 +199,28 @@ static int __ctsvc_db_activity_photo_delete_record(int id) ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : id (%d) is not exist", id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_activity_photo_delete(id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_activity_photo_delete() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); @@ -229,10 +255,12 @@ static int __ctsvc_db_activity_photo_get_all_records(int offset, int limit, cont contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_activity_photo_get_value_from_stmt(stmt, (contacts_record_h*)&activity_photo); ctsvc_list_prepend(list, (contacts_record_h)activity_photo); @@ -265,10 +293,12 @@ static int __ctsvc_db_activity_photo_get_records_with_query(contacts_query_h que while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_activity_photo._uri, &record); diff --git a/server/db/ctsvc_db_plugin_activity_photo_helper.c b/server/db/ctsvc_db_plugin_activity_photo_helper.c index 7f395d0..0e14501 100644 --- a/server/db/ctsvc_db_plugin_activity_photo_helper.c +++ b/server/db/ctsvc_db_plugin_activity_photo_helper.c @@ -73,9 +73,11 @@ int ctsvc_db_activity_photo_insert(contacts_record_h record, int activity_id, in ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (id) *id = ctsvc_db_get_last_insert_id(); @@ -161,10 +163,12 @@ int ctsvc_db_activity_photo_get_records(int activity_id, contacts_record_h recor contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_h record = NULL; ctsvc_db_activity_photo_get_value_from_stmt(stmt, &record); diff --git a/server/db/ctsvc_db_plugin_address.c b/server/db/ctsvc_db_plugin_address.c index 85db2fe..8874354 100644 --- a/server/db/ctsvc_db_plugin_address.c +++ b/server/db/ctsvc_db_plugin_address.c @@ -45,8 +45,10 @@ static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -55,32 +57,42 @@ static int __ctsvc_db_address_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", address->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_address_insert(record, address->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(address->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); @@ -104,37 +116,47 @@ static int __ctsvc_db_address_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", address->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", address->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_address_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(address->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); @@ -161,12 +183,15 @@ static int __ctsvc_db_address_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("DB error :ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -174,6 +199,7 @@ static int __ctsvc_db_address_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -181,23 +207,29 @@ static int __ctsvc_db_address_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_address_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_address_delete() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); @@ -229,12 +261,14 @@ static int __ctsvc_db_address_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_address_get_value_from_stmt(stmt, (contacts_record_h*)&address, 0); @@ -274,10 +308,12 @@ static int __ctsvc_db_address_get_all_records(int offset, int limit, contacts_li contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_address_get_value_from_stmt(stmt, (contacts_record_h*)&address, 0); ctsvc_list_prepend(list, (contacts_record_h)address); @@ -310,10 +346,12 @@ static int __ctsvc_db_address_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_address._uri, &record); diff --git a/server/db/ctsvc_db_plugin_address_helper.c b/server/db/ctsvc_db_plugin_address_helper.c index 4407b1d..0f9bf91 100644 --- a/server/db/ctsvc_db_plugin_address_helper.c +++ b/server/db/ctsvc_db_plugin_address_helper.c @@ -117,9 +117,11 @@ int ctsvc_db_address_insert(contacts_record_h record, int contact_id, bool is_my ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } address_id = ctsvc_db_get_last_insert_id(); if (id) diff --git a/server/db/ctsvc_db_plugin_addressbook.c b/server/db/ctsvc_db_plugin_addressbook.c index 12661a6..fc2489b 100644 --- a/server/db/ctsvc_db_plugin_addressbook.c +++ b/server/db/ctsvc_db_plugin_addressbook.c @@ -74,20 +74,24 @@ static int __ctsvc_db_addressbook_get_record(int id, contacts_record_h *out_reco ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_addressbook_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_addressbook_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -120,6 +124,7 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i addressbook->account_id); ret = ctsvc_query_get_first_int_result(query, &addresbook_id); if (CONTACTS_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ ctsvc_end_trans(false); if (CONTACTS_ERROR_NONE == ret) { ERR("One addressbook which has account_id(%d) already exists", addressbook->account_id); @@ -128,22 +133,27 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; } + /* LCOV_EXCL_STOP */ } /* check account_id validation */ ret = account_create(&account); if (ACCOUNT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("account_create() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = account_query_account_by_account_id(addressbook->account_id, &account); if (ACCOUNT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("account_query_account_by_account_id Faild(%d) : account_id(%d)", ret, addressbook->account_id); ret = account_destroy(account); WARN_IF(ret != ACCOUNT_ERROR_NONE, "account_destroy Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = account_destroy(account); WARN_IF(ret != ACCOUNT_ERROR_NONE, "account_destroy Fail(%d)", ret); @@ -155,9 +165,11 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_bind_text(stmt, 1, addressbook->name); @@ -170,9 +182,11 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i do { ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } /* int index = ctsvc_db_get_last_insert_id(); */ @@ -183,9 +197,11 @@ static int __ctsvc_db_addressbook_insert_record(contacts_record_h record, int *i ctsvc_set_addressbook_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); free(smack); return ret; + /* LCOV_EXCL_STOP */ } /* addressbook->id = index; */ @@ -219,12 +235,14 @@ static int __ctsvc_db_addressbook_update_record(contacts_record_h record) ret = ctsvc_is_owner(addressbook->id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ if (CONTACTS_ERROR_PERMISSION_DENIED == ret) ERR("Does not have permission of address_book (%d)", addressbook->id); else ERR("ctsvc_is_owner Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } do { @@ -309,8 +327,10 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id) do { ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); @@ -327,14 +347,18 @@ static int __ctsvc_db_addressbook_delete_record(int addressbook_id) ret = ctsvc_person_do_garbage_collection(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_person_garbagecollection() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -375,10 +399,12 @@ static int __ctsvc_db_addressbook_get_all_records(int offset, int limit, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_addressbook_value_set(stmt, &record); @@ -411,10 +437,12 @@ static int __ctsvc_db_addressbook_get_records_with_query(contacts_query_h query, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_address_book._uri, &record); diff --git a/server/db/ctsvc_db_plugin_addressbook_helper.c b/server/db/ctsvc_db_plugin_addressbook_helper.c index 9293222..67b107e 100644 --- a/server/db/ctsvc_db_plugin_addressbook_helper.c +++ b/server/db/ctsvc_db_plugin_addressbook_helper.c @@ -38,12 +38,14 @@ int ctsvc_addressbook_reset_internal_addressbook(void) ret = ctsvc_is_owner(0); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ if (CONTACTS_ERROR_PERMISSION_DENIED == ret) ERR("Does not have permission of address_book (0)"); else ERR("ctsvc_is_owner Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -55,8 +57,10 @@ int ctsvc_addressbook_reset_internal_addressbook(void) do { ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE addressbook_id = %d", @@ -64,38 +68,48 @@ int ctsvc_addressbook_reset_internal_addressbook(void) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE addressbook_id = %d", CTS_TABLE_GROUPS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE addressbook_id = %d", CTS_TABLE_GROUP_DELETEDS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE addressbook_id = %d", CTS_TABLE_DELETEDS, 0 /*CTS_ADDRESSBOOK_INTERNAL*/); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_do_garbage_collection(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_person_garbagecollection() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ctsvc_set_contact_noti(); @@ -104,8 +118,10 @@ int ctsvc_addressbook_reset_internal_addressbook(void) ctsvc_set_group_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -133,9 +149,11 @@ int ctsvc_addressbook_delete(int account_id) CTS_TABLE_ADDRESSBOOKS, account_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (addressbook_id == 0) { @@ -151,9 +169,11 @@ int ctsvc_addressbook_delete(int account_id) CTS_TABLE_ADDRESSBOOKS, account_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); @@ -164,16 +184,20 @@ int ctsvc_addressbook_delete(int account_id) ctsvc_set_group_noti(); ctsvc_set_addressbook_noti(); } else { + /* LCOV_EXCL_START */ ERR("There is no addressbook which has account_id (%d)", account_id); ctsvc_end_trans(false); return CONTACTS_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } ret = ctsvc_person_do_garbage_collection(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_person_garbagecollection() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } return ctsvc_end_trans(true); diff --git a/server/db/ctsvc_db_plugin_company.c b/server/db/ctsvc_db_plugin_company.c index d3cd0af..5408995 100644 --- a/server/db/ctsvc_db_plugin_company.c +++ b/server/db/ctsvc_db_plugin_company.c @@ -55,12 +55,14 @@ static int __ctsvc_db_company_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_company_get_value_from_stmt(stmt, out_record, 0); @@ -83,8 +85,10 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -93,41 +97,53 @@ static int __ctsvc_db_company_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", company->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_company_insert(record, company->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(company->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_COMPANY); ret = ctsvc_db_contact_update_changed_time(company->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -147,46 +163,58 @@ static int __ctsvc_db_company_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", company->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", company->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_company_update(record, company->contact_id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(company->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_COMPANY); ret = ctsvc_db_contact_update_changed_time(company->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -203,8 +231,10 @@ static int __ctsvc_db_company_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -212,12 +242,15 @@ static int __ctsvc_db_company_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -225,6 +258,7 @@ static int __ctsvc_db_company_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -232,32 +266,40 @@ static int __ctsvc_db_company_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_company_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_COMPANY); ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -292,10 +334,12 @@ static int __ctsvc_db_company_get_all_records(int offset, int limit, contacts_li contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_company_get_value_from_stmt(stmt, (contacts_record_h*)&company, 0); ctsvc_list_prepend(list, (contacts_record_h)company); @@ -328,10 +372,12 @@ static int __ctsvc_db_company_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_company._uri, &record); diff --git a/server/db/ctsvc_db_plugin_company_helper.c b/server/db/ctsvc_db_plugin_company_helper.c index 0fe04a8..001cd6d 100644 --- a/server/db/ctsvc_db_plugin_company_helper.c +++ b/server/db/ctsvc_db_plugin_company_helper.c @@ -89,9 +89,11 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my ret = ctsvc_db_get_next_id(CTS_TABLE_DATA); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_get_next_id() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } company_id = ret; @@ -109,25 +111,31 @@ int ctsvc_db_company_insert(contacts_record_h record, int contact_id, bool is_my char image[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0}; ret = ctsvc_have_file_read_permission(company->logo); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_utils_make_image_file_name(contact_id, company_id, company->logo, image, sizeof(image)); ret = ctsvc_utils_copy_image(CTS_LOGO_IMAGE_LOCATION, company->logo, image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_utils_copy_image() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_bind_text(stmt, 9, image); } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -234,9 +242,11 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my if (company->logo) { ret = ctsvc_have_file_read_permission(company->logo); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } check_permission = true; } @@ -252,17 +262,21 @@ int ctsvc_db_company_update(contacts_record_h record, int contact_id, bool is_my if (false == check_permission) { ret = ctsvc_have_file_read_permission(company->logo); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } ctsvc_utils_make_image_file_name(contact_id, company->id, company->logo, dest, sizeof(dest)); ret = ctsvc_utils_copy_image(CTS_LOGO_IMAGE_LOCATION, company->logo, dest); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_copy_file() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } free(company->logo); company->logo = strdup(dest); diff --git a/server/db/ctsvc_db_plugin_contact.c b/server/db/ctsvc_db_plugin_contact.c index fa410e4..85e63f7 100644 --- a/server/db/ctsvc_db_plugin_contact.c +++ b/server/db/ctsvc_db_plugin_contact.c @@ -71,12 +71,14 @@ static int __ctsvc_db_get_contact_base_info(int id, ctsvc_contact_s *contact) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } i = 0; @@ -136,9 +138,11 @@ static int __ctsvc_db_get_data(int id, ctsvc_contact_s *contact) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE */!= ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } do { @@ -190,8 +194,10 @@ static int __ctsvc_db_get_data(int id, ctsvc_contact_s *contact) ctsvc_get_data_info_sip(stmt, (contacts_list_h)contact->sips); break; default: + /* LCOV_EXCL_START */ ERR("Intenal : Not supported data type (%d)", datatype); break; + /* LCOV_EXCL_STOP */ } } while (1 == ctsvc_stmt_step(stmt)); @@ -250,23 +256,29 @@ static int __ctsvc_db_contact_get_record(int id, contacts_record_h *out_record) contact = (ctsvc_contact_s*)record; ret = __ctsvc_db_get_contact_base_info(id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_get_contact_base_info(ALL) Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_get_data(id, contact); if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_get_data_info Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_get_contact_grouprel(id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_get_group_relations Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -286,64 +298,80 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact) if (contact->name) { ret = ctsvc_contact_update_data_name((contacts_list_h)contact->name, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_name() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->company) { ret = ctsvc_contact_update_data_company((contacts_list_h)contact->company, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_company() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->note) { ret = ctsvc_contact_update_data_note((contacts_list_h)contact->note, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_note() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->events) { ret = ctsvc_contact_update_data_event((contacts_list_h)contact->events, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_events() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->messengers) { ret = ctsvc_contact_update_data_messenger((contacts_list_h)contact->messengers, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->postal_addrs) { ret = ctsvc_contact_update_data_address((contacts_list_h)contact->postal_addrs, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_address() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->urls) { ret = ctsvc_contact_update_data_url((contacts_list_h)contact->urls, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_url() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->nicknames) { ret = ctsvc_contact_update_data_nickname((contacts_list_h)contact->nicknames, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -351,8 +379,10 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact) bool had_phonenumber; ret = ctsvc_contact_update_data_number((contacts_list_h)contact->numbers, contact->id, false, &had_phonenumber); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } contact->has_phonenumber = had_phonenumber; } @@ -361,8 +391,10 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact) bool had_email; ret = ctsvc_contact_update_data_email((contacts_list_h)contact->emails, contact->id, false, &had_email); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_email() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } contact->has_email = had_email; } @@ -370,40 +402,50 @@ static inline int __ctsvc_contact_update_data(ctsvc_contact_s *contact) if (contact->profiles) { ret = ctsvc_contact_update_data_profile((contacts_list_h)contact->profiles, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->relationships) { ret = ctsvc_contact_update_data_relationship((contacts_list_h)contact->relationships, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->images) { ret = ctsvc_contact_update_data_image((contacts_list_h)contact->images, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_image() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->extensions) { ret = ctsvc_contact_update_data_extension((contacts_list_h)contact->extensions, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (contact->sips) { ret = ctsvc_contact_update_data_sip((contacts_list_h)contact->sips, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_sips() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } return CONTACTS_ERROR_NONE; @@ -507,9 +549,11 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(number) + SAFE_STRLEN(number_record->cleaned) + SAFE_STRLEN(number_record->normalized) + 3; temp_number = calloc(1, buf_size); if (NULL == temp_number) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (number) @@ -537,10 +581,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, * (had ? 2 : 1) + 4; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (data) { @@ -570,10 +616,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(nickname->nickname) * (had ? 2 : 1) + 4; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (data) @@ -606,10 +654,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, + str_len * 2 + 16; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } char temp[str_len+1]; @@ -665,10 +715,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(note->note) * (had ? 2 : 1) + 4; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (data) { @@ -698,10 +750,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(messenger->im_id) * (had ? 2 : 1) + 4; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (data) { @@ -731,10 +785,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(data) + SAFE_STRLEN(relationship->name) * (had ? 2 : 1) + 4; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (data) { @@ -770,10 +826,12 @@ static inline int __ctsvc_contact_make_search_data(ctsvc_contact_s *contact, buf_size = SAFE_STRLEN(data) + str_len * 2 + 18; temp_data = calloc(1, buf_size); if (NULL == temp_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(data); free(number); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } char temp[str_len+1]; @@ -836,16 +894,20 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont CTS_TABLE_NAME_LOOKUP, contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE contact_id = %d", CTS_TABLE_PHONE_LOOKUP, contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } if (contact == NULL) @@ -885,8 +947,10 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont int reverse_lang_type = ctsvc_contact_get_name_language(name_record); temp_name = calloc(1, temp_len); if (NULL == temp_name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (reverse_lang_type == CTSVC_LANG_KOREAN || @@ -918,10 +982,12 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(temp_name); free(normalized_name); return ret; + /* LCOV_EXCL_STOP */ } if (normalized_name) @@ -935,8 +1001,10 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } break; } @@ -967,9 +1035,11 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ctsvc_stmt_bind_text(stmt, 1, number_record->cleaned); ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (number_record->normalized && STRING_EQUAL != strcmp(number_record->cleaned, number_record->normalized)) { ctsvc_stmt_reset(stmt); @@ -977,9 +1047,11 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ctsvc_stmt_bind_text(stmt, 1, number_record->normalized); ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } ctsvc_stmt_finalize(stmt); @@ -1003,9 +1075,11 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(normalized_nickname); return ret; + /* LCOV_EXCL_STOP */ } if (normalized_nickname && *normalized_nickname) @@ -1018,8 +1092,10 @@ static inline int __ctsvc_contact_refresh_lookup_data(int contact_id, ctsvc_cont ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } } while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list)); @@ -1048,33 +1124,41 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r CTS_TABLE_SEARCH_INDEX, contact_id); r = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != r) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", r); ctsvc_end_trans(false); return r; + /* LCOV_EXCL_STOP */ } ctsvc_end_trans(false); return ret; } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_get() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_contact_make_search_name(contact, &search_name); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_make_search_name() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_contact_make_search_data(contact, &search_number, &search_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); free(search_name); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -1084,6 +1168,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); @@ -1091,6 +1176,7 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r free(search_number); free(search_data); return ret; + /* LCOV_EXCL_STOP */ } if (search_name) @@ -1107,11 +1193,13 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r free(search_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -1119,10 +1207,12 @@ static inline int __ctsvc_contact_update_search_data(int contact_id, bool need_r /* update phone_lookup, name_lookup */ ret = __ctsvc_contact_refresh_lookup_data(contact_id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1189,15 +1279,19 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record) "WHERE contact_id = %d AND deleted = 0", contact->id); ret = ctsvc_query_get_first_int_result(query, ¤t_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("The index(%d) is Invalid. %d Record(s) is(are) found", contact->id, ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(contact->addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", contact->addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (current_version != contact->changed_ver) @@ -1210,17 +1304,21 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record) /* update data */ ret = __ctsvc_contact_update_data(contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_update_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (contact->grouprelations) { rel_changed = __ctsvc_contact_update_grouprel(contact->id, (contacts_list_h)contact->grouprelations); if (rel_changed < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("cts_update_contact_grouprel() Fail(%d)", rel_changed); ctsvc_end_trans(false); return rel_changed; + /* LCOV_EXCL_STOP */ } } @@ -1237,9 +1335,11 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record) do { ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (image->is_default) @@ -1334,8 +1434,10 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -1348,9 +1450,11 @@ static int __ctsvc_db_contact_update_record(contacts_record_h record) } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); } while (0); @@ -1419,18 +1523,22 @@ static int __ctsvc_db_contact_get_all_records(int offset, int limit, contacts_li while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); ret = ctsvc_db_contact_get(contact_id, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_get() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); } @@ -1487,8 +1595,10 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int if (false == had_contact_id) { s_query->projection = realloc(s_query->projection, s_query->projection_count+1); if (NULL == s_query->projection) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_CONTACT_ID; @@ -1502,10 +1612,12 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_contact._uri, &record); @@ -1599,26 +1711,32 @@ static int __ctsvc_db_contact_get_records_with_query(contacts_query_h query, int /* get changed_ver */ ret = __ctsvc_db_contact_get_changed_ver(contact_id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_contact_get_changed_ver Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_get_data(contact_id, contact); if (CONTACTS_ERROR_NONE != ret && CONTACTS_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_get_data_info Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_get_contact_grouprel(contact_id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_get_group_relations Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); @@ -1640,8 +1758,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->name) { ret = ctsvc_contact_insert_data_name((contacts_list_h)contact->name, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1649,8 +1769,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->company) { ret = ctsvc_contact_insert_data_company((contacts_list_h)contact->company, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_company() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1658,8 +1780,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->events) { ret = ctsvc_contact_insert_data_event((contacts_list_h)contact->events, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_event() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1667,8 +1791,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->messengers) { ret = ctsvc_contact_insert_data_messenger((contacts_list_h)contact->messengers, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_messenger() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1676,8 +1802,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->postal_addrs) { ret = ctsvc_contact_insert_data_address((contacts_list_h)contact->postal_addrs, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_postal() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1685,8 +1813,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->urls) { ret = ctsvc_contact_insert_data_url((contacts_list_h)contact->urls, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_web() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1694,8 +1824,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->nicknames) { ret = ctsvc_contact_insert_data_nickname((contacts_list_h)contact->nicknames, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_nickname() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1703,8 +1835,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->numbers) { ret = ctsvc_contact_insert_data_number((contacts_list_h)contact->numbers, contact->id, false); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1712,8 +1846,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->emails) { ret = ctsvc_contact_insert_data_email((contacts_list_h)contact->emails, contact->id, false); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_email() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1721,8 +1857,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->profiles) { ret = ctsvc_contact_insert_data_profile((contacts_list_h)contact->profiles, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_profile() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1730,8 +1868,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->relationships) { ret = ctsvc_contact_insert_data_relationship((contacts_list_h)contact->relationships, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1739,8 +1879,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->images) { ret = ctsvc_contact_insert_data_image((contacts_list_h)contact->images, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1748,8 +1890,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->note) { ret = ctsvc_contact_insert_data_note((contacts_list_h)contact->note, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1757,8 +1901,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->extensions) { ret = ctsvc_contact_insert_data_extension((contacts_list_h)contact->extensions, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1766,8 +1912,10 @@ static int __ctsvc_contact_insert_data(ctsvc_contact_s *contact) if (contact->sips) { ret = ctsvc_contact_insert_data_sip((contacts_list_h)contact->sips, contact->id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_contact_data_sip() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1789,26 +1937,32 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i ret = ctsvc_db_contact_get(contact_id, (contacts_record_h*)&contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_get() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_contact_make_search_name(contact, &search_name); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_make_search_name() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_contact_make_search_data(contact, &search_number, &search_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_make_search_data() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); free(search_name); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -1818,6 +1972,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); @@ -1825,6 +1980,7 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i free(search_number); free(search_data); return ret; + /* LCOV_EXCL_STOP */ } if (search_name) @@ -1841,11 +1997,13 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i free(search_data); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -1853,10 +2011,12 @@ static inline int __ctsvc_contact_insert_search_data(int contact_id, bool need_i if (need_insert_lookup_data) { ret = __ctsvc_contact_refresh_lookup_data(contact_id, contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_refresh_lookup_data() Fail(%d)", ret); contacts_record_destroy((contacts_record_h)contact, true); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } @@ -2035,16 +2195,20 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret); if (false == ctsvc_have_ab_write_permission(contact->addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", contact->addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_get_next_id(CTS_TABLE_CONTACTS); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_get_next_id() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } contact->id = ret; if (id) @@ -2059,9 +2223,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) /* Insert Data */ ret = __ctsvc_contact_insert_data(contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_insert_contact_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* thumbnail */ @@ -2077,9 +2243,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) do { ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (image->path && image->is_default) { @@ -2100,9 +2268,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) "WHERE person_id = %d", contact->person_id); ret = ctsvc_query_get_first_int_result(query, &id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Invalid person_id(%d)", contact->person_id); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } auto_linked = true; @@ -2116,9 +2286,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) ret = ctsvc_db_insert_person((contacts_record_h)contact); DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_insert_person() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } contact->person_id = ret; } @@ -2126,9 +2298,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) ret = ctsvc_db_insert_person((contacts_record_h)contact); DBG("ctsvc_db_insert_person return %d, person_id(%d)", ret, ret); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_insert_person() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } contact->person_id = ret; } @@ -2150,9 +2324,11 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (contact->display_name) @@ -2180,10 +2356,12 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -2191,17 +2369,21 @@ static int __ctsvc_db_contact_insert_record(contacts_record_h record, int *id) if (contact->grouprelations) { rel_changed = __ctsvc_contact_insert_grouprel(contact->id, (contacts_list_h)contact->grouprelations); if (rel_changed < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed); ctsvc_end_trans(false); return rel_changed; + /* LCOV_EXCL_STOP */ } } ret = __ctsvc_contact_insert_search_data(contact->id, need_insert_lookup); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_insert_search_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* person aggregation when auto_linked */ @@ -2254,12 +2436,15 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta "WHERE contact_id = %d AND deleted = 0", contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The contact_id(%d) is Invalid(%d)", contact_id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -2267,6 +2452,7 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); @@ -2274,9 +2460,11 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } contact->id = contact_id; @@ -2289,16 +2477,20 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_contact_insert_data(contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_insert_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* remove current child data */ @@ -2306,18 +2498,22 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta "DELETE FROM "CTS_TABLE_GROUP_RELATIONS" WHERE contact_id = %d", contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (contact->grouprelations) { rel_changed = __ctsvc_contact_insert_grouprel(contact_id, (contacts_list_h)contact->grouprelations); if (rel_changed < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("__ctsvc_contact_insert_grouprel() Fail(%d)", rel_changed); ctsvc_end_trans(false); return rel_changed; + /* LCOV_EXCL_STOP */ } } @@ -2335,9 +2531,11 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta ret = contacts_list_get_current_record_p((contacts_list_h)contact->images, (contacts_record_h*)&image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (image->is_default) @@ -2389,9 +2587,11 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (contact->display_name) @@ -2419,10 +2619,12 @@ static int __ctsvc_db_contact_replace_record(contacts_record_h record, int conta ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); diff --git a/server/db/ctsvc_db_plugin_contact_helper.c b/server/db/ctsvc_db_plugin_contact_helper.c index fc8ee27..21fcaf1 100644 --- a/server/db/ctsvc_db_plugin_contact_helper.c +++ b/server/db/ctsvc_db_plugin_contact_helper.c @@ -80,8 +80,10 @@ int ctsvc_contact_add_image_file(int parent_id, int img_id, lower_ext = strdup(ext); temp = lower_ext; if (NULL == temp) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } while (*temp) { *temp = tolower(*temp); @@ -94,9 +96,11 @@ int ctsvc_contact_add_image_file(int parent_id, int img_id, ret = ctsvc_utils_copy_image(CTSVC_CONTACT_IMG_FULL_LOCATION, src_img, dest); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_utils_copy_image() Fail(%d)", ret); dest[0] = '\0'; return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -115,12 +119,14 @@ static int __ctsvc_contact_get_current_image_file(int image_id, char *dest, int ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("DB error: ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } tmp_path = ctsvc_stmt_get_text(stmt, 0); @@ -259,13 +265,16 @@ int ctsvc_db_contact_delete(int contact_id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -273,6 +282,7 @@ int ctsvc_db_contact_delete(int contact_id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); @@ -282,9 +292,11 @@ int ctsvc_db_contact_delete(int contact_id) stmt = NULL; if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -294,9 +306,11 @@ int ctsvc_db_contact_delete(int contact_id) CTS_TABLE_GROUPS, version, CTS_TABLE_GROUP_RELATIONS, contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } rel_changed = ctsvc_db_change(); @@ -305,9 +319,11 @@ int ctsvc_db_contact_delete(int contact_id) CTS_TABLE_CONTACTS, version, contact_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT link_count FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person_id); @@ -335,8 +351,10 @@ int ctsvc_db_contact_delete(int contact_id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -405,9 +423,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(normalized_display_name) + strlen(contact->sort_name) + 2; name = calloc(1, buf_size); if (NULL == name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(normalized_display_name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(name, buf_size, "%s %s", normalized_display_name, contact->sort_name); free(normalized_display_name); @@ -423,9 +443,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) int name_len = (CHINESE_PINYIN_SPELL_MAX_LEN*strlen(contact->display_name)+1) *sizeof(char); char *name_nospace = calloc(1, name_len); if (NULL == name_nospace) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); ctsvc_pinyin_free(pinyinname, size); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } char *temp_name = NULL; @@ -441,11 +463,13 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) + 4; temp_name = calloc(1, buf_size); if (NULL == temp_name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(name_nospace); ctsvc_pinyin_free(pinyinname, size); free(name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(temp_name, buf_size, "%s %s %s %s", name, pinyinname[i].pinyin_name, name_nospace, pinyinname[i].pinyin_initial); @@ -461,11 +485,13 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + 2; temp_name = calloc(1, buf_size); if (NULL == temp_name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(name_nospace); ctsvc_pinyin_free(pinyinname, size); free(name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(temp_name, buf_size, "%s %s", name, &contact->display_name[i]); @@ -485,9 +511,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2; name = calloc(1, buf_size); if (NULL == name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(normalized_display_name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(name, buf_size, "%s %s", normalized_display_name, initial); @@ -504,9 +532,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2; name = calloc(1, buf_size); if (NULL == name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(normalized_display_name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(name, buf_size, "%s %s", normalized_display_name, initial); @@ -520,8 +550,10 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) int full_len, chosung_len; char *chosung = calloc(1, strlen(contact->display_name) * 5); if (NULL == chosung) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } int total_len = strlen(contact->display_name); @@ -537,10 +569,12 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(&contact->display_name[i]) + SAFE_STRLEN(&chosung[j]) + 3; temp_name = calloc(1, buf_size); if (NULL == temp_name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(chosung); free(name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(temp_name, buf_size, "%s %s %s", name, &contact->display_name[i], &chosung[j]); @@ -563,9 +597,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(normalized_display_name) + strlen(initial) + 2; name = calloc(1, buf_size); if (NULL == name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(normalized_display_name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(name, buf_size, "%s %s", normalized_display_name, initial); @@ -589,9 +625,11 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size += 3; /* for space and null string */ phonetic = calloc(1, buf_size); if (NULL == phonetic) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (name_record->phonetic_first) @@ -611,10 +649,12 @@ int ctsvc_contact_make_search_name(ctsvc_contact_s *contact, char **search_name) buf_size = SAFE_STRLEN(name) + SAFE_STRLEN(phonetic) + 2; temp_name = calloc(1, buf_size); if (NULL == temp_name) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(phonetic); free(name); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(temp_name, buf_size, "%s %s", name, phonetic); free(name); @@ -638,8 +678,10 @@ static int __ctsvc_make_phonetic_name(ctsvc_name_s *name, char **phonetic, conta len += 3; /* for space and null string */ *phonetic = calloc(1, len); if (NULL == *phonetic) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } int temp_len = 0; @@ -979,8 +1021,10 @@ char* __ctsvc_remove_first_space(char *src) char *name_nospace = NULL; name_nospace = calloc(1, name_len); if (NULL == name_nospace) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } int len = strlen(src); @@ -1056,8 +1100,10 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact) temp_display_len += 7; temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -1156,9 +1202,11 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact) display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; display = calloc(1, display_len); if (NULL == display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); return; + /* LCOV_EXCL_STOP */ } char *temp = __ctsvc_remove_first_space(name->prefix); snprintf(display, display_len, "%s %s", temp, temp_display); @@ -1198,8 +1246,10 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact) /* make reverse_temp_display_name */ temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -1243,9 +1293,11 @@ void ctsvc_contact_make_display_name(ctsvc_contact_s *contact) display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; display = calloc(1, display_len); if (NULL == display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); return; + /* LCOV_EXCL_STOP */ } snprintf(display, display_len, "%s %s", name->prefix, temp_display); contact->display_name = display; @@ -1684,7 +1736,9 @@ int ctsvc_contact_update_data_name(contacts_list_h name_list, int contact_id, bo ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) + /* LCOV_EXCL_START */ ERR("return(%d)", ret); + /* LCOV_EXCL_STOP */ } return ret; @@ -1727,8 +1781,10 @@ int ctsvc_contact_update_data_company(contacts_list_h company_list, int contact_ ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(company_list)); @@ -1769,8 +1825,10 @@ int ctsvc_contact_update_data_note(contacts_list_h note_list, int contact_id, bo ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(note_list)); @@ -1811,8 +1869,10 @@ int ctsvc_contact_update_data_event(contacts_list_h event_list, int contact_id, ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(event_list)); @@ -1853,8 +1913,10 @@ int ctsvc_contact_update_data_messenger(contacts_list_h messenger_list, int cont ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list)); @@ -1897,8 +1959,10 @@ int ctsvc_contact_update_data_address(contacts_list_h address_list, int contact_ ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(address_list)); @@ -1939,8 +2003,10 @@ int ctsvc_contact_update_data_url(contacts_list_h url_list, int contact_id, bool ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(url_list)); @@ -1980,8 +2046,10 @@ int ctsvc_contact_update_data_profile(contacts_list_h profile_list, int contact_ ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list)); @@ -2022,8 +2090,10 @@ int ctsvc_contact_update_data_relationship(contacts_list_h relationship_list, in ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list)); @@ -2066,8 +2136,10 @@ int ctsvc_contact_update_data_image(contacts_list_h image_list, int contact_id, } } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(image_list)); @@ -2108,8 +2180,10 @@ int ctsvc_contact_update_data_nickname(contacts_list_h nickname_list, int contac ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list)); @@ -2153,8 +2227,10 @@ int ctsvc_contact_update_data_extension(contacts_list_h extension_list, int cont ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list)); @@ -2195,8 +2271,10 @@ int ctsvc_contact_update_data_sip(contacts_list_h sip_list, int contact_id, bool ret = ctsvc_db_sip_insert(record, contact_id, is_my_profile, NULL); } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("DB error : return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(sip_list)); @@ -2243,8 +2321,10 @@ int ctsvc_contact_update_data_number(contacts_list_h number_list, had = true; } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(number_list)); @@ -2293,8 +2373,10 @@ int ctsvc_contact_update_data_email(contacts_list_h email_list, had = true; } if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("return (%d)", ret); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(email_list)); @@ -2314,7 +2396,9 @@ int ctsvc_contact_insert_data_name(contacts_list_h name_list, int contact_id, bo if (record) { ret = ctsvc_db_name_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) + /* LCOV_EXCL_START */ ERR("ctsvc_db_name_insert() Fail"); + /* LCOV_EXCL_STOP */ } return ret; } @@ -2336,8 +2420,10 @@ int ctsvc_contact_insert_data_number(contacts_list_h number_list, int contact_id contacts_list_get_current_record_p(number_list, &record); ret = ctsvc_db_number_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_number_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(number_list)); @@ -2361,8 +2447,10 @@ int ctsvc_contact_insert_data_email(contacts_list_h email_list, int contact_id, contacts_list_get_current_record_p(email_list, &record); ret = ctsvc_db_email_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_email_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(email_list)); @@ -2386,8 +2474,10 @@ int ctsvc_contact_insert_data_profile(contacts_list_h profile_list, int contact_ contacts_list_get_current_record_p(profile_list, &record); ret = ctsvc_db_profile_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_profile_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(profile_list)); @@ -2411,8 +2501,10 @@ int ctsvc_contact_insert_data_company(contacts_list_h company_list, int contact_ contacts_list_get_current_record_p(company_list, &record); ret = ctsvc_db_company_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_company_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(company_list)); @@ -2437,8 +2529,10 @@ int ctsvc_contact_insert_data_note(contacts_list_h note_list, int contact_id, bo if (record) { ret = ctsvc_db_note_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_note_insert"); break; + /* LCOV_EXCL_STOP */ } } } while (CONTACTS_ERROR_NONE == contacts_list_next(note_list)); @@ -2462,8 +2556,10 @@ int ctsvc_contact_insert_data_event(contacts_list_h event_list, int contact_id, contacts_list_get_current_record_p(event_list, &record); ret = ctsvc_db_event_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_event_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(event_list)); @@ -2487,8 +2583,10 @@ int ctsvc_contact_insert_data_messenger(contacts_list_h messenger_list, int cont contacts_list_get_current_record_p(messenger_list, &record); ret = ctsvc_db_messenger_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_messenger_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(messenger_list)); @@ -2512,8 +2610,10 @@ int ctsvc_contact_insert_data_address(contacts_list_h address_list, int contact_ contacts_list_get_current_record_p(address_list, &record); ret = ctsvc_db_address_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_address_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(address_list)); @@ -2537,8 +2637,10 @@ int ctsvc_contact_insert_data_url(contacts_list_h url_list, int contact_id, bool contacts_list_get_current_record_p(url_list, &record); ret = ctsvc_db_url_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_url_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(url_list)); @@ -2562,8 +2664,10 @@ int ctsvc_contact_insert_data_nickname(contacts_list_h nickname_list, int contac contacts_list_get_current_record_p(nickname_list, &record); ret = ctsvc_db_nickname_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_nickname_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(nickname_list)); @@ -2587,8 +2691,10 @@ int ctsvc_contact_insert_data_relationship(contacts_list_h relationship_list, in contacts_list_get_current_record_p(relationship_list, &record); ret = ctsvc_db_relationship_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_relationship_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(relationship_list)); @@ -2612,8 +2718,10 @@ int ctsvc_contact_insert_data_image(contacts_list_h image_list, int contact_id, contacts_list_get_current_record_p(image_list, &record); ret = ctsvc_db_image_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_image_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(image_list)); @@ -2637,8 +2745,10 @@ int ctsvc_contact_insert_data_extension(contacts_list_h extension_list, int cont contacts_list_get_current_record_p(extension_list, &record); ret = ctsvc_db_extension_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_extension_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(extension_list)); @@ -2662,8 +2772,10 @@ int ctsvc_contact_insert_data_sip(contacts_list_h sip_list, int contact_id, bool contacts_list_get_current_record_p(sip_list, &record); ret = ctsvc_db_sip_insert(record, contact_id, is_my_profile, NULL); if (CONTACTS_ERROR_DB == ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_db_sip_insert"); break; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(sip_list)); @@ -2697,9 +2809,11 @@ int ctsvc_contact_update_display_name(int contact_id, contacts_display_name_sour ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } if (contact->display_name) diff --git a/server/db/ctsvc_db_plugin_email.c b/server/db/ctsvc_db_plugin_email.c index 6b74175..fc515ce 100644 --- a/server/db/ctsvc_db_plugin_email.c +++ b/server/db/ctsvc_db_plugin_email.c @@ -145,21 +145,26 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", email->contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -167,15 +172,18 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id) return CONTACTS_ERROR_INVALID_PARAMETER; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); person_id = ctsvc_stmt_get_int(stmt, 1); ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } old_default_email_id = __ctsvc_db_email_get_default_email_id(email->contact_id); @@ -184,9 +192,11 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id) ret = ctsvc_db_email_insert(record, email->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -196,9 +206,11 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (email->is_default) { @@ -218,8 +230,10 @@ static int __ctsvc_db_email_insert_record(contacts_record_h record, int *id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -246,12 +260,14 @@ static int __ctsvc_db_email_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_email_get_value_from_stmt(stmt, out_record, 0); @@ -271,30 +287,38 @@ static int __ctsvc_db_email_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", email->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", email->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_email_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (email->is_default) { @@ -307,16 +331,20 @@ static int __ctsvc_db_email_update_record(contacts_record_h record) ret = ctsvc_db_contact_update_changed_time(email->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -337,8 +365,10 @@ static int __ctsvc_db_email_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -347,13 +377,16 @@ static int __ctsvc_db_email_delete_record(int id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -361,6 +394,7 @@ static int __ctsvc_db_email_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); person_id = ctsvc_stmt_get_int(stmt, 1); @@ -368,9 +402,11 @@ static int __ctsvc_db_email_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -381,6 +417,7 @@ static int __ctsvc_db_email_delete_record(int id) ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -388,6 +425,7 @@ static int __ctsvc_db_email_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } is_default = ctsvc_stmt_get_int(stmt, 0); is_primary_default = ctsvc_stmt_get_int(stmt, 1); @@ -395,9 +433,11 @@ static int __ctsvc_db_email_delete_record(int id) ret = ctsvc_db_email_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -414,9 +454,11 @@ static int __ctsvc_db_email_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (is_default) { @@ -470,10 +512,12 @@ static int __ctsvc_db_email_get_all_records(int offset, int limit, contacts_list contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_email_get_value_from_stmt(stmt, (contacts_record_h*)&email, 0); ctsvc_list_prepend(list, (contacts_record_h)email); @@ -506,10 +550,12 @@ static int __ctsvc_db_email_get_records_with_query(contacts_query_h query, int o while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_email._uri, &record); diff --git a/server/db/ctsvc_db_plugin_email_helper.c b/server/db/ctsvc_db_plugin_email_helper.c index 3b45c34..d52bacf 100644 --- a/server/db/ctsvc_db_plugin_email_helper.c +++ b/server/db/ctsvc_db_plugin_email_helper.c @@ -91,9 +91,11 @@ int ctsvc_db_email_insert(contacts_record_h record, int contact_id, bool is_my_p ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } email_id = ctsvc_db_get_last_insert_id(); diff --git a/server/db/ctsvc_db_plugin_event.c b/server/db/ctsvc_db_plugin_event.c index e6b4fce..0d3c68e 100644 --- a/server/db/ctsvc_db_plugin_event.c +++ b/server/db/ctsvc_db_plugin_event.c @@ -43,8 +43,10 @@ static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -53,39 +55,51 @@ static int __ctsvc_db_event_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", event->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_event_insert(record, event->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(event->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -112,12 +126,14 @@ static int __ctsvc_db_event_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_event_get_value_from_stmt(stmt, out_record, 0); @@ -136,45 +152,57 @@ static int __ctsvc_db_event_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", event->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", event->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_event_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* TODO ; contact display event update */ ret = ctsvc_db_contact_update_changed_time(event->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -190,8 +218,10 @@ static int __ctsvc_db_event_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -199,12 +229,15 @@ static int __ctsvc_db_event_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -212,6 +245,7 @@ static int __ctsvc_db_event_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -219,30 +253,38 @@ static int __ctsvc_db_event_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_event_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -276,10 +318,12 @@ static int __ctsvc_db_event_get_all_records(int offset, int limit, contacts_list contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_event_get_value_from_stmt(stmt, (contacts_record_h*)&event, 0); ctsvc_list_prepend(list, (contacts_record_h)event); @@ -312,10 +356,12 @@ static int __ctsvc_db_event_get_records_with_query(contacts_query_h query, int o while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_event._uri, &record); diff --git a/server/db/ctsvc_db_plugin_event_helper.c b/server/db/ctsvc_db_plugin_event_helper.c index e02d3cd..de2128c 100644 --- a/server/db/ctsvc_db_plugin_event_helper.c +++ b/server/db/ctsvc_db_plugin_event_helper.c @@ -54,9 +54,11 @@ int ctsvc_db_event_insert(contacts_record_h record, int contact_id, bool is_my_p ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* event->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_extension.c b/server/db/ctsvc_db_plugin_extension.c index 8ce39ec..5c4d359 100644 --- a/server/db/ctsvc_db_plugin_extension.c +++ b/server/db/ctsvc_db_plugin_extension.c @@ -46,8 +46,10 @@ static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -56,39 +58,51 @@ static int __ctsvc_db_extension_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", extension->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_extension_insert(record, extension->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(extension->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -116,12 +130,14 @@ static int __ctsvc_db_extension_get_record(int id, contacts_record_h *out_record ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_extension_get_value_from_stmt(stmt, out_record, 0); @@ -145,44 +161,56 @@ static int __ctsvc_db_extension_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", extension->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", extension->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_extension_update(record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(extension->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -198,8 +226,10 @@ static int __ctsvc_db_extension_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -207,12 +237,15 @@ static int __ctsvc_db_extension_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -220,6 +253,7 @@ static int __ctsvc_db_extension_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -227,30 +261,38 @@ static int __ctsvc_db_extension_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_extension_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -285,10 +327,12 @@ static int __ctsvc_db_extension_get_all_records(int offset, int limit, contacts_ contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_extension_get_value_from_stmt(stmt, (contacts_record_h*)&extension, 0); ctsvc_list_prepend(list, (contacts_record_h)extension); @@ -321,10 +365,12 @@ static int __ctsvc_db_extension_get_records_with_query(contacts_query_h query, i while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_extension._uri, &record); diff --git a/server/db/ctsvc_db_plugin_extension_helper.c b/server/db/ctsvc_db_plugin_extension_helper.c index f964808..002865f 100644 --- a/server/db/ctsvc_db_plugin_extension_helper.c +++ b/server/db/ctsvc_db_plugin_extension_helper.c @@ -122,9 +122,11 @@ int ctsvc_db_extension_insert(contacts_record_h record, int contact_id, bool is_ ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* extension->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_group.c b/server/db/ctsvc_db_plugin_group.c index e7ba2d6..4f0869d 100644 --- a/server/db/ctsvc_db_plugin_group.c +++ b/server/db/ctsvc_db_plugin_group.c @@ -72,9 +72,11 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id) RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret); if (false == ctsvc_have_ab_write_permission(group->addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", group->addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } group_prio = __ctsvc_db_group_get_next_group_prio(); @@ -90,9 +92,11 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_bind_text(stmt, 1, group->name); @@ -113,19 +117,23 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id) char image[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0}; ret = ctsvc_have_file_read_permission(group->image_thumbnail_path); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_utils_make_image_file_name(0, group->id, group->image_thumbnail_path, image, sizeof(image)); ret = ctsvc_utils_copy_image(CTS_GROUP_IMAGE_LOCATION, group->image_thumbnail_path, image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_utils_copy_image() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } free(group->image_thumbnail_path); @@ -139,10 +147,12 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_group_noti(); @@ -151,8 +161,10 @@ static int __ctsvc_db_group_insert_record(contacts_record_h record, int *id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -187,13 +199,16 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) CTS_TABLE_GROUPS, group->id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -203,6 +218,7 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) } else { return ret; } + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); @@ -212,17 +228,21 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) ctsvc_stmt_finalize(stmt); if (is_read_only && ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_group.name, CTSVC_PROPERTY_FLAG_DIRTY)) { + /* LCOV_EXCL_START */ ERR("Can not change the group name. It is a read-only group (group_id : %d)", group->id); ctsvc_end_trans(false); free(image); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); free(image); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (ctsvc_record_check_property_flag((ctsvc_record_s*)group, _contacts_group.image_path, CTSVC_PROPERTY_FLAG_DIRTY)) { @@ -241,10 +261,12 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) if (group->image_thumbnail_path) { ret = ctsvc_have_file_read_permission(group->image_thumbnail_path); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("Your module does not have read permission of the image file()"); ctsvc_end_trans(false); free(image); return ret; + /* LCOV_EXCL_STOP */ } check_permission = true; } @@ -260,19 +282,23 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) if (false == check_permission) { ret = ctsvc_have_file_read_permission(group->image_thumbnail_path); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); ctsvc_end_trans(false); free(image); return ret; + /* LCOV_EXCL_STOP */ } } ctsvc_utils_make_image_file_name(0, group->id, group->image_thumbnail_path, dest, sizeof(dest)); ret = ctsvc_utils_copy_image(CTS_GROUP_IMAGE_LOCATION, group->image_thumbnail_path, dest); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_copy_file() Fail(%d)", ret); ctsvc_end_trans(false); free(image); return ret; + /* LCOV_EXCL_STOP */ } free(group->image_thumbnail_path); @@ -294,8 +320,10 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) snprintf(query, sizeof(query), "UPDATE %s SET %s WHERE group_id = %d", CTS_TABLE_GROUPS, query_set, group->id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } if (bind_text) { int i = 0; @@ -307,9 +335,11 @@ static int __ctsvc_db_group_update_record(contacts_record_h record) } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -354,24 +384,30 @@ static int __ctsvc_db_group_delete_record(int id) ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, addressbook_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, true)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT COUNT(contact_id) FROM "CTS_TABLE_GROUP_RELATIONS" WHERE group_id = %d", id); ret = ctsvc_query_get_first_int_result(query, &count); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE group_id=%d AND is_read_only=0", @@ -379,9 +415,11 @@ static int __ctsvc_db_group_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); @@ -401,8 +439,10 @@ static int __ctsvc_db_group_delete_record(int id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -463,20 +503,24 @@ static int __ctsvc_db_group_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_group_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_group_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -512,10 +556,12 @@ static int __ctsvc_db_group_get_all_records(int offset, int limit, contacts_list while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_group_value_set(stmt, &record); @@ -551,10 +597,12 @@ static int __ctsvc_db_group_get_records_with_query(contacts_query_h query, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_group._uri, &record); diff --git a/server/db/ctsvc_db_plugin_grouprelation.c b/server/db/ctsvc_db_plugin_grouprelation.c index b7e9cd2..db2f27d 100644 --- a/server/db/ctsvc_db_plugin_grouprelation.c +++ b/server/db/ctsvc_db_plugin_grouprelation.c @@ -30,26 +30,34 @@ static int __ctsvc_db_grouprelation_insert_record(contacts_record_h record, int *id) { + /* LCOV_EXCL_START */ ERR("Please use the contacts_group_add_contact()"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_grouprelation_get_record(int id, contacts_record_h *out_record) { + /* LCOV_EXCL_START */ ERR("Not support get group-relation"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_grouprelation_update_record(contacts_record_h record) { + /* LCOV_EXCL_START */ ERR("Not support update group-relation"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_grouprelation_delete_record(int id) { + /* LCOV_EXCL_START */ ERR("Please use the contacts_group_remove_contact()"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, contacts_list_h *out_list) @@ -77,10 +85,12 @@ static int __ctsvc_db_grouprelation_get_all_records(int offset, int limit, conta contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_group_relation._uri, (contacts_record_h*)&grouprel); @@ -123,10 +133,12 @@ static int __ctsvc_db_grouprelation_get_records_with_query(contacts_query_h quer while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_group_relation._uri, &record); diff --git a/server/db/ctsvc_db_plugin_image.c b/server/db/ctsvc_db_plugin_image.c index bae08da..f4d004f 100644 --- a/server/db/ctsvc_db_plugin_image.c +++ b/server/db/ctsvc_db_plugin_image.c @@ -85,18 +85,22 @@ static int __ctsvc_db_image_get_primary_default_image_id(int person_id, int *ima ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (ret == CONTACTS_ERROR_NONE) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } *image_id = ctsvc_stmt_get_int(stmt, 0); @@ -183,21 +187,26 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", image->contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -205,6 +214,7 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id) return CONTACTS_ERROR_INVALID_PARAMETER; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); @@ -212,9 +222,11 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } old_default_image_id = __ctsvc_db_image_get_default_image_id(image->contact_id); @@ -223,9 +235,11 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id) ret = ctsvc_db_image_insert(record, image->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -266,8 +280,10 @@ static int __ctsvc_db_image_insert_record(contacts_record_h record, int *id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -294,12 +310,14 @@ static int __ctsvc_db_image_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_image_get_value_from_stmt(stmt, out_record, 0); @@ -325,21 +343,26 @@ static int __ctsvc_db_image_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", image->contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -347,22 +370,27 @@ static int __ctsvc_db_image_update_record(contacts_record_h record) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); person_id = ctsvc_stmt_get_int(stmt, 1); ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_image_update(record, image->contact_id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -403,8 +431,10 @@ static int __ctsvc_db_image_update_record(contacts_record_h record) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -425,8 +455,10 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -434,20 +466,24 @@ static int __ctsvc_db_image_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); person_id = ctsvc_stmt_get_int(stmt, 1); @@ -455,9 +491,11 @@ static int __ctsvc_db_image_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -465,13 +503,16 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -479,6 +520,7 @@ static int __ctsvc_db_image_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } is_default = ctsvc_stmt_get_int(stmt, 0); @@ -488,9 +530,11 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_db_image_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -501,9 +545,11 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (is_default) { @@ -518,15 +564,19 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } image_id = ctsvc_stmt_get_int(stmt, 0); @@ -565,8 +615,10 @@ static int __ctsvc_db_image_delete_record(int id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -600,10 +652,12 @@ static int __ctsvc_db_image_get_all_records(int offset, int limit, contacts_list contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_image_get_value_from_stmt(stmt, (contacts_record_h*)&image, 0); ctsvc_list_prepend(list, (contacts_record_h)image); @@ -636,10 +690,12 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_image._uri, &record); diff --git a/server/db/ctsvc_db_plugin_image_helper.c b/server/db/ctsvc_db_plugin_image_helper.c index c1d611a..1abea45 100644 --- a/server/db/ctsvc_db_plugin_image_helper.c +++ b/server/db/ctsvc_db_plugin_image_helper.c @@ -101,8 +101,10 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p image_id = ctsvc_db_get_next_id(CTS_TABLE_DATA); ret = ctsvc_contact_add_image_file(contact_id, image_id, image->path, image_path, sizeof(image_path)); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_add_image_file() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } free(image->path); image->path = strdup(image_path); @@ -119,9 +121,11 @@ int ctsvc_db_image_insert(contacts_record_h record, int contact_id, bool is_my_p ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* image->id = ctsvc_db_get_last_insert_id(); */ @@ -163,8 +167,10 @@ int ctsvc_db_image_update(contacts_record_h record, int contact_id, bool is_my_p if (image->path) { ret = ctsvc_have_file_read_permission(image->path); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_have_file_read_permission Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -254,8 +260,10 @@ int ctsvc_db_image_set_primary_default(int contact_id, const char *image_thumbna image_path = ctsvc_utils_get_image_path(image_thumbnail_path); if (NULL == image_path) { + /* LCOV_EXCL_START */ ERR("ctsvc_utils_get_image_path() Fail"); return CONTACTS_ERROR_INTERNAL; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), diff --git a/server/db/ctsvc_db_plugin_messenger.c b/server/db/ctsvc_db_plugin_messenger.c index 682d7d3..e38d64e 100644 --- a/server/db/ctsvc_db_plugin_messenger.c +++ b/server/db/ctsvc_db_plugin_messenger.c @@ -42,8 +42,10 @@ static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -52,39 +54,51 @@ static int __ctsvc_db_messenger_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", messenger->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_messenger_insert(record, messenger->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(messenger->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -111,12 +125,14 @@ static int __ctsvc_db_messenger_get_record(int id, contacts_record_h *out_record ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_messenger_get_value_from_stmt(stmt, out_record, 0); @@ -136,44 +152,56 @@ static int __ctsvc_db_messenger_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", messenger->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", messenger->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_messenger_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(messenger->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -189,8 +217,10 @@ static int __ctsvc_db_messenger_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -198,12 +228,15 @@ static int __ctsvc_db_messenger_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -211,6 +244,7 @@ static int __ctsvc_db_messenger_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -218,30 +252,38 @@ static int __ctsvc_db_messenger_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_messenger_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -275,10 +317,12 @@ static int __ctsvc_db_messenger_get_all_records(int offset, int limit, contacts_ contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_messenger_get_value_from_stmt(stmt, (contacts_record_h*)&messenger, 0); ctsvc_list_prepend(list, (contacts_record_h)messenger); @@ -311,10 +355,12 @@ static int __ctsvc_db_messenger_get_records_with_query(contacts_query_h query, i while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_messenger._uri, &record); diff --git a/server/db/ctsvc_db_plugin_messenger_helper.c b/server/db/ctsvc_db_plugin_messenger_helper.c index 4ef5e1d..4ecf895 100644 --- a/server/db/ctsvc_db_plugin_messenger_helper.c +++ b/server/db/ctsvc_db_plugin_messenger_helper.c @@ -79,9 +79,11 @@ int ctsvc_db_messenger_insert(contacts_record_h record, int contact_id, bool is_ ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* messenger->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_my_profile.c b/server/db/ctsvc_db_plugin_my_profile.c index a5f388e..a32aead 100644 --- a/server/db/ctsvc_db_plugin_my_profile.c +++ b/server/db/ctsvc_db_plugin_my_profile.c @@ -62,12 +62,14 @@ static int __ctsvc_db_get_my_profile_base_info(int id, ctsvc_my_profile_s *my_pr ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } i = 0; @@ -105,9 +107,11 @@ static int __ctsvc_db_my_profile_get_data(int id, ctsvc_my_profile_s *my_profile ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE */!= ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } do { @@ -159,8 +163,10 @@ static int __ctsvc_db_my_profile_get_data(int id, ctsvc_my_profile_s *my_profile ctsvc_get_data_info_sip(stmt, (contacts_list_h)my_profile->sips); break; default: + /* LCOV_EXCL_START */ ERR("Intenal : Not supported data type (%d)", datatype); break; + /* LCOV_EXCL_STOP */ } } while (1 /*CTS_TRUE*/ == ctsvc_stmt_step(stmt)); @@ -184,16 +190,20 @@ static int __ctsvc_db_my_profile_get_record(int id, contacts_record_h *out_recor my_profile = (ctsvc_my_profile_s*)record; ret = __ctsvc_db_get_my_profile_base_info(id, my_profile); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_get_main_contacts_info(ALL) Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_my_profile_get_data(id, my_profile); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret); contacts_record_destroy(record, true); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -215,32 +225,40 @@ static int __ctsvc_db_my_profile_delete_record(int id) "SELECT addressbook_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_MY_PROFILES" " "SET deleted = 1, changed_ver = %d WHERE my_profile_id = %d", ctsvc_get_next_ver(), id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_my_profile_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -253,64 +271,80 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile) if (my_profile->name) { ret = ctsvc_contact_update_data_name((contacts_list_h)my_profile->name, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_name() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->company) { ret = ctsvc_contact_update_data_company((contacts_list_h)my_profile->company, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_company() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->note) { ret = ctsvc_contact_update_data_note((contacts_list_h)my_profile->note, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_note() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->events) { ret = ctsvc_contact_update_data_event((contacts_list_h)my_profile->events, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_events() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->messengers) { ret = ctsvc_contact_update_data_messenger((contacts_list_h)my_profile->messengers, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_messengers() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->postal_addrs) { ret = ctsvc_contact_update_data_address((contacts_list_h)my_profile->postal_addrs, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_address() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->urls) { ret = ctsvc_contact_update_data_url((contacts_list_h)my_profile->urls, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_url() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->nicknames) { ret = ctsvc_contact_update_data_nickname((contacts_list_h)my_profile->nicknames, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_nickname() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -318,8 +352,10 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile) bool had_phonenumber; ret = ctsvc_contact_update_data_number((contacts_list_h)my_profile->numbers, my_profile->id, true, &had_phonenumber); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -327,40 +363,50 @@ static inline int __ctsvc_my_profile_update_data(ctsvc_my_profile_s *my_profile) bool had_email; ret = ctsvc_contact_update_data_email((contacts_list_h)my_profile->emails, my_profile->id, true, &had_email); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_email() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->profiles) { ret = ctsvc_contact_update_data_profile((contacts_list_h)my_profile->profiles, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_profile() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->relationships) { ret = ctsvc_contact_update_data_relationship((contacts_list_h)my_profile->relationships, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_relationship() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->images) { ret = ctsvc_contact_update_data_image((contacts_list_h)my_profile->images, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_image() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (my_profile->extensions) { ret = ctsvc_contact_update_data_extension((contacts_list_h)my_profile->extensions, my_profile->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_update_data_extension() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -414,8 +460,10 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile) temp_display_len += 7; temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -502,9 +550,11 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile) display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; display = calloc(1, display_len); if (NULL == display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); return; + /* LCOV_EXCL_STOP */ } snprintf(display, display_len, "%s %s", name->prefix, temp_display); my_profile->reverse_display_name = display; @@ -538,8 +588,10 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile) /* make reverse_temp_display_name */ temp_display = calloc(1, temp_display_len); if (NULL == temp_display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } len = 0; @@ -577,9 +629,11 @@ static void __ctsvc_make_my_profile_display_name(ctsvc_my_profile_s *my_profile) display_len = SAFE_STRLEN(name->prefix) + temp_display_len + 2; display = calloc(1, display_len); if (NULL == display) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(temp_display); return; + /* LCOV_EXCL_STOP */ } snprintf(display, display_len, "%s %s", name->prefix, temp_display); my_profile->display_name = display; @@ -674,15 +728,19 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record) "SELECT my_profile_id FROM "CTSVC_DB_VIEW_MY_PROFILE" WHERE my_profile_id = %d", my_profile->id); ret = ctsvc_query_get_first_int_result(query, &id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("The index(%d) is Invalid. %d Record(s) is(are) found", my_profile->id, ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(my_profile->addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", my_profile->addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } __ctsvc_make_my_profile_display_name(my_profile); @@ -691,9 +749,11 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record) /* update data */ ret = __ctsvc_my_profile_update_data(my_profile); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_my_profile_update_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* thumbnail */ @@ -708,9 +768,11 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record) do { ret = contacts_list_get_current_record_p((contacts_list_h)my_profile->images, (contacts_record_h*)&image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (image->is_default) @@ -761,8 +823,10 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -776,9 +840,11 @@ static int __ctsvc_db_my_profile_update_record(contacts_record_h record) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); } while (0); @@ -827,18 +893,22 @@ static int __ctsvc_db_my_profile_get_all_records(int offset, int limit, contacts while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } my_profile_id = ctsvc_stmt_get_int(stmt, 0); ret = ctsvc_db_get_record(_contacts_my_profile._uri, my_profile_id, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_db_get_record() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); } @@ -880,8 +950,10 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, if (false == had_my_profile_id) { s_query->projection = realloc(s_query->projection, s_query->projection_count+1); if (NULL == s_query->projection) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } s_query->projection[s_query->projection_count] = CTSVC_PROPERTY_MY_PROFILE_ID; s_query->projection_count++; @@ -894,10 +966,12 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_my_profile._uri, &record); @@ -957,10 +1031,12 @@ static int __ctsvc_db_my_profile_get_records_with_query(contacts_query_h query, } ret = __ctsvc_db_my_profile_get_data(my_profile_id, my_profile); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_my_profile_get_data Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); @@ -981,8 +1057,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->name) { ret = ctsvc_contact_insert_data_name((contacts_list_h)contact->name, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_name() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -990,8 +1068,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->company) { ret = ctsvc_contact_insert_data_company((contacts_list_h)contact->company, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_company() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -999,8 +1079,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->events) { ret = ctsvc_contact_insert_data_event((contacts_list_h)contact->events, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_event() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1008,8 +1090,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->messengers) { ret = ctsvc_contact_insert_data_messenger((contacts_list_h)contact->messengers, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_messenger() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1017,8 +1101,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->postal_addrs) { ret = ctsvc_contact_insert_data_address((contacts_list_h)contact->postal_addrs, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_postal() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1026,8 +1112,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->urls) { ret = ctsvc_contact_insert_data_url((contacts_list_h)contact->urls, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_web() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1035,8 +1123,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->nicknames) { ret = ctsvc_contact_insert_data_nickname((contacts_list_h)contact->nicknames, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_nickname() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1044,8 +1134,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->numbers) { ret = ctsvc_contact_insert_data_number((contacts_list_h)contact->numbers, contact->id, true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1053,8 +1145,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->emails) { ret = ctsvc_contact_insert_data_email((contacts_list_h)contact->emails, contact->id, true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_email() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1062,8 +1156,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->profiles) { ret = ctsvc_contact_insert_data_profile((contacts_list_h)contact->profiles, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_insert_my_profile_data_profile() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1071,8 +1167,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->relationships) { ret = ctsvc_contact_insert_data_relationship((contacts_list_h)contact->relationships, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_relationship() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1080,8 +1178,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->images) { ret = ctsvc_contact_insert_data_image((contacts_list_h)contact->images, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_image() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1089,8 +1189,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->note) { ret = ctsvc_contact_insert_data_note((contacts_list_h)contact->note, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_note() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1098,8 +1200,10 @@ static int __ctsvc_my_profile_insert_data(ctsvc_my_profile_s *contact) if (contact->extensions) { ret = ctsvc_contact_insert_data_extension((contacts_list_h)contact->extensions, contact->id, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_contact_insert_data_extension() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1127,9 +1231,11 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id RETVM_IF(ret < CONTACTS_ERROR_NONE, ret, "ctsvc_begin_trans() Fail(%d)", ret); if (false == ctsvc_have_ab_write_permission(my_profile->addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", my_profile->addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_MY_PROFILES" WHERE addressbook_id = %d AND deleted = 1", my_profile->addressbook_id); @@ -1138,9 +1244,11 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id ret = ctsvc_db_get_next_id(CTS_TABLE_MY_PROFILES); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_get_next_id() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } my_profile->id = ret; if (id) @@ -1152,9 +1260,11 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id /* Insert Data */ ret = __ctsvc_my_profile_insert_data(my_profile); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cts_insert_my_profile_data() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* thumbnail */ @@ -1170,9 +1280,11 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id do { ret = contacts_list_get_current_record_p((contacts_list_h)my_profile->images, (contacts_record_h*)&image); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } if (image->path && image->is_default) { @@ -1194,9 +1306,11 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (my_profile->display_name) @@ -1210,10 +1324,12 @@ static int __ctsvc_db_my_profile_insert_record(contacts_record_h record, int *id ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); diff --git a/server/db/ctsvc_db_plugin_name.c b/server/db/ctsvc_db_plugin_name.c index f09e63a..c7ec043 100644 --- a/server/db/ctsvc_db_plugin_name.c +++ b/server/db/ctsvc_db_plugin_name.c @@ -42,8 +42,10 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -52,50 +54,64 @@ static int __ctsvc_db_name_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", name->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT id FROM "CTS_TABLE_DATA" WHERE contact_id = %d AND datatype=%d", name->contact_id, CONTACTS_DATA_TYPE_NAME); ret = ctsvc_query_get_first_int_result(query, &name_id); if (name_id) { + /* LCOV_EXCL_START */ ERR("name_id (%d) is exist", name_id); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_name_insert(record, name->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(name->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME); ret = ctsvc_db_contact_update_changed_time(name->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -123,12 +139,14 @@ static int __ctsvc_db_name_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_name_get_value_from_stmt(stmt, out_record, 0); @@ -150,46 +168,58 @@ static int __ctsvc_db_name_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", name->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", name->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_name_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(name->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME); ret = ctsvc_db_contact_update_changed_time(name->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -206,8 +236,10 @@ static int __ctsvc_db_name_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -215,12 +247,15 @@ static int __ctsvc_db_name_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -228,6 +263,7 @@ static int __ctsvc_db_name_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -235,32 +271,40 @@ static int __ctsvc_db_name_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_name_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NAME); ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -295,10 +339,12 @@ static int __ctsvc_db_name_get_all_records(int offset, int limit, contacts_list_ contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_name_get_value_from_stmt(stmt, (contacts_record_h*)&name, 0); ctsvc_list_prepend(list, (contacts_record_h)name); @@ -332,10 +378,12 @@ static int __ctsvc_db_name_get_records_with_query(contacts_query_h query, int of while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_name._uri, &record); diff --git a/server/db/ctsvc_db_plugin_name_helper.c b/server/db/ctsvc_db_plugin_name_helper.c index f007905..deac247 100644 --- a/server/db/ctsvc_db_plugin_name_helper.c +++ b/server/db/ctsvc_db_plugin_name_helper.c @@ -46,16 +46,20 @@ static inline void __ctsvc_make_name_lookup(int op_code, const char *name_first, if (CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST == op_code) { *name_lookup = calloc(1, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 3); if (NULL == *name_lookup) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } snprintf(*name_lookup, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 3, "%s %c%s", SAFE_STR(name_first), 0x7E, SAFE_STR(name_last)); } else { *name_lookup = calloc(1, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 5); if (NULL == *name_lookup) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } snprintf(*name_lookup, SAFE_STRLEN(name_first) + SAFE_STRLEN(name_last) + 5, "%s,%c %c%s", SAFE_STR(name_last), 0x7E, 0x7E, SAFE_STR(name_first)); @@ -152,8 +156,10 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr contact_id, CONTACTS_DATA_TYPE_NAME, is_my_profile); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Faild(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -218,9 +224,11 @@ int ctsvc_db_name_insert(contacts_record_h record, int contact_id, bool is_my_pr ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* name->id = ctsvc_db_get_last_insert_id(); */ @@ -304,8 +312,10 @@ int ctsvc_db_name_update(contacts_record_h record, bool is_my_profile) ret = __ctsvc_normalize_name(name, normal_name); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("cts_normalize_name() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } switch (ret) { diff --git a/server/db/ctsvc_db_plugin_nickname.c b/server/db/ctsvc_db_plugin_nickname.c index 9f0ee0b..de32336 100644 --- a/server/db/ctsvc_db_plugin_nickname.c +++ b/server/db/ctsvc_db_plugin_nickname.c @@ -42,8 +42,10 @@ static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -52,41 +54,53 @@ static int __ctsvc_db_nickname_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", nickname->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_nickname_insert(record, nickname->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(nickname->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NICKNAME); ret = ctsvc_db_contact_update_changed_time(nickname->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -113,12 +127,14 @@ static int __ctsvc_db_nickname_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_nickname_get_value_from_stmt(stmt, out_record, 0); @@ -138,47 +154,59 @@ static int __ctsvc_db_nickname_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", nickname->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", nickname->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_nickname_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(nickname->contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NICKNAME); ret = ctsvc_db_contact_update_changed_time(nickname->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -194,8 +222,10 @@ static int __ctsvc_db_nickname_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -203,12 +233,15 @@ static int __ctsvc_db_nickname_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -216,6 +249,7 @@ static int __ctsvc_db_nickname_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -223,32 +257,40 @@ static int __ctsvc_db_nickname_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_nickname_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_contact_update_display_name(contact_id, CONTACTS_DISPLAY_NAME_SOURCE_TYPE_NICKNAME); ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -282,10 +324,12 @@ static int __ctsvc_db_nickname_get_all_records(int offset, int limit, contacts_l contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_nickname_get_value_from_stmt(stmt, (contacts_record_h*)&nickname, 0); ctsvc_list_prepend(list, (contacts_record_h)nickname); @@ -318,10 +362,12 @@ static int __ctsvc_db_nickname_get_records_with_query(contacts_query_h query, in while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_nickname._uri, &record); diff --git a/server/db/ctsvc_db_plugin_nickname_helper.c b/server/db/ctsvc_db_plugin_nickname_helper.c index 7d7eba2..a91701c 100644 --- a/server/db/ctsvc_db_plugin_nickname_helper.c +++ b/server/db/ctsvc_db_plugin_nickname_helper.c @@ -76,9 +76,11 @@ int ctsvc_db_nickname_insert(contacts_record_h record, int contact_id, bool is_m ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* nickname->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_note.c b/server/db/ctsvc_db_plugin_note.c index 7df01d2..b58e83c 100644 --- a/server/db/ctsvc_db_plugin_note.c +++ b/server/db/ctsvc_db_plugin_note.c @@ -52,12 +52,14 @@ static int __ctsvc_db_note_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_note_get_value_from_stmt(stmt, out_record, 0); @@ -77,8 +79,10 @@ static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -87,39 +91,51 @@ static int __ctsvc_db_note_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", note->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_note_insert(record, note->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(note->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -136,45 +152,57 @@ static int __ctsvc_db_note_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", note->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", note->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_note_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* TODO ; contact display note update */ ret = ctsvc_db_contact_update_changed_time(note->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -191,8 +219,10 @@ static int __ctsvc_db_note_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -200,12 +230,15 @@ static int __ctsvc_db_note_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -213,6 +246,7 @@ static int __ctsvc_db_note_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -220,31 +254,39 @@ static int __ctsvc_db_note_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_note_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* TODO ; contact name update */ ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -279,10 +321,12 @@ static int __ctsvc_db_note_get_all_records(int offset, int limit, contacts_list_ contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_note_get_value_from_stmt(stmt, (contacts_record_h*)¬e, 0); ctsvc_list_prepend(list, (contacts_record_h)note); @@ -315,10 +359,12 @@ static int __ctsvc_db_note_get_records_with_query(contacts_query_h query, int of while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_note._uri, &record); diff --git a/server/db/ctsvc_db_plugin_note_helper.c b/server/db/ctsvc_db_plugin_note_helper.c index 987ce21..6da28d5 100644 --- a/server/db/ctsvc_db_plugin_note_helper.c +++ b/server/db/ctsvc_db_plugin_note_helper.c @@ -74,9 +74,11 @@ int ctsvc_db_note_insert(contacts_record_h record, int contact_id, bool is_my_pr ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (id) *id = ctsvc_db_get_last_insert_id(); diff --git a/server/db/ctsvc_db_plugin_number.c b/server/db/ctsvc_db_plugin_number.c index e76bc5c..16a3f18 100644 --- a/server/db/ctsvc_db_plugin_number.c +++ b/server/db/ctsvc_db_plugin_number.c @@ -148,21 +148,26 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id, person_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", number->contact_id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -170,15 +175,18 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id) return CONTACTS_ERROR_INVALID_PARAMETER; else return ret; + /* LCOV_EXCL_STOP */ } addressbook_id = ctsvc_stmt_get_int(stmt, 0); person_id = ctsvc_stmt_get_int(stmt, 1); ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } old_default_number_id = __ctsvc_db_number_get_default_number_id(number->contact_id); @@ -187,9 +195,11 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id) ret = ctsvc_db_number_insert(record, number->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -199,9 +209,11 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (number->is_default) { @@ -220,8 +232,10 @@ static int __ctsvc_db_number_insert_record(contacts_record_h record, int *id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -242,12 +256,14 @@ static int __ctsvc_db_number_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_number_get_value_from_stmt(stmt, out_record, 0); @@ -266,30 +282,38 @@ static int __ctsvc_db_number_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", number->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", number->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_number_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (number->is_default) { @@ -302,16 +326,20 @@ static int __ctsvc_db_number_update_record(contacts_record_h record) ret = ctsvc_db_contact_update_changed_time(number->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -332,8 +360,10 @@ static int __ctsvc_db_number_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -342,13 +372,16 @@ static int __ctsvc_db_number_delete_record(int id) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -356,6 +389,7 @@ static int __ctsvc_db_number_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -364,9 +398,11 @@ static int __ctsvc_db_number_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -376,6 +412,7 @@ static int __ctsvc_db_number_delete_record(int id) ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -383,6 +420,7 @@ static int __ctsvc_db_number_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } is_default = ctsvc_stmt_get_int(stmt, 0); is_primary_default = ctsvc_stmt_get_int(stmt, 1); @@ -391,9 +429,11 @@ static int __ctsvc_db_number_delete_record(int id) ret = ctsvc_db_number_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -410,9 +450,11 @@ static int __ctsvc_db_number_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (is_default) { @@ -466,10 +508,12 @@ static int __ctsvc_db_number_get_all_records(int offset, int limit, contacts_lis contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_number_get_value_from_stmt(stmt, (contacts_record_h*)&number, 0); ctsvc_list_prepend(list, (contacts_record_h)number); @@ -502,10 +546,12 @@ static int __ctsvc_db_number_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_number._uri, &record); diff --git a/server/db/ctsvc_db_plugin_number_helper.c b/server/db/ctsvc_db_plugin_number_helper.c index dbe1843..27276fa 100644 --- a/server/db/ctsvc_db_plugin_number_helper.c +++ b/server/db/ctsvc_db_plugin_number_helper.c @@ -91,9 +91,11 @@ int ctsvc_db_number_insert(contacts_record_h record, int contact_id, bool is_my_ ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } number_id = ctsvc_db_get_last_insert_id(); @@ -318,11 +320,13 @@ int ctsvc_db_number_delete(int id, bool is_my_profile) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); #ifdef ENABLE_LOG_FEATURE ctsvc_stmt_finalize(stmt); #endif /* ENABLE_LOG_FEATURE */ return ret; + /* LCOV_EXCL_STOP */ } #ifdef ENABLE_LOG_FEATURE diff --git a/server/db/ctsvc_db_plugin_person.c b/server/db/ctsvc_db_plugin_person.c index e3bd138..f2c24f0 100644 --- a/server/db/ctsvc_db_plugin_person.c +++ b/server/db/ctsvc_db_plugin_person.c @@ -38,8 +38,10 @@ static int __ctsvc_db_person_insert_record(contacts_record_h record, int *id) { + /* LCOV_EXCL_START */ ERR("Can not insert person record directly"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } static int __ctsvc_db_person_get_record(int id, contacts_record_h *out_record) @@ -77,19 +79,23 @@ static int __ctsvc_db_person_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_person_create_record_from_stmt(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -120,9 +126,11 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) "SELECT person_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", person->person_id); ret = ctsvc_query_get_first_int_result(query, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_record_check_property_flag((ctsvc_record_s*)person, _contacts_person.display_contact_id, CTSVC_PROPERTY_FLAG_DIRTY)) { @@ -134,24 +142,30 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) ctsvc_get_display_column(), person->person_id, person->name_contact_id); ret = ctsvc_query_prepare(check_query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { if (CONTACTS_ERROR_NONE == ret) { + /* LCOV_EXCL_START */ ERR("the name_contact_id(%d) is not linked with person_id(%d)", person->name_contact_id, person->person_id); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } temp = ctsvc_stmt_get_text(stmt, 0); @@ -166,9 +180,11 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) ctsvc_record_check_property_flag((ctsvc_record_s*)person, index_favorite, CTSVC_PROPERTY_FLAG_DIRTY)) { ret = ctsvc_db_person_set_favorite(person->person_id, person->is_favorite, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } person->base.properties_flags[index_favorite] &= 0xFFFFFFFD; /* remove dirty bit */ ctsvc_set_contact_noti(); @@ -189,8 +205,10 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -203,9 +221,11 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); break; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); } while (0); @@ -236,6 +256,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) ret = ctsvc_query_prepare(contact_query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); CTSVC_RECORD_RESET_PROPERTY_FLAGS((ctsvc_record_s*)record); @@ -249,6 +270,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) g_slist_free(bind_text); } return ret; + /* LCOV_EXCL_STOP */ } i = 1; @@ -270,6 +292,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -284,6 +307,7 @@ static int __ctsvc_db_person_update_record(contacts_record_h record) g_slist_free(bind_text); } return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -336,9 +360,11 @@ static int __ctsvc_db_person_delete_record(int id) "SELECT person_id FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", id); ret = ctsvc_query_get_first_int_result(query, &person_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } version = ctsvc_get_next_ver(); @@ -351,18 +377,22 @@ static int __ctsvc_db_person_delete_record(int id) version, id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } rel_changed = ctsvc_db_change(); ret = ctsvc_get_write_permitted_addressbook_ids(&addressbook_ids, &count); if (CONTACTS_ERROR_INTERNAL == ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_get_write_permitted_addressbook_ids() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (addressbook_ids && 0 < count) { @@ -382,10 +412,12 @@ static int __ctsvc_db_person_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); free(addressbook_ids); return ret; + /* LCOV_EXCL_STOP */ } } free(addressbook_ids); @@ -396,9 +428,11 @@ static int __ctsvc_db_person_delete_record(int id) version, id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* @@ -408,9 +442,11 @@ static int __ctsvc_db_person_delete_record(int id) snprintf(query, sizeof(query), "DELETE FROM "CTS_TABLE_PERSONS" WHERE person_id = %d", id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_contact_noti(); @@ -420,8 +456,10 @@ static int __ctsvc_db_person_delete_record(int id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -468,17 +506,21 @@ static int __ctsvc_db_person_get_all_records(int offset, int limit, contacts_lis while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_person_create_record_from_stmt(stmt, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_create_record_from_stmt() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); @@ -511,10 +553,12 @@ static int __ctsvc_db_person_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_person._uri, &record); diff --git a/server/db/ctsvc_db_plugin_person_helper.c b/server/db/ctsvc_db_plugin_person_helper.c index 75b9e1b..5bb0fb7 100644 --- a/server/db/ctsvc_db_plugin_person_helper.c +++ b/server/db/ctsvc_db_plugin_person_helper.c @@ -157,8 +157,10 @@ int ctsvc_db_person_create_record_from_stmt_with_query(cts_stmt stmt, contacts_q int i; unsigned int *projection = malloc(sizeof(unsigned int)*s_query->property_count); if (NULL == projection) { + /* LCOV_EXCL_START */ ERR("malloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } for (i = 0; i < s_query->property_count; i++) @@ -259,9 +261,11 @@ int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate) if (1 /*CTS_TRUE*/ == ret) { prio = ctsvc_stmt_get_dbl(stmt, 0); } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -275,8 +279,10 @@ int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } if (propagate) { @@ -288,8 +294,10 @@ int ctsvc_db_person_set_favorite(int person_id, bool set, bool propagate) person_id); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -328,9 +336,11 @@ int ctsvc_db_insert_person(contacts_record_h record) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); free(status); return ret; + /* LCOV_EXCL_STOP */ } if (contact->ringtone_path) ctsvc_stmt_bind_text(stmt, 1, contact->ringtone_path); @@ -347,10 +357,12 @@ int ctsvc_db_insert_person(contacts_record_h record) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); free(status); return ret; + /* LCOV_EXCL_STOP */ } index = ctsvc_db_get_last_insert_id(); @@ -362,17 +374,21 @@ int ctsvc_db_insert_person(contacts_record_h record) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); free(status); return ret; + /* LCOV_EXCL_STOP */ } /* set favorite */ if (contact->is_favorite) { ret = ctsvc_db_person_set_favorite(index, contact->is_favorite, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } @@ -420,9 +436,11 @@ static inline int __ctsvc_db_update_person_default(int person_id, int datatype) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (CONTACTS_DATA_TYPE_IMAGE == datatype) { @@ -447,8 +465,10 @@ static inline int __ctsvc_db_update_person_default(int person_id, int datatype) free(image_path); free(thumbnail_path); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } } @@ -533,9 +553,11 @@ int ctsvc_db_update_person(contacts_record_h record) ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_record_check_property_flag((ctsvc_record_s*)record, _contacts_contact.ringtone_path, CTSVC_PROPERTY_FLAG_DIRTY)) { @@ -562,10 +584,12 @@ int ctsvc_db_update_person(contacts_record_h record) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); @@ -574,9 +598,11 @@ int ctsvc_db_update_person(contacts_record_h record) "SELECT is_favorite FROM "CTS_TABLE_CONTACTS" WHERE contact_id =%d ", contact->id); ret = ctsvc_query_get_first_int_result(query, &is_favorite); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -585,9 +611,11 @@ int ctsvc_db_update_person(contacts_record_h record) if (CONTACTS_ERROR_NO_DATA == ret && is_favorite) { ret = ctsvc_db_person_set_favorite(contact->person_id, true, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } else if (CONTACTS_ERROR_NONE == ret && false == is_favorite) { snprintf(query, sizeof(query), @@ -596,19 +624,25 @@ int ctsvc_db_update_person(contacts_record_h record) if (CONTACTS_ERROR_NO_DATA == ret) { ret = ctsvc_db_person_set_favorite(contact->person_id, false, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_set_favorite() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } else if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } else if (ret < CONTACTS_ERROR_NONE && CONTACTS_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); @@ -619,8 +653,10 @@ int ctsvc_db_update_person(contacts_record_h record) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -649,9 +685,11 @@ void ctsvc_db_normalize_str_callback(sqlite3_context *context, char *dest = NULL; ret = ctsvc_normalize_index(display_name, &dest); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_normalize_index() Fail(%d)", ret); sqlite3_result_null(context); return; + /* LCOV_EXCL_STOP */ } sqlite3_result_text(context, dest, strlen(dest), SQLITE_TRANSIENT); free(dest); diff --git a/server/db/ctsvc_db_plugin_phonelog.c b/server/db/ctsvc_db_plugin_phonelog.c index eba9a2a..210397b 100644 --- a/server/db/ctsvc_db_plugin_phonelog.c +++ b/server/db/ctsvc_db_plugin_phonelog.c @@ -87,20 +87,24 @@ static int __ctsvc_db_phonelog_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_phonelog_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_phonelog_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -133,9 +137,11 @@ static int __ctsvc_db_phonelog_update_record(contacts_record_h record) "SELECT id FROM "CTS_TABLE_PHONELOGS" WHERE id = %d", phonelog->id); ret = ctsvc_query_get_first_int_result(query, &phonelog_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } do { @@ -181,9 +187,11 @@ static int __ctsvc_db_phonelog_delete_record(int id) "SELECT id FROM "CTS_TABLE_PHONELOGS" WHERE id = %d", id); ret = ctsvc_query_get_first_int_result(query, &phonelog_id); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE id = %d", @@ -191,17 +199,21 @@ static int __ctsvc_db_phonelog_delete_record(int id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_phonelog_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -233,10 +245,12 @@ static int __ctsvc_db_phonelog_get_all_records(int offset, int limit, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_phonelog_value_set(stmt, &record); @@ -270,10 +284,12 @@ static int __ctsvc_db_phonelog_get_records_with_query(contacts_query_h query, in while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_phone_log._uri, &record); @@ -392,8 +408,10 @@ static int __ctsvc_db_phonelog_increase_used_count(ctsvc_phonelog_s *phonelog) break; default: + /* LCOV_EXCL_START */ ERR("unknown log type (%d)", phonelog->log_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -471,9 +489,11 @@ static int __ctsvc_db_phonelog_insert(ctsvc_phonelog_s *phonelog, int *id) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (id) *id = ctsvc_db_get_last_insert_id(); @@ -500,9 +520,11 @@ static int __ctsvc_db_phonelog_insert_record(contacts_record_h record, int *id) ret = __ctsvc_db_phonelog_insert(phonelog, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_phonelog_insert() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (0 < phonelog->person_id) { @@ -517,8 +539,10 @@ static int __ctsvc_db_phonelog_insert_record(contacts_record_h record, int *id) ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; } diff --git a/server/db/ctsvc_db_plugin_profile.c b/server/db/ctsvc_db_plugin_profile.c index c3e841a..396e5d1 100644 --- a/server/db/ctsvc_db_plugin_profile.c +++ b/server/db/ctsvc_db_plugin_profile.c @@ -43,8 +43,10 @@ static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -53,39 +55,51 @@ static int __ctsvc_db_profile_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", profile->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_profile_insert(record, profile->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(profile->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -113,12 +127,14 @@ static int __ctsvc_db_profile_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_profile_get_value_from_stmt(stmt, out_record, 0); @@ -138,44 +154,56 @@ static int __ctsvc_db_profile_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", profile->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", profile->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_profile_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(profile->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -191,8 +219,10 @@ static int __ctsvc_db_profile_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -200,12 +230,15 @@ static int __ctsvc_db_profile_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -213,6 +246,7 @@ static int __ctsvc_db_profile_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -220,30 +254,38 @@ static int __ctsvc_db_profile_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_profile_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -278,10 +320,12 @@ static int __ctsvc_db_profile_get_all_records(int offset, int limit, contacts_li contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_profile_get_value_from_stmt(stmt, (contacts_record_h*)&profile, 0); ctsvc_list_prepend(list, (contacts_record_h)profile); @@ -314,10 +358,12 @@ static int __ctsvc_db_profile_get_records_with_query(contacts_query_h query, int while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_profile._uri, &record); diff --git a/server/db/ctsvc_db_plugin_profile_helper.c b/server/db/ctsvc_db_plugin_profile_helper.c index 769135e..7971db7 100644 --- a/server/db/ctsvc_db_plugin_profile_helper.c +++ b/server/db/ctsvc_db_plugin_profile_helper.c @@ -111,9 +111,11 @@ int ctsvc_db_profile_insert(contacts_record_h record, int contact_id, bool is_my ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* profile->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_relationship.c b/server/db/ctsvc_db_plugin_relationship.c index f9ac962..4cb12c1 100644 --- a/server/db/ctsvc_db_plugin_relationship.c +++ b/server/db/ctsvc_db_plugin_relationship.c @@ -42,8 +42,10 @@ static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int * ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -52,39 +54,51 @@ static int __ctsvc_db_relationship_insert_record(contacts_record_h record, int * if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", relationship->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_relationship_insert(record, relationship->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(relationship->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -111,12 +125,14 @@ static int __ctsvc_db_relationship_get_record(int id, contacts_record_h *out_rec ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_relationship_get_value_from_stmt(stmt, out_record, 0); @@ -136,44 +152,56 @@ static int __ctsvc_db_relationship_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", relationship->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", relationship->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_relationship_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(relationship->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -189,8 +217,10 @@ static int __ctsvc_db_relationship_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -198,12 +228,15 @@ static int __ctsvc_db_relationship_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -211,6 +244,7 @@ static int __ctsvc_db_relationship_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -218,30 +252,38 @@ static int __ctsvc_db_relationship_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_relationship_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -275,10 +317,12 @@ static int __ctsvc_db_relationship_get_all_records(int offset, int limit, contac contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_relationship_get_value_from_stmt(stmt, (contacts_record_h*)&relationship, 0); ctsvc_list_prepend(list, (contacts_record_h)relationship); @@ -311,10 +355,12 @@ static int __ctsvc_db_relationship_get_records_with_query(contacts_query_h query while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_relationship._uri, &record); diff --git a/server/db/ctsvc_db_plugin_relationship_helper.c b/server/db/ctsvc_db_plugin_relationship_helper.c index 0f9450a..939b935 100644 --- a/server/db/ctsvc_db_plugin_relationship_helper.c +++ b/server/db/ctsvc_db_plugin_relationship_helper.c @@ -84,9 +84,11 @@ int ctsvc_db_relationship_insert(contacts_record_h record, int contact_id, bool ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* relationship->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_sdn.c b/server/db/ctsvc_db_plugin_sdn.c index ce0ec02..5bff9f9 100644 --- a/server/db/ctsvc_db_plugin_sdn.c +++ b/server/db/ctsvc_db_plugin_sdn.c @@ -72,20 +72,24 @@ static int __ctsvc_db_sdn_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_sdn_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_sdn_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -120,10 +124,12 @@ static int __ctsvc_db_sdn_get_all_records(int offset, int limit, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_sdn_value_set(stmt, &record); @@ -158,10 +164,12 @@ static int __ctsvc_db_sdn_get_records_with_query(contacts_query_h query, int off while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_sdn._uri, &record); diff --git a/server/db/ctsvc_db_plugin_simple_contact.c b/server/db/ctsvc_db_plugin_simple_contact.c index 2de94f0..65730ae 100644 --- a/server/db/ctsvc_db_plugin_simple_contact.c +++ b/server/db/ctsvc_db_plugin_simple_contact.c @@ -99,20 +99,24 @@ static int __ctsvc_db_simple_contact_get_record(int id, contacts_record_h *out_r ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_simple_contact_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_simple_contact_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -148,10 +152,12 @@ static int __ctsvc_db_simple_contact_get_all_records(int offset, int limit, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_simple_contact_value_set(stmt, &record); @@ -186,10 +192,12 @@ static int __ctsvc_db_simple_contact_get_records_with_query(contacts_query_h que while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_simple_contact._uri, &record); diff --git a/server/db/ctsvc_db_plugin_sip.c b/server/db/ctsvc_db_plugin_sip.c index 82bd46c..12b61c1 100644 --- a/server/db/ctsvc_db_plugin_sip.c +++ b/server/db/ctsvc_db_plugin_sip.c @@ -64,8 +64,10 @@ static int __ctsvc_db_sip_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -74,39 +76,51 @@ static int __ctsvc_db_sip_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", sip->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_sip_insert(record, sip->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(sip->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -123,22 +137,24 @@ static int __ctsvc_db_sip_get_record(int id, contacts_record_h* out_record) snprintf(query, sizeof(query), "SELECT id, data.contact_id, is_default, data1, data2, data3 " - "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" " - "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id " - "WHERE id = %d AND datatype = %d ", - id, CONTACTS_DATA_TYPE_SIP); + "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" " + "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id " + "WHERE id = %d AND datatype = %d ", + id, CONTACTS_DATA_TYPE_SIP); ret = ctsvc_query_prepare(query, &stmt); RETVM_IF(NULL == stmt, ret, "DB error : ctsvc_query_prepare() Fail(%d)", ret); ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_sip_get_value_from_stmt(stmt, out_record, 0); @@ -157,45 +173,57 @@ static int __ctsvc_db_sip_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", sip->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", sip->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_sip_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* TODO ; contact display sip update */ ret = ctsvc_db_contact_update_changed_time(sip->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -211,21 +239,26 @@ static int __ctsvc_db_sip_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT contact_id, addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" " - "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); + "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -233,6 +266,7 @@ static int __ctsvc_db_sip_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -240,30 +274,38 @@ static int __ctsvc_db_sip_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_sip_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -280,10 +322,10 @@ static int __ctsvc_db_sip_get_all_records(int offset, int limit, contacts_list_h len = snprintf(query, sizeof(query), "SELECT id, data.contact_id, is_default, data1, data2, data3 " - "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" " - "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id " - "WHERE datatype = %d AND is_my_profile=0 ", - CONTACTS_DATA_TYPE_SIP); + "FROM "CTS_TABLE_DATA", "CTSVC_DB_VIEW_CONTACT" " + "ON "CTS_TABLE_DATA".contact_id = "CTSVC_DB_VIEW_CONTACT".contact_id " + "WHERE datatype = %d AND is_my_profile=0 ", + CONTACTS_DATA_TYPE_SIP); if (0 != limit) { len += snprintf(query+len, sizeof(query)-len, " LIMIT %d", limit); @@ -297,10 +339,12 @@ static int __ctsvc_db_sip_get_all_records(int offset, int limit, contacts_list_h contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_sip_get_value_from_stmt(stmt, (contacts_record_h*)&sip, 0); ctsvc_list_prepend(list, (contacts_record_h)sip); @@ -333,10 +377,12 @@ static int __ctsvc_db_sip_get_records_with_query(contacts_query_h query, int off while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_sip._uri, &record); diff --git a/server/db/ctsvc_db_plugin_sip_helper.c b/server/db/ctsvc_db_plugin_sip_helper.c index 846c8f7..de35ce8 100644 --- a/server/db/ctsvc_db_plugin_sip_helper.c +++ b/server/db/ctsvc_db_plugin_sip_helper.c @@ -54,9 +54,11 @@ int ctsvc_db_sip_insert(contacts_record_h record, int contact_id, bool is_my_pro ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("DB error : ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } /* sip->id = ctsvc_db_get_last_insert_id(); */ diff --git a/server/db/ctsvc_db_plugin_speeddial.c b/server/db/ctsvc_db_plugin_speeddial.c index ef7c2b3..d8d35ba 100644 --- a/server/db/ctsvc_db_plugin_speeddial.c +++ b/server/db/ctsvc_db_plugin_speeddial.c @@ -48,9 +48,11 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id) CONTACTS_DATA_TYPE_NUMBER, speeddial->number_id); ret = ctsvc_query_get_first_int_result(query, &number_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -59,9 +61,11 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id) ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); @@ -70,7 +74,9 @@ static int __ctsvc_db_speeddial_insert_record(contacts_record_h record, int *id) *id = speeddial->dial_number; ctsvc_set_speed_noti(); } else { + /* LCOV_EXCL_START */ ERR("already exist"); + /* LCOV_EXCL_STOP */ } ret = ctsvc_end_trans(true); @@ -133,20 +139,24 @@ static int __ctsvc_db_speeddial_get_record(int id, contacts_record_h *out_record ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_speeddial_value_set(stmt, &record); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_speeddial_value_set(ALL) Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_record = record; @@ -179,18 +189,22 @@ static int __ctsvc_db_speeddial_update_record(contacts_record_h record) CONTACTS_DATA_TYPE_NUMBER, speeddial->number_id); ret = ctsvc_query_get_first_int_result(query, &number_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d) : number_id is invalid", ret); ctsvc_end_trans(false); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", speeddial->dial_number); ret = ctsvc_query_get_first_int_result(query, &speeddial_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "UPDATE "CTS_TABLE_SPEEDDIALS" " @@ -198,17 +212,21 @@ static int __ctsvc_db_speeddial_update_record(contacts_record_h record) speeddial->number_id, speeddial->dial_number); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); ctsvc_stmt_finalize(stmt); @@ -241,26 +259,32 @@ static int __ctsvc_db_speeddial_delete_record(int id) "SELECT speed_number FROM "CTS_TABLE_SPEEDDIALS" WHERE speed_number = %d", id); ret = ctsvc_query_get_first_int_result(query, &speeddial_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "DELETE FROM %s WHERE speed_number = %d", CTS_TABLE_SPEEDDIALS, id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_change(); ctsvc_stmt_finalize(stmt); @@ -305,10 +329,12 @@ static int __ctsvc_db_speeddial_get_all_records(int offset, int limit, contacts_ while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } __ctsvc_db_speeddial_value_set(stmt, &record); @@ -343,10 +369,12 @@ static int __ctsvc_db_speeddial_get_records_with_query(contacts_query_h query, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_speeddial._uri, &record); diff --git a/server/db/ctsvc_db_plugin_url.c b/server/db/ctsvc_db_plugin_url.c index 4bf06cd..18132a6 100644 --- a/server/db/ctsvc_db_plugin_url.c +++ b/server/db/ctsvc_db_plugin_url.c @@ -42,8 +42,10 @@ static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -52,39 +54,51 @@ static int __ctsvc_db_url_insert_record(contacts_record_h record, int *id) if (CONTACTS_ERROR_NONE != ret) { ctsvc_end_trans(false); if (CONTACTS_ERROR_NO_DATA == ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", url->contact_id); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_url_insert(record, url->contact_id, false, id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(url->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -111,12 +125,14 @@ static int __ctsvc_db_url_get_record(int id, contacts_record_h *out_record) ret = ctsvc_stmt_step(stmt); if (1 /*CTS_TRUE*/ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); if (CONTACTS_ERROR_NONE == ret) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_url_get_value_from_stmt(stmt, out_record, 0); @@ -136,44 +152,56 @@ static int __ctsvc_db_url_update_record(contacts_record_h record) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT addressbook_id FROM "CTSVC_DB_VIEW_CONTACT" WHERE contact_id = %d", url->contact_id); ret = ctsvc_query_get_first_int_result(query, &addressbook_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No data : contact_id (%d) is not exist", url->contact_id); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_url_update(record, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("Update record Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(url->contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -189,8 +217,10 @@ static int __ctsvc_db_url_delete_record(int id) ret = ctsvc_begin_trans(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_begin_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -198,12 +228,15 @@ static int __ctsvc_db_url_delete_record(int id) "WHERE contact_id = (SELECT contact_id FROM "CTS_TABLE_DATA" WHERE id = %d)", id); ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_stmt_step(stmt); if (1 != ret) { + /* LCOV_EXCL_START */ ERR("The id(%d) is Invalid(%d)", id, ret); ctsvc_stmt_finalize(stmt); ctsvc_end_trans(false); @@ -211,6 +244,7 @@ static int __ctsvc_db_url_delete_record(int id) return CONTACTS_ERROR_NO_DATA; else return ret; + /* LCOV_EXCL_STOP */ } contact_id = ctsvc_stmt_get_int(stmt, 0); @@ -218,30 +252,38 @@ static int __ctsvc_db_url_delete_record(int id) ctsvc_stmt_finalize(stmt); if (false == ctsvc_have_ab_write_permission(addressbook_id, false)) { + /* LCOV_EXCL_START */ ERR("No permission in this addresbook_id(%d)", addressbook_id); ctsvc_end_trans(false); return CONTACTS_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_url_delete(id, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_url_delete() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_contact_update_changed_time(contact_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_contact_update_changed_time() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_set_person_noti(); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } else { return CONTACTS_ERROR_NONE; } @@ -275,10 +317,12 @@ static int __ctsvc_db_url_get_all_records(int offset, int limit, contacts_list_h contacts_list_create(&list); while ((ret = ctsvc_stmt_step(stmt))) { if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("DB : ctsvc_stmt_step fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_db_url_get_value_from_stmt(stmt, (contacts_record_h*)&url, 0); ctsvc_list_prepend(list, (contacts_record_h)url); @@ -311,10 +355,12 @@ static int __ctsvc_db_url_get_records_with_query(contacts_query_h query, int off while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 /*CTS_TRUE */ != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(_contacts_url._uri, &record); diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index b058d59..2c7081b 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -187,8 +187,10 @@ static inline int __ctsvc_db_create_int_condition(ctsvc_composite_filter_s *com_ snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name); break; default: + /* LCOV_EXCL_START */ ERR("Invalid : match rule(%d) is not supported", filter->match); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -231,8 +233,10 @@ static inline int __ctsvc_db_create_double_condition( snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name); break; default: + /* LCOV_EXCL_START */ ERR("Invalid : match rule(%d) is not supported", filter->match); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -273,8 +277,10 @@ static inline int __ctsvc_db_create_lli_condition(ctsvc_composite_filter_s *com_ snprintf(out_cond, sizeof(out_cond), "%s IS NULL", field_name); break; default: + /* LCOV_EXCL_START */ ERR("Invalid : match rule(%d) is not supported", filter->match); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -334,8 +340,10 @@ static int __db_add_str_matching_rule(const char *field_name, int match, len = snprintf(cond, sizeof(cond), "%s IS NOT NULL", field_name); break; default: + /* LCOV_EXCL_START */ ERR("Invalid : match rule (%d) is not supported", match); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (0 < len) @@ -382,9 +390,11 @@ static char *_get_search_query_for_name(const char *keyword) ret = ctsvc_get_halfwidth_string(keyword, &half_keyword, &keyword_size); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail"); half_keyword = (char*)keyword; use_replaced_keyword = false; + /* LCOV_EXCL_STOP */ } char *search_keyword = NULL; @@ -527,9 +537,11 @@ static char *_get_search_query_for_number(const char *keyword) ret = ctsvc_get_halfwidth_string(keyword, &half_keyword, &keyword_size); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail"); half_keyword = (char*)keyword; use_replaced_keyword = false; + /* LCOV_EXCL_STOP */ } char *search_keyword = NULL; @@ -587,9 +599,11 @@ static char *_get_search_query_for_number(const char *keyword) char *clean_number = calloc(len_keyword + 1, sizeof(char)); int err = ctsvc_clean_number(half_keyword, clean_number, len_keyword + 1, false); if (err <= 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_clean_number() Fail(%d)", err); free(clean_number); break; + /* LCOV_EXCL_STOP */ } temp_len = SAFE_SNPRINTF(&query, &query_size, len, " UNION SELECT contact_id " @@ -645,9 +659,11 @@ static char *_get_search_query_for_data(const char *keyword) ret = ctsvc_get_halfwidth_string(keyword, &half_keyword, &keyword_size); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail"); half_keyword = (char*)keyword; use_replaced_keyword = false; + /* LCOV_EXCL_STOP */ } char *search_keyword = NULL; @@ -871,8 +887,10 @@ static inline int __db_create_str_condtion_normalized_number( ret = __db_add_str_matching_rule(clean_field, filter->match, &tmp, &with_escape); if (ret <= 0) { + /* LCOV_EXCL_START */ ERR("__db_add_str_matching_rule() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cond_len += snprintf(out_cond + cond_len, out_cond_sz - cond_len, "%s", tmp); free(tmp); @@ -904,8 +922,10 @@ static inline int __db_create_str_condtion_normalized_number( ret = __db_add_str_matching_rule(number_field, filter->match, &tmp, &with_escape); if (ret <= 0) { + /* LCOV_EXCL_START */ ERR("__db_add_str_matching_rule() Fail"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cond_len = snprintf(out_cond, out_cond_sz, "%s", tmp); @@ -951,9 +971,11 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_ ret = __db_add_str_matching_rule(field_name, filter->match, &tmp, &with_escape); if (ret <= 0) { + /* LCOV_EXCL_START */ ERR("__db_add_str_matching_rule() Fail(%d)", ret); free(tmp); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cond_len = snprintf(out_cond, sizeof(out_cond), "%s", tmp); free(tmp); @@ -973,8 +995,10 @@ static inline int __ctsvc_db_create_str_condition(ctsvc_composite_filter_s *com_ ret = __db_create_str_condtion_normalized_number(com_filter, filter, with_escape, bind_text, cond_len, out_cond, sizeof(out_cond)); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_str_condtion_normalized_number() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } else if (filter->property_id == CTSVC_PROPERTY_NUMBER_CLEANED_NUMBER || filter->property_id == CTSVC_PROPERTY_PHONELOG_CLEANED_ADDRESS @@ -1122,8 +1146,10 @@ static int __ctsvc_db_create_attribute_condition(ctsvc_composite_filter_s *com_f ret = __ctsvc_db_create_double_condition(com_filter, filter, &cond); break; default: + /* LCOV_EXCL_START */ ERR("The filter type is not supported (%d)", filter->filter_type); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CONTACTS_ERROR_NONE == ret) @@ -1177,9 +1203,11 @@ static inline int __db_create_composite_condition( buf_size = CTSVC_FILTER_LENGTH; out_cond = calloc(1, buf_size); if (NULL == out_cond) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(cond); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = 0; @@ -1264,9 +1292,11 @@ int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text, } ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_stmt_finalize(stmt); return ret; @@ -1288,8 +1318,10 @@ int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bin s_record = (ctsvc_record_s*)record; if (0 == s_record->property_max_count || NULL == s_record->properties_flags) { + /* LCOV_EXCL_START */ ERR("record don't have properties"); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } property_info = ctsvc_view_get_all_property_infos(s_record->view_uri, @@ -1454,7 +1486,7 @@ static int __db_create_projection(const char *view_uri, field_name); } } -DBG("[%s]", out_projection); + DBG("[%s]", out_projection); *projection = strdup(out_projection); return CONTACTS_ERROR_NONE; @@ -1508,16 +1540,20 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int s_query->property_count, s_query->projection, s_query->projection_count, &projection, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_projection() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } query_size = CTS_SQL_MAX_LEN; query = calloc(1, query_size); if (NULL == query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(projection); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = 0; @@ -1542,9 +1578,11 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int ret = __db_create_composite_condition(s_query->filter, &condition, &bind_text); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_composite_condition Fail(%d)", ret); free(projection); return ret; + /* LCOV_EXCL_STOP */ } if (condition && *condition) { temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE ("); @@ -1633,11 +1671,13 @@ int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int ret = ctsvc_query_prepare(query, stmt); free(query); if (NULL == *stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)", ret); for (cursor = bind_text; cursor; cursor = cursor->next) free(cursor->data); g_slist_free(bind_text); return ret; + /* LCOV_EXCL_STOP */ } for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++) @@ -1661,8 +1701,10 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs ret = ctsvc_db_make_get_records_query_stmt(query, offset, limit, &stmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_db_make_get_records_query_stmt() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } contacts_list_create(&list); @@ -1670,10 +1712,12 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs contacts_record_h record; int field_count; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(query->view_uri, (contacts_record_h*)&record); @@ -1710,7 +1754,9 @@ static int __ctsvc_db_get_records_with_query_exec(ctsvc_query_s *query, int offs else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE) ctsvc_record_set_double(record, property_id, ctsvc_stmt_get_dbl(stmt, i)); else + /* LCOV_EXCL_START */ ERR("unknown type(%d)", type); + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); } @@ -1765,10 +1811,12 @@ static int __ctsvc_db_get_all_records_exec(const char *view_uri, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } contacts_record_create(view_uri, &record); @@ -1785,7 +1833,9 @@ static int __ctsvc_db_get_all_records_exec(const char *view_uri, else if (type == CTSVC_VIEW_DATA_TYPE_DOUBLE) ctsvc_record_set_double(record, properties[i].property_id, ctsvc_stmt_get_dbl(stmt, i)); else + /* LCOV_EXCL_START */ ERR("unknown type (%d)", type); + /* LCOV_EXCL_STOP */ } ctsvc_list_prepend(list, record); } @@ -1835,7 +1885,9 @@ static bool __ctsvc_db_view_can_keyword_search(const char *view_uri, int *out_en else if (STRING_EQUAL == strcmp(view_uri, CTSVC_VIEW_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED)) enum_uri = CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED; else + /* LCOV_EXCL_START */ ERR("Invalid uri[%s]", view_uri); + /* LCOV_EXCL_STOP */ *out_enum_uri = enum_uri; @@ -1876,16 +1928,20 @@ static int __db_append_search_query(const char *keyword, char **query, int *quer */ ret = ctsvc_get_halfwidth_string(keyword, &half_keyword, &keyword_size); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("UChar converting error : ctsvc_get_halfwidth_string() Fail"); half_keyword = (char*)keyword; use_replaced_keyword = false; + /* LCOV_EXCL_STOP */ } char *search_keyword = NULL; search_keyword = __ctsvc_db_make_search_keyword(half_keyword); if (NULL == search_keyword) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_make_search_keyword() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } temp_len = SAFE_SNPRINTF(query, query_size, len, "("); @@ -1925,7 +1981,7 @@ static int __db_append_search_query(const char *keyword, char **query, int *quer len += temp_len; temp_len = SAFE_SNPRINTF(query, query_size, len, search_keyword); if (0 <= temp_len - ) len += temp_len; + ) len += temp_len; need_or = true; } @@ -1954,9 +2010,11 @@ static int __db_append_search_query(const char *keyword, char **query, int *quer char *clean_number = calloc(len_keyword + 1, sizeof(char)); int err = ctsvc_clean_number(half_keyword, clean_number, len_keyword + 1, false); if (err <= 0) { + /* LCOV_EXCL_START */ ERR("ctsvc_clean_number() Fail(%d)", err); free(clean_number); break; + /* LCOV_EXCL_STOP */ } const char *cc = ctsvc_get_network_cc(false); @@ -2315,7 +2373,9 @@ static int __ctsvc_db_search_records_append_sort(const char *view_uri, } else { tmp_keyword = __db_get_str_with_escape((char*)keyword, strlen(keyword), true); if (NULL == tmp_keyword) { + /* LCOV_EXCL_START */ ERR("__db_get_str_with_escape() Fail"); + /* LCOV_EXCL_STOP */ return CONTACTS_ERROR_OUT_OF_MEMORY; } @@ -2388,8 +2448,10 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, query_size = CTS_SQL_MAX_LEN; query = calloc(1, query_size); if (NULL == query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = 0; @@ -2398,11 +2460,13 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, range &= ~CONTACTS_SEARCH_RANGE_NUMBER; if (0 == range) { + /* LCOV_EXCL_START */ ERR("No range"); contacts_list_create(&list); *out_list = list; free(query); return CONTACTS_ERROR_NONE; + /* LCOV_EXCL_STOP */ } switch (enum_uri) { @@ -2434,77 +2498,171 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, break; case CTSVC_ENUM_URI_READ_ONLY_PERSON_NUMBER: - { - bool need_or = false; - if (range & CONTACTS_SEARCH_RANGE_DATA || range & CONTACTS_SEARCH_RANGE_EMAIL) { - ERR("Invalid range"); - free(query); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT "); - if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection); - if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM (SELECT * FROM "); - if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, table); - if (0 <= temp_len) len += temp_len; - - if ((range & CONTACTS_SEARCH_RANGE_NUMBER) && ctsvc_is_phonenumber(keyword)) { - char clean_num[strlen(keyword)+1+5]; /* for cc */ - - /* - * Original number can include '-' or special character. So search by cleaned_number - * If contact has 010 1234 5678 (normalized number is +cc 10 1234 5678), - * then the contact should be searched by keyword +cc 10 1234 5678 - */ - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE "); - if (0 <= temp_len) - len += temp_len; + { + bool need_or = false; + if (range & CONTACTS_SEARCH_RANGE_DATA || range & CONTACTS_SEARCH_RANGE_EMAIL) { + /* LCOV_EXCL_START */ + ERR("Invalid range"); + free(query); + return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT "); + if (0 <= temp_len) len += temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection); + if (0 <= temp_len) len += temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM (SELECT * FROM "); + if (0 <= temp_len) len += temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, table); + if (0 <= temp_len) len += temp_len; - ret = ctsvc_clean_number(keyword, clean_num, sizeof(clean_num), false); - if (0 < ret) { - const char *cc = ctsvc_get_network_cc(false); + if ((range & CONTACTS_SEARCH_RANGE_NUMBER) && ctsvc_is_phonenumber(keyword)) { + char clean_num[strlen(keyword)+1+5]; /* for cc */ - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "(normalized_number LIKE '%%"); + /* + * Original number can include '-' or special character. So search by cleaned_number + * If contact has 010 1234 5678 (normalized number is +cc 10 1234 5678), + * then the contact should be searched by keyword +cc 10 1234 5678 + */ + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE "); if (0 <= temp_len) len += temp_len; - if (cc && cc[0] == '7' && clean_num[0] == '8') { /* Russia */ - char normal_num[strlen(clean_num)+1+5]; /* for cc */ - ret = ctsvc_normalize_number(clean_num, normal_num, - sizeof(normal_num), false); - if (0 < ret) - temp_len = SAFE_SNPRINTF(&query, &query_size, len, normal_num); - else + ret = ctsvc_clean_number(keyword, clean_num, sizeof(clean_num), false); + if (0 < ret) { + const char *cc = ctsvc_get_network_cc(false); + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "(normalized_number LIKE '%%"); + if (0 <= temp_len) + len += temp_len; + + if (cc && cc[0] == '7' && clean_num[0] == '8') { /* Russia */ + char normal_num[strlen(clean_num)+1+5]; /* for cc */ + ret = ctsvc_normalize_number(clean_num, normal_num, + sizeof(normal_num), false); + if (0 < ret) + temp_len = SAFE_SNPRINTF(&query, &query_size, len, normal_num); + else + temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num); + } else { temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num); - } else { + } + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' OR cleaned_number LIKE '%%"); + if (0 <= temp_len) + len += temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%')"); + if (0 <= temp_len) + len += temp_len; + } else { + char *temp_keyword = __db_get_str_with_escape((char*)keyword, + strlen(keyword), true); + if (NULL == temp_keyword) { + /* LCOV_EXCL_START */ + ERR("__db_get_str_with_escape() Fail"); + free(query); + return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ + } + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "(SELECT * FROM "); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, table); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE number LIKE '%%"); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_keyword); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' ESCAPE '\\')"); + if (0 <= temp_len) + len += temp_len; + free(temp_keyword); } + need_or = true; + } + + if (range & CONTACTS_SEARCH_RANGE_NAME) { + if (need_or) + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR "); + else + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE "); + if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' OR cleaned_number LIKE '%%"); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "person_id IN (SELECT " + "person_id FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND contact_id IN"); if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, clean_num); + /* + * search contact from search_index table by name and join the results + * FTS can support to serach with multiple words + * If contact display_name is 'abc def', then the contact should be searched by 'def' + */ + temp_len = __db_append_search_query(keyword, &query, &query_size, len, + CONTACTS_SEARCH_RANGE_NAME); if (0 <= temp_len) - len += temp_len; + len = temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%')"); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") "); if (0 <= temp_len) len += temp_len; - } else { + } + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") as temp_contacts"); + if (0 <= temp_len) + len += temp_len; + } + break; + + case CTSVC_ENUM_URI_READ_ONLY_PERSON_EMAIL: + { + bool need_or = false; + if (range & CONTACTS_SEARCH_RANGE_NUMBER || range & CONTACTS_SEARCH_RANGE_DATA) { + free(query); + return CONTACTS_ERROR_INVALID_PARAMETER; + } + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT "); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection); + if (0 <= temp_len) + len += temp_len; + + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ("); + if (0 <= temp_len) + len += temp_len; + + if (range & CONTACTS_SEARCH_RANGE_EMAIL) { + /* search contact which has email address started with keyword */ char *temp_keyword = __db_get_str_with_escape((char*)keyword, strlen(keyword), true); if (NULL == temp_keyword) { + /* LCOV_EXCL_START */ ERR("__db_get_str_with_escape() Fail"); free(query); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "(SELECT * FROM "); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT * FROM "); if (0 <= temp_len) len += temp_len; @@ -2512,7 +2670,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, if (0 <= temp_len) len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE number LIKE '%%"); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE (email LIKE '"); if (0 <= temp_len) len += temp_len; @@ -2524,124 +2682,36 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, if (0 <= temp_len) len += temp_len; free(temp_keyword); + need_or = true; } - need_or = true; - } - - if (range & CONTACTS_SEARCH_RANGE_NAME) { - if (need_or) - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR "); - else - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE "); - - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "person_id IN (SELECT " - "person_id FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND contact_id IN"); - if (0 <= temp_len) - len += temp_len; - - /* - * search contact from search_index table by name and join the results - * FTS can support to serach with multiple words - * If contact display_name is 'abc def', then the contact should be searched by 'def' - */ - temp_len = __db_append_search_query(keyword, &query, &query_size, len, - CONTACTS_SEARCH_RANGE_NAME); - if (0 <= temp_len) - len = temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") "); - if (0 <= temp_len) - len += temp_len; - } - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") as temp_contacts"); - if (0 <= temp_len) - len += temp_len; - } - break; - - case CTSVC_ENUM_URI_READ_ONLY_PERSON_EMAIL: - { - bool need_or = false; - if (range & CONTACTS_SEARCH_RANGE_NUMBER || range & CONTACTS_SEARCH_RANGE_DATA) { - free(query); - return CONTACTS_ERROR_INVALID_PARAMETER; - } - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT "); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, projection); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " FROM ("); - if (0 <= temp_len) - len += temp_len; - - if (range & CONTACTS_SEARCH_RANGE_EMAIL) { - /* search contact which has email address started with keyword */ - char *temp_keyword = __db_get_str_with_escape((char*)keyword, - strlen(keyword), true); - if (NULL == temp_keyword) { - ERR("__db_get_str_with_escape() Fail"); - free(query); - return CONTACTS_ERROR_OUT_OF_MEMORY; - } - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "SELECT * FROM "); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, table); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE (email LIKE '"); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_keyword); - if (0 <= temp_len) - len += temp_len; - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, "%%' ESCAPE '\\')"); - if (0 <= temp_len) - len += temp_len; - free(temp_keyword); - need_or = true; - } - if (range & CONTACTS_SEARCH_RANGE_NAME) { - if (need_or) { - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR "); + if (range & CONTACTS_SEARCH_RANGE_NAME) { + if (need_or) { + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " OR "); + if (0 <= temp_len) + len += temp_len; + } + snprintf(temp_query, sizeof(temp_query), "person_id IN (SELECT person_id " + "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND contact_id "); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query); + if (0 <= temp_len) + len += temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " IN "); + if (0 <= temp_len) + len += temp_len; + temp_len = __db_append_search_query(keyword, &query, &query_size, len, + CONTACTS_SEARCH_RANGE_NAME); + if (0 <= temp_len) + len = temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") "); if (0 <= temp_len) len += temp_len; } - snprintf(temp_query, sizeof(temp_query), "person_id IN (SELECT person_id " - "FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND contact_id "); - temp_len = SAFE_SNPRINTF(&query, &query_size, len, temp_query); - if (0 <= temp_len) - len += temp_len; - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " IN "); - if (0 <= temp_len) - len += temp_len; - temp_len = __db_append_search_query(keyword, &query, &query_size, len, - CONTACTS_SEARCH_RANGE_NAME); - if (0 <= temp_len) - len = temp_len; + temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") "); if (0 <= temp_len) len += temp_len; } - - temp_len = SAFE_SNPRINTF(&query, &query_size, len, ") "); - if (0 <= temp_len) - len += temp_len; - } break; case CTSVC_ENUM_URI_PERSON: @@ -2873,10 +2943,12 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } if (r_type == CTSVC_RECORD_PERSON) { @@ -2890,7 +2962,9 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, free(project); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("make record Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } else { contacts_record_create(view_uri, &record); @@ -2923,8 +2997,10 @@ static int __ctsvc_db_search_records_exec(const char *view_uri, ctsvc_stmt_get_dbl(stmt, i)); break; default: + /* LCOV_EXCL_START */ ERR("unknown type (%d)", type); break; + /* LCOV_EXCL_STOP */ } } } @@ -2965,8 +3041,10 @@ static int __ctsvc_db_search_records(const char *view_uri, p = ctsvc_view_get_all_property_infos(view_uri, &count); ret = __db_create_projection(view_uri, p, count, NULL, 0, &projection, is_snippet); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_projection() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = __ctsvc_db_search_records_exec(view_uri, enum_uri, p, count, projection, @@ -3047,8 +3125,10 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que query_size = CTS_SQL_MAX_LEN; query = calloc(1, query_size); if (NULL == query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = 0; @@ -3366,9 +3446,11 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que ret = ctsvc_query_prepare(query, &stmt); if (NULL == stmt) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_prepare() Fail(%d)[%s]", ret, query); free(query); return ret; + /* LCOV_EXCL_STOP */ } free(query); @@ -3381,10 +3463,12 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } if (ctsvc_view_get_record_type(s_query->view_uri) == CTSVC_RECORD_PERSON) { @@ -3407,7 +3491,9 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que ret = ctsvc_db_person_create_record_from_stmt_with_projection(stmt, project, ids_count, is_snippet, keyword, start_match, end_match, token_number, &record); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("ctsvc_db_person_create_record_from_stmt_with_projection() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ free(project); } else { @@ -3458,8 +3544,10 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que ctsvc_record_set_double(record, property_id, ctsvc_stmt_get_dbl(stmt, i)); break; default: + /* LCOV_EXCL_START */ ERR("unknown type (%d)", type); break; + /* LCOV_EXCL_STOP */ } } } @@ -3506,15 +3594,18 @@ static int __ctsvc_db_search_records_with_query(contacts_query_h query, ret = __db_create_composite_condition(s_query->filter, &condition, &bind_text); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_composite_condition Fail(%d)", ret); free(projection); return ret; + /* LCOV_EXCL_STOP */ } } ret = __ctsvc_db_search_records_with_query_exec(s_query, enum_uri, projection, condition, bind_text, keyword, offset, limit, is_snippet, start_match, end_match, token_number, out_list); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__ctsvc_db_search_records_with_query_exec Fail(%d)", ret); for (cursor = bind_text; cursor; cursor = cursor->next) free(cursor->data); @@ -3523,6 +3614,7 @@ static int __ctsvc_db_search_records_with_query(contacts_query_h query, free(condition); free(projection); return ret; + /* LCOV_EXCL_STOP */ } for (cursor = bind_text; cursor; cursor = cursor->next) @@ -3555,8 +3647,10 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids) ret = contacts_list_get_count(list, &count); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_count() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_begin_trans(); @@ -3569,26 +3663,32 @@ static int __ctsvc_db_insert_records(contacts_list_h list, int **ids) do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); free(id); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_insert_record(record, &id[index++]); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_db_insert_record() Fail(%d)", ret); ctsvc_end_trans(false); free(id); return ret; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); free(id); return ret; + /* LCOV_EXCL_STOP */ } if (ids) @@ -3613,16 +3713,20 @@ static int __ctsvc_db_delete_records(const char *view_uri, int ids[], int count) DBG("the record is not exist : %d", ret); continue; } else if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_db_delete_record() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } while (index < count); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -3645,22 +3749,28 @@ static int __ctsvc_db_update_records(contacts_list_h list) do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_update_record(record); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_db_update_record() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); ret = ctsvc_end_trans(true); if (ret < CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("ctsvc_end_trans() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CONTACTS_ERROR_NONE; @@ -3685,8 +3795,10 @@ static int __ctsvc_db_get_count_exec(const char *view_uri, const property_info_s ret = ctsvc_query_get_first_int_result(query, out_count); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return ret; @@ -3726,8 +3838,10 @@ static int __db_get_count_with_query_exec(ctsvc_query_s *s_query, const char *pr query_size = CTS_SQL_MAX_LEN; query = calloc(1, query_size); if (NULL == query) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CONTACTS_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len = 0; @@ -3790,15 +3904,19 @@ static int __db_get_count_with_query_exec(ctsvc_query_s *s_query, const char *pr ctsvc_stmt_bind_copy_text(stmt, i, cursor->data, strlen(cursor->data)); ret = ctsvc_stmt_get_first_int_result(stmt, out_count); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } else { ret = ctsvc_query_get_first_int_result(query, out_count); free(query); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } return ret; @@ -3826,12 +3944,14 @@ static int __ctsvc_db_get_count_with_query(contacts_query_h query, int *out_coun s_query->property_count, s_query->projection, s_query->projection_count, &projection, false); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("__db_create_projection() Fail(%d)", ret); for (cursor = bind_text; cursor; cursor = cursor->next) free(cursor->data); g_slist_free(bind_text); free(condition); return ret; + /* LCOV_EXCL_STOP */ } ret = __db_get_count_with_query_exec(s_query, projection, condition, bind_text, @@ -3922,10 +4042,12 @@ static int __ctsvc_db_get_contact_changes(const char *view_uri, int addressbook_ ctsvc_updated_info_s *update_info; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_contact_updated_info._uri, &record); @@ -3952,8 +4074,10 @@ static int __ctsvc_db_get_contact_changes(const char *view_uri, int addressbook_ snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION); ret = ctsvc_query_get_first_int_result(query, out_current_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_list = list; @@ -3997,10 +4121,12 @@ static int __ctsvc_db_get_group_changes(const char *view_uri, int addressbook_id ctsvc_updated_info_s *update_info; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(_contacts_group_updated_info._uri, &record); @@ -4024,8 +4150,10 @@ static int __ctsvc_db_get_group_changes(const char *view_uri, int addressbook_id snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION); ret = ctsvc_query_get_first_int_result(query, out_current_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_list = list; @@ -4067,10 +4195,12 @@ static int __ctsvc_db_get_group_relations_changes(const char *view_uri, while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(view_uri, &record); @@ -4093,8 +4223,10 @@ static int __ctsvc_db_get_group_relations_changes(const char *view_uri, snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION); ret = ctsvc_query_get_first_int_result(query, out_current_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_list = list; @@ -4127,10 +4259,12 @@ static int __ctsvc_db_get_group_member_changes(const char *view_uri, int address while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(view_uri, &record); @@ -4149,8 +4283,10 @@ static int __ctsvc_db_get_group_member_changes(const char *view_uri, int address snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION); ret = ctsvc_query_get_first_int_result(query, out_current_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_list = list; @@ -4201,10 +4337,12 @@ static int __ctsvc_db_get_my_profile_changes(const char *view_uri, int addressbo while ((ret = ctsvc_stmt_step(stmt))) { contacts_record_h record; if (1 != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d)", ret); ctsvc_stmt_finalize(stmt); contacts_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_record_create(view_uri, &record); @@ -4222,8 +4360,10 @@ static int __ctsvc_db_get_my_profile_changes(const char *view_uri, int addressbo snprintf(query, sizeof(query), "SELECT ver FROM "CTS_TABLE_VERSION); ret = ctsvc_query_get_first_int_result(query, out_current_version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_list = list; @@ -4263,8 +4403,10 @@ int ctsvc_db_get_changes_by_version(const char *view_uri, int addressbook_id, return ret; } + /* LCOV_EXCL_START */ ERR("this API does not support uri(%s)", view_uri); return CONTACTS_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } int ctsvc_db_get_current_version(int *out_current_version) @@ -4577,16 +4719,20 @@ static int __ctsvc_db_replace_records(contacts_list_h list, int ids[], int count do { ret = contacts_list_get_current_record_p(list, &record); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_list_get_current_record_p() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = ctsvc_db_replace_record(record, ids[i++]); if (ret != CONTACTS_ERROR_NONE) { + /* LCOV_EXCL_START */ ERR("contacts_db_replace_record() Fail(%d)", ret); ctsvc_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } } while (CONTACTS_ERROR_NONE == contacts_list_next(list)); diff --git a/server/db/ctsvc_db_sqlite.c b/server/db/ctsvc_db_sqlite.c index 261443b..69c2cd4 100644 --- a/server/db/ctsvc_db_sqlite.c +++ b/server/db/ctsvc_db_sqlite.c @@ -53,72 +53,92 @@ int ctsvc_db_open(void) if (NULL == ctsvc_db) { ret = db_util_open(CTSVC_DB_PATH, &ctsvc_db, 0); if (SQLITE_OK != ret || NULL == ctsvc_db) { + /* LCOV_EXCL_START */ ERR("db_util_open() Fail(%d), ctsvc_db(0x%x)", ret, ctsvc_db); return CONTACTS_ERROR_DB; /*CTS_ERR_DB_NOT_OPENED*/ + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_DATA_DELETE_", 2, SQLITE_UTF8, NULL, ctsvc_db_data_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_DATA_IMAGE_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_image_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_DATA_COMPANY_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_company_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_NORMALIZE_INDEX_", 2, SQLITE_UTF8, NULL, ctsvc_db_normalize_str_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } #ifdef ENABLE_LOG_FEATURE ret = sqlite3_create_function(ctsvc_db, "_PHONE_LOG_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_phone_log_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } #endif /* ENABLE_LOG_FEATURE */ ret = sqlite3_create_function(ctsvc_db, "_PERSON_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_person_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_GROUP_DELETE_", 1, SQLITE_UTF8, NULL, ctsvc_db_group_delete_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_function(ctsvc_db, "_NUMBER_COMPARE_", 4, SQLITE_UTF8, NULL, ctsvc_db_phone_number_equal_callback, NULL, NULL); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_function() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } ret = sqlite3_create_collation(ctsvc_db, "_NAME_SORT_", SQLITE_UTF8, (void *)SQLITE_UTF8, ctsvc_db_group_name_sort_callback); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_create_collation() Fail(%d)", ret); return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } } @@ -182,7 +202,9 @@ int ctsvc_query_get_first_int_result(const char *query, int *result) do { ret = sqlite3_prepare_v2(ctsvc_db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db)); + /* LCOV_EXCL_STOP */ if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { gettimeofday(&now, NULL); @@ -196,11 +218,13 @@ int ctsvc_query_get_first_int_result(const char *query, int *result) } while (retry); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%s)", sqlite3_errmsg(ctsvc_db)); if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) return CONTACTS_ERROR_DB_LOCKED; else return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } retry = false; @@ -208,8 +232,10 @@ int ctsvc_query_get_first_int_result(const char *query, int *result) do { ret = sqlite3_step(stmt); if (ret != SQLITE_ROW && SQLITE_DONE != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db)); + /* LCOV_EXCL_STOP */ } if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { @@ -230,12 +256,14 @@ int ctsvc_query_get_first_int_result(const char *query, int *result) ret, sqlite3_errmsg(ctsvc_db)); return CONTACTS_ERROR_NO_DATA /*CONTACTS_ERR_DB_RECORD_NOT_FOUND*/; } + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db)); if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) return CONTACTS_ERROR_DB_LOCKED; else return CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } *result = sqlite3_column_int(stmt, 0); @@ -257,7 +285,9 @@ int ctsvc_query_exec(const char *query) ret = ctsvc_stmt_step(stmt); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("ctsvc_stmt_step() Fail(%d, %s)", ret, err_msg); + /* LCOV_EXCL_STOP */ ctsvc_stmt_finalize(stmt); @@ -277,7 +307,9 @@ int ctsvc_query_prepare(char *query, cts_stmt *stmt) do { ret = sqlite3_prepare_v2(ctsvc_db, query, strlen(query), stmt, NULL); if (ret != SQLITE_OK) + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail(%d, %s)", ret, sqlite3_errmsg(ctsvc_db)); + /* LCOV_EXCL_STOP */ if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { gettimeofday(&now, NULL); @@ -309,8 +341,10 @@ int ctsvc_stmt_get_first_int_result(cts_stmt stmt, int *result) do { ret = sqlite3_step(stmt); if (SQLITE_ROW != ret && SQLITE_DONE != ret) + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db)); + /* LCOV_EXCL_STOP */ if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { gettimeofday(&now, NULL); @@ -324,8 +358,10 @@ int ctsvc_stmt_get_first_int_result(cts_stmt stmt, int *result) } while (retry); if (SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db)); + /* LCOV_EXCL_STOP */ sqlite3_finalize(stmt); if (SQLITE_DONE == ret) @@ -354,8 +390,10 @@ int ctsvc_stmt_step(cts_stmt stmt) ret = sqlite3_step(stmt); if (ret != SQLITE_ROW && ret != SQLITE_DONE) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d, %s, %d)", ret, sqlite3_errmsg(ctsvc_db), sqlite3_extended_errcode(ctsvc_db)); + /* LCOV_EXCL_STOP */ } if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) { @@ -394,8 +432,10 @@ int ctsvc_stmt_step(cts_stmt stmt) ret = CONTACTS_ERROR_DB; break; default: + /* LCOV_EXCL_START */ ERR("sqlite3_step() Fail(%d)", ret); ret = CONTACTS_ERROR_DB; + /* LCOV_EXCL_STOP */ } return ret; diff --git a/server/db/ctsvc_db_utils.c b/server/db/ctsvc_db_utils.c index e4da3da..d116f6c 100644 --- a/server/db/ctsvc_db_utils.c +++ b/server/db/ctsvc_db_utils.c @@ -68,8 +68,10 @@ int ctsvc_begin_trans(void) progress *= 2; } if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } transaction_count = 0; @@ -110,7 +112,9 @@ int ctsvc_end_trans(bool is_success) CTS_TABLE_VERSION, transaction_ver); ret = ctsvc_query_exec(query); if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("ctsvc_query_exec(version up) Fail(%d)", ret); + /* LCOV_EXCL_STOP */ } INFO("start commit"); @@ -124,6 +128,7 @@ int ctsvc_end_trans(bool is_success) INFO("%s", (CONTACTS_ERROR_NONE == ret) ? "commit" : "rollback"); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ int tmp_ret; ERR("ctsvc_query_exec() Fail(%d)", ret); ctsvc_nofitication_cancel(); @@ -134,6 +139,7 @@ int ctsvc_end_trans(bool is_success) ERR("ctsvc_query_exec(ROLLBACK) Fail(%d)", tmp_ret); return ret; + /* LCOV_EXCL_STOP */ } ctsvc_notification_send(); @@ -190,8 +196,10 @@ void ctsvc_utils_make_image_file_name(int parent_id, int id, char *src_img, char lower_ext = strdup(ext); if (NULL == lower_ext) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); return; + /* LCOV_EXCL_STOP */ } temp = lower_ext; while (*temp) { @@ -231,8 +239,10 @@ static image_util_rotation_e _ctsvc_image_get_rotation_info(const char *path) ed = exif_data_new_from_file(path); if (NULL == ed) { + /* LCOV_EXCL_START */ ERR("exif_data_new_from_file() Fail"); return IMAGE_UTIL_ROTATION_NONE; + /* LCOV_EXCL_STOP */ } entry = exif_data_get_entry(ed, EXIF_TAG_ORIENTATION); @@ -317,20 +327,24 @@ static bool _ctsvc_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_util_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); free(buffer); if (NULL == packet) { + /* LCOV_EXCL_START */ ERR("ctsvc_image_util_create_media_packet() Fail"); media_format_unref(fmt); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } ret = ctsvc_image_util_rotate(packet, rotation, &buffer_temp, &size); @@ -339,8 +353,10 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb( media_format_unref(fmt); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } if (rotation == IMAGE_UTIL_ROTATION_90 || rotation == IMAGE_UTIL_ROTATION_270) { @@ -374,20 +390,24 @@ static bool _ctsvc_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_util_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); free(buffer); if (NULL == packet) { + /* LCOV_EXCL_START */ ERR("ctsvc_image_util_create_media_packet() Fail"); media_format_unref(fmt); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } ret = ctsvc_image_util_resize(packet, resized_width, resized_height, &buffer_temp, @@ -410,24 +430,30 @@ static bool _ctsvc_image_util_supported_jpeg_colorspace_cb( CTSVC_IMAGE_ENCODE_QUALITY, info->dest); free(buffer); if (IMAGE_UTIL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("image_util_encode_jpeg Fail(%d)", ret); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } dest_fd = open(info->dest, O_RDONLY); if (dest_fd < 0) { + /* LCOV_EXCL_START */ ERR("System : Open Fail(%d)", errno); info->ret = CONTACTS_ERROR_SYSTEM; return false; + /* LCOV_EXCL_STOP */ } ret = fchmod(dest_fd, CTS_SECURITY_IMAGE_PERMISSION); if (0 != ret) { + /* LCOV_EXCL_START */ ERR("fchmod Fail(%d)", errno); info->ret = CONTACTS_ERROR_SYSTEM; close(dest_fd); return false; + /* LCOV_EXCL_STOP */ } close(dest_fd); @@ -470,19 +496,25 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file) if (CONTACTS_ERROR_NONE == ret) return ret; else + /* LCOV_EXCL_START */ ERR("_ctsvc_image_encode Fail(%d)", ret); + /* LCOV_EXCL_STOP */ src_fd = open(src, O_RDONLY); if (src_fd < 0) { + /* LCOV_EXCL_START */ ERR("System : Open(%s) Fail(%d)", src, errno); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } dest_fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0660); if (dest_fd < 0) { + /* LCOV_EXCL_START */ ERR("Open Fail(%d)", errno); close(src_fd); return CONTACTS_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } while (0 < (size = read(src_fd, buf, CTSVC_COPY_SIZE_MAX))) { @@ -491,6 +523,7 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file) if (EINTR == errno) { continue; } else { + /* LCOV_EXCL_START */ ERR("write() Fail(%d)", errno); if (ENOSPC == errno) ret = CONTACTS_ERROR_FILE_NO_SPACE; /* No space */ @@ -500,13 +533,16 @@ int ctsvc_utils_copy_image(const char *dir, const char *src, const char *file) close(dest_fd); unlink(dest); return ret; + /* LCOV_EXCL_STOP */ } } } ret = fchmod(dest_fd, CTS_SECURITY_IMAGE_PERMISSION); if (0 != ret) + /* LCOV_EXCL_START */ ERR("fchmod() Fail(%d)", ret); + /* LCOV_EXCL_STOP */ close(src_fd); close(dest_fd); @@ -527,8 +563,10 @@ char* ctsvc_utils_get_thumbnail_path(const char *image_path) full_len = strlen(image_path) + strlen(CTSVC_IMAGE_THUMBNAIL_SUFFIX) + 1; thumbnail_path = calloc(1, full_len); if (NULL == thumbnail_path) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } ext = strrchr(image_path, '.'); @@ -556,8 +594,10 @@ char* ctsvc_utils_get_image_path(const char *thumbnail_path) full_len = strlen(thumbnail_path) - strlen(CTSVC_IMAGE_THUMBNAIL_SUFFIX) + 1; image_path = calloc(1, full_len); if (NULL == image_path) { - ERR("calloc() Fail"); - return NULL; + /* LCOV_EXCL_START */ + ERR("calloc() Fail"); + return NULL; + /* LCOV_EXCL_STOP */ } ext = strrchr(thumbnail_path, '.'); @@ -583,15 +623,19 @@ char* ctsvc_utils_make_thumbnail(const char *image_path) RETV_IF(NULL != strstr(image_path, CTSVC_IMAGE_THUMBNAIL_SUFFIX), NULL); if (false == _ctsvc_check_available_image_space( - CTSVC_IMAGE_THUMBNAIL_SIZE * CTSVC_IMAGE_THUMBNAIL_SIZE)) { - ERR("No space to make thumbnail"); - return NULL; + CTSVC_IMAGE_THUMBNAIL_SIZE * CTSVC_IMAGE_THUMBNAIL_SIZE)) { + /* LCOV_EXCL_START */ + ERR("No space to make thumbnail"); + return NULL; + /* LCOV_EXCL_STOP */ } thumbnail_path = ctsvc_utils_get_thumbnail_path(image_path); if (NULL == thumbnail_path) { + /* LCOV_EXCL_START */ ERR("ctsvc_image_util_get_thumbnail_path() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } snprintf(src, sizeof(src), "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, image_path); @@ -604,9 +648,11 @@ char* ctsvc_utils_make_thumbnail(const char *image_path) ret = _ctsvc_image_encode(src, dest, CTSVC_IMAGE_THUMBNAIL_SIZE); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_ctsvc_image_encode() Fail(%d)", ret); free(thumbnail_path); return NULL; + /* LCOV_EXCL_STOP */ } return strdup(thumbnail_path); @@ -628,7 +674,9 @@ int ctsvc_get_next_ver(void) /* In this case, contacts-service already works abnormally. */ if (CONTACTS_ERROR_NONE != ret) + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result : get version error(%d)", ret); + /* LCOV_EXCL_STOP */ return (1 + version); } @@ -642,8 +690,10 @@ int ctsvc_get_current_version(int *out_current_version) ret = ctsvc_query_get_first_int_result(query, &version); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_current_version = version; -- 2.7.4