From: Jeesun Kim Date: Wed, 15 Jun 2016 12:00:23 +0000 (+0900) Subject: add comment LCOV_EXCL X-Git-Tag: accepted/tizen/common/20160715.175510~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6904e36c36805a8a7c3a06f347cf13b5346c1370;p=platform%2Fcore%2Fpim%2Fcalendar-service.git add comment LCOV_EXCL Change-Id: I07342b3bb719ff78025359bae72fc6f24ac11065 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 88ff28b..f1c2a34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(calendar-service C CXX) INCLUDE(FindPkgConfig) -SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden") +SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden ") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") diff --git a/client/cal_client_db_helper.c b/client/cal_client_db_helper.c index fb3a24a..7a0cb18 100644 --- a/client/cal_client_db_helper.c +++ b/client/cal_client_db_helper.c @@ -53,12 +53,16 @@ int cal_client_db_add_changed_cb(calendar_h handle, const char* view_uri, void * callback, user_data); break; default: + /* LCOV_EXCL_START */ ERR("Invalid view_uri(%s)", view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_inotify_subscribe() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -85,12 +89,16 @@ int cal_client_db_remove_changed_cb(calendar_h handle, const char* view_uri, cal ret = cal_inotify_unsubscribe(CAL_NOTI_TODO_CHANGED, callback, user_data); break; default: + /* LCOV_EXCL_START */ ERR("Invalid view_uri(%s)", view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_inotify_unsubscribe() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/client/cal_client_dbus.c b/client/cal_client_dbus.c index c385ccb..47445b3 100644 --- a/client/cal_client_dbus.c +++ b/client/cal_client_dbus.c @@ -81,6 +81,7 @@ static void _cal_dbus_cleanup(void) CAL_FN_CALL(); } +/* LCOV_EXCL_START */ static void _cal_dbus_name_owner_notify(GObject *object, GParamSpec *pspec, gpointer user_data) { CAL_FN_CALL(); @@ -95,6 +96,7 @@ static void _cal_dbus_name_owner_notify(GObject *object, GParamSpec *pspec, gpoi _cal_dbus_cleanup(); } +/* LCOV_EXCL_STOP */ void cal_dbus_call_reminder_cb(GDBusConnection *connection, const gchar *sender_name, @@ -114,7 +116,7 @@ void cal_dbus_call_reminder_cb(GDBusConnection *connection, } unsigned int cal_dbus_subscribe_signal(char *signal_name, GDBusSignalCallback callback, - gpointer user_data, GDestroyNotify user_data_free_func) + gpointer user_data, GDestroyNotify user_data_free_func) { GDBusConnection *conn = g_dbus_proxy_get_connection(G_DBUS_PROXY(cal_dbus_object)); @@ -143,9 +145,11 @@ static int _register_resource(void) cal_dbus_call_register_resource_sync(cal_dbus_object, &ret, NULL, &error); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_register_resource_sync() Fail[%s]", error->message); g_error_free(error); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return ret; } @@ -157,9 +161,11 @@ static int _unregister_resource(void) cal_dbus_call_unregister_resource_sync(cal_dbus_object, &ret, NULL, &error); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_register_resource_sync() Fail[%s]", error->message); g_error_free(error); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return ret; } @@ -179,12 +185,14 @@ int cal_dbus_start(void) NULL, &error); if (NULL == cal_dbus_object) { + /* LCOV_EXCL_START */ ERR("cal_dbus_proxy_new_for_bus_sync() Fail"); if (error) { ERR("error[%s]", error->message); g_error_free(error); } return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } _register_resource(); @@ -193,8 +201,10 @@ int cal_dbus_start(void) id = g_signal_connect(cal_dbus_object, "notify::g-name-owner", G_CALLBACK(_cal_dbus_name_owner_notify), NULL); if (0 == id) { + /* LCOV_EXCL_START */ ERR("g_signal_connect() Fail"); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -203,8 +213,10 @@ int cal_dbus_start(void) int cal_dbus_stop(void) { if (NULL == cal_dbus_object) { + /* LCOV_EXCL_START */ ERR("No object"); return CALENDAR_ERROR_NONE; + /* LCOV_EXCL_STOP */ } DBG("[ALL CONNECTION IS CLOSED]"); @@ -218,6 +230,7 @@ int cal_dbus_stop(void) return CALENDAR_ERROR_NONE; } +/* LCOV_EXCL_START */ int cal_dbus_recovery(void) { CAL_FN_CALL(); @@ -254,6 +267,7 @@ int cal_dbus_recovery(void) return CALENDAR_ERROR_NONE; } +/* LCOV_EXCL_STOP */ int cal_dbus_insert_record(calendar_h handle, calendar_record_h record, int *out_id) { @@ -276,6 +290,7 @@ int cal_dbus_insert_record(calendar_h handle, calendar_record_h record, int *out g_variant_unref(arg_record); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_insert_record_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -283,6 +298,7 @@ int cal_dbus_insert_record(calendar_h handle, calendar_record_h record, int *out ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); if (out_id) @@ -311,6 +327,7 @@ int cal_dbus_update_record(calendar_h handle, calendar_record_h record) g_variant_unref(arg_record); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_update_record_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -318,6 +335,7 @@ int cal_dbus_update_record(calendar_h handle, calendar_record_h record) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -342,6 +360,7 @@ int cal_dbus_delete_record(calendar_h handle, const char *view_uri, int id) &version, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_delete_record_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -349,6 +368,7 @@ int cal_dbus_delete_record(calendar_h handle, const char *view_uri, int id) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -375,6 +395,7 @@ int cal_dbus_replace_record(calendar_h handle, calendar_record_h record, int id) g_variant_unref(arg_record); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_replace_record_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -382,6 +403,7 @@ int cal_dbus_replace_record(calendar_h handle, calendar_record_h record, int id) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -409,6 +431,7 @@ int cal_dbus_insert_records(calendar_h handle, calendar_list_h list, g_variant_unref(arg_list); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_insert_records_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -416,6 +439,7 @@ int cal_dbus_insert_records(calendar_h handle, calendar_list_h list, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -452,6 +476,7 @@ int cal_dbus_update_records(calendar_h handle, calendar_list_h list) g_variant_unref(arg_list); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_update_records_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -459,6 +484,7 @@ int cal_dbus_update_records(calendar_h handle, calendar_list_h list) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -484,6 +510,7 @@ int cal_dbus_delete_records(calendar_h handle, const char *view_uri, int *ids, i g_variant_unref(arg_ids); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_delete_records_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -491,6 +518,7 @@ int cal_dbus_delete_records(calendar_h handle, const char *view_uri, int *ids, i ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -518,6 +546,7 @@ int cal_dbus_replace_records(calendar_h handle, calendar_list_h list, int *ids, g_variant_unref(arg_ids); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_replace_records_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -525,6 +554,7 @@ int cal_dbus_replace_records(calendar_h handle, calendar_list_h list, int *ids, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -548,6 +578,7 @@ int cal_dbus_get_record(calendar_h handle, const char *view_uri, int id, &arg_record, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_record_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -555,13 +586,16 @@ int cal_dbus_get_record(calendar_h handle, const char *view_uri, int id, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("get_record() Fail(%d)", ret); g_variant_unref(arg_record); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } cal_dbus_utils_gvariant_to_record(arg_record, out_record); g_variant_unref(arg_record); @@ -585,6 +619,7 @@ int cal_dbus_get_all_records(calendar_h handle, const char *view_uri, offset, limit, &arg_list, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_all_records_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -592,13 +627,16 @@ int cal_dbus_get_all_records(calendar_h handle, const char *view_uri, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("get_all_records() Fail(%d)", ret); g_variant_unref(arg_list); *out_list = NULL; return ret; + /* LCOV_EXCL_STOP */ } cal_dbus_utils_gvariant_to_list(arg_list, out_list); @@ -628,6 +666,7 @@ int cal_dbus_get_records_with_query(calendar_h handle, calendar_query_h query, g_variant_unref(arg_query); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_records_with_query_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -635,6 +674,7 @@ int cal_dbus_get_records_with_query(calendar_h handle, calendar_query_h query, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_dbus_utils_gvariant_to_list(arg_list, out_list); g_variant_unref(arg_list); @@ -660,6 +700,7 @@ int cal_dbus_get_count(calendar_h handle, const char *view_uri, int *out_count) &count, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_count_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -667,6 +708,7 @@ int cal_dbus_get_count(calendar_h handle, const char *view_uri, int *out_count) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } *out_count = count; @@ -690,6 +732,7 @@ int cal_dbus_get_count_with_query(calendar_h handle, calendar_query_h query, int g_variant_unref(arg_query); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_count_with_query_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -697,6 +740,7 @@ int cal_dbus_get_count_with_query(calendar_h handle, calendar_query_h query, int ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } *out_count = count; @@ -714,6 +758,7 @@ int cal_dbus_add_changed_cb(calendar_h handle, const char* view_uri, cal_dbus_call_check_permission_write_sync(cal_dbus_object, NULL, &error); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_check_permission_write_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -721,6 +766,7 @@ int cal_dbus_add_changed_cb(calendar_h handle, const char* view_uri, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } return cal_client_db_add_changed_cb(handle, view_uri, callback, user_data); @@ -737,6 +783,7 @@ int cal_dbus_remove_changed_cb(calendar_h handle, const char* view_uri, cal_dbus_call_check_permission_write_sync(cal_dbus_object, NULL, &error); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_check_permission_write_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -744,6 +791,7 @@ int cal_dbus_remove_changed_cb(calendar_h handle, const char* view_uri, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } return cal_client_db_remove_changed_cb(handle, view_uri, callback, user_data); } @@ -763,6 +811,7 @@ int cal_dbus_get_current_version(calendar_h handle, int *out_version) &version, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_current_version_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -770,10 +819,13 @@ int cal_dbus_get_current_version(calendar_h handle, int *out_version) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("server return Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } *out_version = version; @@ -790,6 +842,7 @@ int cal_dbus_get_last_change_version(calendar_h handle, int *out_version) cal_dbus_call_check_permission_read_sync(cal_dbus_object, NULL, &error); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_check_permission_read_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -797,6 +850,7 @@ int cal_dbus_get_last_change_version(calendar_h handle, int *out_version) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } return cal_handle_get_version(handle, out_version); } @@ -819,6 +873,7 @@ int cal_dbus_get_changes_by_version(calendar_h handle, const char *view_uri, book_id, in_version, &arg_list, out_version, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_changes_by_version_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -826,6 +881,7 @@ int cal_dbus_get_changes_by_version(calendar_h handle, const char *view_uri, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_dbus_utils_gvariant_to_list(arg_list, out_list); g_variant_unref(arg_list); @@ -853,6 +909,7 @@ int cal_dbus_get_changes_exception_by_version(calendar_h handle, const char *vie view_uri, original_id, version, &arg_list, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_get_changes_exception_by_version_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -860,6 +917,7 @@ int cal_dbus_get_changes_exception_by_version(calendar_h handle, const char *vie ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -885,6 +943,7 @@ int cal_dbus_clean_after_sync(calendar_h handle, int book_id, int version) &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_clean_after_sync_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -892,6 +951,7 @@ int cal_dbus_clean_after_sync(calendar_h handle, int book_id, int version) ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } return ret; @@ -916,6 +976,7 @@ int cal_dbus_insert_vcalendars(calendar_h handle, const char *stream, &arg_ids, &count, &version, &ret, NULL, &error); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_insert_vcalendars_sync() Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -923,6 +984,7 @@ int cal_dbus_insert_vcalendars(calendar_h handle, const char *stream, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); @@ -961,6 +1023,7 @@ int cal_dbus_replace_vcalendars(calendar_h handle, const char *stream, g_variant_unref(arg_ids); g_variant_unref(arg_handle); if (error) { + /* LCOV_EXCL_START */ ERR("cal_dbus_call_replace_vcalendars_sync Fail[%s]", error->message); if (G_DBUS_ERROR_ACCESS_DENIED == error->code) ret = CALENDAR_ERROR_PERMISSION_DENIED; @@ -968,6 +1031,7 @@ int cal_dbus_replace_vcalendars(calendar_h handle, const char *stream, ret = CALENDAR_ERROR_IPC; g_error_free(error); return ret; + /* LCOV_EXCL_STOP */ } cal_client_handle_set_version(handle, version); diff --git a/client/cal_client_handle.c b/client/cal_client_handle.c index 29d5d94..5a4bda8 100644 --- a/client/cal_client_handle.c +++ b/client/cal_client_handle.c @@ -31,6 +31,7 @@ static GHashTable *_cal_handle_table = NULL; +/* LCOV_EXCL_START */ static void _foreach_cb(gpointer key, gpointer value, gpointer user_data) { DBG("[hash check]--------- key[%s] value[%p]", key, value); @@ -40,6 +41,7 @@ static void _print_hash(GHashTable *table) if (table) g_hash_table_foreach(table, _foreach_cb, NULL); } +/* LCOV_EXCL_STOP */ static int _cal_client_handle_get_key(unsigned int id, char *key, int key_len) { @@ -72,18 +74,22 @@ int cal_client_handle_get_p(calendar_h *out_handle) if (NULL == handle && tid != pid) { ret = _cal_client_handle_get_key(pid, key, sizeof(key)); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_client_handle_get_key() Fail(%d):No handle(key[%s])", ret, key); _print_hash(_cal_handle_table); return ret; + /* LCOV_EXCL_STOP */ } cal_mutex_lock(CAL_MUTEX_HANDLE); handle = g_hash_table_lookup(_cal_handle_table, key); cal_mutex_unlock(CAL_MUTEX_HANDLE); if (NULL == handle) { + /* LCOV_EXCL_START */ ERR("g_hash_table_lookup() Fail:No handle(key[%s])", key); _print_hash(_cal_handle_table); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } } *out_handle = handle; @@ -106,9 +112,11 @@ int cal_client_handle_get_p_with_id(unsigned int id, calendar_h *out_handle) handle = g_hash_table_lookup(_cal_handle_table, key); cal_mutex_unlock(CAL_MUTEX_HANDLE); if (NULL == handle) { + /* LCOV_EXCL_START */ ERR("g_hash_table_lookup() Fail:No handle:key[%s]", key); _print_hash(_cal_handle_table); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } *out_handle = handle; return CALENDAR_ERROR_NONE; @@ -144,9 +152,11 @@ int cal_client_handle_create(unsigned int id, calendar_h *out_handle) ret = _cal_client_handle_add(handle, key); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_client_handle_add() Fail(%d)", ret); cal_handle_destroy(handle); return ret; + /* LCOV_EXCL_STOP */ } *out_handle = handle; diff --git a/client/cal_client_reminder.c b/client/cal_client_reminder.c index 4f1d515..30033ba 100644 --- a/client/cal_client_reminder.c +++ b/client/cal_client_reminder.c @@ -65,9 +65,11 @@ API int calendar_reminder_add_cb(calendar_reminder_cb callback, void *user_data) callback_info_s *ci = NULL; ci = calloc(1, sizeof(callback_info_s)); if (NULL == ci) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); pthread_mutex_unlock(&cal_mutex_reminder); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } DBG("add reminer(0x%x)", callback); @@ -105,9 +107,11 @@ API int calendar_reminder_remove_cb(calendar_reminder_cb callback, void *user_da } if (0 == is_matched) { + /* LCOV_EXCL_START */ ERR("Not matched callback(0x%x)", callback); pthread_mutex_unlock(&cal_mutex_reminder); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } DBG("remove reminder(0x%x)", callback); @@ -137,7 +141,7 @@ int cal_client_reminder_call_subscribe(const char *stream) while (cursor) { callback_info_s *ci = (callback_info_s *)cursor->data; if (NULL == ci) { - ERR("data is NULL"); + WARN("data is NULL"); cursor = g_slist_next(cursor); continue; } diff --git a/client/cal_client_service.c b/client/cal_client_service.c index 3a2d9d5..bbde159 100644 --- a/client/cal_client_service.c +++ b/client/cal_client_service.c @@ -38,8 +38,10 @@ API int calendar_connect(void) ret = cal_client_handle_create(id, &handle); RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_create() Fail(%d)", ret); } else if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_client_connect(handle, id, &connection_count); return ret; @@ -55,8 +57,10 @@ API int calendar_disconnect(void) if (CALENDAR_ERROR_NO_DATA == ret) { return CALENDAR_ERROR_NONE; } else if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_client_disconnect(handle, id, &connection_count); WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_client_disconnect() Fail(%d)", ret); @@ -74,8 +78,10 @@ API int calendar_connect_on_thread(void) ret = cal_client_handle_create(id, &handle); RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_create() Fail(%d)", ret); } else if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_client_connect(handle, id, &connection_count_on_thread); return ret; @@ -91,8 +97,10 @@ API int calendar_disconnect_on_thread(void) if (CALENDAR_ERROR_NO_DATA == ret) { return CALENDAR_ERROR_NONE; } else if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_client_disconnect(handle, id, &connection_count_on_thread); WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_client_disconnect() Fail(%d)", ret); @@ -110,8 +118,10 @@ API int calendar_connect_with_flags(unsigned int flags) ret = cal_client_handle_create(id, &handle); RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_create() Fail(%d)", ret); } else if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_client_handle_get_p_with_id() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_client_connect_with_flags(handle, id, &connection_count, flags); return ret; diff --git a/client/cal_client_service_helper.c b/client/cal_client_service_helper.c index e029281..9361420 100644 --- a/client/cal_client_service_helper.c +++ b/client/cal_client_service_helper.c @@ -54,9 +54,11 @@ int cal_client_connect(calendar_h handle, unsigned int id, int *connection_count #endif ret = cal_inotify_init(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_inotify_init() Fail(%d)", ret); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } cal_view_initialize(); @@ -102,9 +104,11 @@ int cal_client_disconnect(calendar_h handle, unsigned int id, int *connection_co } else if (1 < *connection_count) { DBG("[System] connection count(%d)", *connection_count); } else { - DBG("[System] calendar_connect() is needed"); + /* LCOV_EXCL_START */ + ERR("[System] calendar_connect() is needed"); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } (*connection_count)--; diff --git a/common/cal_inotify.c b/common/cal_inotify.c index c501996..bb2fccc 100644 --- a/common/cal_inotify.c +++ b/common/cal_inotify.c @@ -128,14 +128,18 @@ static inline int _inotify_attach_handler(int fd) GIOChannel *channel; if (fd < 0) { + /* LCOV_EXCL_START */ ERR("Invalid argument: fd is NULL"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } channel = g_io_channel_unix_new(fd); if (NULL == channel) { + /* LCOV_EXCL_START */ ERR("g_io_channel_unix_new() Fail"); return -1; /* CALENDAR_ERROR_FAILED_INOTIFY */ + /* LCOV_EXCL_STOP */ } g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL); @@ -164,6 +168,7 @@ int cal_inotify_init(void) #endif _inoti_fd = inotify_init(); if (_inoti_fd == -1) { + /* LCOV_EXCL_START */ ERR("inotify_init() Fail(%d)", errno); #ifdef CAL_IPC_CLIENT cal_mutex_lock(CAL_MUTEX_INOTIFY); @@ -171,6 +176,7 @@ int cal_inotify_init(void) cal_mutex_unlock(CAL_MUTEX_INOTIFY); #endif return -1; /* CALENDAR_ERROR_FAILED_INOTIFY */ + /* LCOV_EXCL_STOP */ } ret = fcntl(_inoti_fd, F_SETFD, FD_CLOEXEC); @@ -180,6 +186,7 @@ int cal_inotify_init(void) inoti_handler = _inotify_attach_handler(_inoti_fd); if (inoti_handler <= 0) { + /* LCOV_EXCL_START */ ERR("_inotify_attach_handler() Fail"); close(_inoti_fd); _inoti_fd = -1; @@ -190,6 +197,7 @@ int cal_inotify_init(void) cal_mutex_unlock(CAL_MUTEX_INOTIFY); #endif return -1; /* CALENDAR_ERROR_FAILED_INOTIFY */ + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -206,8 +214,10 @@ static inline int _cal_inotify_add_watch(int fd, const char *notipath) ret = inotify_add_watch(fd, notipath, IN_CLOSE_WRITE); if (ret < 0) { + /* LCOV_EXCL_START */ ERR("Failed to add watch(ret:%d)", ret); return -1; /* CALENDAR_ERROR_FAILED_INOTIFY */ + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -221,7 +231,7 @@ static bool _has_noti(int wd, void *cb, void *cb_data) while (cursor) { noti_info_s *info = (noti_info_s *)cursor->data; if (NULL == info) { - ERR("No info"); + WARN("No info"); cursor = g_slist_next(cursor); continue; } @@ -239,8 +249,10 @@ static int _append_noti(int wd, int type, void *cb, void *cb_data) noti_info_s *info = NULL; info = calloc(1, sizeof(noti_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } info->wd = wd; @@ -264,22 +276,28 @@ int cal_inotify_subscribe(cal_noti_type_e type, const char *path, void *cb, void wd = _cal_inotify_get_wd(_inoti_fd, path); if (wd == -1) { + /* LCOV_EXCL_START */ ERR("_cal_inotify_get_wd() Fail(%d)", errno); if (errno == EACCES) return CALENDAR_ERROR_PERMISSION_DENIED; return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } if (true == _has_noti(wd, cb, cb_data)) { + /* LCOV_EXCL_START */ ERR("noti is already registered: path[%s]", path); _cal_inotify_add_watch(_inoti_fd, path); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = _cal_inotify_add_watch(_inoti_fd, path); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_inotify_add_watch() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } _append_noti(wd, type, cb, cb_data); @@ -312,8 +330,10 @@ static int _cal_del_noti(GSList **_noti_list, int wd, void *cb, void *cb_data) } if (del_cnt == 0) { + /* LCOV_EXCL_START */ ERR("Nothing to delete"); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } *_noti_list = result; @@ -330,10 +350,12 @@ int cal_inotify_unsubscribe(const char *path, void *cb, void *cb_data) wd = _cal_inotify_get_wd(_inoti_fd, path); if (wd == -1) { + /* LCOV_EXCL_START */ ERR("_cal_inotify_get_wd() Fail(%d)", errno); if (errno == EACCES) return CALENDAR_ERROR_PERMISSION_DENIED; return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = _cal_del_noti(&_noti_list, wd, cb, cb_data); diff --git a/common/cal_list.c b/common/cal_list.c index 5ae8431..1420e1d 100644 --- a/common/cal_list.c +++ b/common/cal_list.c @@ -208,23 +208,29 @@ int cal_list_clone(calendar_list_h list, calendar_list_h *out_list) calendar_record_h clone_record = NULL; ret = calendar_list_get_current_record_p(list, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_current_record_p() Fail(%d)", ret); calendar_list_destroy(l, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_clone(record, &clone_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_clone() Fail(%d)", ret); calendar_list_destroy(l, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_list_add(l, clone_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(l, true); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_next(list); } @@ -247,8 +253,10 @@ int cal_list_get_nth_record_p(cal_list_s *list_s, int index, calendar_record_h * return CALENDAR_ERROR_NONE; } + /* LCOV_EXCL_START */ ERR("Check count(%d) < index(%d)", list_s->count, index); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } int cal_list_clear(cal_list_s *list_s) @@ -262,8 +270,10 @@ int cal_list_clear(cal_list_s *list_s) while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = calendar_list_remove(list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_remove() Fail(%d)", ret); break; + /* LCOV_EXCL_STOP */ } } return ret; diff --git a/common/cal_mutex.c b/common/cal_mutex.c index ad86c03..df53e20 100644 --- a/common/cal_mutex.c +++ b/common/cal_mutex.c @@ -62,9 +62,11 @@ static inline pthread_mutex_t* _cal_mutex_get_mutex(int type) ret_val = &_cal_handle_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/cal_query.c b/common/cal_query.c index 7c1af93..f53374a 100644 --- a/common/cal_query.c +++ b/common/cal_query.c @@ -112,8 +112,10 @@ API int calendar_query_set_filter(calendar_query_h query, calendar_filter_h filt que = (cal_query_s *)query; if (NULL == ((cal_composite_filter_s*)filter)->filters) { + /* LCOV_EXCL_START */ ERR("Empty filter"); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } ret = cal_filter_clone(filter, &new_filter); diff --git a/common/cal_record.c b/common/cal_record.c index 9fe10a9..43db95d 100644 --- a/common/cal_record.c +++ b/common/cal_record.c @@ -97,12 +97,16 @@ static inline void _cal_record_set_property_flag(calendar_record_h record, unsig _record->properties_flags = calloc(count, sizeof(char)); _record->properties_max_count = count; if (NULL == _record->properties_flags) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return ; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("get property_info_Fail"); return ; + /* LCOV_EXCL_STOP */ } } diff --git a/common/cal_record_alarm.c b/common/cal_record_alarm.c index eb0100d..f3329be 100644 --- a/common/cal_record_alarm.c +++ b/common/cal_record_alarm.c @@ -140,8 +140,10 @@ static int _cal_record_alarm_get_str(calendar_record_h record, unsigned int prop *out_str = cal_strdup(rec->alarm_attach); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -161,8 +163,10 @@ static int _cal_record_alarm_get_str_p(calendar_record_h record, unsigned int pr *out_str = (rec->alarm_attach); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -185,8 +189,10 @@ static int _cal_record_alarm_get_int(calendar_record_h record, unsigned int prop *out_value = (rec->alarm_action); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -200,8 +206,10 @@ static int _cal_record_alarm_get_caltime(calendar_record_h record, unsigned int *out_value = rec->alarm; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -223,8 +231,10 @@ static int _cal_record_alarm_set_str(calendar_record_h record, unsigned int prop rec->alarm_attach = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -248,8 +258,10 @@ static int _cal_record_alarm_set_int(calendar_record_h record, unsigned int prop rec->remind_tick_unit = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_ALARM_PARENT_ID: @@ -263,13 +275,17 @@ static int _cal_record_alarm_set_int(calendar_record_h record, unsigned int prop rec->alarm_action = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -283,8 +299,10 @@ static int _cal_record_alarm_set_caltime(calendar_record_h record, unsigned int rec->alarm = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_attendee.c b/common/cal_record_attendee.c index c205ca1..bb5cd92 100644 --- a/common/cal_record_attendee.c +++ b/common/cal_record_attendee.c @@ -163,8 +163,10 @@ static int _cal_record_attendee_get_str(calendar_record_h record, unsigned int p *out_str = cal_strdup(rec->attendee_member); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -199,8 +201,10 @@ static int _cal_record_attendee_get_str_p(calendar_record_h record, unsigned int *out_str = (rec->attendee_member); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -229,8 +233,10 @@ static int _cal_record_attendee_get_int(calendar_record_h record, unsigned int p *out_value = (rec->parent_id); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -273,8 +279,10 @@ static int _cal_record_attendee_set_str(calendar_record_h record, unsigned int p rec->attendee_member = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -303,8 +311,10 @@ static int _cal_record_attendee_set_int(calendar_record_h record, unsigned int p (rec->parent_id) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_calendar.c b/common/cal_record_calendar.c index 7813e5c..267d6d4 100644 --- a/common/cal_record_calendar.c +++ b/common/cal_record_calendar.c @@ -175,8 +175,10 @@ static int _cal_record_calendar_get_str(calendar_record_h record, unsigned int p *out_str = cal_strdup(cal_rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -214,8 +216,10 @@ static int _cal_record_calendar_get_str_p(calendar_record_h record, unsigned int *out_str = (cal_rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -244,8 +248,10 @@ static int _cal_record_calendar_get_int(calendar_record_h record, unsigned int p *out_value = (cal_rec->mode); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -292,8 +298,10 @@ static int _cal_record_calendar_set_str(calendar_record_h record, unsigned int p cal_rec->sync_data4 = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -321,8 +329,10 @@ static int _cal_record_calendar_set_int(calendar_record_h record, unsigned int p (cal_rec->store_type) = value; break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : store type is invalid value (%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_CALENDAR_SYNC_EVENT: @@ -333,8 +343,10 @@ static int _cal_record_calendar_set_int(calendar_record_h record, unsigned int p (cal_rec->sync_event) = value; break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : sync event is invalid value (%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_CALENDAR_MODE: @@ -343,8 +355,10 @@ static int _cal_record_calendar_set_int(calendar_record_h record, unsigned int p (cal_rec->mode) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_event.c b/common/cal_record_event.c index a29b32b..c8e26b7 100644 --- a/common/cal_record_event.c +++ b/common/cal_record_event.c @@ -336,8 +336,10 @@ static int _cal_record_event_get_str(calendar_record_h record, unsigned int prop *out_str = cal_strdup(rec->end_tzid); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -423,8 +425,10 @@ static int _cal_record_event_get_str_p(calendar_record_h record, unsigned int pr *out_str = (rec->end_tzid); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -515,8 +519,10 @@ static int _cal_record_event_get_double(calendar_record_h record, unsigned int p *out_value = (rec->longitude); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -553,8 +559,10 @@ static int _cal_record_event_get_caltime(calendar_record_h record, unsigned int *out_value = rec->until; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -665,8 +673,10 @@ static int _cal_record_event_set_str(calendar_record_h record, unsigned int prop rec->end_tzid = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -691,8 +701,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->event_status) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_PRIORITY: @@ -704,8 +716,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->priority) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_TIMEZONE: @@ -723,8 +737,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->busy_status) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_SENSITIVITY: @@ -735,8 +751,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->sensitivity) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_MEETING_STATUS: @@ -748,8 +766,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->meeting_status) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_ORIGINAL_EVENT_ID: @@ -771,8 +791,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->freq) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_RANGE_TYPE: @@ -783,8 +805,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->range_type) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_COUNT: @@ -807,8 +831,10 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->wkst) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_HAS_ATTENDEE: @@ -825,16 +851,20 @@ static int _cal_record_event_set_int(calendar_record_h record, unsigned int prop (rec->system_type) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_EVENT_IS_ALLDAY: (rec->is_allday) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -851,8 +881,10 @@ static int _cal_record_event_set_double(calendar_record_h record, unsigned int p (rec->longitude) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -866,8 +898,10 @@ static int _cal_record_event_set_lli(calendar_record_h record, unsigned int prop (rec->created_time) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -888,8 +922,10 @@ static int _cal_record_event_set_caltime(calendar_record_h record, unsigned int rec->until = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -914,8 +950,10 @@ static int _cal_record_event_reset_child_record_id(calendar_record_h child_recor ((cal_event_s *)record)->index = 0; break; default: + /* LCOV_EXCL_START */ ERR("Invalid child record type (%d)", record->type); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -944,8 +982,10 @@ static int _cal_record_event_add_child_record(calendar_record_h record, unsigned ret = calendar_list_add((calendar_list_h)rec->extended_list, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; @@ -973,8 +1013,10 @@ static int _cal_record_event_remove_child_record(calendar_record_h record, unsig ret = calendar_list_remove((calendar_list_h)rec->extended_list, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -1001,8 +1043,10 @@ static int _cal_record_event_get_child_record_count(calendar_record_h record, un ret = calendar_list_get_count((calendar_list_h)rec->extended_list, (int *)count); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -1029,8 +1073,10 @@ static int _cal_record_event_get_child_record_at_p(calendar_record_h record, uns ret = cal_list_get_nth_record_p(rec->extended_list, index, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -1057,8 +1103,10 @@ static int _cal_record_event_clone_child_record_list(calendar_record_h record, u ret = cal_list_clone((calendar_list_h)rec->extended_list, out_list); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } diff --git a/common/cal_record_extended.c b/common/cal_record_extended.c index 081d78e..3b00017 100644 --- a/common/cal_record_extended.c +++ b/common/cal_record_extended.c @@ -131,8 +131,10 @@ static int _cal_record_extended_get_str(calendar_record_h record, unsigned int p *out_str = cal_strdup(rec->value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -149,8 +151,10 @@ static int _cal_record_extended_get_str_p(calendar_record_h record, unsigned int *out_str = (rec->value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -170,8 +174,10 @@ static int _cal_record_extended_get_int(calendar_record_h record, unsigned int p *out_value = (rec->record_type); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -190,8 +196,10 @@ static int _cal_record_extended_set_str(calendar_record_h record, unsigned int p rec->value = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -212,8 +220,10 @@ static int _cal_record_extended_set_int(calendar_record_h record, unsigned int p (rec->record_type) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_instance_allday.c b/common/cal_record_instance_allday.c index 9f86499..fbeb1ae 100644 --- a/common/cal_record_instance_allday.c +++ b/common/cal_record_instance_allday.c @@ -171,8 +171,10 @@ static int _cal_record_instance_allday_get_str(calendar_record_h record, unsigne *out_str = cal_strdup(rec->sync_data1); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -195,8 +197,10 @@ static int _cal_record_instance_allday_get_str_p(calendar_record_h record, unsig *out_str = (rec->sync_data1); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -237,8 +241,10 @@ static int _cal_record_instance_allday_get_int(calendar_record_h record, unsigne *out_value = (rec->is_allday); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -255,8 +261,10 @@ static int _cal_record_instance_allday_get_double(calendar_record_h record, unsi *out_value = (rec->longitude); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -287,8 +295,10 @@ static int _cal_record_instance_allday_get_caltime(calendar_record_h record, uns *out_value = rec->end; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -315,8 +325,10 @@ static int _cal_record_instance_allday_set_str(calendar_record_h record, unsigne rec->sync_data1 = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -354,8 +366,10 @@ static int _cal_record_instance_allday_set_int(calendar_record_h record, unsigne (rec->original_event_id) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -372,8 +386,10 @@ static int _cal_record_instance_allday_set_double(calendar_record_h record, unsi (rec->longitude) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -390,8 +406,10 @@ static int _cal_record_instance_allday_set_caltime(calendar_record_h record, uns rec->end = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_instance_allday_extended.c b/common/cal_record_instance_allday_extended.c index 9b6a7ff..74f8e07 100644 --- a/common/cal_record_instance_allday_extended.c +++ b/common/cal_record_instance_allday_extended.c @@ -196,8 +196,10 @@ static int _cal_record_instance_allday_extended_get_str(calendar_record_h record *out_str = cal_strdup(rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -235,8 +237,10 @@ static int _cal_record_instance_allday_extended_get_str_p(calendar_record_h reco *out_str = (rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -281,8 +285,10 @@ static int _cal_record_instance_allday_extended_get_int(calendar_record_h record break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -300,8 +306,10 @@ static int _cal_record_instance_allday_extended_get_double(calendar_record_h rec break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -332,8 +340,10 @@ static int _cal_record_instance_allday_extended_get_caltime(calendar_record_h re *out_value = rec->end; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -380,8 +390,10 @@ static int _cal_record_instance_allday_extended_set_str(calendar_record_h record rec->sync_data4 = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -422,8 +434,10 @@ static int _cal_record_instance_allday_extended_set_int(calendar_record_h record (rec->has_attendee) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -441,8 +455,10 @@ static int _cal_record_instance_allday_extended_set_double(calendar_record_h rec break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -459,8 +475,10 @@ static int _cal_record_instance_allday_extended_set_caltime(calendar_record_h re rec->end = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_instance_normal.c b/common/cal_record_instance_normal.c index 9426dfc..ff93597 100644 --- a/common/cal_record_instance_normal.c +++ b/common/cal_record_instance_normal.c @@ -169,8 +169,10 @@ static int _cal_record_instance_normal_get_str(calendar_record_h record, unsigne *out_str = cal_strdup(rec->sync_data1); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -193,8 +195,10 @@ static int _cal_record_instance_normal_get_str_p(calendar_record_h record, unsig *out_str = (rec->sync_data1); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -232,8 +236,10 @@ static int _cal_record_instance_normal_get_int(calendar_record_h record, unsigne *out_value = (rec->original_event_id); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -251,8 +257,10 @@ static int _cal_record_instance_normal_get_double(calendar_record_h record, unsi break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -267,6 +275,7 @@ static int _cal_record_instance_normal_get_lli(calendar_record_h record, unsigne break; default: return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -283,8 +292,10 @@ static int _cal_record_instance_normal_get_caltime(calendar_record_h record, uns *out_value = rec->end; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -311,8 +322,10 @@ static int _cal_record_instance_normal_set_str(calendar_record_h record, unsigne rec->sync_data1 = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -350,8 +363,10 @@ static int _cal_record_instance_normal_set_int(calendar_record_h record, unsigne (rec->original_event_id) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -369,8 +384,10 @@ static int _cal_record_instance_normal_set_double(calendar_record_h record, unsi break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -387,8 +404,10 @@ static int _cal_record_instance_normal_set_caltime(calendar_record_h record, uns rec->end = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_instance_normal_extended.c b/common/cal_record_instance_normal_extended.c index fa2a1b6..367ac1f 100644 --- a/common/cal_record_instance_normal_extended.c +++ b/common/cal_record_instance_normal_extended.c @@ -194,8 +194,10 @@ static int _cal_record_instance_normal_extended_get_str(calendar_record_h record *out_str = cal_strdup(rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -233,8 +235,10 @@ static int _cal_record_instance_normal_extended_get_str_p(calendar_record_h reco *out_str = (rec->sync_data4); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -275,8 +279,10 @@ static int _cal_record_instance_normal_extended_get_int(calendar_record_h record *out_value = (rec->has_attendee); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -294,8 +300,10 @@ static int _cal_record_instance_normal_extended_get_double(calendar_record_h rec break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -310,6 +318,7 @@ static int _cal_record_instance_normal_extended_get_lli(calendar_record_h record break; default: return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -326,8 +335,10 @@ static int _cal_record_instance_normal_extended_get_caltime(calendar_record_h re *out_value = rec->end; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -374,8 +385,10 @@ static int _cal_record_instance_normal_extended_set_str(calendar_record_h record rec->sync_data4 = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -416,8 +429,10 @@ static int _cal_record_instance_normal_extended_set_int(calendar_record_h record (rec->has_attendee) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -435,8 +450,10 @@ static int _cal_record_instance_normal_extended_set_double(calendar_record_h rec break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -453,8 +470,10 @@ static int _cal_record_instance_normal_extended_set_caltime(calendar_record_h re rec->end = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_search.c b/common/cal_record_search.c index 486ceef..3c6f910 100644 --- a/common/cal_record_search.c +++ b/common/cal_record_search.c @@ -154,8 +154,10 @@ static int _cal_record_search_get_str(calendar_record_h record, unsigned int pro *out_str = cal_strdup(data->value.s); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -175,8 +177,10 @@ static int _cal_record_search_get_str_p(calendar_record_h record, unsigned int p *out_str = (data->value.s); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -196,8 +200,10 @@ static int _cal_record_search_get_int(calendar_record_h record, unsigned int pro *out_value = (data->value.i); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -217,8 +223,10 @@ static int _cal_record_search_get_double(calendar_record_h record, unsigned int *out_value = (data->value.d); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -238,8 +246,10 @@ static int _cal_record_search_get_lli(calendar_record_h record, unsigned int pro *out_value = (data->value.lli); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -259,8 +269,10 @@ static int _cal_record_search_get_caltime(calendar_record_h record, unsigned int *out_value = (data->value.caltime); break; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -282,8 +294,10 @@ static int _cal_record_search_set_str(calendar_record_h record, unsigned int pro (data->value.s) = cal_strdup(value); return CALENDAR_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -310,8 +324,10 @@ static int _cal_record_search_set_int(calendar_record_h record, unsigned int pro (data->value.i) = value; return CALENDAR_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -338,8 +354,10 @@ static int _cal_record_search_set_double(calendar_record_h record, unsigned int (data->value.d) = value; return CALENDAR_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -366,8 +384,10 @@ static int _cal_record_search_set_lli(calendar_record_h record, unsigned int pro (data->value.lli) = value; return CALENDAR_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } @@ -394,8 +414,10 @@ static int _cal_record_search_set_caltime(calendar_record_h record, unsigned int (data->value.caltime) = value; return CALENDAR_ERROR_NONE; } else { + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", data->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } } diff --git a/common/cal_record_timezone.c b/common/cal_record_timezone.c index f6b5bfa..0889a8f 100644 --- a/common/cal_record_timezone.c +++ b/common/cal_record_timezone.c @@ -142,8 +142,10 @@ static int _cal_record_timezone_get_str(calendar_record_h record, unsigned int p *out_str = cal_strdup(rec->day_light_name); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -160,8 +162,10 @@ static int _cal_record_timezone_get_str_p(calendar_record_h record, unsigned int *out_str = (rec->day_light_name); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -211,8 +215,10 @@ static int _cal_record_timezone_get_int(calendar_record_h record, unsigned int p *out_value = (rec->calendar_id); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -231,8 +237,10 @@ static int _cal_record_timezone_set_str(calendar_record_h record, unsigned int p rec->day_light_name = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -282,8 +290,10 @@ static int _cal_record_timezone_set_int(calendar_record_h record, unsigned int p (rec->calendar_id) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_record_todo.c b/common/cal_record_todo.c index fededfb..cabdd06 100644 --- a/common/cal_record_todo.c +++ b/common/cal_record_todo.c @@ -307,8 +307,10 @@ static int _cal_record_todo_get_str(calendar_record_h record, unsigned int prope *out_str = cal_strdup(rec->organizer_email); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -385,8 +387,10 @@ static int _cal_record_todo_get_str_p(calendar_record_h record, unsigned int pro *out_str = (rec->organizer_email); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -442,8 +446,10 @@ static int _cal_record_todo_get_int(calendar_record_h record, unsigned int prope *out_value = (rec->is_allday); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -460,8 +466,10 @@ static int _cal_record_todo_get_double(calendar_record_h record, unsigned int pr *out_value = (rec->longitude); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -481,8 +489,10 @@ static int _cal_record_todo_get_lli(calendar_record_h record, unsigned int prope *out_value = (rec->completed_time); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -502,8 +512,10 @@ static int _cal_record_todo_get_caltime(calendar_record_h record, unsigned int p *out_value = rec->until; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -602,7 +614,10 @@ static int _cal_record_todo_set_str(calendar_record_h record, unsigned int prope rec->organizer_email = cal_strdup(value); break; default: + /* LCOV_EXCL_START */ + ERR("invalid parameter (value:%s)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -628,8 +643,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->todo_status) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_TODO_PRIORITY: @@ -641,8 +658,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->priority) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_TODO_SENSITIVITY: @@ -664,8 +683,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->freq) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_TODO_RANGE_TYPE: @@ -676,8 +697,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->range_type) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_TODO_COUNT: @@ -700,8 +723,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->wkst) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (value:%d)", value); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CAL_PROPERTY_TODO_HAS_ALARM: @@ -714,8 +739,10 @@ static int _cal_record_todo_set_int(calendar_record_h record, unsigned int prope (rec->is_allday) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -732,8 +759,10 @@ static int _cal_record_todo_set_double(calendar_record_h record, unsigned int pr (rec->longitude) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -750,8 +779,10 @@ static int _cal_record_todo_set_lli(calendar_record_h record, unsigned int prope (rec->created_time) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -771,8 +802,10 @@ static int _cal_record_todo_set_caltime(calendar_record_h record, unsigned int p (rec->until) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -794,8 +827,10 @@ static int _cal_record_todo_reset_child_record_id(calendar_record_h child_record ((cal_extended_s *)record)->id = 0; break; default: + /* LCOV_EXCL_START */ ERR("Invalid child record type (%d)", record->type); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -820,8 +855,10 @@ static int _cal_record_todo_add_child_record(calendar_record_h record, unsigned ret = calendar_list_add((calendar_list_h)rec->extended_list, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -846,8 +883,10 @@ static int _cal_record_todo_remove_child_record(calendar_record_h record, unsign ret = calendar_list_remove((calendar_list_h)rec->extended_list, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -871,8 +910,10 @@ static int _cal_record_todo_get_child_record_count(calendar_record_h record, uns ret = calendar_list_get_count((calendar_list_h)rec->extended_list, (int *)count); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -896,8 +937,10 @@ static int _cal_record_todo_get_child_record_at_p(calendar_record_h record, unsi ret = cal_list_get_nth_record_p(rec->extended_list, index, child_record); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } @@ -921,8 +964,10 @@ static int _cal_record_todo_clone_child_record_list(calendar_record_h record, un ret = cal_list_clone((calendar_list_h)rec->extended_list, out_list); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return ret; } diff --git a/common/cal_record_updated_info.c b/common/cal_record_updated_info.c index 2d03d10..8fa3e84 100644 --- a/common/cal_record_updated_info.c +++ b/common/cal_record_updated_info.c @@ -118,8 +118,10 @@ static int _cal_record_updated_info_get_int(calendar_record_h record, unsigned i *out_value = (rec->version); break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -142,8 +144,10 @@ static int _cal_record_updated_info_set_int(calendar_record_h record, unsigned i (rec->version) = value; break; default: + /* LCOV_EXCL_START */ ERR("invalid parameter (property:0x%x)", property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/common/cal_time.cpp b/common/cal_time.cpp index d27e489..309976e 100644 --- a/common/cal_time.cpp +++ b/common/cal_time.cpp @@ -88,8 +88,10 @@ UCalendar *cal_time_open_ucal(int calendar_system_type, const char *tzid, int wk } if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("ucal_open() Fail(%s)", u_errorName(status)); return NULL; + /* LCOV_EXCL_STOP */ } if (CALENDAR_SUNDAY <= wkst && wkst <= CALENDAR_SATURDAY) { DBG("set wkst(%d)", wkst); @@ -112,14 +114,18 @@ char* cal_time_convert_ltos(const char *tzid, long long int lli, int is_allday) ucal = cal_time_open_ucal(-1, tzid, -1); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } ucal_setMillis(ucal, sec2ms(lli), &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("ucal_setMillFail (%s)", u_errorName(status)); ucal_close(ucal); return NULL; + /* LCOV_EXCL_STOP */ } y = ucal_get(ucal, UCAL_YEAR, &status); @@ -148,8 +154,10 @@ long long int cal_time_convert_itol(const char *tzid, int y, int mon, int d, int ucal = cal_time_open_ucal(-1, tzid, -1); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return 0; + /* LCOV_EXCL_STOP */ } ucal_set(ucal, UCAL_YEAR, y); ucal_set(ucal, UCAL_MONTH, mon -1); @@ -185,9 +193,11 @@ int cal_time_get_next_date(calendar_time_s *today, calendar_time_s *next) u_uastrcpy(utzid, tzid); ucal = ucal_open(utzid, u_strlen(utzid), "en_US", UCAL_TRADITIONAL, &status); if (U_FAILURE(status)) { + /* LCOV_EXCL_START */ ERR("ucal_open() Fail(%s)", u_errorName(status)); CAL_FREE(utzid); return status; + /* LCOV_EXCL_STOP */ } switch (today->type) { @@ -237,8 +247,10 @@ void cal_time_get_tz_offset(const char *tz, time_t *zone_offset, time_t *dst_off ucal = cal_time_open_ucal(-1, tz, -1); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return; + /* LCOV_EXCL_STOP */ } int32_t zone = ucal_get(ucal, UCAL_ZONE_OFFSET, &status); int32_t dst = ucal_get(ucal, UCAL_DST_OFFSET, &status); @@ -255,8 +267,10 @@ bool cal_time_in_dst(const char *tz, long long int t) ucal = cal_time_open_ucal(-1, tz, -1); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return false; + /* LCOV_EXCL_STOP */ } ucal_setMillis(ucal, sec2ms(t), &status); bool is_dst = ucal_inDaylightTime(ucal, &status); @@ -374,8 +388,10 @@ void cal_time_get_datetime(long long int t, int *y, int *m, int *d, int *h, int UErrorCode status = U_ZERO_ERROR; UCalendar *ucal = __get_gmt_ucal(); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("__get_gmt_ucal() Fail"); return; + /* LCOV_EXCL_STOP */ } ucal_setMillis(ucal, sec2ms(t), &status); if (y) *y = ucal_get(ucal, UCAL_YEAR, &status); @@ -391,8 +407,10 @@ void cal_time_get_local_datetime(char *tzid, long long int t, int *y, int *m, in UErrorCode status = U_ZERO_ERROR; UCalendar *ucal = cal_time_open_ucal(-1, tzid, 0); if (NULL == ucal) { + /* LCOV_EXCL_START */ ERR("__get_gmt_ucal() Fail"); return; + /* LCOV_EXCL_STOP */ } ucal_setMillis(ucal, sec2ms(t), &status); if (y) *y = ucal_get(ucal, UCAL_YEAR, &status); diff --git a/common/cal_utils.c b/common/cal_utils.c index 8d70c95..0b9c7a8 100644 --- a/common/cal_utils.c +++ b/common/cal_utils.c @@ -41,14 +41,18 @@ char* cal_strdup_with_sort(const char *src) char **t = NULL; t = g_strsplit_set(src, " ,", -1); if (NULL == t) { + /* LCOV_EXCL_START */ ERR("g_strsplit_set() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } int len_t = 0; len_t = g_strv_length(t); if (0 == len_t) { + /* LCOV_EXCL_START */ ERR("Empty src"); return NULL; + /* LCOV_EXCL_STOP */ } int i; @@ -58,12 +62,16 @@ char* cal_strdup_with_sort(const char *src) continue; int num = atoi(t[i]); if (0 == num) { + /* LCOV_EXCL_START */ ERR("Invalid parameter[%s]", t[i]); continue; + /* LCOV_EXCL_STOP */ } if (g_list_find(l, GINT_TO_POINTER(num))) { + /* LCOV_EXCL_START */ ERR("Find same data[%s]", t[i]); continue; + /* LCOV_EXCL_STOP */ } l = g_list_append(l, GINT_TO_POINTER(num)); } @@ -72,10 +80,12 @@ char* cal_strdup_with_sort(const char *src) int len_src = strlen(src) +1; char *out_str = calloc(len_src, sizeof(char)); if (NULL == out_str) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); g_list_free(l); g_strfreev(t); return NULL; + /* LCOV_EXCL_STOP */ } int len = 0; GList *cursor = NULL; diff --git a/common/cal_vcalendar.c b/common/cal_vcalendar.c index a2c9799..63507a3 100644 --- a/common/cal_vcalendar.c +++ b/common/cal_vcalendar.c @@ -60,14 +60,18 @@ API int calendar_vcalendar_make_from_records(calendar_list_h list, char **vcalen cal_vcalendar_make_free(&b); if (!ical) { + /* LCOV_EXCL_START */ ERR("cal_vcalendar_make_get_data() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } if (!*ical) { + /* LCOV_EXCL_START */ ERR("No ical data"); free(ical); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } *vcalendar_stream = ical; @@ -109,8 +113,10 @@ static const char* __calendar_vcalendar_get_vcalendar_object(const char *origina len = (int)((long)vcal_cursor - (long)vcal_start); vcalendar_object = calloc(len + 1, sizeof(char)); if (NULL == vcalendar_object) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } memcpy(vcalendar_object, vcal_start, len); *pvcalendar_object = vcalendar_object; @@ -156,11 +162,13 @@ API int calendar_vcalendar_parse_to_calendar(const char* vcalendar_stream, calen err = cal_vcalendar_parse_vcalendar_object(vcalendar_object, list, NULL); if (CALENDAR_ERROR_NONE != err) { + /* LCOV_EXCL_START */ ERR("cal_vcalendar_parse_vcalendar_object() failed(%d)", err); calendar_list_destroy(list, true); free(vcalendar_object); cal_time_fini(); return err; + /* LCOV_EXCL_STOP */ } free(vcalendar_object); } @@ -194,28 +202,34 @@ API int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_ file = fopen(vcalendar_file_path, "r"); if (NULL == file) { + /* LCOV_EXCL_START */ ERR("Invalid argument: no file"); calendar_list_destroy(list, true); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } len = 0; buf_size = ICALENAR_BUFFER_MAX; stream = calloc(ICALENAR_BUFFER_MAX, sizeof(char)); if (NULL == stream) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); fclose(file); calendar_list_destroy(list, true); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } foreach_data = calloc(1, sizeof(vcalendar_foreach_s)); if (NULL == foreach_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(stream); fclose(file); calendar_list_destroy(list, true); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } foreach_data->callback = callback; foreach_data->user_data = user_data; @@ -231,12 +245,14 @@ API int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_ if (new_stream) { stream = new_stream; } else { + /* LCOV_EXCL_START */ + ERR("out of memory"); free(stream); fclose(file); free(foreach_data); calendar_list_destroy(list, true); - ERR("out of memory"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } len += snprintf(stream + len, strlen(buf) +1, "%s", buf); } @@ -248,6 +264,7 @@ API int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_ __calendar_vcalendar_get_vcalendar_object(stream, &vcalendar_object); err = cal_vcalendar_parse_vcalendar_object(vcalendar_object, list, foreach_data); if (CALENDAR_ERROR_NONE != err || false == foreach_data->ret) { + /* LCOV_EXCL_START */ ERR("cal_vcalendar_parse_vcalendar_object() failed(%d)", err); calendar_list_destroy(list, true); free(vcalendar_object); @@ -255,6 +272,7 @@ API int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_ free(foreach_data); fclose(file); return err; + /* LCOV_EXCL_STOP */ } free(vcalendar_object); len = 0; diff --git a/common/cal_vcalendar_make.c b/common/cal_vcalendar_make.c index bb93120..d174b93 100644 --- a/common/cal_vcalendar_make.c +++ b/common/cal_vcalendar_make.c @@ -500,9 +500,11 @@ int _cal_vcalendar_make_rrule_append_mday(char *buf, int buf_len, char *mday) char **t = NULL; t = g_strsplit_set(mday, " ,", -1); if (!t) { + /* LCOV_EXCL_START */ ERR("g_strsplit_set() Fail"); g_strfreev(t); return 0; + /* LCOV_EXCL_STOP */ } int len = strlen(buf); int tlen = g_strv_length(t); @@ -618,9 +620,11 @@ void _cal_vcalendar_make_rrule_append_text_wday(int rrule_type, char *buf, int b int len = strlen(buf); t = g_strsplit_set(wday, " ,", -1); if (!t) { + /* LCOV_EXCL_START */ ERR("g_strsplit_set() Fail"); g_strfreev(t); return; + /* LCOV_EXCL_STOP */ } length = g_strv_length(t); @@ -681,9 +685,11 @@ int _cal_vcalendar_make_rrule_append_wday(int rrule_type, char *buf, int buf_len num_past = 0; t = g_strsplit_set(wday, " ,", -1); if (!t) { + /* LCOV_EXCL_START */ ERR("g_strsplit_set() Fail"); g_strfreev(t); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } length = g_strv_length(t); DBG("len(%d)", length); @@ -720,7 +726,7 @@ int _cal_vcalendar_make_rrule_append_wday(int rrule_type, char *buf, int buf_len } if (num_past == num) len += snprintf(buf +len, buf_len -len, "%s ", p +j); - else + else ERR("Out of 1.0 spec"); DBG("%d num(%d) val[%s]", i, num, p + j); @@ -832,8 +838,10 @@ static void __make_sensitivity(cal_make_s *b, calendar_record_h record) sensitivity = "CONFIDENTIAL"; break; default: + /* LCOV_EXCL_START */ ERR("Invalid sensitivity(%d)", value); return; + /* LCOV_EXCL_STOP */ } _cal_vcalendar_make_printf(b, "CLASS:", sensitivity); } @@ -848,8 +856,10 @@ int _cal_vcalendar_make_rrule_append_until(char *buf, int buf_len, calendar_reco ret = calendar_record_get_int(record, _calendar_event.range_type, &range_type); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_get_int() Fail"); return ret; + /* LCOV_EXCL_STOP */ } int len = strlen(buf); @@ -857,8 +867,10 @@ int _cal_vcalendar_make_rrule_append_until(char *buf, int buf_len, calendar_reco case CALENDAR_RANGE_COUNT: ret = calendar_record_get_int(record, _calendar_event.count, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_get_int() Fail"); return ret; + /* LCOV_EXCL_STOP */ } snprintf(buf +len, buf_len -len, "#%d", count); break; @@ -868,8 +880,10 @@ int _cal_vcalendar_make_rrule_append_until(char *buf, int buf_len, calendar_reco ret = calendar_record_get_caltime(record, _calendar_event.until_time, &caltime); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_get_caltime() Fail"); return ret; + /* LCOV_EXCL_STOP */ } switch (caltime.type) { case CALENDAR_TIME_UTIME: @@ -1018,8 +1032,10 @@ static void __make_rrule_ver1(cal_make_s *b, calendar_record_h record) break; default: + /* LCOV_EXCL_START */ ERR("Out of scope"); break; + /* LCOV_EXCL_STOP */ } if (*buf) { @@ -1239,8 +1255,10 @@ static void __make_rrule(cal_make_s *b, calendar_record_h record) } break; case CALENDAR_BOOK_TYPE_TODO: + /* LCOV_EXCL_START */ ERR("No rrule in todo"); return; + /* LCOV_EXCL_STOP */ } } @@ -1461,8 +1479,10 @@ static void __make_alarm(cal_make_s *b, calendar_record_h record) } break; case CALENDAR_BOOK_TYPE_TODO: + /* LCOV_EXCL_START */ ERR("No rrule in todo"); return; + /* LCOV_EXCL_STOP */ } } @@ -1832,8 +1852,10 @@ static void __make_exdate(cal_make_s *b, calendar_record_h record) RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Fail(%d)", ret); break; case CALENDAR_BOOK_TYPE_TODO: + /* LCOV_EXCL_START */ ERR("Not support exdate in TODO"); break; + /* LCOV_EXCL_STOP */ } if (value && *value) _cal_vcalendar_make_printf(b, "EXDATE:", value); diff --git a/common/cal_vcalendar_parse.c b/common/cal_vcalendar_parse.c index 9e2879c..079ec57 100644 --- a/common/cal_vcalendar_parse.c +++ b/common/cal_vcalendar_parse.c @@ -602,8 +602,10 @@ static void __decode_base64(char *p) return; } if (strlen(p) < size) { + /* LCOV_EXCL_START */ ERR("out of size"); return; + /* LCOV_EXCL_STOP */ } snprintf(p, size + 1, "%s%c", buf, '\0'); @@ -684,8 +686,10 @@ static char* __decode_iso8859_1_to_utf8(char *p) char *out_p = NULL; out_p = realloc(p, len); if (NULL == out_p) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); return NULL; + /* LCOV_EXCL_STOP */ } /* check enough space */ @@ -720,9 +724,11 @@ static char* __decode_charset(char *p) char **s = NULL; s = g_strsplit(t[0], ";", -1); if (NULL == s) { + /* LCOV_EXCL_START */ ERR("g_strsplit() Fail"); g_strfreev(t); return NULL; + /* LCOV_EXCL_STOP */ } int count_param = g_strv_length(s); DBG("count_param(%d)", count_param); @@ -817,8 +823,10 @@ static char* __decode_datetime(char *p, struct user_data *ud) char *tzid = NULL; tzid = strdup(s[i] + strlen("TZID=")); if (NULL == tzid) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } __adjust_tzid(tzid); DBG("modified tzid[%s]", tzid); @@ -833,12 +841,16 @@ static char* __decode_datetime(char *p, struct user_data *ud) if (ud->timezone_tzid && *ud->timezone_tzid) { ud->datetime_tzid = strdup(ud->timezone_tzid); if (NULL == ud->datetime_tzid) { + /* LCOV_EXCL_START */ ERR("strdup() Fail"); break; + /* LCOV_EXCL_STOP */ } DBG("set datetime_tzid[%s] as timezone_tzid", ud->datetime_tzid); } else { + /* LCOV_EXCL_START */ ERR("INVALID tzid"); + /* LCOV_EXCL_STOP */ } break; } @@ -920,8 +932,10 @@ static void __decode_duration(char *cursor, int len, int *tick, int *unit) digit = 0; break; default: + /* LCOV_EXCL_START */ ERR("Invalid value"); break; + /* LCOV_EXCL_STOP */ } } @@ -1047,9 +1061,11 @@ static int _get_caltime(char *p, calendar_time_s *caltime, struct user_data *ud) } break; default: + /* LCOV_EXCL_START */ ERR("Invalid time format[%s]", p); ret = CALENDAR_ERROR_INVALID_PARAMETER; break; + /* LCOV_EXCL_STOP */ } return ret; } @@ -1077,9 +1093,11 @@ static void __parse_tz(const char *tz, int *h, int *m) sign = 0; if (0 == strlen(t[0])) { + /* LCOV_EXCL_START */ ERR("No hour"); g_strfreev(t); return; + /* LCOV_EXCL_STOP */ } char buf[8] = {0}; @@ -1182,8 +1200,10 @@ static void __work_component_property_dtstart(char *value, calendar_record_h rec calendar_time_s dtstart = {0}; ret = _get_caltime(value, &dtstart, ud); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_get_caltime() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } char *tzid = NULL; @@ -1888,8 +1908,10 @@ static void __work_component_property_dtend(char *value, calendar_record_h recor calendar_time_s dtend = {0}; ret = _get_caltime(value, &dtend, ud); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_get_caltime() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } char *tzid = NULL; @@ -1987,7 +2009,9 @@ static void __work_component_property_attendee_cutype(calendar_record_h attendee prop = "UNKNOWN"; } else { + /* LCOV_EXCL_START */ ERR("Invalid value[%s]", value); + /* LCOV_EXCL_STOP */ } WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2030,7 +2054,9 @@ static void __work_component_property_attendee_role(calendar_record_h attendee, if (strlen(value) > strlen("CHAIR")) prop = "CHAIR"; } else { + /* LCOV_EXCL_START */ ERR("Invalid value[%s]", value); + /* LCOV_EXCL_STOP */ } WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2083,7 +2109,9 @@ static void __work_component_property_attendee_partstat(calendar_record_h attend prop = "IN-PROCESS"; } else { + /* LCOV_EXCL_START */ ERR("Invalid value[%s]", value); + /* LCOV_EXCL_STOP */ } WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2284,9 +2312,11 @@ static void __work_component_property_dalarm(char *value, calendar_record_h reco calendar_record_h alarm = NULL; ret = calendar_record_create(_calendar_alarm._uri, &alarm); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); g_strfreev(t); return; + /* LCOV_EXCL_STOP */ } ret = cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_DISPLAY); WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2306,9 +2336,11 @@ static void __work_component_property_dalarm(char *value, calendar_record_h reco calendar_time_s alarm_time = {0}; ret = _get_caltime(t[i], &alarm_time, ud); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_get_caltime() Fail(%d)", ret); index = VCAL_VER_10_AALARM_NONE; break; + /* LCOV_EXCL_STOP */ } if (true == ud->has_rrule) { @@ -2318,9 +2350,11 @@ static void __work_component_property_dalarm(char *value, calendar_record_h reco int diff = 0; ret = _sub_caltime(ud, &start_time, &alarm_time, &diff); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_sub_caltime() Fail(%d)", ret); index = VCAL_VER_10_DALARM_NONE; break; + /* LCOV_EXCL_STOP */ } _set_alarm_tick_unit(alarm, alarm_time, diff); @@ -2377,9 +2411,11 @@ static void __work_component_property_malarm(char *value, calendar_record_h reco calendar_record_h alarm = NULL; ret = calendar_record_create(_calendar_alarm._uri, &alarm); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); g_strfreev(t); return; + /* LCOV_EXCL_STOP */ } ret = cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_EMAIL); WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2399,9 +2435,11 @@ static void __work_component_property_malarm(char *value, calendar_record_h reco calendar_time_s alarm_time = {0}; ret = _get_caltime(t[i], &alarm_time, ud); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_get_caltime() Fail(%d)", ret); index = VCAL_VER_10_AALARM_NONE; break; + /* LCOV_EXCL_STOP */ } if (true == ud->has_rrule) { @@ -2412,9 +2450,11 @@ static void __work_component_property_malarm(char *value, calendar_record_h reco int diff = 0; ret = _sub_caltime(ud, &start_time, &alarm_time, &diff); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_sub_caltime() Fail(%d)", ret); index = VCAL_VER_10_MALARM_NONE; break; + /* LCOV_EXCL_STOP */ } _set_alarm_tick_unit(alarm, alarm_time, diff); @@ -2478,9 +2518,11 @@ static void __work_component_property_aalarm(char *value, calendar_record_h reco calendar_record_h alarm = NULL; ret = calendar_record_create(_calendar_alarm._uri, &alarm); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); g_strfreev(t); return; + /* LCOV_EXCL_STOP */ } ret = cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_AUDIO); WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_int() Fail(%d)", ret); @@ -2500,9 +2542,11 @@ static void __work_component_property_aalarm(char *value, calendar_record_h reco calendar_time_s alarm_time = {0}; ret = _get_caltime(t[i], &alarm_time, ud); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_get_caltime() Fail(%d)", ret); index = VCAL_VER_10_AALARM_NONE; break; + /* LCOV_EXCL_STOP */ } if (true == ud->has_rrule) { @@ -2512,9 +2556,11 @@ static void __work_component_property_aalarm(char *value, calendar_record_h reco int diff = 0; ret = _sub_caltime(ud, &start_time, &alarm_time, &diff); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_sub_caltime() Fail(%d)", ret); index = VCAL_VER_10_AALARM_NONE; break; + /* LCOV_EXCL_STOP */ } _set_alarm_tick_unit(alarm, alarm_time, diff); @@ -2565,8 +2611,10 @@ static void __work_component_property_exdate(char *value, calendar_record_h reco WARN_IF(CALENDAR_ERROR_NONE != ret, "cal_record_set_str() Fail(%d)", ret); break; case CALENDAR_BOOK_TYPE_TODO: + /* LCOV_EXCL_START */ ERR("No exdate in todo"); break; + /* LCOV_EXCL_STOP */ } } @@ -2887,9 +2935,11 @@ static char* __work_component_property_begin(char *cursor, calendar_record_h rec break; default: + /* LCOV_EXCL_START */ ERR("Invalid index(%d)", index); cursor = __crlf(cursor); break; + /* LCOV_EXCL_STOP */ } if (true == exit_loop) break; @@ -3393,9 +3443,11 @@ static char* __work_component_vtimezone(char *cursor, calendar_record_h record, if (CAL_STRING_EQUAL == strncmp(cursor, "TZID:", strlen("TZID:"))) { char *p = cursor + strlen("TZID"); if (NULL == p || '\0' == *p) { + /* LCOV_EXCL_START */ ERR("Inavlid tzid"); cursor = __crlf(cursor); continue; + /* LCOV_EXCL_STOP */ } if (ud->timezone_tzid) { free(ud->timezone_tzid); diff --git a/common/cal_view.c b/common/cal_view.c index 723a571..415fff5 100644 --- a/common/cal_view.c +++ b/common/cal_view.c @@ -1055,7 +1055,9 @@ cal_record_type_e cal_view_get_type(const char *view_uri) else ERR("g_hash_table_lookup() Fail"); } else { + /* LCOV_EXCL_START */ ERR("Unable to get cal_uri_property_hash[%s]", view_uri); + /* LCOV_EXCL_STOP */ } return type; diff --git a/server/cal_access_control.c b/server/cal_access_control.c index 9f98367..5913dea 100644 --- a/server/cal_access_control.c +++ b/server/cal_access_control.c @@ -97,15 +97,19 @@ static void _cal_access_control_set_permission_info(cal_permission_info_s *info) snprintf(query, sizeof(query), "SELECT count(id) FROM %s WHERE deleted = 0 ", CAL_TABLE_CALENDAR); ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } info->write_list = calloc(count +1, sizeof(int)); if (NULL == info->write_list) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return; + /* LCOV_EXCL_STOP */ } info->write_list_count = 0; @@ -113,9 +117,11 @@ static void _cal_access_control_set_permission_info(cal_permission_info_s *info) snprintf(query, sizeof(query), "SELECT id, mode, owner_label FROM %s WHERE deleted = 0 ", CAL_TABLE_CALENDAR); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } int write_index = 0; @@ -151,9 +157,11 @@ void cal_access_control_set_client_info(void *ipc, const char *smack_label) if (NULL == info) { info = calloc(1, sizeof(cal_permission_info_s)); if (NULL == info) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); cal_mutex_unlock(CAL_MUTEX_ACCESS_CONTROL); return; + /* LCOV_EXCL_STOP */ } __thread_list = g_list_append(__thread_list, info); } @@ -219,15 +227,19 @@ bool cal_access_control_have_write_permission(int book_id) unsigned int thread_id = pthread_self(); info = _cal_access_control_find_permission_info(thread_id); if (NULL == info) { + /* LCOV_EXCL_START */ cal_mutex_unlock(CAL_MUTEX_ACCESS_CONTROL); ERR("_cal_access_control_find_permission_info() Fail"); return false; + /* LCOV_EXCL_STOP */ } if (NULL == info->write_list) { + /* LCOV_EXCL_START */ cal_mutex_unlock(CAL_MUTEX_ACCESS_CONTROL); ERR("there is no write access info"); return false; + /* LCOV_EXCL_STOP */ } int i = 0; @@ -255,15 +267,19 @@ int cal_is_owner(int book_id) CAL_TABLE_CALENDAR, book_id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (CAL_SQLITE_ROW != cal_db_util_stmt_step(stmt)) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } ret = CALENDAR_ERROR_PERMISSION_DENIED; diff --git a/server/cal_server.c b/server/cal_server.c index affafeb..d52e327 100644 --- a/server/cal_server.c +++ b/server/cal_server.c @@ -54,11 +54,13 @@ GMainLoop* main_loop = NULL; static int cal_timeout = 0; +/* LCOV_EXCL_START */ void cal_server_quit_loop(void) { g_main_loop_quit(main_loop); main_loop = NULL; } +/* LCOV_EXCL_STOP */ static int _cal_server_init(void) { @@ -69,8 +71,10 @@ static int _cal_server_init(void) ret = cal_connect(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_connect() Failed"); return ret; + /* LCOV_EXCL_STOP */ } cal_access_control_set_client_info(NULL, "calendar-service"); @@ -138,10 +142,11 @@ int cal_server_get_timeout(void) int main(int argc, char *argv[]) { INFO("---------------------[SERVER START]------------------------"); + if (getuid() == 0) { /* root */ gid_t glist[] = {CAL_SECURITY_FILE_GROUP}; if (setgroups(1, glist) < 0) - ERR("setgroups() Failed"); + WARN("setgroups() Failed"); } cal_timeout = argc > 1 ? atoi(argv[1]) : CAL_TIMEOUT_FOR_DEFAULT; diff --git a/server/cal_server_account.c b/server/cal_server_account.c index ab23ff5..430d37e 100644 --- a/server/cal_server_account.c +++ b/server/cal_server_account.c @@ -48,9 +48,11 @@ int cal_server_account_init(void) pthread_mutex_lock(&cal_mutex_account); ret = account_subscribe_create(&cal_account_h); if (ACCOUNT_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("account_subscribe_create() Fail(%d)", ret); pthread_mutex_unlock(&cal_mutex_account); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = account_subscribe_notification(cal_account_h, _noti_cb, NULL); diff --git a/server/cal_server_alarm.c b/server/cal_server_alarm.c index fdcfbf6..956e940 100644 --- a/server/cal_server_alarm.c +++ b/server/cal_server_alarm.c @@ -57,8 +57,10 @@ static int _cal_server_alarm_unset_alerted_alarmmgr_id(int alarm_id) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } DBG("alarm_id(%d)", alarm_id); @@ -67,10 +69,12 @@ static int _cal_server_alarm_unset_alerted_alarmmgr_id(int alarm_id) CAL_TABLE_ALARM, alarm_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_end_trans(true); return CALENDAR_ERROR_NONE; @@ -84,8 +88,10 @@ static int _cal_server_alarm_clear_all_cb(alarm_id_t alarm_id, void *data) _cal_server_alarm_unset_alerted_alarmmgr_id(alarm_id); ret = alarmmgr_remove_alarm(alarm_id); if (ret != ALARMMGR_RESULT_SUCCESS) { + /* LCOV_EXCL_START */ ERR("alarmmgr_remove_alarm() Fail(ret:%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -97,8 +103,10 @@ static int _cal_server_alarm_update_alarm_id(int alarm_id, int event_id, int tic ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } DBG("Update alarm_id(%d) in alarm table", alarm_id); @@ -107,10 +115,12 @@ static int _cal_server_alarm_update_alarm_id(int alarm_id, int event_id, int tic CAL_TABLE_ALARM, alarm_id, event_id, tick, unit); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_end_trans(true); return CALENDAR_ERROR_NONE; @@ -127,9 +137,11 @@ static long long int _cal_server_alarm_get_alert_utime(const char *field, int ev sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } long long int utime = 0; @@ -155,9 +167,11 @@ static int _cal_server_alarm_get_alert_localtime(const char *field, int event_id sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } const char *datetime = NULL; @@ -165,9 +179,11 @@ static int _cal_server_alarm_get_alert_localtime(const char *field, int event_id datetime = (const char *)sqlite3_column_text(stmt, 0); if (NULL == datetime || '\0' == *datetime) { + /* LCOV_EXCL_START */ ERR("Invalid datetime [%s]", datetime); sqlite3_finalize(stmt); return 0; + /* LCOV_EXCL_STOP */ } int y = 0, m = 0, d = 0; @@ -203,9 +219,11 @@ int cal_server_alarm_get_alert_time(int alarm_id, time_t *tt_alert) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int event_id = 0; @@ -232,9 +250,11 @@ int cal_server_alarm_get_alert_time(int alarm_id, time_t *tt_alert) } if (NULL == tt_alert) { + /* LCOV_EXCL_START */ ERR("Invalid parameter: tt_alert is NULL"); sqlite3_finalize(stmt); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ALARM_TIME_UNIT_SPECIFIC == unit) { @@ -317,17 +337,21 @@ static void _cal_server_alarm_get_upcoming_specific_utime(time_t utime, bool get sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -349,7 +373,7 @@ static void _cal_server_alarm_get_upcoming_specific_localtime(const char *dateti { int ret = 0; char query[CAL_DB_SQL_MAX_LEN] = {0}; -snprintf(query, sizeof(query), "SELECT event_id,remind_tick_unit,remind_tick," + snprintf(query, sizeof(query), "SELECT event_id,remind_tick_unit,remind_tick," "alarm_type,alarm_utime,alarm_datetime " "FROM %s WHERE remind_tick_unit=%d AND alarm_type=%d AND alarm_datetime %s '%s' %s", CAL_TABLE_ALARM, CALENDAR_ALARM_TIME_UNIT_SPECIFIC, CALENDAR_TIME_LOCALTIME, @@ -359,17 +383,21 @@ snprintf(query, sizeof(query), "SELECT event_id,remind_tick_unit,remind_tick," sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -418,17 +446,21 @@ static void _cal_server_alarm_get_upcoming_nonspecific_event_utime(time_t utime, sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -466,17 +498,21 @@ static void _cal_server_alarm_get_upcoming_nonspecific_event_localtime(const cha sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -527,17 +563,21 @@ static void _cal_server_alarm_get_upcoming_nonspecific_todo_utime(time_t utime, sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -577,17 +617,21 @@ static void _cal_server_alarm_get_upcoming_nonspecific_todo_localtime(const char sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { struct _alarm_data_s *ad = calloc(1, sizeof(struct _alarm_data_s)); if (NULL == ad) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return; + /* LCOV_EXCL_STOP */ } ad->event_id = sqlite3_column_int(stmt, 0); @@ -675,16 +719,20 @@ static int _cal_server_alarm_register(GList *alarm_list) /* clear all alarm which set by mine. */ ret = alarmmgr_enum_alarm_ids(_cal_server_alarm_clear_all_cb, NULL); if (ret != ALARMMGR_RESULT_SUCCESS) { + /* LCOV_EXCL_START */ ERR("alarmmgr_enum_alarm_ids() Fail"); return ret; + /* LCOV_EXCL_STOP */ } time_t mod_time = (time_t)ad->alert_utime; alarm_entry_t *alarm_info = NULL; alarm_info = alarmmgr_create_alarm(); if (NULL == alarm_info) { + /* LCOV_EXCL_START */ ERR("Failed to create alarm"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } tzset(); struct tm st_alarm = {0}; @@ -715,9 +763,11 @@ static int _cal_server_alarm_register(GList *alarm_list) int alarm_id = 0; ret = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id); if (ret < 0) { + /* LCOV_EXCL_START */ ERR("alarmmgr_add_alarm_with_localtime Fail (%d)", ret); alarmmgr_free_alarm(alarm_info); return ret; + /* LCOV_EXCL_STOP */ } DBG("alarmmgr id (%d)", alarm_id); _cal_server_alarm_update_alarm_id(alarm_id, ad->event_id, ad->tick, ad->unit); @@ -753,8 +803,10 @@ static bool __app_matched_cb(app_control_h app_control, const char *package, voi struct alarm_ud *au = (struct alarm_ud *)user_data; GList *alarm_list = au->alarm_list; if (NULL == alarm_list) { + /* LCOV_EXCL_START */ ERR("No list"); return true; + /* LCOV_EXCL_STOP */ } int len = 0; len = g_list_length(alarm_list); @@ -766,34 +818,42 @@ static bool __app_matched_cb(app_control_h app_control, const char *package, voi app_control_h ac = NULL; ret = app_control_create(&ac); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_create() Fail(%d)", ret); return true; + /* LCOV_EXCL_STOP */ } ret = app_control_set_operation(ac, APP_CONTROL_OPERATION_DEFAULT); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_create() Fail(%d)", ret); app_control_destroy(ac); return true; + /* LCOV_EXCL_STOP */ } ret = app_control_set_app_id(ac, package); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_set_app_id() Fail(%d)", ret); app_control_destroy(ac); return true; + /* LCOV_EXCL_STOP */ } char **ids = NULL; ids = calloc(len, sizeof(char *)); if (NULL == ids) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); app_control_destroy(ac); return true; + /* LCOV_EXCL_STOP */ } GList *cursor = g_list_first(alarm_list); for (i = 0; i < len; i++) { struct _alarm_data_s *ad = (struct _alarm_data_s *)cursor->data; if (NULL == ad) { - ERR("No data"); + WARN("No data"); cursor = g_list_next(cursor); continue; } @@ -845,35 +905,45 @@ static void _cal_server_alarm_noti_with_control(GList *alarm_list) app_control_h app_control = NULL; ret = app_control_create(&app_control); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_create() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_set_operation() Fail(%d)", ret); app_control_destroy(app_control); return; + /* LCOV_EXCL_STOP */ } ret = app_control_set_mime(app_control, "application/x-tizen.calendar.reminder"); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_set_mime() Fail(%d)", ret); app_control_destroy(app_control); return; + /* LCOV_EXCL_STOP */ } struct alarm_ud *au = calloc(1, sizeof(struct alarm_ud)); if (NULL == au) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); app_control_destroy(app_control); return; + /* LCOV_EXCL_STOP */ } au->alarm_list = alarm_list; ret = app_control_foreach_app_matched(app_control, __app_matched_cb, au); if (APP_CONTROL_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("app_control_foreach_app_matched() Fail(%d)", ret); free(au); app_control_destroy(app_control); return; + /* LCOV_EXCL_STOP */ } free(au); app_control_destroy(app_control); @@ -887,7 +957,7 @@ static void _cal_server_alarm_noti_with_callback(GList *alarm_list) while (l) { struct _alarm_data_s *ad = (struct _alarm_data_s *)l->data; if (NULL == ad) { - ERR("No data"); + WARN("No data"); l = g_list_next(l); continue; } @@ -1007,14 +1077,18 @@ int cal_server_alarm_init(void) ret = alarmmgr_init("calendar-service"); if (ret < 0) { + /* LCOV_EXCL_START */ ERR("alarmmgr_init() Fail(%d)", ret); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = alarmmgr_set_cb(_alert_cb, NULL); if (ret < 0) { + /* LCOV_EXCL_START */ ERR("alarmmgr_set_cb() Fail(%d)", ret); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } cal_server_alarm_register_next_alarm(time(NULL)); diff --git a/server/cal_server_calendar_delete.c b/server/cal_server_calendar_delete.c index f3651cd..4bfc930 100644 --- a/server/cal_server_calendar_delete.c +++ b/server/cal_server_calendar_delete.c @@ -59,12 +59,14 @@ static gpointer _cal_server_calendar_main(gpointer user_data); static bool _cal_server_calendar_delete_step(int ret, __calendar_delete_data_s* data) { if (CALENDAR_ERROR_NONE != ret && CALENDAR_ERROR_NO_DATA != ret) { + /* LCOV_EXCL_START */ + ERR("_cal_server_calendar_delete_step Fail(%d)", ret); if (data->calendar_id_list) g_list_free(data->calendar_id_list); CAL_FREE(data); - ERR("_cal_server_calendar_delete_step Fail(%d)", ret); return false; + /* LCOV_EXCL_STOP */ } switch (data->step) { case STEP_1: @@ -106,9 +108,11 @@ static int _cal_server_calendar_delete_step1(__calendar_delete_data_s* data) snprintf(query, sizeof(query), "SELECT id FROM %s WHERE deleted = 1", CAL_TABLE_CALENDAR); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { int id = 0; @@ -120,7 +124,7 @@ static int _cal_server_calendar_delete_step1(__calendar_delete_data_s* data) count = g_list_length(data->calendar_id_list); if (count <= 0) - return CALENDAR_ERROR_NO_DATA; + return CALENDAR_ERROR_NO_DATA; GList *cursor = g_list_first(data->calendar_id_list); if (cursor) { @@ -145,8 +149,10 @@ static int _cal_server_calendar_delete_step2(__calendar_delete_data_s* data) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() failed"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } /* get event_list */ @@ -155,10 +161,12 @@ static int _cal_server_calendar_delete_step2(__calendar_delete_data_s* data) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -182,11 +190,13 @@ static int _cal_server_calendar_delete_step2(__calendar_delete_data_s* data) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id=%d", CAL_TABLE_SCHEDULE, id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); g_list_free(list); return ret; + /* LCOV_EXCL_STOP */ } cursor = g_list_next(cursor); } @@ -205,8 +215,10 @@ static int _cal_server_calendar_delete_step3(__calendar_delete_data_s* data) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() failed"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } CAL_FN_CALL(); @@ -215,10 +227,12 @@ static int _cal_server_calendar_delete_step3(__calendar_delete_data_s* data) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id=%d", CAL_TABLE_CALENDAR, data->current_calendar_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_end_trans(true); @@ -232,8 +246,10 @@ static bool _cal_server_calendar_run(__calendar_delete_data_s* data) CAL_FN_CALL(); if (data == NULL) { + /* LCOV_EXCL_START */ ERR("data is NULL"); return false; + /* LCOV_EXCL_STOP */ } switch (data->step) { @@ -247,13 +263,14 @@ static bool _cal_server_calendar_run(__calendar_delete_data_s* data) ret = _cal_server_calendar_delete_step3(data); break; default: + /* LCOV_EXCL_START */ ERR("invalid step"); if (data->calendar_id_list) g_list_free(data->calendar_id_list); CAL_FREE(data); - return false; + /* LCOV_EXCL_STOP */ } return _cal_server_calendar_delete_step(ret, data); @@ -269,8 +286,10 @@ static gpointer _cal_server_calendar_main(gpointer user_data) __calendar_delete_data_s *callback_data = NULL; callback_data = calloc(1, sizeof(__calendar_delete_data_s)); if (NULL == callback_data) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); break; + /* LCOV_EXCL_STOP */ } callback_data->step = STEP_1; @@ -278,9 +297,11 @@ static gpointer _cal_server_calendar_main(gpointer user_data) /* delete */ ret = cal_connect(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_connect() Fail(%d)", ret); free(callback_data); break; + /* LCOV_EXCL_STOP */ } while (1) { diff --git a/server/cal_server_contacts.c b/server/cal_server_contacts.c index d3da53e..6be2d09 100644 --- a/server/cal_server_contacts.c +++ b/server/cal_server_contacts.c @@ -71,83 +71,107 @@ static int _cal_server_contacts_set_new_event(int id, char *label, int calendar_ ret = calendar_record_set_str(event, _calendar_event.summary, label); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_str() Fail:summary"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_int(event, _calendar_event.calendar_book_id, DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:calendar_book_id"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_caltime(event, _calendar_event.start_time, st); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_caltime() Fail:start_time"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_caltime(event, _calendar_event.end_time, et); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_caltime() Fail:end_time"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_int(event, _calendar_event.person_id, id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:person_id"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_str(event, _calendar_event.sync_data1, type_str); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_str() Fail:sync_data1"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_int(event, _calendar_event.freq, CALENDAR_RECURRENCE_YEARLY); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:freq"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } ret = calendar_record_set_int(event, _calendar_event.interval, 1); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:interval"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } if (CONTACTS_EVENT_CALENDAR_TYPE_CHINESE == calendar_type) { ret = calendar_record_set_int(event, _calendar_event.calendar_system_type, CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:calendar_system_type"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } } else { ret = calendar_record_set_str(event, _calendar_event.bymonthday, buf); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_str() Fail:bymonthday"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } } ret = calendar_record_set_int(event, _calendar_event.range_type, CALENDAR_RANGE_NONE); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_int() Fail:range type"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } if (0 < account_id) { snprintf(buf, sizeof(buf), "%d", account_id); ret = calendar_record_set_str(event, _calendar_event.sync_data4, buf); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_set_str() Fail:sync data4"); calendar_record_destroy(event, true); return ret; + /* LCOV_EXCL_STOP */ } } @@ -167,8 +191,10 @@ static int cal_server_contacts_delete_event(int contact_id, int **out_array, int array = calloc(max_count, sizeof(int)); if (NULL == array) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } char query[CAL_DB_SQL_MAX_LEN] = {0}; @@ -177,26 +203,32 @@ static int cal_server_contacts_delete_event(int contact_id, int **out_array, int CAL_TABLE_SCHEDULE, contact_id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(array); return ret; + /* LCOV_EXCL_STOP */ } int index = 0; while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { int event_id = sqlite3_column_int(stmt, 0); if (0 == event_id) { + /* LCOV_EXCL_START */ ERR("event id is invalid"); break; + /* LCOV_EXCL_STOP */ } if (max_count <= index) { max_count *= 2; array = realloc(array, max_count *sizeof(int)); if (NULL == array) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); break; + /* LCOV_EXCL_STOP */ } } array[index] = event_id; @@ -220,31 +252,39 @@ static int cal_server_contacts_insert_event(int id, calendar_list_h out_insert) contacts_record_h contact = NULL; ret = contacts_db_get_record(_contacts_contact._uri, id, &contact); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_db_get_record() Fail(%d)", ret); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } int address_book_id = 0; ret = contacts_record_get_int(contact, _contacts_contact.address_book_id, &address_book_id); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_record_get_int() Fail(%d)", ret); contacts_record_destroy(contact, true); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } if (0 < address_book_id) { /* default phone addressbook is 0 */ DBG("address_book_id(%d)", address_book_id); contacts_record_h address_book = NULL; ret = contacts_db_get_record(_contacts_address_book._uri, address_book_id, &address_book); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ DBG("contacts_db_get_record() Fail(%d)", ret); contacts_record_destroy(contact, true); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } ret = contacts_record_get_int(address_book, _contacts_address_book.account_id, &account_id); contacts_record_destroy(address_book, true); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ DBG("contacts_record_get_inti() Fail(%d)", ret); contacts_record_destroy(contact, true); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } DBG("account_id[%d]", account_id); } @@ -280,9 +320,11 @@ static int cal_server_contacts_insert_event(int id, calendar_list_h out_insert) case CONTACTS_EVENT_TYPE_CUSTOM: ret = contacts_record_get_str_p(contact_event, _contacts_event.label, &type_str); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_record_get_str_p() Fail(%d)", ret); is_proper_type = false; break; + /* LCOV_EXCL_STOP */ } break; default: @@ -344,8 +386,10 @@ static void _cal_server_contacts_get_event_list(contacts_list_h contacts_list, cal_server_contacts_delete_event(contact_id, &delete_array, &delete_count); break; default: + /* LCOV_EXCL_START */ ERR("Invalid"); break; + /* LCOV_EXCL_STOP */ } if (0 < delete_count) { @@ -356,9 +400,11 @@ static void _cal_server_contacts_get_event_list(contacts_list_h contacts_list, array = realloc(array, (count +delete_count) *sizeof(int)); if (NULL == array) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); free(delete_array); break; + /* LCOV_EXCL_STOP */ } memcpy(array +count, delete_array, delete_count *sizeof(int)); count += delete_count; @@ -373,15 +419,17 @@ static int _cal_server_contacts_sync(void) { CAL_START_TIMESTAMP - int ret; + int ret; int contacts_ver = -1; char query[CAL_DB_SQL_MAX_LEN] = {0}; snprintf(query, sizeof(query), "SELECT contacts_ver FROM %s", CAL_TABLE_VERSION); ret = cal_db_util_query_get_first_int_result(query, NULL, &contacts_ver); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } DBG("contacts_ver(%d)", contacts_ver); @@ -390,9 +438,11 @@ static int _cal_server_contacts_sync(void) ret = contacts_db_get_changes_by_version(_contacts_contact_updated_info._uri, -1, contacts_ver, &contacts_list, &latest_ver); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_db_get_changes_by_version() Fail(%d)", ret); contacts_list_destroy(contacts_list, true); return ret; + /* LCOV_EXCL_STOP */ } if (NULL == contacts_list) { @@ -421,12 +471,14 @@ static int _cal_server_contacts_sync(void) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail(%d)", ret); contacts_list_destroy(contacts_list, true); calendar_list_destroy(insert_list, true); free(delete_array); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_delete_records(_calendar_event._uri, delete_array, delete_count); @@ -435,12 +487,14 @@ static int _cal_server_contacts_sync(void) snprintf(query, sizeof(query), "UPDATE %s SET contacts_ver=%d", CAL_TABLE_VERSION, latest_ver); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); contacts_list_destroy(contacts_list, true); calendar_list_destroy(insert_list, true); free(delete_array); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_notify(CAL_NOTI_TYPE_EVENT); contacts_list_destroy(contacts_list, true); @@ -449,7 +503,7 @@ static int _cal_server_contacts_sync(void) cal_db_util_end_trans(true); CAL_PRINT_TIMESTAMP - return CALENDAR_ERROR_NONE; + return CALENDAR_ERROR_NONE; } void cal_server_contacts_delete(int account_id) @@ -471,75 +525,93 @@ void cal_server_contacts_delete(int account_id) RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_query_create() Fail"); ret = calendar_filter_create(_calendar_event._uri, &filter); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_filter_create() Fail"); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = calendar_filter_add_str(filter, _calendar_event.sync_data4, CALENDAR_MATCH_EXACTLY, buf); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_filter_add_str() Fail(%d)", ret); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = calendar_filter_add_operator(filter, CALENDAR_FILTER_OPERATOR_AND); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_filter_add_operator() Fail(%d)", ret); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = calendar_filter_add_int(filter, _calendar_event.calendar_book_id, CALENDAR_MATCH_EQUAL, DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_filter_add_int() Fail(%d)", ret); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = calendar_query_set_filter(query, filter); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_query_set_filter() Fail"); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } unsigned int projection = _calendar_event.id; ret = calendar_query_set_projection(query, &projection , 1); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_query_set_projection() Fail"); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = cal_db_get_records_with_query(query, 0, 0, &list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_get_records_with_query() Fail"); calendar_list_destroy(list, true); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } ret = calendar_list_get_count(list, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_count() Fail"); calendar_list_destroy(list, true); calendar_filter_destroy(filter); calendar_query_destroy(query); return ; + /* LCOV_EXCL_STOP */ } DBG("event count(%d)\n", count); if (0 < count) { record_id_array = (int *)calloc(count, sizeof(int)); if (NULL == record_id_array) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); calendar_list_destroy(list, true); calendar_filter_destroy(filter); calendar_query_destroy(query); return; + /* LCOV_EXCL_STOP */ } calendar_list_first(list); @@ -580,9 +652,11 @@ static gpointer _cal_server_contacts_sync_main(gpointer user_data) ret = cal_connect(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_connect() Fail(%d)", ret); cal_server_ondemand_start(); break; + /* LCOV_EXCL_STOP */ } cal_access_control_set_client_info(NULL, "calendar-service"); @@ -634,8 +708,10 @@ int cal_server_contacts_init(void) ret = contacts_connect(); if (CONTACTS_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("contacts_connect() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = contacts_db_add_changed_cb(_contacts_event._uri, _changed_cb, NULL); diff --git a/server/cal_server_dbus.c b/server/cal_server_dbus.c index df7f45d..f09e488 100644 --- a/server/cal_server_dbus.c +++ b/server/cal_server_dbus.c @@ -54,7 +54,7 @@ static bool _has_sender(const char *name, GList **out_cursor) while (cursor) { cal_sender_s *sender = (cal_sender_s *)cursor->data; if (NULL == sender) { - ERR("sender is NULL"); + WARN("sender is NULL"); cursor = g_list_next(cursor); continue; } @@ -77,8 +77,10 @@ static int _append_sender(const char *name) cal_sender_s *sender = NULL; sender = calloc(1, sizeof(cal_sender_s)); if (NULL == sender) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } sender->name = cal_strdup(name); DBG("[SENDER] Append sender[%s]", sender->name); @@ -97,15 +99,19 @@ static gboolean _handle_register_resource(calDbus *object, g_mutex_lock(&cal_server_dbus_sender); if (true == _has_sender(sender_name, NULL)) { + /* LCOV_EXCL_START */ ERR("Already has sender"); g_mutex_unlock(&cal_server_dbus_sender); return TRUE; + /* LCOV_EXCL_STOP */ } ret = _append_sender(sender_name); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_append_sender() Fail"); g_mutex_unlock(&cal_server_dbus_sender); return TRUE; + /* LCOV_EXCL_STOP */ } DBG("append sender"); g_mutex_unlock(&cal_server_dbus_sender); @@ -502,8 +508,10 @@ static int _cal_server_dbus_find_sender(const char *owner_name, cal_sender_s **o while (cursor) { cal_sender_s *sender = (cal_sender_s *)cursor->data; if (NULL == sender) { + /* LCOV_EXCL_START */ ERR("sender is NULL"); return CALENDAR_ERROR_NO_DATA; + /* LCOV_EXCL_STOP */ } if (CAL_STRING_EQUAL == g_strcmp0(sender->name, owner_name)) { @@ -560,9 +568,11 @@ static void _cal_server_dbus_name_owner_changed_cb(GDBusConnection *connection, cal_sender_s *sender = NULL; ret = _cal_server_dbus_find_sender(old_owner, &sender); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_server_dbus_find_sender() Fail(%d)", ret); g_mutex_unlock(&cal_server_dbus_sender); return; + /* LCOV_EXCL_STOP */ } if (sender) { /* found bus name in our bus list */ @@ -588,8 +598,10 @@ static int _cal_server_dbus_subscribe_name_owner_changed(GDBusConnection *conn) NULL, NULL); if (0 == id) { + /* LCOV_EXCL_START */ ERR("g_dbus_connection_signal_subscribe() Fail"); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -601,8 +613,10 @@ static void _dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name, gpoi dbus_object = cal_dbus_skeleton_new(); if (NULL == dbus_object) { + /* LCOV_EXCL_START */ ERR("cal_dbus_skeleton_new() Fail"); return; + /* LCOV_EXCL_STOP */ } g_signal_connect(dbus_object, "handle-register-resource", @@ -655,15 +669,19 @@ static void _dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name, gpoi ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(dbus_object), conn, CAL_DBUS_OBJPATH, &error); if (FALSE == ret) { + /* LCOV_EXCL_START */ ERR("g_dbus_interface_skeleton_export() Fail(%s)", error->message); g_error_free(error); return; + /* LCOV_EXCL_STOP */ } ret = _cal_server_dbus_subscribe_name_owner_changed(conn); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_server_dbus_subscribe_name_owner_changed() Fail(%d)", ret); return; + /* LCOV_EXCL_STOP */ } } @@ -689,8 +707,10 @@ unsigned int cal_server_dbus_init(void) NULL, NULL); if (0 == id) { + /* LCOV_EXCL_START */ ERR("g_bus_own_name() Fail"); return 0; + /* LCOV_EXCL_STOP */ } return id; } @@ -713,15 +733,19 @@ int cal_dbus_emit_signal(const char *dest, const char *signal_name, GVariant *va calDbusSkeleton *skeleton = NULL; skeleton = CAL_DBUS_SKELETON(cal_dbus_get_object()); if (NULL == skeleton) { + /* LCOV_EXCL_START */ ERR("cal_dbus_get_object() Fail"); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } GDBusConnection *conn = NULL; conn = g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)); if (NULL == conn) { + /* LCOV_EXCL_START */ ERR("g_dbus_interface_skeleton_get_connection() Fail"); return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } ret = g_dbus_connection_emit_signal(conn, @@ -733,21 +757,25 @@ int cal_dbus_emit_signal(const char *dest, const char *signal_name, GVariant *va &error); if (FALSE == ret) { + /* LCOV_EXCL_START */ ERR("g_dbus_connection_emit_signal() Fail"); if (error) { ERR("error[%s]", error->message); g_error_free(error); } return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } if (FALSE == g_dbus_connection_flush_sync(conn, NULL, &error)) { + /* LCOV_EXCL_START */ ERR("g_dbus_connection_flush_sync() Fail"); if (error) { ERR("error[%s]", error->message); g_error_free(error); } return CALENDAR_ERROR_IPC; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/cal_server_schema.c b/server/cal_server_schema.c index f2ddcbc..ee18afe 100644 --- a/server/cal_server_schema.c +++ b/server/cal_server_schema.c @@ -40,14 +40,20 @@ static inline int __remake_db_file(char* db_path) ret = db_util_open(db_file, &db, 0); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("db_util_open() Fail(%d) ", ret); return -1; + /* LCOV_EXCL_STOP */ } ret = sqlite3_exec(db, schema_query, NULL, 0, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec() Fail[%s]", errmsg); sqlite3_free(errmsg); + db_util_close(db); + return -1; + /* LCOV_EXCL_STOP */ } db_util_close(db); return 0; @@ -62,8 +68,10 @@ static inline int __check_db_file(char* db_path) fd = open(db_file, O_RDONLY); if (fd < 0) { + /* LCOV_EXCL_START */ ERR("DB file(%s) is not exist(err:%d) ", db_file, fd); return -1; + /* LCOV_EXCL_STOP */ } close(fd); return 0; diff --git a/server/cal_server_service.c b/server/cal_server_service.c index 36b2d91..3f7b0f0 100644 --- a/server/cal_server_service.c +++ b/server/cal_server_service.c @@ -43,9 +43,11 @@ int cal_connect(void) cal_view_initialize(); ret = cal_inotify_init(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_inotify_init() Fail(%d)", ret); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } } else { DBG("[System] calendar service has been already connected"); @@ -55,9 +57,11 @@ int cal_connect(void) if (0 == cal_thread_connection) { ret = cal_db_util_open(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_open() Fail(%d)", ret); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return ret; + /* LCOV_EXCL_STOP */ } } cal_thread_connection++; @@ -74,9 +78,11 @@ int cal_disconnect(void) if (1 == cal_thread_connection) { cal_db_util_close(); } else if (cal_thread_connection <= 0) { + /* LCOV_EXCL_START */ DBG("[System] not connected, count(%d)", cal_thread_connection); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cal_thread_connection--; @@ -86,9 +92,11 @@ int cal_disconnect(void) } else if (1 < cal_total_connection) { DBG("[System] connection count(%d)", cal_total_connection); } else { + /* LCOV_EXCL_START */ DBG("[System] Not connected, count(%d)", cal_total_connection); cal_mutex_unlock(CAL_MUTEX_CONNECTION); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cal_total_connection--; diff --git a/server/cal_server_update.c b/server/cal_server_update.c index c590482..f86a965 100644 --- a/server/cal_server_update.c +++ b/server/cal_server_update.c @@ -36,14 +36,18 @@ static int _cal_server_update_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() failed[%s]", sqlite3_errmsg(db)); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } ret = sqlite3_step(stmt); if (SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step() failed[%s]", sqlite3_errmsg(db)); sqlite3_finalize(stmt); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } if (version) *version = (int)sqlite3_column_int(stmt, 0); @@ -65,12 +69,15 @@ int cal_server_update(void) snprintf(db_file, sizeof(db_file), "%s/%s", DB_PATH, CALS_DB_NAME); ret = db_util_open(db_file, &__db, 0); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("db_util_open() fail(%d):[%s]", ret, db_file); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } _cal_server_update_get_db_version(__db, &old_version); DBG("[%s] old version(%d)", db_file, old_version); + /* LCOV_EXCL_START */ if (old_version < 100) { /* ----------------------- start modified 2013/08/22 * added attendee_table(cutype, delegatee_uri, member), alarm_table(summary, action, attach). @@ -114,7 +121,7 @@ int cal_server_update(void) } old_version = 100; /* ----------------------- end modified 2013/08/22 - */ + */ } if (old_version == 100) { /* ----------------------- start modified 2013/09/22 @@ -127,7 +134,7 @@ int cal_server_update(void) } old_version = 101; /* ----------------------- end modified 2013/09/22 - */ + */ } if (old_version == 101) { /* ----------------------- start modified 2014/07/02 @@ -211,7 +218,7 @@ int cal_server_update(void) sqlite3_free(errmsg); } /* ----------------------- end modified 2014/07/02 - */ + */ old_version = 102; } if (old_version == 102) { @@ -226,7 +233,7 @@ int cal_server_update(void) sqlite3_free(errmsg); } /* ----------------------- end modified 2014/10/24 - */ + */ old_version = 103; } @@ -261,13 +268,18 @@ int cal_server_update(void) } old_version = 105; } + /* LCOV_EXCL_STOP */ /* update DB user_version */ snprintf(query, sizeof(query), "PRAGMA user_version = %d", __USER_VERSION); ret = sqlite3_exec(__db, query, NULL, 0, &errmsg); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_exec() failed(%d) [%s]", ret, errmsg); sqlite3_free(errmsg); + db_util_close(__db); + return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } db_util_close(__db); __db = NULL; diff --git a/server/db/cal_db.c b/server/db/cal_db.c index bf5662e..1e8f328 100644 --- a/server/db/cal_db.c +++ b/server/db/cal_db.c @@ -64,8 +64,10 @@ int cal_db_append_string(char **dst, const char *src) if (NULL == *dst) { *dst = cal_strdup(src); if (NULL == *dst) { + /* LCOV_EXCL_START */ ERR("cal_strdup() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -74,8 +76,10 @@ int cal_db_append_string(char **dst, const char *src) char *tmp = *dst; tmp = (char *)realloc(tmp, len_dst + len_src + 2); if (NULL == tmp) { + /* LCOV_EXCL_START */ ERR("realloc() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *dst = tmp; snprintf(*dst + len_dst, len_src + 2, " %s", src); @@ -111,8 +115,10 @@ cal_db_plugin_cb_s* _cal_db_get_plugin(cal_record_type_e type) case CAL_RECORD_TYPE_EXTENDED: return (&cal_db_extended_plugin_cb); default: + /* LCOV_EXCL_START */ ERR("Invalid plugin(%d)", type); return NULL; + /* LCOV_EXCL_STOP */ } return NULL; } @@ -152,8 +158,10 @@ void cal_db_initialize_view_table(void) CAL_SCH_TYPE_EVENT); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -181,8 +189,10 @@ void cal_db_initialize_view_table(void) CAL_SCH_TYPE_TODO); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -211,8 +221,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_CALENDAR); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* CAL_VIEW_TABLE_ALLDAY_INSTANCE : CALENDAR_VIEW_INSTANCE_ALLDAY_CALENDAR */ @@ -235,8 +247,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_CALENDAR); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -265,8 +279,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_CALENDAR); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* CAL_VIEW_TABLE_ALLDAY_INSTANCE_EXTENDED : CALENDAR_VIEW_INSTANCE_ALLDAY_CALENDAR_EXTENDED */ @@ -289,8 +305,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_CALENDAR); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -315,8 +333,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_RRULE); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -341,8 +361,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_RRULE); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } /* @@ -369,8 +391,10 @@ void cal_db_initialize_view_table(void) CAL_TABLE_RRULE); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("[%s]", query); + /* LCOV_EXCL_START */ + SECURE("[%s]", query); ERR("create view Fail"); + /* LCOV_EXCL_STOP */ } cal_db_util_end_trans(true); return ; @@ -494,8 +518,10 @@ int cal_db_get_all_records(const char* view_uri, int offset, int limit, calendar ret = plugin_cb->get_all_records(offset, limit, &list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("get_all_records() Fail"); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_first(list); if (out_list) *out_list = list; @@ -521,8 +547,10 @@ int cal_db_get_records_with_query(calendar_query_h query, int offset, int limit, ret = plugin_cb->get_records_with_query(query, offset, limit, &list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("get_records_with_query() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_first(list); if (out_list) *out_list = list; @@ -558,19 +586,23 @@ int cal_db_clean_after_sync(int calendar_book_id, int calendar_db_version) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail"); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } /* !! please check rrule_table, alarm_table, attendee_table ..*/ ret = cal_is_owner(calendar_book_id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ if (CALENDAR_ERROR_PERMISSION_DENIED == ret) ERR("Does not have permission of calendar_book (%d)", calendar_book_id); else ERR("cal_is_owner() Fail(%d)", ret); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* delete event table */ @@ -581,10 +613,12 @@ int cal_db_clean_after_sync(int calendar_book_id, int calendar_db_version) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* delete delete table */ @@ -592,10 +626,12 @@ int cal_db_clean_after_sync(int calendar_book_id, int calendar_db_version) CAL_TABLE_DELETED, calendar_book_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_end_trans(true); @@ -665,26 +701,32 @@ int cal_db_insert_records(calendar_list_h list, int** ids, int* count) calendar_record_h record = NULL; ret = calendar_list_get_current_record_p(list, &record); if (NULL == record || CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No record in the list"); cal_db_util_end_trans(false); CAL_FREE(_ids); return ret; + /* LCOV_EXCL_STOP */ } cal_record_s *temp = (cal_record_s *)record; cal_db_plugin_cb_s* plugin_cb = _cal_db_get_plugin(temp->type); if (NULL == plugin_cb || NULL == plugin_cb->insert_record) { - DBG("Not plugin"); + /* LCOV_EXCL_START */ + ERR("Not plugin"); cal_db_util_end_trans(false); CAL_FREE(_ids); return CALENDAR_ERROR_NOT_PERMITTED; + /* LCOV_EXCL_STOP */ } ret = plugin_cb->insert_record(record, &_ids[i]); if (CALENDAR_ERROR_NONE != ret) { - DBG("insert_record() Fail(%d)", ret); + /* LCOV_EXCL_START */ + ERR("insert_record() Fail(%d)", ret); cal_db_util_end_trans(false); CAL_FREE(_ids); return ret; + /* LCOV_EXCL_STOP */ } DBG("insert with id(%d)", _ids[i]); calendar_list_next(list); @@ -695,10 +737,12 @@ int cal_db_insert_records(calendar_list_h list, int** ids, int* count) sleep(1); ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("cal_db_util_begin_trans() Fail(%d)", ret); calendar_list_destroy(list, true); CAL_FREE(_ids); - ERR("cal_db_util_begin_trans() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } } @@ -741,24 +785,30 @@ int cal_db_update_records(calendar_list_h list) calendar_record_h record = NULL; ret = calendar_list_get_current_record_p(list, &record); if (NULL == record || CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No record in the list"); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_record_s *temp = (cal_record_s *)record; cal_db_plugin_cb_s* plugin_cb = _cal_db_get_plugin(temp->type); if (NULL == plugin_cb || NULL == plugin_cb->update_record) { + /* LCOV_EXCL_START */ ERR("Not plugin"); cal_db_util_end_trans(false); ret = CALENDAR_ERROR_NOT_PERMITTED; return ret; + /* LCOV_EXCL_STOP */ } ret = plugin_cb->update_record(record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("update_record() Fail(%d)", ret); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } DBG("update record"); calendar_list_next(list); @@ -770,9 +820,11 @@ int cal_db_update_records(calendar_list_h list) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { - calendar_list_destroy(list, true); + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail(%d)", ret); + calendar_list_destroy(list, true); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } } @@ -826,24 +878,30 @@ int cal_db_replace_records(calendar_list_h list, int *ids, int count) calendar_record_h record = NULL; ret = calendar_list_get_current_record_p(list, &record); if (NULL == record || CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("No record in the list"); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } cal_record_s *temp = (cal_record_s *)record; cal_db_plugin_cb_s* plugin_cb = _cal_db_get_plugin(temp->type); if (NULL == plugin_cb || NULL == plugin_cb->insert_record) { - DBG("Not plugin"); + /* LCOV_EXCL_START */ + ERR("Not plugin"); cal_db_util_end_trans(false); ret = CALENDAR_ERROR_NOT_PERMITTED; return ret; + /* LCOV_EXCL_STOP */ } ret = plugin_cb->replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { - DBG("replace_record() Fail(%d)", ret); + /* LCOV_EXCL_START */ + ERR("replace_record() Fail(%d)", ret); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } DBG("insert with id(%d)", ids[i]); calendar_list_next(list); @@ -869,26 +927,32 @@ int cal_db_insert_vcalendars(const char* vcalendar_stream, int **record_id_array ret = calendar_list_get_count(list, &list_count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_count() Fail(%d)", ret); calendar_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_first(list); ids = calloc(1, sizeof(int)*list_count); if (NULL == ids) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); calendar_list_destroy(list, true); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("cal_db_util_begin_trans() Fail(%d)", ret); calendar_list_destroy(list, true); CAL_FREE(ids); - ERR("cal_db_util_begin_trans() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } for (i = 0; i < list_count; i++) { @@ -896,20 +960,24 @@ int cal_db_insert_vcalendars(const char* vcalendar_stream, int **record_id_array ret = calendar_list_get_current_record_p(list, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_current_record_p() Fail(%d)", ret); calendar_list_destroy(list, true); CAL_FREE(ids); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_insert_record(record, &ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_insert_record() Fail(%d)", ret); calendar_list_destroy(list, true); CAL_FREE(ids); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_next(list); @@ -940,15 +1008,19 @@ int cal_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array ret = calendar_list_get_count(list, &list_count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_count() Fail(%d)", ret); calendar_list_destroy(list, true); return ret; + /* LCOV_EXCL_STOP */ } if (count != list_count) { calendar_list_destroy(list, true); + /* LCOV_EXCL_START */ ERR("Mismatched count: vcalendar_count=%d, input count=%d", list_count, count); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } calendar_list_first(list); @@ -956,8 +1028,10 @@ int cal_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { calendar_list_destroy(list, true); + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } /* divide count for accessing of another modules */ @@ -970,19 +1044,23 @@ int cal_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array ret = calendar_list_get_current_record_p(list, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_get_current_record_p() Fail(%d)", ret); calendar_list_destroy(list, true); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } /* set_id */ ret = calendar_record_get_uri_p(record, &view_uri); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_get_uri_p() Fail(%d)", ret); calendar_list_destroy(list, true); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } if (CAL_STRING_EQUAL == strcmp(view_uri, _calendar_event._uri)) { @@ -996,19 +1074,23 @@ int cal_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_record_set_int() Fail(%d)", ret); calendar_list_destroy(list, true); cal_db_util_end_trans(false); + /* LCOV_EXCL_STOP */ return ret; } /* update */ ret = cal_db_update_record(record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_update_record() Fail(%d)", ret); calendar_list_destroy(list, true); cal_db_util_end_trans(false); return ret; + /* LCOV_EXCL_STOP */ } calendar_list_next(list); @@ -1019,8 +1101,10 @@ int cal_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { calendar_list_destroy(list, true); + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } } @@ -1042,8 +1126,10 @@ int cal_db_get_current_version(int* current_version) ret = cal_db_util_query_get_first_int_result(query, NULL, &transaction_ver); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } if (current_version) *current_version = transaction_ver; @@ -1082,8 +1168,10 @@ int cal_db_get_changes_by_version(const char* view_uri, int calendar_book_id, in schedule_type = CAL_SCH_TYPE_TODO; record_type = CAL_RECORD_TYPE_TODO; } else { + /* LCOV_EXCL_START */ ERR("Invalid parameter"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -1103,10 +1191,12 @@ int cal_db_get_changes_by_version(const char* view_uri, int calendar_book_id, in ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); calendar_list_destroy(*record_list, true); *record_list = NULL; return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -1117,11 +1207,13 @@ int cal_db_get_changes_by_version(const char* view_uri, int calendar_book_id, in ret = calendar_record_create(_calendar_updated_info._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail"); calendar_list_destroy(*record_list, true); *record_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } id = sqlite3_column_int(stmt, 0); @@ -1150,11 +1242,14 @@ int cal_db_get_changes_by_version(const char* view_uri, int calendar_book_id, in ret = calendar_list_add(*record_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail"); calendar_list_destroy(*record_list, true); *record_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1189,8 +1284,10 @@ int cal_db_get_changes_exception_by_version(const char* view_uri, int original_e record_type = CAL_RECORD_TYPE_EVENT; } else { + /* LCOV_EXCL_START */ ERR("Invalid parameter"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), @@ -1210,10 +1307,12 @@ int cal_db_get_changes_exception_by_version(const char* view_uri, int original_e ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); calendar_list_destroy(*record_list, true); *record_list = NULL; return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -1224,11 +1323,13 @@ int cal_db_get_changes_exception_by_version(const char* view_uri, int original_e ret = calendar_record_create(_calendar_updated_info._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail"); calendar_list_destroy(*record_list, true); *record_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } id = sqlite3_column_int(stmt, 0); @@ -1252,11 +1353,14 @@ int cal_db_get_changes_exception_by_version(const char* view_uri, int original_e ret = calendar_list_add(*record_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail"); calendar_list_destroy(*record_list, true); *record_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } diff --git a/server/db/cal_db_instance.c b/server/db/cal_db_instance.c index 1d198ef..f46aaf9 100644 --- a/server/db/cal_db_instance.c +++ b/server/db/cal_db_instance.c @@ -72,8 +72,10 @@ static void __print_ucal(int calendar_system_type, UCalendar *ucal, const char * case CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR: s_ucal = cal_time_open_ucal(-1, tzid, wkst); if (NULL == s_ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return; + /* LCOV_EXCL_STOP */ } ucal_setMillis(s_ucal, ucal_getMillis(ucal, &ec), &ec); break; @@ -105,8 +107,10 @@ static void __get_allday_date(cal_event_s *event, UCalendar *ucal, int *y, int * case CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR: s_ucal = cal_time_open_ucal(-1, event->start_tzid, event->wkst); if (NULL == s_ucal) { + /* LCOV_EXCL_START */ ERR("cal_time_open_ucal() Fail"); return; + /* LCOV_EXCL_STOP */ } ucal_setMillis(s_ucal, ucal_getMillis(ucal, &ec), &ec); break; @@ -337,10 +341,12 @@ static int _cal_db_instance_update_exdate_mod(int original_event_id, char *recur } ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); g_strfreev(t); return ret; + /* LCOV_EXCL_STOP */ } } g_strfreev(t); @@ -413,9 +419,11 @@ static int _cal_db_instance_del_inundant(int event_id, calendar_time_s *st, cal_ ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -459,8 +467,10 @@ static int _cal_db_instance_get_duration(UCalendar *ucal, calendar_time_s *st, c switch (st->type) { case CALENDAR_TIME_UTIME: if (et->time.utime < st->time.utime) { + /* LCOV_EXCL_START */ ERR("check time: end(%lld < start(%lld)", et->time.utime, st->time.utime); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } _duration = et->time.utime - st->time.utime; break; @@ -475,8 +485,10 @@ static int _cal_db_instance_get_duration(UCalendar *ucal, calendar_time_s *st, c _duration = ucal_getFieldDifference(ucal, ud, UCAL_SECOND, &ec); if (U_FAILURE(ec)) { + /* LCOV_EXCL_START */ ERR("ucal_getFieldDifference() Fail[%s]", u_errorName(ec)); return ec; + /* LCOV_EXCL_STOP */ } break; } @@ -1845,8 +1857,10 @@ int cal_db_instance_update_exdate_del(int id, char *exdate) DBG("exdate[%s]", exdate); t = g_strsplit_set(exdate, " ,", -1); if (NULL == t) { + /* LCOV_EXCL_START */ ERR("g_strsplit_set() Fail"); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } int i; @@ -1887,10 +1901,12 @@ int cal_db_instance_update_exdate_del(int id, char *exdate) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); g_strfreev(t); return ret; + /* LCOV_EXCL_STOP */ } } g_strfreev(t); @@ -1965,9 +1981,11 @@ int cal_db_instance_discard_record(int index) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } DBG("delete allday"); @@ -1976,9 +1994,11 @@ int cal_db_instance_discard_record(int index) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } diff --git a/server/db/cal_db_instance_helper.c b/server/db/cal_db_instance_helper.c index ae5686f..648d3a8 100644 --- a/server/db/cal_db_instance_helper.c +++ b/server/db/cal_db_instance_helper.c @@ -33,9 +33,11 @@ int cal_db_instance_helper_insert_utime_instance(int event_id, long long int s, ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -49,9 +51,11 @@ int cal_db_instance_helper_insert_localtime_instance(int event_id, const char *s ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } diff --git a/server/db/cal_db_plugin_alarm.c b/server/db/cal_db_plugin_alarm.c index c2a8251..b2c2020 100644 --- a/server/db/cal_db_plugin_alarm.c +++ b/server/db/cal_db_plugin_alarm.c @@ -139,31 +139,37 @@ static int _cal_db_alarm_get_all_records(int offset, int limit, calendar_list_h* ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_list_destroy(*out_list, true); *out_list = NULL; return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record = NULL; ret = calendar_record_create(_calendar_alarm._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_alarm_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -276,17 +282,21 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_ALARM)) { table_name = cal_strdup(CAL_TABLE_ALARM); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -333,6 +343,7 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -341,6 +352,7 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -351,20 +363,24 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } CAL_FREE(query_str); - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_alarm._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create(%d) Fail", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -375,6 +391,7 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, @@ -389,6 +406,8 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add(%d) Fail", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -400,6 +419,7 @@ static int _cal_db_alarm_get_records_with_query(calendar_query_h query, int offs CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -426,8 +446,10 @@ static int _cal_db_alarm_get_count(int *out_count) ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query, count); @@ -449,17 +471,21 @@ static int _cal_db_alarm_get_count_with_query(calendar_query_h query, int *out_c if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_ALARM)) { table_name = cal_strdup(CAL_TABLE_ALARM); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -479,6 +505,7 @@ static int _cal_db_alarm_get_count_with_query(calendar_query_h query, int *out_c /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -486,6 +513,7 @@ static int _cal_db_alarm_get_count_with_query(calendar_query_h query, int *out_c } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query_str, count); diff --git a/server/db/cal_db_plugin_alarm_helper.c b/server/db/cal_db_plugin_alarm_helper.c index 4f34df9..5a88599 100644 --- a/server/db/cal_db_plugin_alarm_helper.c +++ b/server/db/cal_db_plugin_alarm_helper.c @@ -77,9 +77,11 @@ static int _cal_db_alarm_insert_record(calendar_record_h record, int parent_id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index = 1; @@ -117,8 +119,10 @@ static int _cal_db_alarm_insert_record(calendar_record_h record, int parent_id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -160,9 +164,11 @@ int cal_db_alarm_get_records(int parent, cal_list_s *list) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index = 0; @@ -173,9 +179,11 @@ int cal_db_alarm_get_records(int parent, cal_list_s *list) while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { ret = calendar_record_create(_calendar_alarm._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ sqlite3_finalize(stmt); cal_list_clear(list); return ret; + /* LCOV_EXCL_STOP */ } index = 0; @@ -243,9 +251,11 @@ int cal_db_alarm_delete_with_id(int parent_id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_plugin_attendee.c b/server/db/cal_db_plugin_attendee.c index e64df42..9ddbdfe 100644 --- a/server/db/cal_db_plugin_attendee.c +++ b/server/db/cal_db_plugin_attendee.c @@ -121,11 +121,13 @@ static int _cal_db_attendee_get_all_records(int offset, int limit, calendar_list ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_list_destroy(*out_list, true); *out_list = NULL; return ret; + /* LCOV_EXCL_STOP */ } calendar_record_h record = NULL; @@ -133,20 +135,26 @@ static int _cal_db_attendee_get_all_records(int offset, int limit, calendar_list while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { ret = calendar_record_create(_calendar_attendee._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_attendee_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -249,17 +257,21 @@ static int _cal_db_attendee_get_records_with_query(calendar_query_h query, int o if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_ATTENDEE)) { table_name = cal_strdup(CAL_TABLE_ATTENDEE); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -306,6 +318,7 @@ static int _cal_db_attendee_get_records_with_query(calendar_query_h query, int o /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -314,6 +327,7 @@ static int _cal_db_attendee_get_records_with_query(calendar_query_h query, int o } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -324,14 +338,16 @@ static int _cal_db_attendee_get_records_with_query(calendar_query_h query, int o ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } CAL_FREE(query_str); - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -398,8 +414,10 @@ static int _cal_db_attendee_get_count(int *out_count) ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query, count); @@ -422,17 +440,21 @@ static int _cal_db_attendee_get_count_with_query(calendar_query_h query, int *ou if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_ATTENDEE)) { table_name = cal_strdup(CAL_TABLE_ATTENDEE); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -453,6 +475,7 @@ static int _cal_db_attendee_get_count_with_query(calendar_query_h query, int *ou /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -460,6 +483,7 @@ static int _cal_db_attendee_get_count_with_query(calendar_query_h query, int *ou } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query_str, count); diff --git a/server/db/cal_db_plugin_attendee_helper.c b/server/db/cal_db_plugin_attendee_helper.c index ad04412..ea7afa3 100644 --- a/server/db/cal_db_plugin_attendee_helper.c +++ b/server/db/cal_db_plugin_attendee_helper.c @@ -68,9 +68,11 @@ static int _cal_db_attendee_insert_record(calendar_record_h record, int parent_i ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } index = 1; @@ -109,8 +111,10 @@ static int _cal_db_attendee_insert_record(calendar_record_h record, int parent_i ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } attendee->parent_id = parent_id; @@ -169,9 +173,11 @@ int cal_db_attendee_get_records(int parent_id, cal_list_s *list) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index; @@ -182,9 +188,12 @@ int cal_db_attendee_get_records(int parent_id, cal_list_s *list) while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { ret = calendar_record_create(_calendar_attendee._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); sqlite3_finalize(stmt); cal_list_clear(list); return ret; + /* LCOV_EXCL_STOP */ } index = 0; @@ -241,9 +250,11 @@ int cal_db_attendee_delete_with_id(int parent_id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_plugin_calendar.c b/server/db/cal_db_plugin_calendar.c index f234b48..fb375d9 100644 --- a/server/db/cal_db_plugin_calendar.c +++ b/server/db/cal_db_plugin_calendar.c @@ -88,8 +88,10 @@ static bool _cal_db_calendar_check_value_validation(cal_book_s* calendar) return true; default: + /* LCOV_EXCL_START */ ERR("store type is invalid(%d)", calendar->store_type); return false; + /* LCOV_EXCL_STOP */ } return true; } @@ -104,8 +106,10 @@ static int _cal_db_calendar_insert_record(calendar_record_h record, int* id) cal_book_s *book = (cal_book_s *)(record); if (false == _cal_db_calendar_check_value_validation(book)) { + /* LCOV_EXCL_START */ ERR("cal_db_calendar_check_value_validation() Fail"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } char *client_label = NULL; @@ -122,10 +126,12 @@ static int _cal_db_calendar_insert_record(calendar_record_h record, int* id) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(client_label); return ret; + /* LCOV_EXCL_STOP */ } if (book->uid) @@ -151,10 +157,12 @@ static int _cal_db_calendar_insert_record(calendar_record_h record, int* id) ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); free(client_label); - ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); free(client_label); @@ -180,22 +188,27 @@ static int _cal_db_calendar_get_record(int id, calendar_record_h* out_record) ret = calendar_record_create(_calendar_book._uri, out_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT * FROM %s WHERE id=%d AND (deleted = 0)", CAL_TABLE_CALENDAR, id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); @@ -204,6 +217,7 @@ static int _cal_db_calendar_get_record(int id, calendar_record_h* out_record) if (CALENDAR_ERROR_NONE == ret) return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; return ret; + /* LCOV_EXCL_STOP */ } _cal_db_calendar_get_stmt(stmt, *out_record); @@ -220,8 +234,10 @@ static int _cal_db_calendar_update_record(calendar_record_h record) cal_book_s* book = (cal_book_s*)(record); if (false == _cal_db_calendar_check_value_validation(book)) { + /* LCOV_EXCL_START */ ERR("cal_db_calendar_check_value_validation() Fail"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (book->common.properties_flags != NULL) @@ -240,9 +256,11 @@ static int _cal_db_calendar_update_record(calendar_record_h record) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (book->uid) @@ -266,10 +284,12 @@ static int _cal_db_calendar_update_record(calendar_record_h record) ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { - sqlite3_finalize(stmt); + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); + sqlite3_finalize(stmt); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); cal_db_util_notify(CAL_NOTI_TYPE_CALENDAR); @@ -287,8 +307,10 @@ static int _cal_db_calendar_delete_record(int id) CAL_TABLE_CALENDAR, id); ret = cal_db_util_query_get_first_int_result(query, NULL, &calendar_book_id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } int count = 0; @@ -296,15 +318,19 @@ static int _cal_db_calendar_delete_record(int id) snprintf(query, sizeof(query), "select count(*) from %s", CAL_TABLE_NORMAL_INSTANCE); ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "select count(*) from %s", CAL_TABLE_ALLDAY_INSTANCE); ret = cal_db_util_query_get_first_int_result(query, NULL, &count2); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } count += count2; @@ -342,8 +368,10 @@ static int _cal_db_calendar_replace_record(calendar_record_h record, int id) cal_book_s *book = (cal_book_s *)(record); if (false == _cal_db_calendar_check_value_validation(book)) { + /* LCOV_EXCL_START */ ERR("cal_db_calendar_check_value_validation() Fail"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } book->index = id; @@ -362,9 +390,11 @@ static int _cal_db_calendar_replace_record(calendar_record_h record, int id) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (book->uid) @@ -388,10 +418,12 @@ static int _cal_db_calendar_replace_record(calendar_record_h record, int id) ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { - sqlite3_finalize(stmt); + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); + sqlite3_finalize(stmt); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); cal_db_util_notify(CAL_NOTI_TYPE_CALENDAR); @@ -425,34 +457,40 @@ static int _cal_db_calendar_get_all_records(int offset, int limit, calendar_list ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_book._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_calendar_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -476,8 +514,10 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -530,6 +570,7 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o ret = cal_db_util_query_prepare(query_str, &stmt); SECURE("[TEST]---------query[%s]", query_str); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -538,6 +579,7 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -549,20 +591,24 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_book._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -573,6 +619,7 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { @@ -588,6 +635,8 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -599,6 +648,7 @@ static int _cal_db_calendar_get_records_with_query(calendar_query_h query, int o sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -619,8 +669,10 @@ static int _cal_db_calendar_delete_records(int ids[], int count) for (i = 0; i < count; i++) { ret = _cal_db_calendar_delete_record(ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_calendar_delete_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -633,22 +685,28 @@ static int _cal_db_calendar_replace_records(const calendar_list_h list, int ids[ int ret = 0; if (NULL == list) { + /* LCOV_EXCL_START */ ERR("Invalid argument: list is NULL"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_calendar_replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_calendar_replace_record() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)) @@ -671,9 +729,11 @@ static int _cal_db_calendar_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -696,17 +756,21 @@ static int _cal_db_calendar_get_count_with_query(calendar_query_h query, int *ou if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_CALENDAR)) { table_name = cal_strdup(CAL_TABLE_CALENDAR); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -727,6 +791,7 @@ static int _cal_db_calendar_get_count_with_query(calendar_query_h query, int *ou /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -734,6 +799,7 @@ static int _cal_db_calendar_get_count_with_query(calendar_query_h query, int *ou } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); @@ -896,6 +962,7 @@ static int _cal_db_calendar_update_projection(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(set); @@ -904,6 +971,7 @@ static int _cal_db_calendar_update_projection(calendar_record_h record) bind_text = NULL; } return ret; + /* LCOV_EXCL_STOP */ } /* bind */ @@ -915,6 +983,7 @@ static int _cal_db_calendar_update_projection(calendar_record_h record) ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); @@ -924,6 +993,7 @@ static int _cal_db_calendar_update_projection(calendar_record_h record) bind_text = NULL; } return ret; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); diff --git a/server/db/cal_db_plugin_calendar_helper.c b/server/db/cal_db_plugin_calendar_helper.c index 5034e2d..d8e85fd 100644 --- a/server/db/cal_db_plugin_calendar_helper.c +++ b/server/db/cal_db_plugin_calendar_helper.c @@ -42,9 +42,11 @@ int cal_db_delete_account(int account_id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -59,9 +61,11 @@ int cal_db_delete_account(int account_id) ret = cal_db_util_begin_trans(); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_begin_trans() Fail(%d)", ret); g_list_free(calendar_list); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } GList* cursor = calendar_list; @@ -70,8 +74,10 @@ int cal_db_delete_account(int account_id) ret = cal_db_delete_record(_calendar_book._uri, id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_delete_record() Fail(%d)", ret); SECURE("book_id(%d)", id); + /* LCOV_EXCL_STOP */ } cursor = g_list_next(cursor); } diff --git a/server/db/cal_db_plugin_event.c b/server/db/cal_db_plugin_event.c index 4245e25..793b0f7 100644 --- a/server/db/cal_db_plugin_event.c +++ b/server/db/cal_db_plugin_event.c @@ -137,8 +137,10 @@ static int _cal_db_event_get_record(int id, calendar_record_h* out_record) ret = calendar_record_create(_calendar_event._uri, out_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create(%d)", ret); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } event = (cal_event_s*)(*out_record); @@ -152,15 +154,18 @@ static int _cal_db_event_get_record(int id, calendar_record_h* out_record) CAL_TABLE_CALENDAR); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("[%s]", query); sqlite3_finalize(stmt); @@ -169,6 +174,7 @@ static int _cal_db_event_get_record(int id, calendar_record_h* out_record) if (CALENDAR_ERROR_NONE == ret) return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; return ret; + /* LCOV_EXCL_STOP */ } _cal_db_event_get_stmt(stmt, false, *out_record, &exception, &extended); @@ -183,9 +189,11 @@ static int _cal_db_event_get_record(int id, calendar_record_h* out_record) calendar_record_destroy(record_calendar, true); } if (event->is_deleted == 1 && CALENDAR_BOOK_SYNC_EVENT_FOR_EVERY_AND_REMAIN != sync_event_type) { + /* LCOV_EXCL_START */ calendar_record_destroy(*out_record, true); *out_record = NULL; return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; + /* LCOV_EXCL_STOP */ } if (CALENDAR_RECURRENCE_NONE != event->freq) { ret = cal_db_rrule_get_rrule(event->index, &rrule); @@ -316,9 +324,11 @@ static int __get_time_shifted_field(char *old_field, int old_type, int new_type, field = calloc(len_field, sizeof(char)); /* add (len_t * 8) for YYYYMMDD -> YYYYMMDDTHHMMSSZ */ if (NULL == field) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); g_strfreev(t); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } struct tm tm = {0}; @@ -486,14 +496,18 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time) ret = cal_db_event_check_value_validation(event); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_event_check_value_validation() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* access control */ if (cal_access_control_have_write_permission(event->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (event->common.properties_flags) { @@ -509,8 +523,10 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time) calendar_record_h old_record = NULL; ret = cal_db_get_record(_calendar_event._uri, event->index, &old_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_db_get_record() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* get time diff */ @@ -619,9 +635,11 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index = 1; @@ -716,8 +734,10 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* @@ -812,9 +832,11 @@ static int _cal_db_event_add_exdate(int original_event_id, char* recurrence_id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } /* add recurrence id to end of the exdate of original event. */ @@ -835,9 +857,11 @@ static int _cal_db_event_add_exdate(int original_event_id, char* recurrence_id) len = strlen((const char *)temp) + strlen(recurrence_id) + 2; exdate = calloc(len, sizeof(char)); if (NULL == exdate) { + /* LCOV_EXCL_START */ ERR("calloc() Fail"); sqlite3_finalize(stmt); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(exdate, len, "%s,%s", temp, recurrence_id); DBG("append [%s] to already has exdate [%s]", temp, recurrence_id); @@ -856,10 +880,12 @@ static int _cal_db_event_add_exdate(int original_event_id, char* recurrence_id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(exdate); return ret; + /* LCOV_EXCL_STOP */ } int index = 1; @@ -869,8 +895,10 @@ static int _cal_db_event_add_exdate(int original_event_id, char* recurrence_id) sqlite3_finalize(stmt); free(exdate); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -892,15 +920,19 @@ static int _cal_db_event_delete_record(int id) /* get calendar_id, created_ver, original_event_id, recurrence_id */ ret = _cal_db_event_get_deleted_data(id, &calendar_book_id, &created_ver, &original_event_id, &recurrence_id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ DBG("_cal_db_event_get_deleted_data() Fail"); return ret; + /* LCOV_EXCL_STOP */ } /* access control */ if (cal_access_control_have_write_permission(calendar_book_id) == false) { + /* LCOV_EXCL_START */ ERR("Fail"); CAL_FREE(recurrence_id); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (0 < original_event_id) { @@ -922,9 +954,11 @@ static int _cal_db_event_delete_record(int id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } } else { @@ -934,14 +968,16 @@ static int _cal_db_event_delete_record(int id) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id = %d ", CAL_TABLE_SCHEDULE, id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } DBG("attendee, alarm and rrule is deleted by trigger"); } - cal_db_instance_discard_record(id); + cal_db_instance_discard_record(id); cal_db_util_notify(CAL_NOTI_TYPE_EVENT); return CALENDAR_ERROR_NONE; } @@ -972,12 +1008,14 @@ static int _cal_db_event_get_all_records(int offset, int limit, calendar_list_h* ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } SECURE("[TEST]---------query[%s]", query_str); @@ -986,11 +1024,14 @@ static int _cal_db_event_get_all_records(int offset, int limit, calendar_list_h* int exception = 0, extended = 0; ret = calendar_record_create(_calendar_event._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_event_get_stmt(stmt, true, record, &exception, &extended); @@ -1016,12 +1057,15 @@ static int _cal_db_event_get_all_records(int offset, int limit, calendar_list_h* ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1043,8 +1087,10 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs char *table_name; if (NULL == query || NULL == out_list) { + /* LCOV_EXCL_START */ ERR("Invalid parameter"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } que = (cal_query_s *)query; @@ -1056,8 +1102,10 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_EVENT_CALENDAR_ATTENDEE)) { table_name = cal_strdup(CAL_VIEW_TABLE_EVENT_CALENDAR_ATTENDEE); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ @@ -1065,8 +1113,10 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1119,6 +1169,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -1127,6 +1178,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -1137,14 +1189,16 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs ret = calendar_list_create(&list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail(%d)", ret); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail(%d)", ret); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -1154,6 +1208,8 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs ret = calendar_record_create(_calendar_event._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); calendar_list_destroy(list, true); if (bind_text) { g_slist_free_full(bind_text, free); @@ -1162,6 +1218,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, que->projection, que->projection_count, que->property_count); @@ -1196,6 +1253,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs ret = calendar_list_add(list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(list, true); calendar_record_destroy(record, true); @@ -1207,6 +1265,7 @@ static int _cal_db_event_get_records_with_query(calendar_query_h query, int offs sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1232,8 +1291,10 @@ static int _cal_db_event_delete_records(int ids[], int count) for (i = 0; i < count; i++) { ret = _cal_db_event_delete_record(ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_event_delete_record() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -1251,9 +1312,11 @@ static int _cal_db_event_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -1280,8 +1343,10 @@ static int _cal_db_event_get_count_with_query(calendar_query_h query, int *out_c } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_EVENT_CALENDAR_ATTENDEE)) { table_name = cal_strdup(CAL_VIEW_TABLE_EVENT_CALENDAR_ATTENDEE); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ @@ -1289,8 +1354,10 @@ static int _cal_db_event_get_count_with_query(calendar_query_h query, int *out_c ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1311,6 +1378,7 @@ static int _cal_db_event_get_count_with_query(calendar_query_h query, int *out_c /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -1318,6 +1386,7 @@ static int _cal_db_event_get_count_with_query(calendar_query_h query, int *out_c } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); @@ -1349,8 +1418,10 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id) /* access control */ if (cal_access_control_have_write_permission(event->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (event->common.properties_flags != NULL) return _cal_db_event_update_dirty(record, -1); @@ -1450,9 +1521,11 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index = 1; @@ -1543,8 +1616,10 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* @@ -1596,22 +1671,28 @@ static int _cal_db_event_replace_records(const calendar_list_h list, int ids[], int ret = 0; if (NULL == list) { + /* LCOV_EXCL_START */ ERR("Invalid argument: list is NULL"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_event_replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_event_replace_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)) @@ -2045,8 +2126,10 @@ static void _cal_db_event_get_property_stmt(sqlite3_stmt *stmt, event->is_allday = sqlite3_column_int(stmt, *stmt_count); break; default: + /* LCOV_EXCL_START */ ERR("invalid (0x%x)", property); break; + /* LCOV_EXCL_STOP */ } *stmt_count = *stmt_count+1; @@ -2075,18 +2158,22 @@ static bool _cal_db_event_check_calendar_book_type(calendar_record_h record) CAL_TABLE_CALENDAR, event->calendar_id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return false; + /* LCOV_EXCL_STOP */ } if (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { store_type = sqlite3_column_int(stmt, 0); } else { + /* LCOV_EXCL_START */ + ERR("Failed to get calendar: calendar_id(%d)", event->calendar_id); sqlite3_finalize(stmt); stmt = NULL; - DBG("Failed to get calendar: calendar_id(%d)", event->calendar_id); return false; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); @@ -2113,9 +2200,11 @@ static int _cal_db_event_delete_exception(int *exception_ids, int exception_len) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id=%d ", CAL_TABLE_SCHEDULE, exception_ids[i]); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -2276,9 +2365,11 @@ static int _cal_db_event_exception_get_records(int original_id, cal_list_s *list ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } calendar_record_h record = NULL; @@ -2287,9 +2378,12 @@ static int _cal_db_event_exception_get_records(int original_id, cal_list_s *list int exception = 0, extended = 0; ret = calendar_record_create(_calendar_event._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); sqlite3_finalize(stmt); cal_list_clear(list); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_event_get_stmt(stmt, false, record, &exception, &extended); @@ -2340,9 +2434,11 @@ static int _cal_db_event_exception_delete_with_id(int original_id) CAL_TABLE_SCHEDULE, original_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -2362,9 +2458,11 @@ static int _cal_db_event_exception_get_ids(int original_id, GList **out_list) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -2435,17 +2533,21 @@ static int _cal_db_event_exception_update(cal_list_s *exception_list_s, int orig /* insert */ ret = cal_record_set_int(exception, _calendar_event.calendar_book_id, calendar_id); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_record_set_int() Fail(%d)", ret); if (id_list) g_list_free(id_list); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_event_insert_record(exception, original_id, NULL); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_event_insert_record() Fail(%d)", ret); if (id_list) g_list_free(id_list); return ret; + /* LCOV_EXCL_STOP */ } } calendar_list_next(exception_list); @@ -2461,8 +2563,10 @@ static int _cal_db_event_exception_update(cal_list_s *exception_list_s, int orig snprintf(query, sizeof(query), "DELETE FROM %s WHERE id=%d ", CAL_TABLE_SCHEDULE, tmp); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("cal_db_util_query_exec() Fail(%d)", ret); + /* LCOV_EXCL_START */ + WARN("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); + /* LCOV_EXCL_STOP */ } tmp_list = g_list_next(tmp_list); } @@ -2488,17 +2592,21 @@ static int _cal_db_event_get_deleted_data(int id, int* book_id, int* created_ver CAL_TABLE_SCHEDULE, id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; + /* LCOV_EXCL_STOP */ } *book_id = sqlite3_column_int(stmt, 0); @@ -2534,13 +2642,13 @@ static int _cal_db_event_exdate_insert_normal(int event_id, const char* original int exception_count = 0; for (i = 0; i < len1; i++) { if (NULL == patterns1[i]) { - ERR("exdate is NULL, so check next"); + WARN("exdate is NULL, so check next"); continue; } bool bFind = false; for (j = 0; j < len2; j++) { if (NULL == patterns2[j]) { - ERR("original exdate is NULL"); + WARN("original exdate is NULL"); continue; } if (CAL_STRING_EQUAL == strcmp(patterns1[i], patterns2[j])) { @@ -2609,8 +2717,10 @@ static int _cal_db_event_exdate_insert_normal(int event_id, const char* original ); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { - ERR("cal_db_util_query_exec() Fail(%d)", ret); + /* LCOV_EXCL_START */ + WARN("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); + /* LCOV_EXCL_STOP */ } int event_id = cal_db_util_last_insert_id(); DBG("last id(%d)", event_id); diff --git a/server/db/cal_db_plugin_event_helper.c b/server/db/cal_db_plugin_event_helper.c index a5e76d4..57e64d2 100644 --- a/server/db/cal_db_plugin_event_helper.c +++ b/server/db/cal_db_plugin_event_helper.c @@ -65,9 +65,11 @@ int cal_db_event_update_original_event_version(int original_event_id, int versio ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -81,34 +83,46 @@ int cal_db_event_check_value_validation(cal_event_s *event) RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER); if (event->start.type != event->end.type) { + /* LCOV_EXCL_START */ ERR("normal end(%lld) < start(%lld)", event->end.time.utime, event->start.time.utime); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } switch (event->start.type) { case CALENDAR_TIME_UTIME: if (event->end.time.utime < event->start.time.utime) { + /* LCOV_EXCL_START */ ERR("normal end(%lld) < start(%lld) so set same", event->end.time.utime, event->start.time.utime); event->end.time.utime = event->start.time.utime; return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; case CALENDAR_TIME_LOCALTIME: /* check invalid value */ if (event->start.time.date.month < 1 || 12 < event->start.time.date.month) { + /* LCOV_EXCL_START */ ERR("Error check start month(input:%d)", event->start.time.date.month); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else if (event->start.time.date.mday < 1 || 31 < event->start.time.date.mday) { + /* LCOV_EXCL_START */ ERR("Error check start mday(input:%d)", event->start.time.date.mday); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else if (event->end.time.date.month < 1 || 12 < event->end.time.date.month) { + /* LCOV_EXCL_START */ ERR("Error check end month(input:%d)", event->end.time.date.month); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else if (event->end.time.date.mday < 1 || 31 < event->end.time.date.mday) { + /* LCOV_EXCL_START */ ERR("Error check end mday(input:%d)", event->end.time.date.mday); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } else { /* handle hour, minute, second */ if (event->start.time.date.hour < 0 || 24 < event->start.time.date.hour) @@ -135,8 +149,10 @@ int cal_db_event_check_value_validation(cal_event_s *event) if (1 < slli - elli) { /* 1 is to ignore milliseconds */ + /* LCOV_EXCL_START */ ERR("allday end(%lld) < start(%lld) so set same", elli, slli); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } break; } @@ -157,9 +173,11 @@ GList* cal_db_event_get_list_with_uid(char *uid, int parent_id) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return NULL; + /* LCOV_EXCL_STOP */ } GList *l = NULL; @@ -181,8 +199,10 @@ void cal_db_event_update_child_origina_event_id(int child_id, int parent_id) CAL_TABLE_SCHEDULE, parent_id, child_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); + /* LCOV_EXCL_STOP */ } } @@ -196,9 +216,11 @@ char* cal_db_event_get_recurrence_id_from_exception(int child_id) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return NULL; + /* LCOV_EXCL_STOP */ } char *recurrence_id = NULL; @@ -240,9 +262,9 @@ static void __get_tzid_and_range(char *p, char **out_tzid, int *out_range) else if (CAL_STRING_EQUAL == strncmp(param, "THISANDPRIOR", strlen("THISANDPRIOR"))) range = CAL_RECURRENCE_ID_RANGE_THISANDPRIOR; else - ERR("Invalid param[%s]", s[i]); + WARN("Invalid param[%s]", s[i]); } else { - ERR("Invalid param[%s]", s[i]); + WARN("Invalid param[%s]", s[i]); } } *out_tzid = tzid; @@ -315,9 +337,11 @@ static void __get_next_instance_caltime(int parent_id, calendar_time_s *caltime, ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -338,9 +362,11 @@ static void __get_next_instance_caltime(int parent_id, calendar_time_s *caltime, ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } if (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -377,9 +403,11 @@ static void __get_last_instance_caltime(int parent_id, int type, calendar_time_s CAL_TABLE_NORMAL_INSTANCE, parent_id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { dtstart->type = CALENDAR_TIME_UTIME; @@ -393,9 +421,11 @@ static void __get_last_instance_caltime(int parent_id, int type, calendar_time_s CAL_TABLE_ALLDAY_INSTANCE, parent_id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return; + /* LCOV_EXCL_STOP */ } if (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { char *temp = NULL; @@ -406,7 +436,7 @@ static void __get_last_instance_caltime(int parent_id, int type, calendar_time_s &(dtstart->time.date.year), &(dtstart->time.date.month), &(dtstart->time.date.mday), &(dtstart->time.date.hour), &(dtstart->time.date.minute), &(dtstart->time.date.second)); } else { - ERR("datetime is NULL"); + WARN("datetime is NULL"); } } break; @@ -431,9 +461,11 @@ static void __del_recurence_id_instance(calendar_time_s *rectime, int parent_id) } ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return; + /* LCOV_EXCL_STOP */ } int y = 0, m = 0, d = 0; @@ -460,8 +492,10 @@ static void __set_original_event_id_in_child(int child_id, int parent_id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); + /* LCOV_EXCL_STOP */ } } @@ -611,9 +645,11 @@ static int __get_parent_id_with_uid(char *uid, int child_id) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) parent_id = sqlite3_column_int64(stmt, 0); @@ -645,14 +681,18 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id, ret = cal_db_event_check_value_validation(event); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_event_check_value_validation() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } /* access control */ if (cal_access_control_have_write_permission(event->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = calendar_record_get_int(record, _calendar_event.calendar_book_id, &calendar_book_id); @@ -742,9 +782,11 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id, ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } index = 1; @@ -840,8 +882,10 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id, ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } event_id = cal_db_util_last_insert_id(); @@ -903,8 +947,10 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id, int parent_id = 0; parent_id = __get_parent_id_with_uid(event->uid, event_id); if (parent_id < 0) { + /* LCOV_EXCL_START */ ERR("__get_parent_id_with_uid() Fail"); break; + /* LCOV_EXCL_STOP */ } calendar_record_h parent = NULL; cal_db_get_record(_calendar_event._uri, parent_id, &parent); diff --git a/server/db/cal_db_plugin_extended.c b/server/db/cal_db_plugin_extended.c index 1294bab..9e9061a 100644 --- a/server/db/cal_db_plugin_extended.c +++ b/server/db/cal_db_plugin_extended.c @@ -89,28 +89,34 @@ static int _cal_db_extended_get_record(int id, calendar_record_h* out_record) ret = calendar_record_create(_calendar_extended_property._uri, out_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT * FROM %s WHERE id=%d", CAL_TABLE_EXTENDED, id); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } _cal_db_extended_get_stmt(stmt, *out_record); @@ -146,9 +152,11 @@ static int _cal_db_extended_update_record(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (extended_info->key) @@ -160,8 +168,10 @@ static int _cal_db_extended_update_record(calendar_record_h record) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -176,9 +186,11 @@ static int _cal_db_extended_delete_record(int id) CAL_TABLE_EXTENDED, id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -209,9 +221,11 @@ static int _cal_db_extended_replace_record(calendar_record_h record, int id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (extended_info->key) @@ -223,8 +237,10 @@ static int _cal_db_extended_replace_record(calendar_record_h record, int id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -253,31 +269,37 @@ static int _cal_db_extended_get_all_records(int offset, int limit, calendar_list ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_list_destroy(*out_list, true); *out_list = NULL; return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_extended_property._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_extended_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -303,8 +325,10 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -350,6 +374,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -358,6 +383,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -368,20 +394,23 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } CAL_FREE(query_str); - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_extended_property._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -392,6 +421,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, @@ -406,6 +436,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -417,6 +448,7 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -439,8 +471,10 @@ static int _cal_db_extended_insert_records(const calendar_list_h list, int** ids ret = calendar_list_get_count(list, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list get error"); return ret; + /* LCOV_EXCL_STOP */ } id = calloc(1, sizeof(int)*count); @@ -449,17 +483,21 @@ static int _cal_db_extended_insert_records(const calendar_list_h list, int** ids ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); CAL_FREE(id); return ret; + /* LCOV_EXCL_STOP */ } do { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_extended_insert_record(record, &id[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_extended_insert_record() Fail(%d)", ret); CAL_FREE(id); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } i++; @@ -480,15 +518,19 @@ static int _cal_db_extended_update_records(const calendar_list_h list) ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } do { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_extended_update_record(record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_extended_update_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } } while (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)); @@ -503,8 +545,10 @@ static int _cal_db_extended_delete_records(int ids[], int count) for (i = 0; i < count; i++) { ret = _cal_db_extended_delete_record(ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_extended_delete_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -517,22 +561,28 @@ static int _cal_db_extended_replace_records(const calendar_list_h list, int ids[ int ret = 0; if (NULL == list) { + /* LCOV_EXCL_START */ ERR("Invalid argument: list is NULL"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_extended_replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_extended_replace_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)) @@ -554,8 +604,10 @@ static int _cal_db_extended_get_count(int *out_count) ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query, count); @@ -578,17 +630,21 @@ static int _cal_db_extended_get_count_with_query(calendar_query_h query, int *ou if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_EXTENDED)) { table_name = cal_strdup(CAL_TABLE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -607,6 +663,7 @@ static int _cal_db_extended_get_count_with_query(calendar_query_h query, int *ou /* query */ ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -614,6 +671,7 @@ static int _cal_db_extended_get_count_with_query(calendar_query_h query, int *ou } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query_str, count); @@ -704,6 +762,7 @@ static int _cal_db_extended_update_projection(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(set); @@ -712,6 +771,7 @@ static int _cal_db_extended_update_projection(calendar_record_h record) bind_text = NULL; } return ret; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -728,8 +788,10 @@ static int _cal_db_extended_update_projection(calendar_record_h record) bind_text = NULL; } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_plugin_extended_helper.c b/server/db/cal_db_plugin_extended_helper.c index cbaec36..1323540 100644 --- a/server/db/cal_db_plugin_extended_helper.c +++ b/server/db/cal_db_plugin_extended_helper.c @@ -49,9 +49,11 @@ int cal_db_extended_get_records(int record_id, calendar_record_type_e record_typ ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int count = 0; @@ -62,9 +64,11 @@ int cal_db_extended_get_records(int record_id, calendar_record_type_e record_typ while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { ret = calendar_record_create(_calendar_extended_property._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ sqlite3_finalize(stmt); cal_list_clear(list); return ret; + /* LCOV_EXCL_STOP */ } count = 0; @@ -94,9 +98,11 @@ int cal_db_extended_delete_with_id(int record_id, calendar_record_type_e record_ ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -122,9 +128,11 @@ int cal_db_extended_insert_record(calendar_record_h record, int record_id, calen ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (extended->key) @@ -136,8 +144,10 @@ int cal_db_extended_insert_record(calendar_record_h record, int record_id, calen ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } index = cal_db_util_last_insert_id(); @@ -150,9 +160,11 @@ int cal_db_extended_insert_record(calendar_record_h record, int record_id, calen CAL_TABLE_SCHEDULE, record_id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_plugin_instance_allday.c b/server/db/cal_db_plugin_instance_allday.c index 76c4320..f287ff4 100644 --- a/server/db/cal_db_plugin_instance_allday.c +++ b/server/db/cal_db_plugin_instance_allday.c @@ -74,9 +74,11 @@ static int _cal_db_instance_allday_delete_record(int id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -107,12 +109,14 @@ static int _cal_db_instance_allday_get_all_records(int offset, int limit, calend ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } SECURE("[TEST]---------query[%s]", query_str); @@ -120,23 +124,27 @@ static int _cal_db_instance_allday_get_all_records(int offset, int limit, calend calendar_record_h record; ret = calendar_record_create(_calendar_instance_localtime_calendar_book._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_instance_allday_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -163,17 +171,21 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_INSTANCE_LOCALTIME_CALENDAR_EXTENDED)) { table_name = cal_strdup(CAL_VIEW_TABLE_ALLDAY_INSTANCE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -225,6 +237,7 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -233,6 +246,7 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -244,20 +258,24 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(que->view_uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_record_create() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -268,6 +286,7 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, que->projection, que->projection_count, que->property_count); @@ -278,6 +297,8 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_add() Fail(%d)", ret); calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -289,6 +310,7 @@ static int _cal_db_instance_allday_get_records_with_query(calendar_query_h query sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -315,9 +337,11 @@ static int _cal_db_instance_allday_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -342,17 +366,21 @@ static int _cal_db_instance_allday_get_count_with_query(calendar_query_h query, } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_INSTANCE_LOCALTIME_CALENDAR_EXTENDED)) { table_name = cal_strdup(CAL_VIEW_TABLE_ALLDAY_INSTANCE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -373,6 +401,7 @@ static int _cal_db_instance_allday_get_count_with_query(calendar_query_h query, /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -380,6 +409,7 @@ static int _cal_db_instance_allday_get_count_with_query(calendar_query_h query, } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); diff --git a/server/db/cal_db_plugin_instance_allday_extended.c b/server/db/cal_db_plugin_instance_allday_extended.c index 5fb5094..b118921 100644 --- a/server/db/cal_db_plugin_instance_allday_extended.c +++ b/server/db/cal_db_plugin_instance_allday_extended.c @@ -87,34 +87,40 @@ static int _cal_db_instance_allday_extended_get_all_records(int offset, int limi ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_instance_localtime_calendar_book_extended._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_instance_allday_extended_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -142,9 +148,11 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -196,6 +204,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -204,6 +213,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -219,16 +229,19 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer g_slist_free_full(bind_text, free); bind_text = NULL; } + /* LCOV_EXCL_START */ ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(que->view_uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -239,6 +252,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, que->projection, que->projection_count, que->property_count); @@ -249,6 +263,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -260,6 +275,7 @@ static int _cal_db_instance_allday_extended_get_records_with_query(calendar_quer sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -286,9 +302,11 @@ static int _cal_db_instance_allday_extended_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -314,9 +332,11 @@ static int _cal_db_instance_allday_extended_get_count_with_query(calendar_query_ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -337,6 +357,7 @@ static int _cal_db_instance_allday_extended_get_count_with_query(calendar_query_ /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -344,6 +365,7 @@ static int _cal_db_instance_allday_extended_get_count_with_query(calendar_query_ } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); diff --git a/server/db/cal_db_plugin_instance_normal.c b/server/db/cal_db_plugin_instance_normal.c index e5f4b3d..79a5b0e 100644 --- a/server/db/cal_db_plugin_instance_normal.c +++ b/server/db/cal_db_plugin_instance_normal.c @@ -79,9 +79,11 @@ static int _cal_db_instance_normal_delete_record(int id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -112,12 +114,14 @@ static int _cal_db_instance_normal_get_all_records(int offset, int limit, calend ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } SECURE("[TEST]---------query[%s]", query_str); @@ -125,22 +129,26 @@ static int _cal_db_instance_normal_get_all_records(int offset, int limit, calend calendar_record_h record; ret = calendar_record_create(_calendar_instance_utime_calendar_book._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_instance_normal_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -167,17 +175,21 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_INSTANCE_UTIME_CALENDAR_EXTENDED)) { table_name = cal_strdup(CAL_VIEW_TABLE_NORMAL_INSTANCE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -229,6 +241,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -237,6 +250,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -252,16 +266,19 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query g_slist_free_full(bind_text, free); bind_text = NULL; } + /* LCOV_EXCL_START */ ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(que->view_uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -271,6 +288,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query } sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, @@ -285,6 +303,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -296,6 +315,7 @@ static int _cal_db_instance_normal_get_records_with_query(calendar_query_h query sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -321,6 +341,7 @@ static int _cal_db_instance_normal_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; @@ -348,17 +369,21 @@ static int _cal_db_instance_normal_get_count_with_query(calendar_query_h query, } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_INSTANCE_UTIME_CALENDAR_EXTENDED)) { table_name = cal_strdup(CAL_VIEW_TABLE_NORMAL_INSTANCE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -379,6 +404,7 @@ static int _cal_db_instance_normal_get_count_with_query(calendar_query_h query, /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -387,6 +413,7 @@ static int _cal_db_instance_normal_get_count_with_query(calendar_query_h query, CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); diff --git a/server/db/cal_db_plugin_instance_normal_extended.c b/server/db/cal_db_plugin_instance_normal_extended.c index d49fe76..2cc289c 100644 --- a/server/db/cal_db_plugin_instance_normal_extended.c +++ b/server/db/cal_db_plugin_instance_normal_extended.c @@ -86,34 +86,40 @@ static int _cal_db_instance_normal_extended_get_all_records(int offset, int limi ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; free(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_instance_utime_calendar_book_extended._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_instance_normal_extended_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -141,9 +147,11 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -195,6 +203,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -203,6 +212,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -214,20 +224,23 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(que->view_uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -237,6 +250,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer } sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { @@ -251,6 +265,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -262,6 +277,7 @@ static int _cal_db_instance_normal_extended_get_records_with_query(calendar_quer sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -287,9 +303,11 @@ static int _cal_db_instance_normal_extended_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -314,9 +332,11 @@ static int _cal_db_instance_normal_extended_get_count_with_query(calendar_query_ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -337,6 +357,7 @@ static int _cal_db_instance_normal_extended_get_count_with_query(calendar_query_ /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -345,6 +366,7 @@ static int _cal_db_instance_normal_extended_get_count_with_query(calendar_query_ CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); diff --git a/server/db/cal_db_plugin_search.c b/server/db/cal_db_plugin_search.c index eb0656c..32a83e6 100644 --- a/server/db/cal_db_plugin_search.c +++ b/server/db/cal_db_plugin_search.c @@ -78,8 +78,10 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -105,10 +107,12 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_INSTANCE_LOCALTIME_CALENDAR_EXTENDED)) { table_name = strdup(CAL_VIEW_TABLE_ALLDAY_INSTANCE_EXTENDED); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); CAL_FREE(projection); CAL_FREE(condition); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } char *query_str = NULL; @@ -157,6 +161,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -165,6 +170,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -176,20 +182,23 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(que->view_uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -200,6 +209,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { _cal_db_search_get_projection_stmt(stmt, que->projection, que->projection_count, @@ -210,6 +220,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -221,6 +232,7 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -262,18 +274,22 @@ static int _cal_db_search_get_count_with_query(calendar_query_h query, int *out_ table_name = cal_strdup(CAL_VIEW_TABLE_ALLDAY_INSTANCE); projection = cal_strdup("event_id"); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); CAL_FREE(projection); return ret; + /* LCOV_EXCL_STOP */ } } @@ -303,6 +319,7 @@ static int _cal_db_search_get_count_with_query(calendar_query_h query, int *out_ /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Failed"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -311,6 +328,7 @@ static int _cal_db_search_get_count_with_query(calendar_query_h query, int *out_ CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); @@ -425,8 +443,10 @@ static int _cal_db_search_make_projection(calendar_query_h query, char **project len += snprintf(out_projection+len, sizeof(out_projection)-len, "%s", field_name); if (sizeof(out_projection) <= len) { + /* LCOV_EXCL_START */ ERR("buf len max"); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } for (i = 1; i < query_s->property_count; i++) { @@ -439,8 +459,10 @@ static int _cal_db_search_make_projection(calendar_query_h query, char **project if (field_name) { len += snprintf(out_projection+len, sizeof(out_projection)-len, ", %s", field_name); if (sizeof(out_projection) <= len) { + /* LCOV_EXCL_START */ ERR("buf len max"); return CALENDAR_ERROR_SYSTEM; + /* LCOV_EXCL_STOP */ } } } diff --git a/server/db/cal_db_plugin_timezone.c b/server/db/cal_db_plugin_timezone.c index 0b4cc94..1266547 100644 --- a/server/db/cal_db_plugin_timezone.c +++ b/server/db/cal_db_plugin_timezone.c @@ -95,17 +95,21 @@ static int _cal_db_timezone_insert_record(calendar_record_h record, int* id) CAL_TABLE_TIMEZONE); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } cal_db_util_stmt_bind_text(stmt, 1, timezone->standard_name); ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } index = 0; @@ -143,9 +147,11 @@ static int _cal_db_timezone_insert_record(calendar_record_h record, int* id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (timezone->standard_name) @@ -157,8 +163,10 @@ static int _cal_db_timezone_insert_record(calendar_record_h record, int* id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } index = cal_db_util_last_insert_id(); @@ -176,8 +184,10 @@ static int _cal_db_timezone_get_record(int id, calendar_record_h* out_record) ret = calendar_record_create(_calendar_timezone._uri, out_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT * FROM %s WHERE id = %d AND " @@ -186,15 +196,18 @@ static int _cal_db_timezone_get_record(int id, calendar_record_h* out_record) CAL_TABLE_CALENDAR); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Faile%d)", ret); sqlite3_finalize(stmt); calendar_record_destroy(*out_record, true); @@ -202,6 +215,7 @@ static int _cal_db_timezone_get_record(int id, calendar_record_h* out_record) if (CALENDAR_ERROR_NONE == ret) return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; return ret; + /* LCOV_EXCL_STOP */ } _cal_db_timezone_get_stmt(stmt, *out_record); @@ -257,9 +271,11 @@ static int _cal_db_timezone_update_record(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (timezone_info->standard_name) @@ -271,8 +287,10 @@ static int _cal_db_timezone_update_record(calendar_record_h record) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -286,9 +304,11 @@ static int _cal_db_timezone_delete_record(int id) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id = %d", CAL_TABLE_TIMEZONE, id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -340,9 +360,11 @@ static int _cal_db_timezone_replace_record(calendar_record_h record, int id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } if (timezone_info->standard_name) @@ -354,8 +376,10 @@ static int _cal_db_timezone_replace_record(calendar_record_h record, int id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -390,31 +414,37 @@ static int _cal_db_timezone_get_all_records(int offset, int limit, calendar_list ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_list_destroy(*out_list, true); *out_list = NULL; return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_timezone._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_timezone_get_stmt(stmt, record); ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -440,8 +470,10 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); return ret; + /* LCOV_EXCL_STOP */ } } @@ -494,6 +526,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -502,6 +535,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -512,20 +546,23 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } CAL_FREE(query_str); - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { calendar_record_h record; ret = calendar_record_create(_calendar_timezone._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -536,6 +573,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, @@ -550,6 +588,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -561,6 +600,7 @@ static int _cal_db_timezone_get_records_with_query(calendar_query_h query, int o CAL_FREE(query_str); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } } @@ -581,8 +621,10 @@ static int _cal_db_timezone_delete_records(int ids[], int count) for (i = 0; i < count; i++) { ret = _cal_db_timezone_delete_record(ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_timezone_delete_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -598,16 +640,20 @@ static int _cal_db_timezone_replace_records(const calendar_list_h list, int ids[ ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_timezone_replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_timezone_replace_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)) @@ -632,8 +678,10 @@ static int _cal_db_timezone_get_count(int *out_count) ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query, count); @@ -656,17 +704,21 @@ static int _cal_db_timezone_get_count_with_query(calendar_query_h query, int *ou if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_TIMEZONE)) { table_name = cal_strdup(CAL_TABLE_TIMEZONE); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -692,6 +744,7 @@ static int _cal_db_timezone_get_count_with_query(calendar_query_h query, int *ou /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -699,6 +752,7 @@ static int _cal_db_timezone_get_count_with_query(calendar_query_h query, int *ou } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("%s=%d", query_str, count); @@ -797,8 +851,10 @@ static void _cal_db_timezone_get_property_stmt(sqlite3_stmt *stmt, timezone->calendar_id = sqlite3_column_int(stmt, stmt_count); break; default: + /* LCOV_EXCL_START */ ERR("Invalid property(0x%x)", property); break; + /* LCOV_EXCL_STOP */ } return; @@ -832,6 +888,7 @@ static int _cal_db_timezone_update_projection(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); free(set); @@ -840,6 +897,7 @@ static int _cal_db_timezone_update_projection(calendar_record_h record) bind_text = NULL; } return ret; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -856,8 +914,10 @@ static int _cal_db_timezone_update_projection(calendar_record_h record) bind_text = NULL; } if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_plugin_todo.c b/server/db/cal_db_plugin_todo.c index ee65cda..e91d822 100644 --- a/server/db/cal_db_plugin_todo.c +++ b/server/db/cal_db_plugin_todo.c @@ -98,8 +98,10 @@ static int _cal_db_todo_insert_record(calendar_record_h record, int* id) RETV_IF(false == _cal_db_todo_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER); if (cal_access_control_have_write_permission(todo->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } ret = calendar_record_get_int(record, @@ -180,9 +182,11 @@ static int _cal_db_todo_insert_record(calendar_record_h record, int* id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int count = 1; @@ -260,10 +264,12 @@ static int _cal_db_todo_insert_record(calendar_record_h record, int* id) ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } index = cal_db_util_last_insert_id(); @@ -316,8 +322,10 @@ static int _cal_db_todo_get_record(int id, calendar_record_h* out_record) ret = calendar_record_create(_calendar_todo._uri, out_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("calendar_record_create() Fail(%d)", ret); return CALENDAR_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } todo = (cal_todo_s*)(*out_record); @@ -330,15 +338,18 @@ static int _cal_db_todo_get_record(int id, calendar_record_h* out_record) CAL_TABLE_CALENDAR); ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); calendar_record_destroy(*out_record, true); *out_record = NULL; return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); calendar_record_destroy(*out_record, true); @@ -346,6 +357,7 @@ static int _cal_db_todo_get_record(int id, calendar_record_h* out_record) if (CALENDAR_ERROR_NONE == ret) return CALENDAR_ERROR_DB_RECORD_NOT_FOUND; return ret; + /* LCOV_EXCL_STOP */ } _cal_db_todo_get_stmt(stmt, false, *out_record, &extended); @@ -399,8 +411,10 @@ static int _cal_db_todo_update_record(calendar_record_h record) RETV_IF(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER); if (cal_access_control_have_write_permission(todo->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (todo->common.properties_flags != NULL) @@ -481,9 +495,11 @@ static int _cal_db_todo_update_record(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int count = 1; @@ -562,8 +578,10 @@ static int _cal_db_todo_update_record(calendar_record_h record) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } cal_db_rrule_get_rrule_from_record(record, &rrule); @@ -613,16 +631,20 @@ static int _cal_db_todo_delete_record(int id) } if (cal_access_control_have_write_permission(calendar_book_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } snprintf(query, sizeof(query), "SELECT sync_event FROM %s WHERE id = %d ", CAL_TABLE_CALENDAR, calendar_book_id); ret = cal_db_util_query_get_first_int_result(query, NULL, (int *)&sync_event_type); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } DBG("sync_event_type(%d)", sync_event_type); @@ -634,9 +656,11 @@ static int _cal_db_todo_delete_record(int id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } DBG("attendee, alarm and rrule will be deleted by trigger after sync clean"); } else { @@ -646,9 +670,11 @@ static int _cal_db_todo_delete_record(int id) snprintf(query, sizeof(query), "DELETE FROM %s WHERE id = %d ", CAL_TABLE_SCHEDULE, id); ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } DBG("attendee, alarm and rrule is deleted by trigger"); } @@ -672,8 +698,10 @@ static int _cal_db_todo_replace_record(calendar_record_h record, int id) todo->index = id; if (cal_access_control_have_write_permission(todo->calendar_id) == false) { + /* LCOV_EXCL_START */ ERR("cal_access_control_have_write_permission() Fail"); return CALENDAR_ERROR_PERMISSION_DENIED; + /* LCOV_EXCL_STOP */ } if (todo->common.properties_flags) @@ -754,9 +782,11 @@ static int _cal_db_todo_replace_record(calendar_record_h record, int id) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int count = 1; @@ -835,8 +865,10 @@ static int _cal_db_todo_replace_record(calendar_record_h record, int id) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } cal_db_rrule_get_rrule_from_record(record, &rrule); @@ -894,12 +926,14 @@ static int _cal_db_todo_get_all_records(int offset, int limit, calendar_list_h* ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); calendar_list_destroy(*out_list, true); *out_list = NULL; CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -907,11 +941,13 @@ static int _cal_db_todo_get_all_records(int offset, int limit, calendar_list_h* int extended = 0; ret = calendar_record_create(_calendar_todo._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } _cal_db_todo_get_stmt(stmt, true, record, &extended); @@ -934,12 +970,14 @@ static int _cal_db_todo_get_all_records(int offset, int limit, calendar_list_h* ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } sqlite3_finalize(stmt); @@ -966,17 +1004,21 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_TODO_CALENDAR)) { table_name = cal_strdup(CAL_VIEW_TABLE_TODO_CALENDAR); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1029,6 +1071,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse /* query */ ret = cal_db_util_query_prepare(query_str, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query_str); if (bind_text) { @@ -1037,6 +1080,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse } free(query_str); return ret; + /* LCOV_EXCL_STOP */ } /* bind text */ @@ -1048,14 +1092,16 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse ret = calendar_list_create(out_list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ + ERR("calendar_list_create() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); bind_text = NULL; } - ERR("calendar_list_create() Fail"); sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) { @@ -1064,6 +1110,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse int attendee = 1, alarm = 1; ret = calendar_record_create(_calendar_todo._uri, &record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; @@ -1074,6 +1121,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } if (0 < que->projection_count) { cal_record_set_projection(record, @@ -1108,6 +1156,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse ret = calendar_list_add(*out_list, record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ calendar_list_destroy(*out_list, true); *out_list = NULL; calendar_record_destroy(record, true); @@ -1119,6 +1168,7 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse sqlite3_finalize(stmt); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1140,8 +1190,10 @@ static int _cal_db_todo_delete_records(int ids[], int count) for (i = 0; i < count; i++) { ret = _cal_db_todo_delete_record(ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_todo_delete_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } return CALENDAR_ERROR_NONE; @@ -1159,9 +1211,11 @@ static int _cal_db_todo_get_count(int *out_count) int count = 0; ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); CAL_FREE(query_str); @@ -1177,22 +1231,28 @@ static int _cal_db_todo_replace_records(const calendar_list_h list, int ids[], i int ret = 0; if (NULL == list) { + /* LCOV_EXCL_START */ ERR("Invalid argument: list is NULL"); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } ret = calendar_list_first(list); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("list first error"); return ret; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) { ret = _cal_db_todo_replace_record(record, ids[i]); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_todo_replace_record() Fail(%d)", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } } if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list)) @@ -1219,17 +1279,21 @@ static int _cal_db_todo_get_count_with_query(calendar_query_h query, int *out_co } else if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_TODO_CALENDAR)) { table_name = cal_strdup(CAL_VIEW_TABLE_TODO_CALENDAR); } else { + /* LCOV_EXCL_START */ ERR("uri(%s) not support get records with query", que->view_uri); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } /* make filter */ if (que->filter) { ret = cal_db_query_create_condition(query, &condition, &bind_text); if (CALENDAR_ERROR_NONE != ret) { - CAL_FREE(table_name); + /* LCOV_EXCL_START */ ERR("cal_db_query_create_condition() Fail(%d), ret"); + CAL_FREE(table_name); return ret; + /* LCOV_EXCL_STOP */ } } @@ -1250,6 +1314,7 @@ static int _cal_db_todo_get_count_with_query(calendar_query_h query, int *out_co /* query */ ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); if (bind_text) { g_slist_free_full(bind_text, free); @@ -1257,6 +1322,7 @@ static int _cal_db_todo_get_count_with_query(calendar_query_h query, int *out_co } CAL_FREE(query_str); return ret; + /* LCOV_EXCL_STOP */ } DBG("count(%d) str[%s]", count, query_str); @@ -1688,16 +1754,20 @@ static bool _cal_db_todo_check_calendar_book_type(calendar_record_h record) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return false; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); return false; + /* LCOV_EXCL_STOP */ } store_type = sqlite3_column_int(stmt, 0); sqlite3_finalize(stmt); @@ -1731,8 +1801,10 @@ static int _cal_db_todo_update_dirty(calendar_record_h record) ret = _cal_db_todo_get_record(todo_id, &original_record); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_todo_get_record() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } cal_record_s *_record = NULL; @@ -1817,16 +1889,20 @@ static int _cal_db_todo_get_deleted_data(int id, int* calendar_book_id, int* cre ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } *calendar_book_id = sqlite3_column_int(stmt, 0); diff --git a/server/db/cal_db_query.c b/server/db/cal_db_query.c index b47d067..919a967 100644 --- a/server/db/cal_db_query.c +++ b/server/db/cal_db_query.c @@ -470,8 +470,10 @@ static int _cal_db_query_create_composite_condition(cal_composite_filter_s *com_ ret = _cal_db_query_create_attribute_condition(com_filter, (cal_attribute_filter_s*)filter, &cond, &binds); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_query_create_attribute_condition() Fail(%d)", ret); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cursor_filter = com_filter->filters->next; @@ -491,6 +493,7 @@ static int _cal_db_query_create_composite_condition(cal_composite_filter_s *com_ ret = _cal_db_query_create_attribute_condition(com_filter, (cal_attribute_filter_s*)filter, &cond, &binds2); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("_cal_db_query_create_attribute_condition() Fail(%d)", ret); CAL_FREE(out_cond); if (binds) { @@ -498,6 +501,7 @@ static int _cal_db_query_create_composite_condition(cal_composite_filter_s *com_ binds = NULL; } return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } op = (calendar_filter_operator_e)cursor_ops->data; @@ -549,8 +553,10 @@ static int _cal_db_query_create_attribute_condition(cal_composite_filter_s *com_ ret = _cal_db_query_create_caltime_condition(com_filter, filter, &cond); break; default: + /* LCOV_EXCL_START */ ERR("The filter type is not supported (%d)", filter->filter_type); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (CALENDAR_ERROR_NONE == ret) @@ -593,8 +599,10 @@ static int _cal_db_query_create_int_condition(cal_composite_filter_s *com_filter snprintf(out_cond, sizeof(out_cond), "%s <> %d", field_name, filter->value.i); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : int match rule(%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -635,8 +643,10 @@ static int _cal_db_query_create_double_condition(cal_composite_filter_s *com_fil snprintf(out_cond, sizeof(out_cond), "%s <> %lf", field_name, filter->value.d); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : int match rule(%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -677,8 +687,10 @@ static int _cal_db_query_create_lli_condition(cal_composite_filter_s *com_filter snprintf(out_cond, sizeof(out_cond), "%s <> %lld", field_name, filter->value.lli); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : int match rule(%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } *condition = strdup(out_cond); @@ -725,8 +737,10 @@ static int _cal_db_query_create_caltime_condition(cal_composite_filter_s *com_fi snprintf(out_cond, sizeof(out_cond), "%s <> %lld", tmp, filter->value.caltime.time.utime); break; default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : int match rule(%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else if (filter->value.caltime.type == CALENDAR_TIME_LOCALTIME) { char sdate[CAL_STR_SHORT_LEN32] = {0}; @@ -758,12 +772,16 @@ static int _cal_db_query_create_caltime_condition(cal_composite_filter_s *com_fi break; case CALENDAR_MATCH_NONE: default: + /* LCOV_EXCL_START */ ERR("Invalid parameter : int match rule(%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } } else { + /* LCOV_EXCL_START */ ERR("Invalid parameter : property id(%d)", filter->property_id); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } cal_record_type_e record_type = cal_view_get_type(com_filter->view_uri); @@ -832,8 +850,10 @@ static int _cal_db_query_create_str_condition(cal_composite_filter_s *com_filter snprintf(out_cond, sizeof(out_cond), "%s IS NOT NULL", field_name); break; default: + /* LCOV_EXCL_START */ ERR("Invalid paramter : int match rule (%d) is not supported", filter->match); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } if (filter->value.s) { diff --git a/server/db/cal_db_rrule.c b/server/db/cal_db_rrule.c index 477ebf0..3ffaaa0 100644 --- a/server/db/cal_db_rrule.c +++ b/server/db/cal_db_rrule.c @@ -183,9 +183,11 @@ int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } index = 1; @@ -241,8 +243,10 @@ int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } rrule_id = cal_db_util_last_insert_id(); @@ -268,17 +272,21 @@ int cal_db_rrule_get_rrule(int id, cal_rrule_s **rrule) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CAL_SQLITE_ROW != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } _rrule = calloc(1, sizeof(cal_rrule_s)); @@ -355,9 +363,11 @@ static int _cal_db_rrule_delete_record(int id) ret = cal_db_util_query_exec(query); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_exec() Fail(%d)", ret); SECURE("[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -375,8 +385,10 @@ static int _cal_db_rrule_has_record(int id, int *has_record) ret = cal_db_util_query_get_first_int_result(query, NULL, &count); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() failed"); return ret; + /* LCOV_EXCL_STOP */ } *has_record = 0 < count ? 1 : 0; @@ -422,9 +434,11 @@ static int _cal_db_rrule_update_record(int id, cal_rrule_s *rrule) ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); SECURE("query[%s]", query); return ret; + /* LCOV_EXCL_STOP */ } int index = 1; @@ -479,8 +493,10 @@ static int _cal_db_rrule_update_record(int id, cal_rrule_s *rrule) ret = cal_db_util_stmt_step(stmt); sqlite3_finalize(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; diff --git a/server/db/cal_db_util.c b/server/db/cal_db_util.c index 30e8b6e..7e7a822 100644 --- a/server/db/cal_db_util.c +++ b/server/db/cal_db_util.c @@ -53,7 +53,9 @@ static void _cal_db_util_notify_event_change(void) close(fd); event_change = false; } else { + /* LCOV_EXCL_START */ ERR("open() Fail"); + /* LCOV_EXCL_STOP */ } } @@ -64,7 +66,9 @@ static inline void _cal_db_util_notify_todo_change(void) close(fd); todo_change = false; } else { + /* LCOV_EXCL_START */ ERR("open() Fail"); + /* LCOV_EXCL_STOP */ } } @@ -75,7 +79,9 @@ static inline void _cal_db_util_notify_calendar_change(void) close(fd); calendar_change = false; } else { + /* LCOV_EXCL_START */ ERR("open() Fail"); + /* LCOV_EXCL_STOP */ } } @@ -100,8 +106,10 @@ int cal_db_util_notify(cal_noti_type_e type) calendar_change = true; break; default: + /* LCOV_EXCL_START */ ERR("The type(%d) is not supported", type); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -117,8 +125,10 @@ int cal_db_util_notify(cal_noti_type_e type) _cal_db_util_notify_calendar_change(); break; default: + /* LCOV_EXCL_START */ ERR("The type(%d) is not supported", type); return CALENDAR_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -138,8 +148,10 @@ int cal_db_util_open(void) int ret = 0; ret = db_util_open(CAL_DB_FILE, &cal_db, 0); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("db_util_open() Fail(%d).", ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; @@ -196,17 +208,23 @@ int cal_db_util_query_prepare(char *query, sqlite3_stmt **stmt) ret = CALENDAR_ERROR_NONE; break; case SQLITE_BUSY: + /* LCOV_EXCL_START */ ERR("SQLITE_BUSY"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ case SQLITE_LOCKED: + /* LCOV_EXCL_START */ ERR("SQLITE_LOCKED"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ default: + /* LCOV_EXCL_START */ ERR("ERROR(%d)", ret); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ } return ret; } @@ -241,17 +259,23 @@ int cal_db_util_stmt_step(sqlite3_stmt *stmt) ret = CALENDAR_ERROR_NONE; break; case SQLITE_BUSY: + /* LCOV_EXCL_START */ ERR("SQLITE_BUSY"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ case SQLITE_LOCKED: + /* LCOV_EXCL_START */ ERR("SQLITE_LOCKED"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ default: + /* LCOV_EXCL_START */ ERR("ERROR(%d)", ret); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ } return ret; } @@ -265,16 +289,20 @@ int cal_db_util_query_exec(char *query) sqlite3_stmt *stmt = NULL; ret = cal_db_util_query_prepare(query, &stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_prepare() Fail(%d)", ret); return ret; + /* LCOV_EXCL_STOP */ } ret = cal_db_util_stmt_step(stmt); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_stmt_step() Fail(%d)", ret); SECURE("query[%s]", query); sqlite3_finalize(stmt); return ret; + /* LCOV_EXCL_STOP */ } sqlite3_finalize(stmt); @@ -296,6 +324,7 @@ int cal_db_util_query_get_first_int_result(const char *query, GSList *bind_text, do { ret = sqlite3_prepare_v2(cal_db, query, strlen(query), &stmt, NULL); if (SQLITE_BUSY == ret || SQLITE_LOCKED == ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2() Fail:[%s]", sqlite3_errmsg(cal_db)); SECURE("[%s]", query); gettimeofday(&now, NULL); @@ -303,15 +332,18 @@ int cal_db_util_query_get_first_int_result(const char *query, GSList *bind_text, retry = (diff.tv_sec < CAL_QUERY_RETRY_TIME) ? true : false; if (retry) usleep(CAL_QUERY_RETRY_INTERVAL); /* 50ms */ + /* LCOV_EXCL_STOP */ } else { retry = false; } } while (retry); if (SQLITE_OK != ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_prepare_v2(%s) Fail(%s).", query, sqlite3_errmsg(cal_db)); SECURE("query[%s]", query); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } if (bind_text) { @@ -328,12 +360,14 @@ int cal_db_util_query_get_first_int_result(const char *query, GSList *bind_text, do { ret = sqlite3_step(stmt); if (SQLITE_BUSY == ret || SQLITE_LOCKED == ret) { + /* LCOV_EXCL_START */ ERR("sqlite3_step fail(%d, %s)", ret, sqlite3_errmsg(cal_db)); gettimeofday(&now, NULL); timersub(&now, &from, &diff); retry = (diff.tv_sec < CAL_QUERY_RETRY_TIME) ? true : false; if (retry) usleep(CAL_QUERY_RETRY_INTERVAL); /* 50ms */ + /* LCOV_EXCL_STOP */ } else { retry = false; } @@ -352,17 +386,23 @@ int cal_db_util_query_get_first_int_result(const char *query, GSList *bind_text, ret = CALENDAR_ERROR_NO_DATA; break; case SQLITE_BUSY: + /* LCOV_EXCL_START */ ERR("SQLITE_BUSY"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ case SQLITE_LOCKED: + /* LCOV_EXCL_START */ ERR("SQLITE_LOCKED"); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ default: + /* LCOV_EXCL_START */ ERR("ERROR(%d)", ret); ret = CALENDAR_ERROR_DB_FAILED; break; + /* LCOV_EXCL_STOP */ } return CALENDAR_ERROR_NONE; } @@ -386,8 +426,10 @@ int cal_db_util_begin_trans(void) const char *query = "SELECT ver FROM "CAL_TABLE_VERSION; ret = cal_db_util_query_get_first_int_result(query, NULL, &transaction_ver); if (CALENDAR_ERROR_NONE != ret) { + /* LCOV_EXCL_START */ ERR("cal_db_util_query_get_first_int_result() Fail"); return ret; + /* LCOV_EXCL_STOP */ } version_up = false; } @@ -437,11 +479,13 @@ int cal_db_util_end_trans(bool is_success) if (CALENDAR_ERROR_NONE != ret) { int tmp_ret; + /* LCOV_EXCL_START */ ERR("cal_query_exec() Fail(%d)", ret); _cal_db_util_cancel_changes(); tmp_ret = cal_db_util_query_exec("ROLLBACK TRANSACTION"); WARN_IF(CALENDAR_ERROR_NONE != tmp_ret, "cal_query_exec(ROLLBACK) Fail(%d).", tmp_ret); return CALENDAR_ERROR_DB_FAILED; + /* LCOV_EXCL_STOP */ } if (event_change) _cal_db_util_notify_event_change(); if (todo_change) _cal_db_util_notify_todo_change();