diff options
author | Soham <s3.chowdhury@samsung.com> | 2023-09-18 12:07:39 +0530 |
---|---|---|
committer | Soham <s3.chowdhury@samsung.com> | 2023-09-19 15:24:08 +0530 |
commit | fdd6d7b901e4cbf6d020f4a81f0779b16dd36d7e (patch) | |
tree | a713a66f21112348624077fa5a869bb729fca2c8 | |
parent | 98d11012788113b1f775fa5378fbedef090ef4b6 (diff) | |
download | email-service-fdd6d7b901e4cbf6d020f4a81f0779b16dd36d7e.tar.gz email-service-fdd6d7b901e4cbf6d020f4a81f0779b16dd36d7e.tar.bz2 email-service-fdd6d7b901e4cbf6d020f4a81f0779b16dd36d7e.zip |
Increase LCOV coverage
Change-Id: I6a62b0875f84af5347c7bbadf65a9e0dc305826f
Signed-off-by: Soham <s3.chowdhury@samsung.com>
49 files changed, 591 insertions, 596 deletions
diff --git a/email-api/email-api-account.c b/email-api/email-api-account.c index dcee29c..f4b3ea8 100755 --- a/email-api/email-api-account.c +++ b/email-api/email-api-account.c @@ -42,6 +42,7 @@ #include "email-api-private.h" /* API - Adds the Email Account */ +/* LCOV_EXCL_START */ EXPORT_API int email_add_account(email_account_t* account) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -56,85 +57,59 @@ EXPORT_API int email_add_account(email_account_t* account) if (account == NULL || account->user_email_address == NULL || account->incoming_server_user_name == NULL || account->incoming_server_address == NULL || account->outgoing_server_user_name == NULL || account->outgoing_server_address == NULL) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; - /* LCOV_EXCL_STOP */ } if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emstorage_check_duplicated_account(multi_user_name, account, true, &err)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emstorage_check_duplicated_account failed (%d) ", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* composing account information to be added */ hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT); if (hAPI == NULL) { - - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - - /* LCOV_EXCL_STOP */ } local_account_stream = em_convert_account_to_byte_stream(account, &size); if (local_account_stream == NULL) { - - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_convert_account_to_byte_stream failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - - /* LCOV_EXCL_STOP */ } if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) { - - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - - /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("APPID[%d], APIID [%d]", emipc_get_app_id(hAPI), emipc_get_api_id(hAPI)); /* passing account information to service */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - - /* LCOV_EXCL_STOP */ } /* get result from service */ if ((ret_from_ipc = emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err)) != EMAIL_ERROR_NONE) { - - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_parameter failed [%d]", ret_from_ipc); err = ret_from_ipc; goto FINISH_OFF; - - /* LCOV_EXCL_STOP */ } if (err == EMAIL_ERROR_NONE) { @@ -220,24 +195,18 @@ EXPORT_API int email_delete_account(int account_id) /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); if (ret != EMAIL_ERROR_NONE) { /* get error code */ - /* LCOV_EXCL_START */ emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err); - /* LCOV_EXCL_STOP */ } emipc_destroy_email_api(hAPI); @@ -288,10 +257,8 @@ EXPORT_API int email_update_account(int account_id, email_account_t* new_account } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -328,36 +295,28 @@ EXPORT_API int email_update_account_with_validation(int account_id, email_accoun /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter account_id failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* new_account */ new_account_stream = em_convert_account_to_byte_stream(new_account, &size); EM_PROXY_IF_NULL_RETURN_VALUE(new_account_stream, hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, new_account_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter new_account failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* with_validation */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter with_validation failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("email_update_account--emipc_execute_proxy_api failed "); /* Prevent defect 18624 */ EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -368,7 +327,7 @@ EXPORT_API int email_update_account_with_validation(int account_id, email_accoun EM_DEBUG_API_END("err[%d]", err); return err; } - +/* LCOV_EXCL_STOP */ /* API - Get the account Information based on the account ID */ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t** account) @@ -383,11 +342,14 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t EM_IF_NULL_RETURN_VALUE(account, EMAIL_ERROR_INVALID_PARAM); if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (pulloption == GET_FULL_DATA) + /* LCOV_EXCL_START */ pulloption = EMAIL_ACC_GET_OPT_FULL_DATA; if (!emstorage_get_account_by_id(multi_user_name, account_id, pulloption, &account_tbl, true, &err)) { @@ -395,7 +357,6 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", err); goto FINISH_OFF; } - if (pulloption & EMAIL_ACC_GET_OPT_PASSWORD) { pulloption = pulloption & (~(EMAIL_ACC_GET_OPT_PASSWORD)); /* disable password -Can't obtain password by MAPI */ EM_DEBUG_LOG("change pulloption : disable password"); @@ -406,11 +367,16 @@ EXPORT_API int email_get_account(int account_id, int pulloption, email_account_t goto FINISH_OFF; } } + /* LCOV_EXCL_STOP */ *account = em_malloc(sizeof(email_account_t)); if (!*account) { + /* LCOV_EXCL_START */ + EM_DEBUG_EXCEPTION("allocation failed [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ + } memset((void*)*account, 0, sizeof(email_account_t)); em_convert_account_tbl_to_account(account_tbl, *account); @@ -426,6 +392,8 @@ FINISH_OFF: return err; } + /* LCOV_EXCL_START */ + EXPORT_API int email_get_account_list(email_account_t** account_list, int* count) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -452,11 +420,9 @@ EXPORT_API int email_get_account_list(email_account_t** account_list, int* count if (temp_account_tbl && (*count) > 0) { *account_list = em_malloc(sizeof(email_account_t) * (*count)); if (!*account_list) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("allocation failed [%d]", err); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } memset((void*)*account_list, 0, sizeof(email_account_t) * (*count)); @@ -495,17 +461,13 @@ EXPORT_API int email_validate_account(int account_id, int *handle) /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); /* return */ @@ -545,17 +507,13 @@ EXPORT_API int email_validate_account_ex(email_account_t* account, int *handle) local_account_stream = em_convert_account_to_byte_stream(account, &size); EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); @@ -611,27 +569,21 @@ EXPORT_API int email_add_account_with_validation(email_account_t* account, int * local_account_stream = em_convert_account_to_byte_stream(account, &size); if (local_account_stream == NULL) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_convert_account_to_byte_stream failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter failed "); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); @@ -655,6 +607,7 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } + /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name) @@ -755,6 +708,9 @@ EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name } /* LCOV_EXCL_STOP */ + +/* LCOV_EXCL_START */ + EXPORT_API int email_get_password_length_of_account(int account_id, email_get_password_length_type password_type, int *password_length) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -774,27 +730,21 @@ EXPORT_API int email_get_password_length_of_account(int account_id, email_get_pa /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* password type */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&password_type, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); @@ -827,47 +777,37 @@ EXPORT_API int email_update_notification_bar(int account_id, int total_mail_coun /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* total_mail_count */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&total_mail_count, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* unread_mail_count */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&unread_mail_count, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* input_from_eas */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -892,18 +832,14 @@ EXPORT_API int email_clear_all_notification_bar() /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -932,18 +868,14 @@ EXPORT_API int email_clear_notification_bar(int account_id) /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -971,18 +903,14 @@ EXPORT_API int email_save_default_account_id(int input_account_id) /* Input account ID */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char *)&input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter input_account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -992,6 +920,7 @@ EXPORT_API int email_save_default_account_id(int input_account_id) EM_DEBUG_API_END("ret[%d]", err); return err; } + /* LCOV_EXCL_STOP */ EXPORT_API int email_load_default_account_id(int *output_account_id) { diff --git a/email-api/email-api-etc.c b/email-api/email-api-etc.c index 0268be5..12d6cf8 100644 --- a/email-api/email-api-etc.c +++ b/email-api/email-api-etc.c @@ -39,6 +39,8 @@ #include "email-core-gmime.h" #include "email-api-private.h" + /* LCOV_EXCL_START */ + EXPORT_API int email_show_user_message(int id, email_action_t action, int error_code) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -54,33 +56,25 @@ EXPORT_API int email_show_user_message(int id, email_action_t action, int error_ /* id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* action */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&action, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* error_code */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&error_code, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_execute_proxy_api(hAPI)) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("ipcProxy_ExecuteAsyncAPI failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -127,28 +121,22 @@ EXPORT_API int email_write_mime_file(email_mail_data_t *input_mail_data, hAPI = emipc_create_email_api(_EMAIL_API_WRITE_MIME_FILE); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_execute_proxy_api(hAPI)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if ((ret_from_ipc = emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err)) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_parameter failed:[%d]", ret_from_ipc); err = ret_from_ipc; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emcore_make_rfc822_file(NULL, input_mail_data, input_attachment_data, input_attachment_count, false, @@ -241,3 +229,4 @@ EXPORT_API int email_convert_mutf7_to_utf8(const char *mutf7_str, char **utf8_st EM_DEBUG_API_END("ret[%d]", err); return err; } + /* LCOV_EXCL_STOP */ diff --git a/email-api/email-api-init.c b/email-api/email-api-init.c index 06d2ec5..b932d03 100644 --- a/email-api/email-api-init.c +++ b/email-api/email-api-init.c @@ -44,6 +44,8 @@ #include "email-core-container.h" #include "email-api-private.h" + /* LCOV_EXCL_START */ + EXPORT_API int email_open_db(void) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -86,6 +88,7 @@ EXPORT_API int email_close_db(void) return error; } + /* LCOV_EXCL_STOP */ EXPORT_API int email_service_begin(void) { @@ -112,8 +115,11 @@ EXPORT_API int email_service_end(void) int ret = -1; if (cancel) { + /* LCOV_EXCL_START */ + g_cancellable_cancel(cancel); while (cancel) usleep(1000000); + /* LCOV_EXCL_STOP */ } ret = emipc_finalize_proxy(); @@ -146,7 +152,8 @@ EXPORT_API int email_init_storage(void) EM_DEBUG_API_END("error[%d]", error); return error; } -/* LCOV_EXCL_STOP */ + + EXPORT_API int email_ping_service(void) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -158,11 +165,9 @@ EXPORT_API int email_ping_service(void) if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &error); @@ -174,3 +179,5 @@ EXPORT_API int email_ping_service(void) EM_DEBUG_API_END("err[%d]", error); return error; } + /* LCOV_EXCL_STOP */ + diff --git a/email-api/email-api-mail.c b/email-api/email-api-mail.c index 177e9de..a9c0112 100644 --- a/email-api/email-api-mail.c +++ b/email-api/email-api-mail.c @@ -66,8 +66,10 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme EM_IF_NULL_RETURN_VALUE(input_mail_data->mailbox_id, EMAIL_ERROR_INVALID_PARAM); if (input_attachment_count > 0 && !input_attachment_data_list) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } int err = EMAIL_ERROR_NONE; @@ -81,8 +83,10 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme HIPC_API hAPI = NULL; if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (input_from_eas == 0) { /* native emails */ @@ -92,11 +96,11 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme EM_DEBUG_EXCEPTION("emcore_make_rfc822_file failed [%d]", err); goto FINISH_OFF; } - /* LCOV_EXCL_STOP */ input_mail_data->file_path_mime_entity = EM_SAFE_STRDUP(emcore_set_mime_entity(rfc822_file)); emstorage_delete_file(rfc822_file, NULL); EM_SAFE_FREE(rfc822_file); + /* LCOV_EXCL_STOP */ } hAPI = emipc_create_email_api(_EMAIL_API_ADD_MAIL); @@ -121,7 +125,9 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme } if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed"); + /* LCOV_EXCL_STOP */ /* email_attachment_data_t */ attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size); @@ -136,23 +142,24 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme /* email_meeting_request_t */ if (input_mail_data->meeting_request_status != EMAIL_MAIL_TYPE_NORMAL) { + /* LCOV_EXCL_START */ meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size); if (!meeting_request_stream) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } - if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed"); + /* LCOV_EXCL_STOP */ } /* input_from_eas */ if (emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int)) == false) + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter() failed"); + /* LCOV_EXCL_STOP */ /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { @@ -171,7 +178,9 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme if ((ret_nth_value = (int *)emipc_get_nth_parameter_data(hAPI, ePARAMETER_OUT, 1))) { input_mail_data->mail_id = *ret_nth_value; } else { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ goto FINISH_OFF; } @@ -197,9 +206,9 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme /* LCOV_EXCL_STOP */ } } - + /* LCOV_EXCL_START */ FINISH_OFF: - + /* LCOV_EXCL_STOP */ if (hAPI) emipc_destroy_email_api(hAPI); @@ -208,7 +217,7 @@ FINISH_OFF: return err; } - + /* LCOV_EXCL_START */ EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -222,18 +231,14 @@ EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receip EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_read_mail_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Add Param mail body Fail"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -300,7 +305,6 @@ EXPORT_API int email_create_db_full() EM_DEBUG_EXCEPTION("email_get_mailbox_list_ex failed [%d]", err); goto FINISH_OFF; } - /* LCOV_EXCL_START */ for (mailbox_index = 0; mailbox_index < mailbox_count; mailbox_index++) { mail_slot_size = mailbox_list[mailbox_index].mail_slot_size; for (mail_index = 0; mail_index < mail_slot_size; mail_index++) { @@ -314,7 +318,6 @@ EXPORT_API int email_create_db_full() } } } - /* LCOV_EXCL_STOP */ FINISH_OFF: if ((err = email_close_db()) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("email_close_db failed [%d]", err); @@ -358,30 +361,24 @@ EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attac hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_MAIL); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* email_mail_data_t */ mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, &size); if (!mail_data_stream) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter for head failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* email_attachment_data_t */ @@ -394,7 +391,6 @@ EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attac /* email_meeting_request_t */ if (input_mail_data->meeting_request_status != EMAIL_MAIL_TYPE_NORMAL) { - /* LCOV_EXCL_START */ meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size); if (!meeting_request_stream) { @@ -408,24 +404,19 @@ EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attac err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; } - }/* LCOV_EXCL_STOP */ /* input_from_eas */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -492,7 +483,6 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } -/* LCOV_EXCL_START */ EXPORT_API int email_clear_mail_data() { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -516,7 +506,6 @@ EXPORT_API int email_clear_mail_data() return err; } -/* LCOV_EXCL_STOP */ EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int input_filter_count, int *output_total_mail_count, int *output_unseen_mail_count) { @@ -586,55 +575,43 @@ EXPORT_API int email_delete_mail(int input_mailbox_id, int *input_mail_ids, int hAPI = emipc_create_email_api(_EMAIL_API_DELETE_MAIL); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* mailbox id*/ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Number of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_num, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* set of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)input_mail_ids, input_num * sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* from-server */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -665,35 +642,27 @@ EXPORT_API int email_delete_all_mails_in_mailbox(int input_mailbox_id, int input hAPI = emipc_create_email_api(_EMAIL_API_DELETE_ALL_MAIL); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -722,39 +691,31 @@ EXPORT_API int email_add_attachment(int mail_id, email_attachment_data_t* attach hAPI = emipc_create_email_api(_EMAIL_API_ADD_ATTACHMENT); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* mail_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Attachment */ attchment_stream = em_convert_attachment_data_to_byte_stream(attachment, 1, &size); if (!attchment_stream) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_convert_attachment_data_to_byte_stream failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, attchment_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ @@ -793,29 +754,23 @@ EXPORT_API int email_delete_attachment(int attachment_id) hAPI = emipc_create_email_api(_EMAIL_API_DELETE_ATTACHMENT); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* attachment_index */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&attachment_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -923,20 +878,16 @@ EXPORT_API int email_get_attachment_data(int attachment_id, email_attachment_dat /* attachment_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&attachment_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -947,11 +898,9 @@ EXPORT_API int email_get_attachment_data(int attachment_id, email_attachment_dat attchment_stream = (char*)em_malloc(nSize+1); if (!attchment_stream) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, nSize, attchment_stream); @@ -959,11 +908,9 @@ EXPORT_API int email_get_attachment_data(int attachment_id, email_attachment_dat } if (!attachment_data) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_NULL_VALUE"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } *attachment = attachment_data; @@ -1306,7 +1253,6 @@ EXPORT_API int email_get_mail_data(int input_mail_id, email_mail_data_t **output Mail Flag API -----------------------------------------------------------*/ -/* LCOV_EXCL_START */ EXPORT_API int email_modify_seen_flag(int *mail_ids, int num, int seen_flag, int onserver) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -1315,7 +1261,6 @@ EXPORT_API int email_modify_seen_flag(int *mail_ids, int num, int seen_flag, int return EMAIL_ERROR_NOT_IMPLEMENTED; } -/* LCOV_EXCL_STOP */ EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, email_flags_field_type field_type, int value, int onserver) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -1326,83 +1271,65 @@ EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, ema EM_IF_NULL_RETURN_VALUE(mail_ids, EMAIL_ERROR_INVALID_PARAM); if (account_id == 0 || num <= 0 || (onserver != 0 && onserver != 1)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; - /* LCOV_EXCL_STOP */ } HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SET_FLAGS_FIELD); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* account_id*/ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Number of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* set of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* field_type */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&field_type, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* value */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&value, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* onserver */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(onserver), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1443,47 +1370,37 @@ EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, int input_targ hAPI = emipc_create_email_api(_EMAIL_API_MOVE_MAIL); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Number of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* set of mail_ids */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_target_mailbox_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_target_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1514,38 +1431,30 @@ EXPORT_API int email_move_all_mails_to_mailbox(int input_source_mailbox_id, int hAPI = emipc_create_email_api(_EMAIL_API_MOVE_ALL_MAIL); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_source_mailbox_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_source_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_target_mailbox_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_target_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1587,7 +1496,7 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } - + /* LCOV_EXCL_STOP */ EXPORT_API int email_free_mail_data(email_mail_data_t** mail_list, int count) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -1603,7 +1512,7 @@ EXPORT_API int email_free_mail_data(email_mail_data_t** mail_list, int count) /* Convert Modified UTF-7 mailbox name to UTF-8 */ /* returns modified UTF-8 Name if success else NULL */ - + /* LCOV_EXCL_START */ EXPORT_API int email_cancel_sending_mail(int mail_id) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -1631,17 +1540,14 @@ EXPORT_API int email_cancel_sending_mail(int mail_id) /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { int as_handle; ASNotiData as_noti_data; - /* LCOV_EXCL_START */ if (em_get_handle_for_activesync(&as_handle, &err) == false) { EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; @@ -1659,43 +1565,34 @@ EXPORT_API int email_cancel_sending_mail(int mail_id) err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; } - /* LCOV_EXCL_STOP */ } else { hAPI = emipc_create_email_api(_EMAIL_API_SEND_MAIL_CANCEL_JOB); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Mail ID */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1732,38 +1629,30 @@ EXPORT_API int email_retry_sending_mail(int mail_id, int timeout_in_sec) HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SEND_RETRY); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Mail ID */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* timeout */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(timeout_in_sec), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1960,47 +1849,37 @@ EXPORT_API int email_move_thread_to_mailbox(int thread_id, int target_mailbox_id HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MOVE_THREAD_TO_MAILBOX); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* thread_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* target mailbox information */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&target_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* move_always_flag */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&move_always_flag, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -2028,38 +1907,30 @@ EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag) HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_THREAD); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* thread_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* delete_always_flag */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&delete_always_flag, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -2088,47 +1959,37 @@ EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, in HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* thread_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* seen_flag */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&seen_flag, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* on_server */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&on_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -2200,38 +2061,30 @@ EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int inp hAPI = emipc_create_email_api(_EMAIL_API_EXPUNGE_MAILS_DELETED_FLAGGED); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_mailbox_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_on_server */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_on_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -2254,4 +2107,5 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } + /* LCOV_EXCL_STOP */ diff --git a/email-api/email-api-mailbox.c b/email-api/email-api-mailbox.c index 6bb752d..798dd06 100644 --- a/email-api/email-api-mailbox.c +++ b/email-api/email-api-mailbox.c @@ -42,7 +42,7 @@ #include "email-api-private.h" /* API - Create a mailbox */ - + /* LCOV_EXCL_START */ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, int *handle) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -67,11 +67,9 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, new_mailbox->account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && on_server) { @@ -93,11 +91,9 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in as_noti_data.add_mailbox.multi_user_name = multi_user_name; if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_ADD_MAILBOX, &as_noti_data) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (handle) @@ -112,25 +108,19 @@ EXPORT_API int email_add_mailbox(email_mailbox_t* new_mailbox, int on_server, in EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_SAFE_FREE(local_mailbox_stream); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -219,38 +209,28 @@ EXPORT_API int email_rename_mailbox(int input_mailbox_id, char *input_mailbox_na hAPI = emipc_create_email_api(_EMAIL_API_RENAME_MAILBOX); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_name, EM_SAFE_STRLEN(input_mailbox_name)+1)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_path failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_alias, EM_SAFE_STRLEN(input_mailbox_alias)+1)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_alias failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -297,22 +277,18 @@ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl->account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) { int as_handle; if (em_get_handle_for_activesync(&as_handle, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* noti to active sync */ @@ -337,45 +313,33 @@ EXPORT_API int email_rename_mailbox_ex(int input_mailbox_id, char *input_mailbox hAPI = emipc_create_email_api(_EMAIL_API_RENAME_MAILBOX_EX); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_name, EM_SAFE_STRLEN(input_mailbox_name)+1)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_path failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_mailbox_alias, EM_SAFE_STRLEN(input_mailbox_alias)+1)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_mailbox_alias failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, input_eas_data, input_eas_data_length)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for input_eas_data failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_on_server, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -423,22 +387,18 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, mailbox_tbl->account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) { int as_handle; if (em_get_handle_for_activesync(&as_handle, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* noti to active sync */ @@ -448,11 +408,9 @@ EXPORT_API int email_delete_mailbox(int input_mailbox_id, int input_on_server, i as_noti_data.delete_mailbox.multi_user_name = multi_user_name; if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_DELETE_MAILBOX, &as_noti_data) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (output_handle) @@ -530,11 +488,9 @@ EXPORT_API int email_delete_mailbox_ex(int input_account_id, int *input_mailbox_ &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC && input_on_server) { @@ -597,24 +553,18 @@ EXPORT_API int email_set_mailbox_type(int input_mailbox_id, email_mailbox_type_e EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_type, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -639,24 +589,18 @@ EXPORT_API int email_set_local_mailbox(int input_mailbox_id, int input_is_local_ EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_is_local_mailbox, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -667,7 +611,6 @@ EXPORT_API int email_set_local_mailbox(int input_mailbox_id, int input_is_local_ EM_DEBUG_API_END("err[%d]", err); return err; } -/* LCOV_EXCL_START */ EXPORT_API int email_get_sync_mailbox_list(int account_id, email_mailbox_t** mailbox_list, int* count) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -715,7 +658,6 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } -/* LCOV_EXCL_STOP */ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, email_mailbox_t** mailbox_list, int* count) { @@ -745,11 +687,9 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, ema if (mailbox_count > 0) { if (!(*mailbox_list = em_malloc(sizeof(email_mailbox_t) * mailbox_count))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("malloc failed for mailbox_list"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } for (i = 0; i < mailbox_count; i++) @@ -802,11 +742,9 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, if (mailbox_count > 0) { if (!(*mailbox_list = em_malloc(sizeof(email_mailbox_t) * mailbox_count))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("malloc failed for mailbox_list"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } for (i = 0; i < mailbox_count; i++) @@ -854,11 +792,9 @@ EXPORT_API int email_get_mailbox_list_by_keyword(int account_id, char *keyword, if (mailbox_count > 0) { if (!(*mailbox_list = em_malloc(sizeof(email_mailbox_t) * mailbox_count))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("malloc failed for mailbox_list"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } for (i = 0; i < mailbox_count; i++) @@ -879,7 +815,7 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } - + /* LCOV_EXCL_STOP */ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_type_e mailbox_type, email_mailbox_t** mailbox) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -894,25 +830,33 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, email_mailbox_t EM_IF_NULL_RETURN_VALUE(account_id, EMAIL_ERROR_INVALID_PARAM) ; if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (mailbox_type < EMAIL_MAILBOX_TYPE_INBOX || mailbox_type > EMAIL_MAILBOX_TYPE_USER_DEFINED) { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (!emstorage_get_mailbox_by_mailbox_type(multi_user_name, account_id, mailbox_type, &local_mailbox, true, &err)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type failed [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } else { err = EMAIL_ERROR_NONE; curr_mailbox = em_malloc(sizeof(email_mailbox_t)); if (curr_mailbox == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } memset(curr_mailbox, 0x00, sizeof(email_mailbox_t)); @@ -931,7 +875,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err[%d]", err); return err; } - + /* LCOV_EXCL_START */ EXPORT_API int email_get_mailbox_by_mailbox_id(int input_mailbox_id, email_mailbox_t** output_mailbox) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -995,31 +939,23 @@ EXPORT_API int email_set_mail_slot_size(int account_id, int mailbox_id, int new_ if (hAPI) { if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" emipc_add_parameter for new_slot_size failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1069,7 +1005,7 @@ EXPORT_API int email_stamp_sync_time_of_mailbox(int input_mailbox_id) EM_DEBUG_API_END("err[%d]", err); return err; } - + /* LCOV_EXCL_STOP */ EXPORT_API int email_free_mailbox(email_mailbox_t** mailbox_list, int count) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -1077,9 +1013,11 @@ EXPORT_API int email_free_mailbox(email_mailbox_t** mailbox_list, int count) int err = EMAIL_ERROR_NONE; if (count <= 0 || !mailbox_list || !*mailbox_list) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("EMAIL_ERROR_INVALID_PARAM"); err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } email_mailbox_t *p = *mailbox_list; diff --git a/email-api/email-api-network.c b/email-api/email-api-network.c index e1ed241..f2b95f9 100644 --- a/email-api/email-api-network.c +++ b/email-api/email-api-network.c @@ -61,14 +61,18 @@ EXPORT_API int email_send_mail(int mail_id, int *handle) } if (mail_id <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("mail_id is not valid"); err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (!emstorage_get_mail_by_id(multi_user_name, mail_id, &mail_table_data, true, &err) || !mail_table_data) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (mail_table_data->account_id <= 0) { @@ -85,19 +89,21 @@ EXPORT_API int email_send_mail(int mail_id, int *handle) /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { + /* LCOV_EXCL_START */ int as_handle; if (em_get_handle_for_activesync(&as_handle, &err) == false) { EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; } - /* noti to active sync */ as_noti_data.send_mail.handle = as_handle; as_noti_data.send_mail.account_id = mail_table_data->account_id; @@ -112,6 +118,7 @@ EXPORT_API int email_send_mail(int mail_id, int *handle) if (handle) *handle = as_handle; + /* LCOV_EXCL_STOP */ } else { hAPI = emipc_create_email_api(_EMAIL_API_SEND_MAIL); @@ -146,8 +153,9 @@ EXPORT_API int email_send_mail(int mail_id, int *handle) emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle); } } - + /* LCOV_EXCL_START */ FINISH_OFF: + /* LCOV_EXCL_STOP */ emipc_destroy_email_api(hAPI); hAPI = (HIPC_API)NULL; @@ -158,7 +166,7 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } - + /* LCOV_EXCL_START */ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int input_mail_id, int *output_handle) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -197,11 +205,9 @@ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { @@ -211,11 +217,9 @@ EXPORT_API int email_send_mail_with_downloading_attachment_of_original_mail(int memset(&as_noti_data, 0x00, sizeof(ASNotiData)); if (em_get_handle_for_activesync(&as_handle, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* noti to active sync */ @@ -283,11 +287,9 @@ EXPORT_API int email_schedule_sending_mail(int input_mail_id, time_t input_sched /* check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, mail_table_data->account_id, &account_server_type, false, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { @@ -295,13 +297,11 @@ EXPORT_API int email_schedule_sending_mail(int input_mail_id, time_t input_sched ASNotiData as_noti_data; memset(&as_noti_data, 0x00, sizeof(ASNotiData)); - /* LCOV_EXCL_START */ if (em_get_handle_for_activesync(&as_handle, &err) == false) { EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; } - /* LCOV_EXCL_STOP */ /* noti to active sync */ as_noti_data.schedule_sending_mail.handle = as_handle; as_noti_data.schedule_sending_mail.account_id = mail_table_data->account_id; @@ -353,19 +353,15 @@ EXPORT_API int email_send_saved(int account_id, int *handle) /* Account ID */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(account_id), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_SAFE_FREE(pOptionStream); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -394,18 +390,14 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int memset(&as_noti_data, 0x00, sizeof(ASNotiData)); if ((err = emipc_get_user_name(&multi_user_name)) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_user_name failed : [%d]", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* 2010/02/12 ch715.lee : check account bind type and branch off */ if (em_get_account_server_type_by_account_id(multi_user_name, input_account_id, &account_server_type, true, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_account_server_type_by_account_id failed[%d]", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (account_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { @@ -438,20 +430,16 @@ EXPORT_API int email_sync_header(int input_account_id, int input_mailbox_id, int /* input_account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_mailbox_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { @@ -506,28 +494,22 @@ EXPORT_API int email_sync_header_for_all_account(int *handle) /* input_account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* input_account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_SAFE_FREE(multi_user_name); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -659,32 +641,24 @@ EXPORT_API int email_download_body(int mail_id, int with_attachment, int *handle /* Account Id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Mail Id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* with_attachment */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_attachment, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -786,34 +760,26 @@ EXPORT_API int email_download_attachment(int mail_id, int nth, int *handle) /* Account Id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Mail ID */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* nth */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &(nth), sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -883,11 +849,9 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca as_noti_data.cancel_job.multi_user_name = multi_user_name; if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CANCEL_JOB, &as_noti_data) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } } } @@ -896,36 +860,28 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca hAPI = emipc_create_email_api(_EMAIL_API_CANCEL_JOB); if (!hAPI) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("INVALID PARAM: hAPI NULL "); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_account_id, sizeof(int))) { /* input_account_id == 0 */ - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_handle, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_SOCKET_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -944,11 +900,9 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca as_noti_data.cancel_job.multi_user_name = multi_user_name; if (em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CANCEL_JOB, &as_noti_data) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } } else { hAPI = emipc_create_email_api(_EMAIL_API_CANCEL_JOB); @@ -956,25 +910,19 @@ EXPORT_API int email_cancel_job(int input_account_id, int input_handle, email_ca EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_handle, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* Execute API */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); emipc_destroy_email_api(hAPI); @@ -1029,19 +977,15 @@ EXPORT_API int email_get_task_information(email_task_information_t **output_task } if ((hAPI = emipc_create_email_api(_EMAIL_API_GET_TASK_INFORMATION)) == NULL) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_email_api failed"); err = EMAIL_ERROR_IPC_CRASH; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); err = EMAIL_ERROR_IPC_CRASH; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1051,11 +995,9 @@ EXPORT_API int email_get_task_information(email_task_information_t **output_task task_information_stream = (char*)em_malloc(task_information_stream_length + 1); if (!task_information_stream) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, task_information_stream_length, task_information_stream); @@ -1064,11 +1006,9 @@ EXPORT_API int email_get_task_information(email_task_information_t **output_task } if (!output_task_information) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_NULL_VALUE"); err = EMAIL_ERROR_NULL_VALUE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } } @@ -1099,17 +1039,13 @@ EXPORT_API int email_sync_imap_mailbox_list(int account_id, int *handle) /* account_id */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("emipc_add_parameter failed "); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } if (!emipc_execute_proxy_api(hAPI)) { - /* LCOV_EXCL_START */ EM_DEBUG_LOG("ipcProxy_ExecuteAsyncAPI failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); @@ -1168,10 +1104,8 @@ EXPORT_API int email_search_mail_on_server(int input_account_id, int as_handle = 0; if (em_get_handle_for_activesync(&as_handle, &err) == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_get_handle_for_activesync failed[%d].", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } /* noti to active sync */ @@ -1185,11 +1119,9 @@ EXPORT_API int email_search_mail_on_server(int input_account_id, return_value = em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER, &as_noti_data); if (return_value == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (output_handle) @@ -1200,19 +1132,15 @@ EXPORT_API int email_search_mail_on_server(int input_account_id, EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_mailbox_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } stream_for_search_filter_list = em_convert_search_filter_to_byte_stream(input_search_filter_list, @@ -1224,11 +1152,9 @@ EXPORT_API int email_search_mail_on_server(int input_account_id, if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, stream_for_search_filter_list, stream_size_for_search_filter_list)) { /*prevent 18950*/ - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { @@ -1304,11 +1230,9 @@ EXPORT_API int email_clear_result_of_search_mail_on_server(int input_account_id) return_value = em_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_CLEAR_RESULT_OF_SEARCH_ON_SERVER, &as_noti_data); if (return_value == false) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_send_notification_to_active_sync_engine failed."); err = EMAIL_ERROR_ACTIVE_SYNC_NOTI_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } } else { hAPI = emipc_create_email_api(_EMAIL_API_CLEAR_RESULT_OF_SEARCH_MAIL_ON_SERVER); @@ -1316,26 +1240,20 @@ EXPORT_API int email_clear_result_of_search_mail_on_server(int input_account_id) EM_IF_NULL_RETURN_VALUE(hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_add_parameter failed "); err = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err); if (err != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("_EMAIL_API_CLEAR_RESULT_OF_SEARCH_MAIL_ON_SERVER failed [%d]", err); goto FINISH_OFF; - /* LCOV_EXCL_STOP */ } } @@ -1409,3 +1327,4 @@ FINISH_OFF: EM_DEBUG_API_END("err[%d]", err); return err; } + /* LCOV_EXCL_STOP */ diff --git a/email-api/email-api-rule.c b/email-api/email-api-rule.c index afc074e..8abd79b 100644 --- a/email-api/email-api-rule.c +++ b/email-api/email-api-rule.c @@ -39,6 +39,7 @@ #include "email-core-utils.h" #include "email-api-private.h" + /* LCOV_EXCL_START */ EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set) { CHECK_EMAILS_SUPPORTED(EMAIL_FEATURE); @@ -129,18 +130,14 @@ EXPORT_API int email_add_rule(email_rule_t* filtering_set) stream = em_convert_rule_to_byte_stream(filtering_set, &size); EM_PROXY_IF_NULL_RETURN_VALUE(stream, hAPI, EMAIL_ERROR_NULL_VALUE); if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Add Param Failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* pass rule info */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api Failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } /* get reult form service */ @@ -180,10 +177,8 @@ EXPORT_API int email_update_rule(int filter_id, email_rule_t* new_set) /* make filter info */ if (!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&filter_id, sizeof(int))) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Add Param filter_id Failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } stream = em_convert_rule_to_byte_stream(new_set, &size); @@ -191,18 +186,14 @@ EXPORT_API int email_update_rule(int filter_id, email_rule_t* new_set) EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); } if (!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, stream, size)) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Add Param new_set Failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_NULL_VALUE); - /* LCOV_EXCL_STOP */ } /* request update rule with filter info */ if (emipc_execute_proxy_api(hAPI) != EMAIL_ERROR_NONE) { - /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_execute_proxy_api Failed"); EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMAIL_ERROR_IPC_SOCKET_FAILURE); - /* LCOV_EXCL_STOP */ } /* get result */ @@ -300,3 +291,4 @@ EXPORT_API int email_apply_rule(int filter_id) EM_DEBUG_API_END("err[%d]", err); return err; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-common-use/email-convert.c b/email-common-use/email-convert.c index e3ed72a..99845b8 100755 --- a/email-common-use/email-convert.c +++ b/email-common-use/email-convert.c @@ -39,7 +39,7 @@ #define fATTACHMENT 0x40 #define fFORWARD 0x80 - +/* LCOV_EXCL_START */ INTERNAL_FUNC int em_convert_account_to_account_tbl(email_account_t *account, emstorage_account_tbl_t *account_tbl) { EM_DEBUG_FUNC_BEGIN("account[%p], account_tbl[%p]", account, account_tbl); @@ -121,7 +121,7 @@ INTERNAL_FUNC int em_convert_account_to_account_tbl(email_account_t *account, em EM_DEBUG_FUNC_END(); return ret; } - +/* LCOV_EXCL_STOP */ INTERNAL_FUNC int em_convert_account_tbl_to_account(emstorage_account_tbl_t *account_tbl, email_account_t *account) { EM_DEBUG_FUNC_BEGIN("account_tbl[%p], account[%p]", account_tbl, account); @@ -198,7 +198,7 @@ INTERNAL_FUNC int em_convert_account_tbl_to_account(emstorage_account_tbl_t *acc EM_DEBUG_FUNC_END(); return ret; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC int em_convert_mailbox_to_mailbox_tbl(email_mailbox_t *mailbox, emstorage_mailbox_tbl_t *mailbox_tbl) { EM_DEBUG_FUNC_BEGIN("mailbox[%p], mailbox_tbl[%p]", mailbox, mailbox_tbl); @@ -230,7 +230,7 @@ INTERNAL_FUNC int em_convert_mailbox_to_mailbox_tbl(email_mailbox_t *mailbox, em EM_DEBUG_FUNC_END(); return ret; } - +/* LCOV_EXCL_STOP */ INTERNAL_FUNC int em_convert_mailbox_tbl_to_mailbox(emstorage_mailbox_tbl_t *mailbox_tbl, email_mailbox_t *mailbox) { EM_DEBUG_FUNC_BEGIN("mailbox_tbl[%p], mailbox[%p]", mailbox_tbl, mailbox); @@ -252,18 +252,20 @@ INTERNAL_FUNC int em_convert_mailbox_tbl_to_mailbox(emstorage_mailbox_tbl_t *mai mailbox->eas_data_length = mailbox_tbl->eas_data_length; if ((mailbox_tbl->eas_data_length > 0) && mailbox_tbl->eas_data) { + /* LCOV_EXCL_START */ if ((mailbox->eas_data = em_malloc(mailbox_tbl->eas_data_length)) == NULL) { EM_DEBUG_EXCEPTION("em_malloc failed"); return 0; /*prevent 53445*/ } memcpy(mailbox->eas_data, mailbox_tbl->eas_data, mailbox_tbl->eas_data_length); + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END(); return ret; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC int em_convert_mail_tbl_to_mail_data(emstorage_mail_tbl_t *mail_table_data, int item_count, email_mail_data_t **mail_data, int *error) { EM_DEBUG_FUNC_BEGIN("mail_table_data[%p], item_count [%d], mail_data[%p]", mail_table_data, item_count, mail_data); @@ -682,7 +684,7 @@ static int fetch_string_from_stream(char *input_stream, int *input_output_stream /* EM_DEBUG_FUNC_END("stream_offset [%d]", stream_offset); */ return EMAIL_ERROR_NONE; } - +/* LCOV_EXCL_STOP */ /* divide struct at binary field (void* user_data)*/ #define EMAIL_ACCOUNT_FMT "S(" "isiii" "isiis" "sssis" "issii" "iiiii" "iiiis" "issii" "i"\ "$(" "iiiii" "iisii" "iisii" "iiis" ")" "iiiii" "isiis" "i" ")" "B" @@ -693,8 +695,10 @@ static char *convert_format(char *fmt) EM_DEBUG_FUNC_BEGIN(); if (fmt == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid parameter"); return NULL; + /* LCOV_EXCL_STOP */ } int size = 0; @@ -715,8 +719,10 @@ static char *convert_format(char *fmt) } if (converted_fmt == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed"); return NULL; + /* LCOV_EXCL_START */ } c = fmt; @@ -752,9 +758,11 @@ static char *convert_format(char *fmt) break; case '$': /* nested structure */ /* if 64 bit inserted the dump integer type */ + /* LCOV_EXCL_START */ strncat(converted_fmt, c, 1); nested_structure = 1; break; + /* LCOV_EXCL_STOP */ case ')': strncat(converted_fmt, c, 1); if (nested_structure) @@ -765,9 +773,11 @@ static char *convert_format(char *fmt) if (nested_structure && size == 8) strncat(converted_fmt, "i", 1); break; + /* LCOV_EXCL_START */ default: EM_DEBUG_EXCEPTION("unsupported option %c\n", *c); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } c++; } @@ -780,13 +790,15 @@ static char *convert_format(char *fmt) FINISH_OFF: if (ret == false) { + /* LCOV_EXCL_START */ EM_SAFE_FREE(converted_fmt); + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END(); return converted_fmt; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC char* em_convert_account_to_byte_stream(email_account_t* account, int *stream_len) { EM_DEBUG_FUNC_END(); @@ -859,7 +871,7 @@ INTERNAL_FUNC void em_convert_byte_stream_to_account(char *stream, int stream_le EM_DEBUG_FUNC_END(); } - +/* LCOV_EXCL_STOP */ #define EMAIL_MAIL_DATA_FMT "S(" "iiiis" "tisss" "issss" "sssss" "sisss"\ "icccc" "cccii" "iiiii" "iisii" "iitii" "ttsss" "si" ")B" @@ -875,17 +887,21 @@ INTERNAL_FUNC char* em_convert_mail_data_to_byte_stream(email_mail_data_t *mail_ converted_fmt = convert_format(EMAIL_MAIL_DATA_FMT); if (converted_fmt == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("converting failed"); return NULL; + /* LCOV_EXCL_START */ } EM_DEBUG_LOG("eas_data_length[%d]", mail_data->eas_data_length); /*prevent 44369*/ tn = tpl_map(converted_fmt, mail_data, &tb); if (!tn) { + /* LCOV_EXCL_START */ EM_SAFE_FREE(converted_fmt); EM_DEBUG_EXCEPTION("tpl_map failed"); return NULL; + /* LCOV_EXCL_STOP */ } EM_SAFE_FREE(converted_fmt); tb.sz = mail_data->eas_data_length; @@ -903,7 +919,7 @@ INTERNAL_FUNC char* em_convert_mail_data_to_byte_stream(email_mail_data_t *mail_ EM_DEBUG_FUNC_END(); return (char*) buf; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC void em_convert_byte_stream_to_mail_data(char *stream, int stream_len, email_mail_data_t *mail_data) { EM_DEBUG_FUNC_BEGIN("stream[%p] stream_len[%d] mail_data[%p]", stream, stream_len, mail_data); @@ -943,7 +959,7 @@ INTERNAL_FUNC void em_convert_byte_stream_to_mail_data(char *stream, int stream_ EM_DEBUG_FUNC_END(); } - +/* LCOV_EXCL_STOP */ #define EMAIL_ATTACHMENT_DATA_FMT "A(S(" "isssi" "iicii" "is" "))" @@ -958,17 +974,21 @@ INTERNAL_FUNC char* em_convert_attachment_data_to_byte_stream(email_attachment_d converted_fmt = convert_format(EMAIL_ATTACHMENT_DATA_FMT); if (converted_fmt == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("convertinf failed"); return NULL; + /* LCOV_EXCL_STOP */ } /* tpl_map adds value at 2nd param addr to packing buffer iterately */ /* 2nd param value (not addr via pointer) should be modified at each iteration */ tn = tpl_map(converted_fmt, &cur); if (!tn) { + /* LCOV_EXCL_START */ EM_SAFE_FREE(converted_fmt); EM_DEBUG_EXCEPTION("tpl_map failed"); return NULL; + /* LCOV_EXCL_STOP */ } EM_SAFE_FREE(converted_fmt); @@ -992,7 +1012,7 @@ INTERNAL_FUNC char* em_convert_attachment_data_to_byte_stream(email_attachment_d EM_DEBUG_FUNC_END(); return (char*) buf; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC void em_convert_byte_stream_to_attachment_data(char *stream, int stream_len, email_attachment_data_t **attachment_data, int *attachment_count) { EM_DEBUG_FUNC_BEGIN(); @@ -1679,4 +1699,4 @@ INTERNAL_FUNC int em_convert_certificate_to_certificate_tbl(email_certificate_t EM_DEBUG_FUNC_END(); return true; } - +/* LCOV_EXCL_STOP */ diff --git a/email-common-use/email-utilities.c b/email-common-use/email-utilities.c index be688f6..b02a53b 100755 --- a/email-common-use/email-utilities.c +++ b/email-common-use/email-utilities.c @@ -48,15 +48,19 @@ INTERNAL_FUNC void* em_malloc(int len) { /* EM_DEBUG_LOG("Memory allocation size[%d] bytes", len); */ if (len <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("len should be positive.[%d]", len); return NULL; + /* LCOV_EXCL_STOP */ } void *p = NULL; p = malloc(len); if (!p) { + /* LCOV_EXCL_START */ EM_DEBUG_PERROR("malloc failed"); return NULL; + /* LCOV_EXCL_STOP */ } memset(p, 0x00, len); @@ -68,14 +72,18 @@ INTERNAL_FUNC void* em_memdup(void* src, int len) { /* EM_DEBUG_LOG("Memory allocation size[%d] bytes", len); */ if (len <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("len should be positive.[%d]", len); return NULL; + /* LCOV_EXCL_STOP */ } void *p = calloc(1, len); if (!p) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("malloc failed"); return NULL; + /* LCOV_EXCL_STOP */ } memcpy(p, src, len); @@ -85,6 +93,7 @@ INTERNAL_FUNC void* em_memdup(void* src, int len) /* remove left space, tab, CR, L */ +/* LCOV_EXCL_START */ INTERNAL_FUNC char *em_trim_left(char *str) { char *p, *temp_buffer = NULL; @@ -727,7 +736,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return result_content_type; } - +/* LCOV_EXCL_STOP */ #define EMAIL_ATOM "([^]()<>@, ;:\\\".[\x20\x01-\x1f\x7f])+" // x20: space, #define EMAIL_QTEXT "[^\"\\\x0d]" /* " \ CR */ #define EMAIL_DTEXT "[^][\\\x0d]" /* [ ] \ CR */ @@ -746,7 +755,7 @@ FINISH_OFF: #define EMAIL_MAILBOX "("EMAIL_ADDR_SPEC "|" EMAIL_PHRASE "[[:space:]]*" "<" EMAIL_ADDR_SPEC ">|<" EMAIL_ADDR_SPEC ">)" #define EMAIL_ADDRESS "^([:blank:]*" EMAIL_MAILBOX "[, ;[:blank:]]*([, ;][, ;[:blank:]]*" EMAIL_MAILBOX "[, ;[:blank:]]*)*)$" - +/* LCOV_EXCL_START */ static int em_verify_email_address_by_using_regex(char *address) { EM_DEBUG_FUNC_BEGIN_SEC("address[%s]", address); @@ -1108,7 +1117,7 @@ INTERNAL_FUNC int em_decode_base64(unsigned char *enc_text, unsigned long enc_le return ret; } - +/* LCOV_EXCL_STOP */ INTERNAL_FUNC int em_get_account_server_type_by_account_id(char *multi_user_name, int account_id, email_account_server_t* account_server_type, int flag, int *error) { EM_DEBUG_FUNC_BEGIN(); @@ -1117,24 +1126,30 @@ INTERNAL_FUNC int em_get_account_server_type_by_account_id(char *multi_user_name int err = EMAIL_ERROR_NONE; if (account_server_type == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("account_server_type is NULL"); err = EMAIL_ERROR_INVALID_PARAM; ret = false; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (!emstorage_get_account_by_id(multi_user_name, account_id, WITHOUT_OPTION, &account_tbl_data, false, &err)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed [%d] ", err); ret = false; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (flag == false) { /* sending server */ *account_server_type = account_tbl_data->outgoing_server_type; - } else if (flag == true) { /* receiving server */ + } + /* LCOV_EXCL_START */ + else if (flag == true) { /* receiving server */ *account_server_type = account_tbl_data->incoming_server_type; } - + /* LCOV_EXCL_STOP */ ret = true; FINISH_OFF: @@ -1154,7 +1169,7 @@ FINISH_OFF: #define ACTIVE_SYNC_HANDLE_INIT_VALUE (-1) #define ACTIVE_SYNC_HANDLE_BOUNDARY (-100000000) - +/* LCOV_EXCL_START */ INTERNAL_FUNC int em_get_handle_for_activesync(int *handle, int *error) { EM_DEBUG_FUNC_BEGIN(); @@ -1346,7 +1361,7 @@ void em_thread_join(email_thread_handle_t *thd_handle) EM_DEBUG_EXCEPTION("pthread_join failed [%d]", errno); } } - +/* LCOV_EXCL_STOP */ INTERNAL_FUNC int em_fopen(const char *filename, const char *mode, FILE **fp) { EM_DEBUG_FUNC_BEGIN("filename: [%s]", filename); @@ -1354,9 +1369,11 @@ INTERNAL_FUNC int em_fopen(const char *filename, const char *mode, FILE **fp) int err = EMAIL_ERROR_NONE; if (!filename) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid param"); err = EMAIL_ERROR_INVALID_PARAM; return err; + /* LCOV_EXCL_STOP */ } FILE *temp_fp = NULL; @@ -1364,6 +1381,7 @@ INTERNAL_FUNC int em_fopen(const char *filename, const char *mode, FILE **fp) temp_fp = fopen(filename, mode); if (temp_fp == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("fopen failed: [%s][%d]", EM_STRERROR(errno_buf), errno); if (errno == EACCES || errno == EPERM) err = EMAIL_ERROR_PERMISSION_DENIED; @@ -1371,17 +1389,20 @@ INTERNAL_FUNC int em_fopen(const char *filename, const char *mode, FILE **fp) err = EMAIL_ERROR_MAIL_MEMORY_FULL; else err = EMAIL_ERROR_SYSTEM_FAILURE; + /* LCOV_EXCL_STOP */ } if (fp) *fp = temp_fp; else + /* LCOV_EXCL_START */ if (temp_fp) fclose(temp_fp); + /* LCOV_EXCL_STOP */ EM_DEBUG_FUNC_END(); return err; } - +/* LCOV_EXCL_START */ INTERNAL_FUNC int em_open(const char *filename, int oflags, mode_t mode, int *handle) { EM_DEBUG_FUNC_BEGIN_SEC("filename : [%s]", filename); @@ -1419,3 +1440,4 @@ INTERNAL_FUNC int em_open(const char *filename, int oflags, mode_t mode, int *ha EM_DEBUG_FUNC_END(); return err; } +/* LCOV_EXCL_STOP */ diff --git a/email-common-use/tpl.c b/email-common-use/tpl.c index 6a76561..7626199 100644 --- a/email-common-use/tpl.c +++ b/email-common-use/tpl.c @@ -250,6 +250,7 @@ static const struct tpl_type_t tpl_types[] = { }; /* default error-reporting function. Just writes to stderr. */ +/* LCOV_EXCL_START */ static int tpl_oops(const char *fmt, ...) { char buf[256]; @@ -261,13 +262,15 @@ static int tpl_oops(const char *fmt, ...) va_end(ap); return 0; } - +/* LCOV_EXCL_STOP */ static tpl_node *tpl_node_new(tpl_node *parent) { tpl_node *n; if ((n = tpl_hook.malloc(sizeof(tpl_node))) == NULL) + /* LCOV_EXCL_START */ fatal_oom(); + /* LCOV_EXCL_STOP */ n->addr = NULL; n->data = NULL; @@ -292,8 +295,9 @@ char *calc_field_addr(tpl_node *parent, int type, char *struct_addr, int ordinal tpl_node *prev; int offset; int align_sz; - +/* LCOV_EXCL_START */ if (ordinal == 1) return struct_addr; /* first field starts on structure address */ + /* LCOV_EXCL_STOP */ /* generate enough padding so field addr is divisible by it's align_sz. 4, 8, etc */ prev = parent->children->prev; @@ -366,12 +370,14 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) case 'f': if (*c == 'c') t = TPL_TYPE_BYTE; else if (*c == 'i') t = TPL_TYPE_INT32; + /* LCOV_EXCL_START */ else if (*c == 'u') t = TPL_TYPE_UINT32; else if (*c == 'j') t = TPL_TYPE_INT16; else if (*c == 'v') t = TPL_TYPE_UINT16; else if (*c == 'I') t = TPL_TYPE_INT64; else if (*c == 'U') t = TPL_TYPE_UINT64; else if (*c == 'f') t = TPL_TYPE_DOUBLE; + /* LCOV_EXCL_STOP */ if (expect_lparen) goto fail; n = tpl_node_new(parent); @@ -383,10 +389,15 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) struct_widest_node = n; } if (tpl_types[n->type].sz > tpl_types[struct_widest_node->type].sz) + /* LCOV_EXCL_START */ struct_widest_node = n; + /* LCOV_EXCL_STOP */ n->addr = calc_field_addr(parent, n->type, struct_addr, ordinal++); - } else n->addr = (void*)va_arg(ap, void*); + } + /* LCOV_EXCL_START */ + else n->addr = (void*)va_arg(ap, void*); + /* LCOV_EXCL_STOP */ n->data = tpl_hook.malloc(tpl_types[t].sz); if (!n->data) fatal_oom(); if (n->parent->type == TPL_TYPE_ARY) @@ -399,14 +410,21 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) n->type = TPL_TYPE_STR; if (in_structure) { if (ordinal == 1) { + /* LCOV_EXCL_START */ iter_start_node = n; /* for S(...)# iteration */ struct_widest_node = n; + /* LCOV_EXCL_STOP */ } if (tpl_types[n->type].sz > tpl_types[struct_widest_node->type].sz) + /* LCOV_EXCL_START */ struct_widest_node = n; + /* LCOV_EXCL_STOP */ n->addr = calc_field_addr(parent, n->type, struct_addr, ordinal++); - } else n->addr = (void*)va_arg(ap, void*); + } + /* LCOV_EXCL_START */ + else n->addr = (void*)va_arg(ap, void*); + /* LCOV_EXCL_STOP */ n->data = tpl_hook.malloc(sizeof(char*)); if (!n->data) fatal_oom(); *(char**)(n->data) = NULL; @@ -414,6 +432,7 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) ((tpl_atyp*)(n->parent->data))->sz += sizeof(void*); DL_ADD(parent->children, n); break; + /* LCOV_EXCL_START */ case '#': /* apply a 'num' to preceding atom */ if (!parent->children) goto fail; @@ -489,6 +508,7 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) for (i = 0; i < num_contig_fxlens; i++) fxlens[j++] = contig_fxlens[i]; break; + /* LCOV_EXCL_STOP */ case 'B': if (expect_lparen) goto fail; if (in_structure) goto fail; @@ -499,7 +519,9 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) if (!n->data) fatal_oom(); *((tpl_bin**)n->data) = NULL; if (n->parent->type == TPL_TYPE_ARY) + /* LCOV_EXCL_START */ ((tpl_atyp*)(n->parent->data))->sz += sizeof(tpl_bin); + /* LCOV_EXCL_STOP */ DL_ADD(parent->children, n); break; case 'A': @@ -523,7 +545,9 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) ((tpl_atyp*)(n->data))->bbtail = NULL; ((tpl_atyp*)(n->data))->cur = NULL; if (n->parent->type == TPL_TYPE_ARY) + /* LCOV_EXCL_START */ ((tpl_atyp*)(n->parent->data))->sz += sizeof(void*); + /* LCOV_EXCL_STOP */ break; case 'S': if (in_structure) goto fail; @@ -532,11 +556,13 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) in_structure = 1+lparen_level; /* so we can tell where S fmt ends */ struct_addr = (char*)va_arg(ap, void*); break; + /* LCOV_EXCL_START */ case '$': /* nested structure */ if (!in_structure) goto fail; expect_lparen = 1; in_nested_structure++; break; + /* LCOV_EXCL_STOP */ case ')': lparen_level--; if (lparen_level < 0) goto fail; @@ -555,9 +581,11 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) expect_lparen = 0; lparen_level++; break; + /* LCOV_EXCL_START */ default: tpl_hook.oops("unsupported option %c\n", *c); goto fail; + /* LCOV_EXCL_STOP */ } c++; } @@ -566,17 +594,20 @@ static tpl_node *tpl_map_va(char *fmt, va_list ap) /* copy the format string, save for convenience */ ((tpl_root_data*)(root->data))->fmt = tpl_hook.malloc(EM_SAFE_STRLEN(fmt)+1); if (((tpl_root_data*)(root->data))->fmt == NULL) + /* LCOV_EXCL_START */ fatal_oom(); + /* LCOV_EXCL_STOP */ memcpy(((tpl_root_data*)(root->data))->fmt, fmt, EM_SAFE_STRLEN(fmt)+1); return root; - +/* LCOV_EXCL_START */ fail: tpl_hook.oops("failed to parse %s\n", fmt); tpl_free(root); return NULL; } + static int tpl_unmap_file(tpl_mmap_rec *mr) { if (munmap(mr->text, mr->text_sz) == -1) @@ -587,7 +618,7 @@ static int tpl_unmap_file(tpl_mmap_rec *mr) mr->text_sz = 0; return 0; } - +/* LCOV_EXCL_STOP */ static void tpl_free_keep_map(tpl_node *r) { int mmap_bits = (TPL_RDONLY|TPL_FILE); @@ -693,10 +724,12 @@ TPL_API void tpl_free(tpl_node *r) tpl_pidx *pidx, *pidx_nxt; /* For mmap'd files, or for 'ufree' memory images , do appropriate release */ + /* LCOV_EXCL_START */ if ((((tpl_root_data*)(r->data))->flags & mmap_bits) == mmap_bits) tpl_unmap_file(&((tpl_root_data*)(r->data))->mmap); else if ((((tpl_root_data*)(r->data))->flags & ufree_bits) == ufree_bits) tpl_hook.free(((tpl_root_data*)(r->data))->mmap.text); + /* LCOV_EXCL_STOP */ c = r->children; if (c) { @@ -706,8 +739,9 @@ TPL_API void tpl_free(tpl_node *r) /* free any binary buffer hanging from tpl_bin */ if (*((tpl_bin**)(c->data))) { if ((*((tpl_bin**)(c->data)))->sz != 0) + /* LCOV_EXCL_START */ tpl_hook.free((*((tpl_bin**)(c->data)))->addr); - + /* LCOV_EXCL_STOP */ tpl_hook.free(*((tpl_bin**)c->data)); /* free tpl_bin */ } tpl_hook.free(c->data); /* free tpl_bin* */ @@ -742,9 +776,11 @@ TPL_API void tpl_free(tpl_node *r) if (c->children) c = c->children; /* normal case */ else find_next_node = 1; /* edge case, handle bad format A() */ break; + /* LCOV_EXCL_START */ default: tpl_hook.fatal("unsupported format character\n"); break; + /* LCOV_EXCL_STOP */ } if (find_next_node) { @@ -776,7 +812,9 @@ TPL_API void tpl_free(tpl_node *r) } tpl_hook.free(((tpl_root_data*)(r->data))->fmt); if (((tpl_root_data*)(r->data))->num_fxlens > 0) + /* LCOV_EXCL_START */ tpl_hook.free(((tpl_root_data*)(r->data))->fxlens); + /* LCOV_EXCL_STOP */ tpl_hook.free(r->data); /* tpl_root_data */ tpl_hook.free(r); @@ -930,7 +968,9 @@ static size_t tpl_ser_osz(tpl_node *n) /* handle the root node ONLY (subtree's ser_osz have been bubbled-up) */ if (n->type != TPL_TYPE_ROOT) + /* LCOV_EXCL_START */ tpl_hook.fatal("internal error: tpl_ser_osz on non-root node\n"); + /* LCOV_EXCL_STOP */ sz = n->ser_osz; /* start with fixed overhead, already stored */ c = n->children; @@ -962,6 +1002,7 @@ static size_t tpl_ser_osz(tpl_node *n) sz += sizeof(uint32_t); /* array len */ sz += c->ser_osz; /* bubbled-up child array ser_osz */ break; + /* LCOV_EXCL_START */ case TPL_TYPE_POUND: /* iterate over the preceding nodes */ itermax = c->num; @@ -985,6 +1026,7 @@ static size_t tpl_ser_osz(tpl_node *n) default: tpl_hook.fatal("unsupported format character\n"); break; + /* LCOV_EXCL_STOP */ } c = c->next; } @@ -1001,14 +1043,17 @@ TPL_API int tpl_dump(tpl_node *r, int mode, ...) size_t sz, *sz_out, pa_sz; if (((tpl_root_data*)(r->data))->flags & TPL_RDONLY) { /* unusual */ + /* LCOV_EXCL_START */ tpl_hook.oops("error: tpl_dump called for a loaded tpl\n"); return -1; + /* LCOV_EXCL_STOP */ } sz = tpl_ser_osz(r); /* compute the size needed to serialize */ va_start(ap, mode); if (mode & TPL_FILE) { + /* LCOV_EXCL_START */ filename = va_arg(ap, char*); fd = tpl_mmap_output_file(filename, sz, &buf); if (fd == -1) rc = -1; @@ -1021,8 +1066,10 @@ TPL_API int tpl_dump(tpl_node *r, int mode, ...) tpl_hook.oops("munmap failed on fd %d: %s\n", fd, strerror(errno)); close(fd); + /* LCOV_EXCL_STOP */ } } else if (mode & TPL_FD) { + /* LCOV_EXCL_START */ fd = va_arg(ap, int); if ((buf = tpl_hook.malloc(sz)) == NULL) fatal_oom(); tpl_dump_to_mem(r, buf, sz); @@ -1042,8 +1089,10 @@ TPL_API int tpl_dump(tpl_node *r, int mode, ...) } while (sz > 0); free(buf); rc = 0; + /* LCOV_EXCL_STOP */ } else if (mode & TPL_MEM) { if (mode & TPL_PREALLOCD) { /* caller allocated */ + /* LCOV_EXCL_START */ pa_addr = (void*)va_arg(ap, void*); pa_sz = va_arg(ap, size_t); if (pa_sz < sz) { @@ -1052,6 +1101,7 @@ TPL_API int tpl_dump(tpl_node *r, int mode, ...) return -1; } rc = tpl_dump_to_mem(r, pa_addr, sz); + /* LCOV_EXCL_STOP */ } else { /* we allocate */ addr_out = (void**)va_arg(ap, void*); sz_out = va_arg(ap, size_t*); @@ -1060,11 +1110,16 @@ TPL_API int tpl_dump(tpl_node *r, int mode, ...) *addr_out = buf; rc = tpl_dump_to_mem(r, buf, sz); } - } else if (mode & TPL_GETSIZE) { + } + else if (mode & TPL_GETSIZE) { + /* LCOV_EXCL_START */ sz_out = va_arg(ap, size_t*); *sz_out = sz; + /* LCOV_EXCL_STOP */ } else { + /* LCOV_EXCL_START */ tpl_hook.oops("unsupported tpl_dump mode %d\n", mode); + /* LCOV_EXCL_STOP */ rc = -1; } va_end(ap); @@ -1129,6 +1184,7 @@ static int tpl_dump_to_mem(tpl_node *r, void *addr, size_t sz) case TPL_TYPE_ARY: dv = tpl_dump_atyp(c, (tpl_atyp*)c->data, dv); break; + /* LCOV_EXCL_START */ case TPL_TYPE_POUND: pd = (tpl_pound_data*)c->data; itermax = c->num; @@ -1158,6 +1214,7 @@ static int tpl_dump_to_mem(tpl_node *r, void *addr, size_t sz) default: tpl_hook.fatal("unsupported format character\n"); break; + /* LCOV_EXCL_STOP */ } c = c->next; } @@ -1182,6 +1239,7 @@ static int tpl_cpu_bigendian() * should exactly match the buffer size (bufsz) and the internal * recorded size (intlsz) */ + /* LCOV_EXCL_START */ static int tpl_sanity(tpl_node *r, int excess_ok) { uint32_t intlsz; @@ -1574,7 +1632,7 @@ TPL_API int tpl_Alen(tpl_node *r, int i) if (n->type != TPL_TYPE_ARY) return -1; return ((tpl_atyp*)(n->data))->num; } - + /* LCOV_EXCL_STOP */ static void tpl_free_atyp(tpl_node *n, tpl_atyp *atyp) { tpl_backbone *bb, *bbnxt; @@ -1739,7 +1797,7 @@ static int tpl_serlen(tpl_node *r, tpl_node *n, void *dv, size_t *serlen) *serlen = len; return 0; } - + /* LCOV_EXCL_START */ static int tpl_mmap_output_file(char *filename, size_t sz, void **text_out) { void *text; @@ -1799,7 +1857,7 @@ static int tpl_mmap_file(char *filename, tpl_mmap_rec *mr) return 0; } - + /* LCOV_EXCL_STOP */ TPL_API int tpl_pack(tpl_node *r, int i) { tpl_node *n, *child, *np; @@ -1813,13 +1871,17 @@ TPL_API int tpl_pack(tpl_node *r, int i) n = tpl_find_i(r, i); if (n == NULL) { + /* LCOV_EXCL_START */ tpl_hook.oops("invalid index %d to tpl_pack\n", i); return -1; + /* LCOV_EXCL_STOP */ } if (((tpl_root_data*)(r->data))->flags & TPL_RDONLY) { /* convert to an writeable tpl, initially empty */ + /* LCOV_EXCL_START */ tpl_free_keep_map(r); + /* LCOV_EXCL_STOP */ } ((tpl_root_data*)(r->data))->flags |= TPL_WRONLY; @@ -1845,9 +1907,12 @@ TPL_API int tpl_pack(tpl_node *r, int i) /* copy the buffer to be packed */ slen = ((tpl_bin*)child->addr)->sz; if (slen > 0) { + /* LCOV_EXCL_START */ str = tpl_hook.malloc(slen); if (!str) fatal_oom(); memcpy(str, ((tpl_bin*)child->addr)->addr, slen); + /* LCOV_EXCL_STOP */ + } else str = NULL; /* and make a tpl_bin to point to it */ bin = tpl_hook.malloc(sizeof(tpl_bin)); @@ -1856,19 +1921,25 @@ TPL_API int tpl_pack(tpl_node *r, int i) bin->sz = slen; /* now pack its pointer, first deep freeing any pre-existing bin */ if (*(tpl_bin**)(child->data) != NULL) { + /* LCOV_EXCL_START */ if ((*(tpl_bin**)(child->data))->sz != 0) tpl_hook.free((*(tpl_bin**)(child->data))->addr); tpl_hook.free(*(tpl_bin**)(child->data)); + /* LCOV_EXCL_STOP */ } memcpy(child->data, &bin, sizeof(tpl_bin*)); if (datav) { + /* LCOV_EXCL_START */ datav = tpl_cpv(datav, &bin, sizeof(tpl_bin*)); *(tpl_bin**)(child->data) = NULL; + /* LCOV_EXCL_STOP */ } if (n->type == TPL_TYPE_ARY) { + /* LCOV_EXCL_START */ n->ser_osz += sizeof(uint32_t); /* binary buf len word */ n->ser_osz += bin->sz; /* binary buf */ + /* LCOV_EXCL_STOP */ } break; case TPL_TYPE_STR: @@ -1887,7 +1958,9 @@ TPL_API int tpl_pack(tpl_node *r, int i) } /* now pack its pointer, first freeing any pre-existing string */ if (*cdata != NULL) + /* LCOV_EXCL_START */ tpl_hook.free(*cdata); + /* LCOV_EXCL_STOP */ memcpy(cdata, &str, sizeof(char*)); if (datav) { @@ -1900,6 +1973,7 @@ TPL_API int tpl_pack(tpl_node *r, int i) } } break; + /* LCOV_EXCL_START */ case TPL_TYPE_ARY: /* copy the child's tpl_atype* and reset it to empty */ if (datav) { @@ -1959,12 +2033,13 @@ TPL_API int tpl_pack(tpl_node *r, int i) default: tpl_hook.fatal("unsupported format character\n"); break; + /* LCOV_EXCL_STOP */ } child = child->next; } return 0; } - + /* LCOV_EXCL_START */ TPL_API int tpl_unpack(tpl_node *r, int i) { tpl_node *n, *c, *np; @@ -2509,3 +2584,4 @@ static int tpl_gather_mem(char *buf, size_t len, tpl_gather_t **gs, tpl_gather_c } return 1; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-account.c b/email-core/email-core-account.c index c4b5436..b6013a7 100755 --- a/email-core/email-core-account.c +++ b/email-core/email-core-account.c @@ -92,6 +92,7 @@ email_mailbox_type_e g_default_mbox_type[MAILBOX_COUNT] = { EMAIL_MAILBOX_TYPE_SPAMBOX, }; + /* LCOV_EXCL_START */ INTERNAL_FUNC email_account_t* emcore_get_account_reference(char *multi_user_name, int account_id, int with_password) { EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id); @@ -1623,3 +1624,4 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-alarm.c b/email-core/email-core-alarm.c index c18be90..2481027 100755 --- a/email-core/email-core-alarm.c +++ b/email-core/email-core-alarm.c @@ -54,6 +54,7 @@ INTERNAL_FUNC GList *alarm_data_list = NULL; static pthread_mutex_t alarm_data_lock = PTHREAD_MUTEX_INITIALIZER; + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_get_alarm_data_by_alarm_id(alarm_id_t input_alarm_id, email_alarm_data_t **output_alarm_data) { EM_DEBUG_FUNC_BEGIN("input_alarm_id [%d] output_alarm_data [%p]", input_alarm_id, output_alarm_data); @@ -318,3 +319,4 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-auto-download.c b/email-core/email-core-auto-download.c index 3b73a51..88d109b 100755 --- a/email-core/email-core-auto-download.c +++ b/email-core/email-core-auto-download.c @@ -60,7 +60,7 @@ INTERNAL_FUNC int auto_download_thread_run = 0; static void* worker_auto_download_queue(void *arg); static gint __auto_download_compare_func(gconstpointer a, gconstpointer b, gpointer user_data); - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_start_auto_download_loop(int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -870,3 +870,4 @@ static gint __auto_download_compare_func(gconstpointer a, gconstpointer b, gpoin } return 1; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-container.c b/email-core/email-core-container.c index 1a35a5b..472ed4d 100644 --- a/email-core/email-core-container.c +++ b/email-core/email-core-container.c @@ -41,7 +41,7 @@ int vsm_event_handle = 0; #ifdef __FEATURE_CONTAINER_ENABLE__ vsm_context_h container; - + /* LCOV_EXCL_START */ static int container_state_listener(vsm_zone_h zone, vsm_zone_state_t state, void *user_data) { EM_DEBUG_FUNC_BEGIN(); @@ -418,3 +418,4 @@ INTERNAL_FUNC void emcore_unset_join_zone(void *join_zone) #endif /* __FEATURE_CONTAINER_ENABLE__ */ EM_DEBUG_FUNC_END(); } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-dpm.c b/email-core/email-core-dpm.c index ad9684d..d5e8e74 100644 --- a/email-core/email-core-dpm.c +++ b/email-core/email-core-dpm.c @@ -9,7 +9,7 @@ static int g_dpm_policy_status = 0; #include <dpm/restriction.h> - + /* LCOV_EXCL_START */ void on_restriction(const char* policy, const char* value, void* user_data) { int is_allowed = strcmp(value, "allowed") == 0 ? 1 : 0; @@ -84,4 +84,4 @@ void dpm_interface_destroy() dpm_remove_policy_changed_cb(dpm, callback_id); dpm_manager_destroy(dpm); } - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-event.c b/email-core/email-core-event.c index 86e5385..12afc3a 100755 --- a/email-core/email-core-event.c +++ b/email-core/email-core-event.c @@ -133,7 +133,7 @@ static int event_handler_EMAIL_EVENT_LOCAL_ACTIVITY(int account_id, int *error); extern int g_imap_idle_thread_alive; extern int imap_idle_thread; #endif /* ENABLE_IMAP_IDLE_THREAD */ - + /* LCOV_EXCL_START */ static int is_gdk_lock_needed() { if (g_event_loop) { @@ -2371,3 +2371,4 @@ FINISH_OFF: } #endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */ + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-global.c b/email-core/email-core-global.c index 66301d9..97bf517 100755 --- a/email-core/email-core-global.c +++ b/email-core/email-core-global.c @@ -43,7 +43,7 @@ static email_account_list_t *g_unvalidated_account_list = NULL; static pthread_mutex_t _unvalidated_account_lock = PTHREAD_MUTEX_INITIALIZER; extern int pthread_mutexattr_settype(pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull((1)); - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_get_account_from_unvalidated_account_list(int input_unvalidated_account_id, email_account_t **oupput_account) { EM_DEBUG_FUNC_BEGIN("input_unvalidated_account_id[%d], oupput_account[%p]", input_unvalidated_account_id, oupput_account); @@ -157,6 +157,6 @@ INTERNAL_FUNC int emcore_delete_account_from_unvalidated_account_list(int input_ EM_DEBUG_FUNC_END("err [%d]", err); return err; } - + /* LCOV_EXCL_STOP */ diff --git a/email-core/email-core-gmime.c b/email-core/email-core-gmime.c index ad9b665..5b3a520 100755 --- a/email-core/email-core-gmime.c +++ b/email-core/email-core-gmime.c @@ -57,7 +57,7 @@ static void emcore_gmime_pop3_parse_foreach_cb(GMimeObject *parent, GMimeObject static void emcore_gmime_eml_parse_foreach_cb(GMimeObject *parent, GMimeObject *part, gpointer user_data); static int emcore_gmime_parse_mime_header(GMimeMessage *message, struct _rfc822header *rfc822_header); - + /* LCOV_EXCL_START */ INTERNAL_FUNC void emcore_gmime_init(void) { EM_DEBUG_FUNC_BEGIN(); @@ -5189,3 +5189,4 @@ INTERNAL_FUNC char *emcore_gmime_get_mime_entity(int fd) EM_DEBUG_FUNC_END(); return output_path; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-imap-idle.c b/email-core/email-core-imap-idle.c index 42fae66..e064666 100755 --- a/email-core/email-core-imap-idle.c +++ b/email-core/email-core-imap-idle.c @@ -73,7 +73,7 @@ typedef struct _email_imap_idle_connection_info_t { int imap_idle_pipe_fd[2]; thread_t imap_idle_thread_id; - + /* LCOV_EXCL_START */ static int emcore_get_connection_info_by_socket_fd(GList *input_imap_idle_task_list, int input_socket_fd, email_imap_idle_connection_info_t **output_connection_info) @@ -758,3 +758,4 @@ INTERNAL_FUNC int emcore_refresh_imap_idle_thread() return err; } #endif /* __FEATURE_IMAP_IDLE__ */ + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-imap-mailbox.c b/email-core/email-core-imap-mailbox.c index 4a96d77..65dfbd1 100755 --- a/email-core/email-core-imap-mailbox.c +++ b/email-core/email-core-imap-mailbox.c @@ -51,7 +51,7 @@ #include "c-client.h" #include "email-debug-log.h" - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_get_default_mail_slot_count(char *multi_user_name, int input_account_id, int *output_count) { EM_DEBUG_FUNC_BEGIN("input_account_id [%d] output_count[%p]", input_account_id, output_count); @@ -1152,3 +1152,4 @@ INTERNAL_FUNC int emcore_set_quota(int input_mailbox_id, char *input_quota_root, } #endif /* __FEATURE_IMAP_QUOTA__ */ + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-key-manager.c b/email-core/email-core-key-manager.c index 497e74d..0decaf8 100755 --- a/email-core/email-core-key-manager.c +++ b/email-core/email-core-key-manager.c @@ -59,6 +59,7 @@ static char *add_shared_owner_prefix(const char *name) return ckm_alias; } */ + /* LCOV_EXCL_START */ static char *__get_key_manager_alias(const char* name) { int ret = 0; @@ -538,5 +539,4 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return err; } - - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-mail.c b/email-core/email-core-mail.c index a1f6e4c..c547b7d 100755 --- a/email-core/email-core-mail.c +++ b/email-core/email-core-mail.c @@ -204,7 +204,7 @@ void _print_body(BODY *body, int recursive) EM_DEBUG_LOG(" ========================================================== "); } #endif /* FEATURE_CORE_DEBUG */ - + /* LCOV_EXCL_START */ static int pop3_mail_delete(MAILSTREAM *stream, int msgno, int *err_code) { EM_DEBUG_FUNC_BEGIN("stream[%p], msgno[%d], err_code[%p]", stream, msgno, err_code); @@ -589,7 +589,7 @@ FINISH_OFF: emcore_free_account(ref_account); EM_SAFE_FREE(ref_account); } - + /* LCOV_EXCL_STOP */ #ifdef __FEATURE_LOCAL_ACTIVITY__ if (ret || ref_account->incoming_server_type != EMAIL_SERVER_TYPE_IMAP4) /* Delete local activity for POP3 mails and successful move operation in IMAP */ { emstorage_activity_tbl_t new_activity; @@ -607,6 +607,7 @@ FINISH_OFF: } } #endif + /* LCOV_EXCL_START */ if (dest_mailbox) { emstorage_free_mailbox(&dest_mailbox, 1, &err_code); } @@ -804,6 +805,7 @@ int emcore_delete_mails_from_imap4_server(char *multi_user_name, if (!strncmp(p, tag, EM_SAFE_STRLEN(tag))) { if (!strncmp(p + EM_SAFE_STRLEN(tag) + 1, "OK", 2)) { + /* LCOV_EXCL_STOP */ #ifdef __FEATURE_LOCAL_ACTIVITY__ int index = 0; emstorage_mail_tbl_t **mail = NULL; @@ -887,6 +889,7 @@ int emcore_delete_mails_from_imap4_server(char *multi_user_name, } #endif + /* LCOV_EXCL_START */ EM_SAFE_FREE(p); break; } else { /* 'NO' or 'BAD' */ @@ -2309,7 +2312,7 @@ FINISH_OFF: return ret; } - + /* LCOV_EXCL_STOP */ #ifdef __ATTACHMENT_OPTI__ INTERNAL_FUNC int emcore_download_attachment_bulk(int account_id, int mail_id, int nth, int event_handle, int *err_code) { @@ -2541,7 +2544,7 @@ INTERNAL_FUNC int emcore_download_attachment_bulk(int account_id, int mail_id, i return ret; } #endif - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_gmime_download_body_sections(char *multi_user_name, void *mail_stream, int account_id, @@ -6152,7 +6155,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return ret; } - + /* LCOV_EXCL_STOP */ int emcore_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, int *downloded_size, int *result_total_body_size, int *err_code) { EM_DEBUG_FUNC_BEGIN("stream[%p], msgno[%d], limited_size[%d], err_code[%p]", stream, msgno, limited_size, err_code); @@ -6275,7 +6278,7 @@ FINISH_OFF: return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_sync_flag_with_server(char *multi_user_name, int mail_id, int event_handle, int *err_code) { EM_DEBUG_FUNC_BEGIN("mail_id[%p], err_code[%p]", mail_id, err_code); @@ -6539,7 +6542,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC void emcore_free_mail_data_list(email_mail_data_t **mail_list, int count) { EM_DEBUG_FUNC_BEGIN("count[%d]", count); @@ -6563,8 +6566,10 @@ INTERNAL_FUNC void emcore_free_mail_data(email_mail_data_t *mail_data) EM_DEBUG_FUNC_BEGIN(); if (!mail_data) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY"); return; + /* LCOV_EXCL_STOP */ } EM_SAFE_FREE(mail_data->subject); @@ -6591,7 +6596,7 @@ INTERNAL_FUNC void emcore_free_mail_data(email_mail_data_t *mail_data) EM_DEBUG_FUNC_END(); } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_free_attachment_data(email_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code) { EM_DEBUG_FUNC_BEGIN("attachment_data_list[%p], attachment_data_count [%d], err_code[%p]", attachment_data_list, attachment_data_count, err_code); @@ -6622,7 +6627,6 @@ INTERNAL_FUNC int emcore_free_attachment_data(email_attachment_data_t **attachme } - #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__ INTERNAL_FUNC int emcore_delete_pbd_activity(char *multi_user_name, int account_id, int mail_id, int activity_id, int *err_code) @@ -8681,3 +8685,4 @@ FINISH_OFF: return err; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-mailbox-sync.c b/email-core/email-core-mailbox-sync.c index 6f8edee..ef4b113 100755 --- a/email-core/email-core-mailbox-sync.c +++ b/email-core/email-core-mailbox-sync.c @@ -100,7 +100,7 @@ static struct { {"koi8-u", "uk" } #endif }; - + /* LCOV_EXCL_START */ int pop3_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -4897,6 +4897,6 @@ FINISH_OFF: EM_DEBUG_FUNC_END("server_response [%p]", server_response); return server_response; } - + /* LCOV_EXCL_STOP */ #endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */ /* EOF */ diff --git a/email-core/email-core-mailbox.c b/email-core/email-core-mailbox.c index a55032a..9d0eccf 100755 --- a/email-core/email-core-mailbox.c +++ b/email-core/email-core-mailbox.c @@ -169,7 +169,7 @@ INTERNAL_FUNC int emcore_remove_connection_info(int account_id) #endif /* __FEATURE_KEEP_CONNECTION__ */ - + /* LCOV_EXCL_START */ INTERNAL_FUNC void emcore_close_recv_stream_list(void) { EM_DEBUG_FUNC_BEGIN(); @@ -1702,4 +1702,4 @@ FINISH_OFF: } #endif - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-mime.c b/email-core/email-core-mime.c index 484ee2d..eb7e438 100755 --- a/email-core/email-core-mime.c +++ b/email-core/email-core-mime.c @@ -131,7 +131,7 @@ void emcore_mime_free_mime(struct _m_mesg *mmsg); extern long pop3_reply(MAILSTREAM *stream); /* ------------------------------------------------------------------------------------------------- */ - + /* LCOV_EXCL_START */ char *em_get_escaped_str(const char *str) { EM_DEBUG_FUNC_BEGIN_SEC("str [%s]", str); @@ -1667,3 +1667,4 @@ INTERNAL_FUNC int emcore_get_digest_type(char *micalg_value) EM_DEBUG_FUNC_END(); return digest_type; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-mm-callbacks.c b/email-core/email-core-mm-callbacks.c index 85c6907..f68fc05 100755 --- a/email-core/email-core-mm-callbacks.c +++ b/email-core/email-core-mm-callbacks.c @@ -46,6 +46,7 @@ static void mm_get_error(char *string, int *err_code); * callback mm_lsub * get subscribed mailbox list */ + /* LCOV_EXCL_START */ INTERNAL_FUNC void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes) { EM_DEBUG_FUNC_BEGIN(); @@ -489,3 +490,4 @@ FINISH_OFF: } #endif /* __FEATURE_SUPPORT_IMAP_ID__ */ /* EOF */ + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-signal.c b/email-core/email-core-signal.c index 1b4fd0e..6203c44 100755 --- a/email-core/email-core-signal.c +++ b/email-core/email-core-signal.c @@ -47,7 +47,7 @@ typedef enum { _NOTI_TYPE_NETWORK = 1,
_NOTI_TYPE_RESPONSE_TO_API = 2,
} enotitype_t;
-
+ /* LCOV_EXCL_START */
INTERNAL_FUNC int emcore_initialize_signal()
{
return EMAIL_ERROR_NONE;
@@ -572,3 +572,4 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err);
return err;
}
+ /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-smtp.c b/email-core/email-core-smtp.c index 2ae5030..2e1f174 100755 --- a/email-core/email-core-smtp.c +++ b/email-core/email-core-smtp.c @@ -85,7 +85,7 @@ extern long smtp_soutr_test(void *stream, char *s); - + /* LCOV_EXCL_START */ void mail_send_notify(email_send_status_t status, int total, int sent, int account_id, int mail_id, int err_code) { EM_DEBUG_FUNC_BEGIN("status[%d], total[%d], sent[%d], account_id[%d], mail_id[%d], err_code[%d]", status, total, sent, account_id, mail_id, err_code); @@ -4980,3 +4980,4 @@ FINISH_OFF: return err; } #endif /* __FEATURE_AUTO_RETRY_SEND__ */ + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-task-manager.c b/email-core/email-core-task-manager.c index 2234840..ada4505 100755 --- a/email-core/email-core-task-manager.c +++ b/email-core/email-core-task-manager.c @@ -63,6 +63,7 @@ static int emcore_update_task_status_on_task_table(char *multi_user_name, int in static int emcore_get_task_handler_reference(email_task_type_t input_task_type, email_task_handler_t **output_task_handler); /*- task handlers helpers - begin --------------------------------------------*/ + /* LCOV_EXCL_START */ static int emcore_initialize_async_task_handler(email_task_t *input_task) { EM_DEBUG_FUNC_BEGIN("input_task [%p]", input_task); @@ -199,6 +200,7 @@ INTERNAL_FUNC int emcore_default_sync_task_handler(void *intput_param) EM_DEBUG_FUNC_END("err [%d]", err); return err; } + /* LCOV_EXCL_STOP */ /*- task handlers helpers - end --------------------------------------------*/ int _task_handler_array_size; @@ -220,9 +222,11 @@ static int emcore_register_task_handler(email_task_type_t input_task_type, new_task_handler = malloc(sizeof(email_task_handler_t)); if (new_task_handler == NULL) { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_OUT_OF_MEMORY; EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY"); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } new_task_handler->task_type = input_task_type; @@ -238,11 +242,13 @@ static int emcore_register_task_handler(email_task_type_t input_task_type, _new_task_handler_array = realloc(_task_handler_array, sizeof(email_task_handler_t*) * _task_handler_array_size); if (NULL == _new_task_handler_array) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("memory reallocation failed"); err = EMAIL_ERROR_OUT_OF_MEMORY; EM_SAFE_FREE(new_task_handler); EM_SAFE_FREE(_task_handler_array); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } _task_handler_array = _new_task_handler_array; @@ -250,9 +256,11 @@ static int emcore_register_task_handler(email_task_type_t input_task_type, _task_handler_array = malloc(sizeof(email_task_handler_t*) * _task_handler_array_size); if (_task_handler_array == NULL) { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_OUT_OF_MEMORY; EM_SAFE_FREE(new_task_handler); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } } @@ -264,7 +272,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_init_task_handler_array() { EM_DEBUG_FUNC_BEGIN(); @@ -684,5 +692,5 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } - + /* LCOV_EXCL_STOP */ /*-Task manager loop - end-------------------------------------------------------------*/ diff --git a/email-core/email-core-tasks.c b/email-core/email-core-tasks.c index aaff6e4..3c0e49b 100755 --- a/email-core/email-core-tasks.c +++ b/email-core/email-core-tasks.c @@ -44,7 +44,7 @@ /*-------------------------------------------------------------------------------------------*/ /* to handle EMAIL_ASYNC_TASK_MOVE_MAILS_TO_MAILBOX_OF_ANOTHER_ACCOUNT */ #define task_parameter_format_EMAIL_ASYNC_TASK_MOVE_MAILS_TO_MAILBOX_OF_ANOTHER_ACCOUNT "iiiB" - + /* LCOV_EXCL_START */ INTERNAL_FUNC int email_encode_task_parameter_EMAIL_ASYNC_TASK_MOVE_MAILS_TO_MAILBOX_OF_ANOTHER_ACCOUNT(void *input_task_parameter_struct, char **output_byte_stream, int *output_stream_size) { EM_DEBUG_FUNC_BEGIN("input_task_parameter_struct [%p] output_byte_stream [%p] output_stream_size [%p]", input_task_parameter_struct, output_byte_stream, output_stream_size); @@ -754,4 +754,5 @@ FINISH_OFF: return (void *)return_err; } + /* LCOV_EXCL_STOP */ /*-------------------------------------------------------------------------------------------*/ diff --git a/email-core/email-core-timer.c b/email-core/email-core-timer.c index 07eb822..c0ab21e 100755 --- a/email-core/email-core-timer.c +++ b/email-core/email-core-timer.c @@ -40,7 +40,7 @@ typedef struct { int time_id; } em_timer_callback_data; - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_timer_ex_callback(void *a_pData) { EM_DEBUG_LOG("[emcore_timer_ex_callback] enter\n"); @@ -96,4 +96,4 @@ INTERNAL_FUNC void emcore_kill_timer_ex(int a_nTimerID) EM_DEBUG_LOG("[emcore_kill_timer_ex] a_nTimerID %d", a_nTimerID); g_source_remove(a_nTimerID); } - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-core/email-core-utils.c b/email-core/email-core-utils.c index 551bf0f..279318a 100755 --- a/email-core/email-core-utils.c +++ b/email-core/email-core-utils.c @@ -126,7 +126,7 @@ struct emcore_account_list_t { }; #include <gmime/gmime.h> - + /* LCOV_EXCL_START */ INTERNAL_FUNC char *emcore_convert_mutf7_to_utf8(char *mailbox_name) { EM_DEBUG_FUNC_BEGIN("mailbox_name[%p]", mailbox_name); @@ -587,7 +587,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emcore_get_file_size(char *path, int *size, int *err_code) { EM_DEBUG_FUNC_BEGIN_SEC("path[%s], size[%p], err_code[%p]", path, size, err_code); @@ -596,19 +596,23 @@ INTERNAL_FUNC int emcore_get_file_size(char *path, int *size, int *err_code) int error = EMAIL_ERROR_NONE; if ((path == NULL) || (size == NULL)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("\t path[%p], size[%p]\n", path, size); error = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } struct stat st_buf; if (stat(path, &st_buf) < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("\t stat failed - %s\n", path); error = EMAIL_ERROR_SYSTEM_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } *size = st_buf.st_size; @@ -621,7 +625,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_check_drm_file(char *path, int *err_code) { EM_DEBUG_FUNC_BEGIN_SEC("path[%s], err_code[%p]", path, err_code); @@ -1138,7 +1142,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("noti_err : [%d]", noti_err); return noti_err; } - + /* LCOV_EXCL_STOP */ static int emcore_layout_single_noti(notification_h noti, char *account_name, int ids, char *display_sender, time_t time, char *subject, int display_status) { EM_DEBUG_FUNC_BEGIN(); @@ -1219,7 +1223,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("noti_err : [%d]", noti_err); return noti_err; } - + /* LCOV_EXCL_START */ static int emcore_get_alert_type(int vibrate_status) { EM_DEBUG_FUNC_BEGIN(); @@ -1313,7 +1317,7 @@ static char *emcore_get_sound_file_path(int default_ringtone_status, char *alert EM_DEBUG_FUNC_END_SEC("ret [%s]", ret); return ret; } - + /* LCOV_EXCL_STOP */ #if 0 //using notification_status_message_post instead of calling email-app toast - change date: 30/9/2014 INTERNAL_FUNC int emcore_show_toast_popup(char *input_popup_string) { @@ -1370,7 +1374,7 @@ FINISH_OFF: return err; } #endif - + /* LCOV_EXCL_START */ static int __emcore_show_new_mail_noti(void) { EM_DEBUG_FUNC_BEGIN(); @@ -2441,7 +2445,7 @@ void emcore_fill_address_information_of_mail_tbl(char *multi_user_name, emstorag EM_SAFE_FREE(recipient_self); EM_DEBUG_FUNC_END(); } - + /* LCOV_EXCL_STOP */ struct email_attribute_info { email_mail_attribute_type attribute_type; char *attribute_name; @@ -2500,7 +2504,7 @@ static struct email_attribute_info _mail_attribute_info_array[] = { {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_LENGTH_TYPE, "eas_data_length", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_INTEGER}, {EMAIL_MAIL_ATTRIBUTE_EAS_DATA_TYPE, "eas_data", EMAIL_MAIL_ATTRIBUTE_VALUE_TYPE_BINARY} }; - + /* LCOV_EXCL_START */ INTERNAL_FUNC char* emcore_get_mail_field_name_by_attribute_type(email_mail_attribute_type input_attribute_type) { EM_DEBUG_FUNC_BEGIN("input_attribute_type [%d]", input_attribute_type); @@ -3292,7 +3296,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return error_code; } - + /* LCOV_EXCL_STOP */ #define MAX_TITLE_LENGTH 1024 #ifdef __FEATURE_DRIVING_MODE__ @@ -3394,7 +3398,7 @@ FINISH_OFF: return convert_app_err_to_email_err(err); } #endif /* __FEATURE_DRIVING_MODE__ */ - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emcore_clear_notifications(char *multi_user_name, int account_id) { int account_count = 0, i; @@ -3956,7 +3960,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return ret; } - + /* LCOV_EXCL_STOP */ #ifdef __FEATURE_LOCAL_ACTIVITY__ INTERNAL_FUNC int emcore_add_activity(emstorage_activity_tbl_t *new_activity, int *err_code) { @@ -4046,7 +4050,7 @@ FINISH_OFF: #endif /* __FEATURE_LOCAL_ACTIVITY__ */ - + /* LCOV_EXCL_START */ INTERNAL_FUNC void emcore_free_rule(email_rule_t* rule) { EM_DEBUG_FUNC_BEGIN(); @@ -4163,7 +4167,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("error:[%d]", error); return error; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emcore_load_query_from_file(char *file_path, char ***query_array, int *array_len) { EM_DEBUG_FUNC_BEGIN_SEC("file_path : [%s], query_array : [%p]", file_path, *query_array); @@ -4176,55 +4180,71 @@ INTERNAL_FUNC int emcore_load_query_from_file(char *file_path, char ***query_arr char **result_vector = NULL; if (!file_path) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid parameter"); error = EMAIL_ERROR_INVALID_PARAM; return error; + /* LCOV_EXCL_STOP */ } error = em_fopen(file_path, "r", &fp); if (error != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_fopen failed"); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (!emcore_get_file_size(file_path, &file_size, &error)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emcore_get_file_size failed"); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } buf = em_malloc(file_size + 1); if (buf == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_mallocfailed"); error = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (fread(buf, sizeof(char), file_size, fp) != file_size) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Get the data from file : failed"); error = EMAIL_ERROR_SYSTEM_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } buf[file_size] = '\0'; result_vector = g_strsplit(buf, ";", -1); if (!result_vector || g_strv_length(result_vector) <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Parsing sql file failed"); error = EMAIL_ERROR_SYSTEM_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } vector_len = g_strv_length(result_vector); if (vector_len <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("vector length : [%d]", vector_len); error = EMAIL_ERROR_SYSTEM_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } *query_array = (char **)calloc(vector_len, sizeof(char *)); if (*query_array == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("calloc failed"); error = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } for (i = 0; i < vector_len; i++) { @@ -4238,8 +4258,9 @@ INTERNAL_FUNC int emcore_load_query_from_file(char *file_path, char ***query_arr *array_len = vector_len; EM_DEBUG_LOG("SQL string array length : [%d]", vector_len); } - + /* LCOV_EXCL_START */ FINISH_OFF: + /* LCOV_EXCL_STOP */ if (fp) fclose(fp); @@ -4327,7 +4348,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err[%d]", err); return err; } - + /* LCOV_EXCL_START */ static int emcore_check_time_in_peak_schedule(emstorage_account_tbl_t *input_account_ref, time_t input_time, int *output_result) { EM_DEBUG_FUNC_BEGIN("input_account_ref [%p] input_time[%d] output_result[%p]", input_account_ref, input_time, output_result); @@ -5114,7 +5135,7 @@ INTERNAL_FUNC int emcore_disconnect_contacts_service(char *multi_user_name) EM_DEBUG_FUNC_END(); return err; } - + /* LCOV_EXCL_STOP */ #ifdef __FEATURE_BLOCKING_MODE__ #define ALLOWED_CONTACT_TYPE_NONE 0 @@ -5323,6 +5344,7 @@ FINISH_OFF: #endif /* __FEATURE_BLOCKING_MODE__ */ + /* LCOV_EXCL_START */ INTERNAL_FUNC char *emcore_set_mime_entity(char *mime_path) { EM_DEBUG_FUNC_BEGIN("mime_path : [%s]", mime_path); @@ -5740,4 +5762,5 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } + /* LCOV_EXCL_STOP */ /* EOF */ diff --git a/email-core/email-network/email-network.c b/email-core/email-network/email-network.c index 7152bdb..13c4140 100755 --- a/email-core/email-network/email-network.c +++ b/email-core/email-network/email-network.c @@ -60,7 +60,7 @@ int network_status = 0; /* _get_network_status - Get the data network status from vconf */ - + /* LCOV_EXCL_START */ INTERNAL_FUNC void emnetwork_set_network_status(int input_network_status) { EM_DEBUG_FUNC_BEGIN(); @@ -385,4 +385,4 @@ INTERNAL_FUNC long tcp_soutr_lnx(TCPSTREAM *stream, char *string) { return tcp_sout_lnx(stream, string, EM_SAFE_STRLEN(string)); } - + /* LCOV_EXCL_STOP */ diff --git a/email-core/email-storage/email-storage.c b/email-core/email-storage/email-storage.c index b707878..364da32 100755 --- a/email-core/email-storage/email-storage.c +++ b/email-core/email-storage/email-storage.c @@ -220,6 +220,7 @@ sqlite3 *emstorage_get_db_handle(char *multi_user_name) sqlite3 *result_db_handle = NULL; if (EM_SAFE_STRLEN(multi_user_name) > 0) { + /* LCOV_EXCL_START */ ENTER_CRITICAL_SECTION(_db_handle_lock); for (i = 0; i < MAX_DB_CLIENT; i++) { if (EM_SAFE_STRCASECMP(_db_handle_list[i].user_name, multi_user_name) != 0) @@ -232,11 +233,14 @@ sqlite3 *emstorage_get_db_handle(char *multi_user_name) } } LEAVE_CRITICAL_SECTION(_db_handle_lock); + /* LCOV_EXCL_STOP */ } else { ENTER_CRITICAL_SECTION(_db_handle_lock); for (i = 0; i < MAX_DB_CLIENT; i++) { if (EM_SAFE_STRLEN(_db_handle_list[i].user_name) > 0) + /* LCOV_EXCL_START */ continue; + /* LCOV_EXCL_STOP */ if (pthread_equal(current_thread_id, _db_handle_list[i].thread_id)) { EM_DEBUG_LOG_DEV("found db handle at [%d]", i); @@ -275,12 +279,14 @@ int emstorage_set_db_handle(char *multi_user_name, sqlite3 *db_handle) LEAVE_CRITICAL_SECTION(_db_handle_lock); if (error_code == EMAIL_ERROR_MAX_EXCEEDED) + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Exceeded the limitation of db client. Can't find empty slot in _db_handle_list."); + /* LCOV_EXCL_STOP */ EM_DEBUG_FUNC_END("error_code [%d]", error_code); return error_code; } - + /* LCOV_EXCL_START */ int emstorage_remove_db_handle() { EM_DEBUG_FUNC_BEGIN(); @@ -322,11 +328,13 @@ int emstorage_reset_db_handle_list() EM_DEBUG_FUNC_END(); return EMAIL_ERROR_NONE; } - + /* LCOV_EXCL_STOP */ sqlite3 *emstorage_get_db_connection(char *multi_user_name) { + /* LCOV_EXCL_START */ return emstorage_db_open(multi_user_name, NULL); + /* LCOV_EXCL_STOP */ } #else /* _MULTIPLE_DB_HANDLE */ @@ -369,7 +377,7 @@ int shm_fd_for_generating_mail_id = 0; { return_value = function_call; } #endif /* __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */ - + /* LCOV_EXCL_START */ static int emstorage_exec_query_by_prepare_v2(sqlite3 *local_db_handle, char *query_string) { EM_DEBUG_FUNC_BEGIN("local_db_handle[%p] query_string[%p]", local_db_handle, query_string); @@ -460,15 +468,17 @@ int emstorage_shm_file_destroy(const char *shm_file_name) EM_DEBUG_FUNC_END(); return EMAIL_ERROR_NONE; } - + /* LCOV_EXCL_STOP */ int _initialize_shm_mutex(const char *shm_file_name, int *param_shm_fd, mmapped_t **param_mapped) { EM_DEBUG_FUNC_BEGIN("shm_file_name [%p] param_shm_fd [%p], param_mapped [%p]", shm_file_name, param_shm_fd, param_mapped); char errno_buf[ERRNO_BUF_SIZE] = {0}; if (!shm_file_name || !param_shm_fd || !param_mapped) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } if (!(*param_mapped)) { @@ -476,22 +486,28 @@ int _initialize_shm_mutex(const char *shm_file_name, int *param_shm_fd, mmapped_ if (!(*param_shm_fd)) { /* open shm_file_name at first. Otherwise, the num of files in /proc/pid/fd will be increasing */ *param_shm_fd = shm_open(shm_file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if ((*param_shm_fd) == -1) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("FAIL: shm_open(): %s", EM_STRERROR(errno_buf)); return EMAIL_ERROR_SYSTEM_FAILURE; + /* LCOV_EXCL_STOP */ } } fchmod((*param_shm_fd), 0666); EM_DEBUG_LOG("** Create SHM FILE **"); if (ftruncate((*param_shm_fd), sizeof(mmapped_t)) != 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("ftruncate errno [%d]", errno); return EMAIL_ERROR_SYSTEM_FAILURE; + /* LCOV_EXCL_STOP */ } mmapped_t *tmp = (mmapped_t *)mmap(NULL, sizeof(mmapped_t), PROT_READ|PROT_WRITE, MAP_SHARED, (*param_shm_fd), 0); if (tmp == MAP_FAILED) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("mmap failed: %s", EM_STRERROR(errno_buf)); return EMAIL_ERROR_SYSTEM_FAILURE; + /* LCOV_EXCL_STOP */ } tmp->data = 0; @@ -509,7 +525,7 @@ int _initialize_shm_mutex(const char *shm_file_name, int *param_shm_fd, mmapped_ EM_DEBUG_FUNC_END(); return EMAIL_ERROR_NONE; } - + /* LCOV_EXCL_START */ int _timedlock_shm_mutex(mmapped_t *param_mapped, int sec) { EM_DEBUG_FUNC_BEGIN("param_mapped [%p], sec [%d]", param_mapped, sec); @@ -544,6 +560,7 @@ void _unlockshm_mutex(mmapped_t *param_mapped) pthread_mutex_unlock(&(param_mapped->mutex)); EM_DEBUG_FUNC_END(); } + /* LCOV_EXCL_STOP */ /* ------------------------------------------------------------------------------ */ @@ -1089,8 +1106,10 @@ static int _get_table_field_data_char(char **table, char *buf, int index) static int _get_table_field_data_int(char **table, int *buf, int index) { if ((table == NULL) || (buf == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("table[%p], buf[%p], index[%d]", table, buf, index); return false; + /* LCOV_EXCL_STOP */ } if (table[index] != NULL) { @@ -1099,16 +1118,19 @@ static int _get_table_field_data_int(char **table, int *buf, int index) } /* EM_DEBUG_LOG("Empty field. Set as zero"); */ - + /* LCOV_EXCL_START */ *buf = 0; return false; + /* LCOV_EXCL_STOP */ } static int _get_table_field_data_time_t(char **table, time_t *buf, int index) { if ((table == NULL) || (buf == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("table[%p], buf[%p], index[%d]", table, buf, index); return false; + /* LCOV_EXCL_STOP */ } if (table[index] != NULL) { @@ -1117,9 +1139,10 @@ static int _get_table_field_data_time_t(char **table, time_t *buf, int index) } /* EM_DEBUG_LOG("Empty field. Set as zero"); */ - + /* LCOV_EXCL_START */ *buf = 0; return false; + /* LCOV_EXCL_STOP */ } static int _get_table_field_data_string(char **table, char **buf, int ucs2, int index) @@ -1188,8 +1211,10 @@ static int _get_table_field_data_string_without_allocation(char **table, char *b static int _get_table_field_data_blob(char **table, void **buffer, int buffer_size, int index) { if ((table == NULL) || (buffer == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION(" table[%p], buffer[%p], buffer_size [%d], index[%d]", table, buffer, buffer_size, index); return false; + /* LCOV_EXCL_STOP */ } char *temp_buffer = table[index]; @@ -1197,6 +1222,7 @@ static int _get_table_field_data_blob(char **table, void **buffer, int buffer_si if (temp_buffer == NULL) buffer = NULL; else { + /* LCOV_EXCL_START */ *buffer = malloc(buffer_size); if (*buffer == NULL) { EM_DEBUG_EXCEPTION("allocation failed."); @@ -1204,6 +1230,7 @@ static int _get_table_field_data_blob(char **table, void **buffer, int buffer_si } memset(*buffer, 0, buffer_size); memcpy(*buffer, temp_buffer, buffer_size); + /* LCOV_EXCL_STOP */ } #ifdef _PRINT_STORAGE_LOG_ if (buf) @@ -1214,7 +1241,7 @@ static int _get_table_field_data_blob(char **table, void **buffer, int buffer_si return true; } - + /* LCOV_EXCL_START */ static int _get_stmt_field_data_char(DB_STMT hStmt, char *buf, int index) { if ((hStmt == NULL) || (buf == NULL) || (index < 0)) { @@ -1234,12 +1261,14 @@ static int _get_stmt_field_data_char(DB_STMT hStmt, char *buf, int index) return false; } - + /* LCOV_EXCL_STOP */ static int _get_stmt_field_data_int(DB_STMT hStmt, int *buf, int index) { if ((hStmt == NULL) || (buf == NULL) || (index < 0)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("buf[%p], index[%d]", buf, index); return false; + /* LCOV_EXCL_STOP */ } if (sqlite3_column_text(hStmt, index) != NULL) { @@ -1249,12 +1278,13 @@ static int _get_stmt_field_data_int(DB_STMT hStmt, int *buf, int index) #endif return true; } - + /* LCOV_EXCL_START */ EM_DEBUG_LOG("sqlite3_column_int fail. index [%d]", index); return false; + /* LCOV_EXCL_STOP */ } - + /* LCOV_EXCL_START */ static int _get_stmt_field_data_time_t(DB_STMT hStmt, time_t *buf, int index) { if ((hStmt == NULL) || (buf == NULL) || (index < 0)) { @@ -1273,7 +1303,7 @@ static int _get_stmt_field_data_time_t(DB_STMT hStmt, time_t *buf, int index) EM_DEBUG_LOG("_get_stmt_field_data_time_t fail. index [%d]", index); return false; } - + /* LCOV_EXCL_STOP */ static int _get_stmt_field_data_string(DB_STMT hStmt, char **buf, int ucs2, int index) { if (!hStmt || !buf || (index < 0)) { /*prevent 39619*/ @@ -1312,8 +1342,10 @@ static int _get_stmt_field_data_string(DB_STMT hStmt, char **buf, int ucs2, int static void _get_stmt_field_data_blob(DB_STMT hStmt, void **buf, int index) { if (!hStmt || !buf || (index < 0)) { /*prevent 39618*/ + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("No hStmt, buf[%p], index[%d]", buf, index); return; + /* LCOV_EXCL_STOP */ } int sLen = 0; @@ -1326,16 +1358,20 @@ static void _get_stmt_field_data_blob(DB_STMT hStmt, void **buf, int index) if (sLen > 0) { *buf = (char *) em_malloc(sLen); if (*buf == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_mallocfailed"); return; + /* LCOV_EXCL_STOP */ } memcpy(*buf, (void *)sqlite3_column_blob(hStmt, index), sLen); } else + /* LCOV_EXCL_START */ *buf = NULL; + /* LCOV_EXCL_STOP */ } - + /* LCOV_EXCL_START */ static int _bind_stmt_field_data_char(DB_STMT hStmt, int index, char value) { if ((hStmt == NULL) || (index < 0)) { @@ -1386,7 +1422,7 @@ static int _bind_stmt_field_data_time_t(DB_STMT hStmt, int index, time_t value) return true; } - + /* LCOV_EXCL_STOP */ static int _bind_stmt_field_data_string(DB_STMT hStmt, int index, char *value, int ucs2, int max_len) { if ((hStmt == NULL) || (index < 0)) { @@ -1446,7 +1482,7 @@ static int _bind_stmt_field_data_nstring(DB_STMT hStmt, int index, char *value, return true; } - + /* LCOV_EXCL_START */ static int _bind_stmt_field_data_blob(DB_STMT hStmt, int index, void *blob, int blob_size) { if ((hStmt == NULL) || (index < 0)) { @@ -1907,7 +1943,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END(); return err; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int em_db_open(char *db_file_path, sqlite3 **sqlite_handle, int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -1918,10 +1954,12 @@ INTERNAL_FUNC int em_db_open(char *db_file_path, sqlite3 **sqlite_handle, int *e EM_DEBUG_LOG_DEV("*sqlite_handle[%p]", *sqlite_handle); if (*sqlite_handle) { /*prevent 33351*/ + /* LCOV_EXCL_START */ EM_DEBUG_LOG_DEV(">>>>> DB Already Opened......"); if (err_code != NULL) *err_code = error; return true; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("DB file path : [%s]", db_file_path); @@ -1929,6 +1967,7 @@ INTERNAL_FUNC int em_db_open(char *db_file_path, sqlite3 **sqlite_handle, int *e /* db open */ EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_open(db_file_path, sqlite_handle), rc); if (SQLITE_OK != rc) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("sqlite3_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); if (SQLITE_PERM == rc || SQLITE_CANTOPEN == rc) error = EMAIL_ERROR_PERMISSION_DENIED; @@ -1960,27 +1999,32 @@ INTERNAL_FUNC int em_db_open(char *db_file_path, sqlite3 **sqlite_handle, int *e } } else goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } /* register busy handler */ EM_DEBUG_LOG_DEV(">>>>> Register DB Handle to busy handler: *sqlite_handle[%p]", *sqlite_handle); rc = sqlite3_busy_handler(*sqlite_handle, _callback_sqlite_busy_handler, NULL); /* Busy Handler registration, NULL is a parameter which will be passed to handler */ if (SQLITE_OK != rc) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("sqlite3_busy_handler fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); error = EMAIL_ERROR_DB_FAILURE; sqlite3_close(*sqlite_handle); *sqlite_handle = NULL; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } /* Register collation callback function */ rc = sqlite3_create_collation(*sqlite_handle, "CONVERTUTF8", SQLITE_UTF8, NULL, _callback_collation_utf7_sort); if (SQLITE_OK != rc) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("sqlite3_create_collation failed : [%d][%s]", rc, sqlite3_errmsg(*sqlite_handle)); error = EMAIL_ERROR_DB_FAILURE; sqlite3_close(*sqlite_handle); *sqlite_handle = NULL; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } ret = true; @@ -2009,16 +2053,19 @@ INTERNAL_FUNC sqlite3* emstorage_db_open(char *multi_user_name, int *err_code) char temp_file_path[MAX_PATH] = {0}; if (EM_SAFE_STRLEN(multi_user_name) > 0) { + /* LCOV_EXCL_START */ error = emcore_get_container_path(multi_user_name, &prefix_path); if (error != EMAIL_ERROR_CONTAINER_NOT_INITIALIZATION && error != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emcore_get_container_path failed :[%d]", error); goto FINISH_OFF; + /* LCOV_EXCL_STOP*/ } } else { prefix_path = strdup(""); } if (error == EMAIL_ERROR_CONTAINER_NOT_INITIALIZATION) { + /* LCOV_EXCL_START */ if ((error = emcore_get_canonicalize_path((char *)EMAIL_SERVICE_DB_FILE_PATH, &output_file_path)) != EMAIL_ERROR_NONE) { EM_DEBUG_EXCEPTION("emcore_get_canonicalize_path failed : [%d]", error); goto FINISH_OFF; @@ -2029,7 +2076,7 @@ INTERNAL_FUNC sqlite3* emstorage_db_open(char *multi_user_name, int *err_code) } else { SNPRINTF(temp_file_path, sizeof(temp_file_path), "%s%s", prefix_path, EMAIL_SERVICE_DB_FILE_PATH); } - + /* LCOV_EXCL_STOP */ if (!em_db_open(temp_file_path, &_db_handle, &error)) { EM_DEBUG_EXCEPTION("em_db_open failed[%d]", error); goto FINISH_OFF; @@ -2051,12 +2098,14 @@ FINISH_OFF: EM_SAFE_FREE(prefix_path); if (err_code != NULL) + /* LCOV_EXCL_START */ *err_code = error; + /* LCOV_EXCL_STOP */ EM_DEBUG_FUNC_END("ret [%p]", _db_handle); return _db_handle; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_db_close(char *multi_user_name, int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -2139,7 +2188,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_STOP */ static int emstorage_get_field_count_from_create_table_query(char *input_create_table_query, int *output_field_count) { EM_DEBUG_FUNC_BEGIN("input_create_table_query[%d], output_field_count[%p]", input_create_table_query, output_field_count); @@ -2148,8 +2197,10 @@ static int emstorage_get_field_count_from_create_table_query(char *input_create_ char *pos = NULL; if (input_create_table_query == NULL || output_field_count == NULL) { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_INVALID_PARAM; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } pos = input_create_table_query; @@ -2180,8 +2231,10 @@ INTERNAL_FUNC int emstorage_initialize_field_count() char **create_table_query = NULL; if (_field_count_of_table[CREATE_TABLE_MAIL_ACCOUNT_TBL] != 0) { + /* LCOV_EXCL_START */ err = EMAIL_ERROR_ALREADY_INITIALIZED; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } err = emcore_load_query_from_file((char *)EMAIL_SERVICE_CREATE_TABLE_QUERY_FILE_PATH, &create_table_query, &query_len); @@ -2218,7 +2271,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_create_table(char *multi_user_name, emstorage_create_db_type_t type, int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -2559,7 +2612,7 @@ INTERNAL_FUNC int emstorage_create_table(char *multi_user_name, emstorage_create } sqlite3_free_table(result); result = NULL; - + /* LCOV_EXCL_STOP */ #ifdef __FEATURE_LOCAL_ACTIVITY__ sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_local_activity_tbl';"; @@ -2594,6 +2647,7 @@ INTERNAL_FUNC int emstorage_create_table(char *multi_user_name, emstorage_create result = NULL; #endif /* __FEATURE_LOCAL_ACTIVITY__ */ /* create mail_certificate_tbl */ + /* LCOV_EXCL_START */ sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_certificate_tbl';"; /* rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); */ EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc); @@ -3084,16 +3138,18 @@ FINISH_OFF: return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emstorage_query_mail_tbl(char *multi_user_name, const char *conditional_clause, int transaction, emstorage_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code) { EM_DEBUG_FUNC_BEGIN("conditional_clause[%s], result_mail_tbl[%p], result_count [%p], transaction[%d], err_code[%p]", conditional_clause, result_mail_tbl, result_count, transaction, err_code); if (!conditional_clause || !result_mail_tbl || !result_count) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM: [%p] [%p] [%p]", conditional_clause, result_mail_tbl, result_mail_tbl); if (err_code != NULL) *err_code = EMAIL_ERROR_INVALID_PARAM; return false; + /* LCOV_EXCL_STOP */ } int i, col_index = FIELD_COUNT_OF_MAIL_TBL, rc, ret = false, count; @@ -3113,10 +3169,12 @@ INTERNAL_FUNC int emstorage_query_mail_tbl(char *multi_user_name, const char *co ("sqlite3_get_table failed [%d] [%s]", rc, sql_query_string)); if (!count) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("No mail found..."); ret = false; error = EMAIL_ERROR_MAIL_NOT_FOUND; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("There are [%d] mails.", count); @@ -3196,8 +3254,10 @@ FINISH_OFF: *result_mail_tbl = p_data_tbl; *result_count = count; } else { + /* LCOV_EXCL_START */ *result_mail_tbl = NULL; *result_count = 0; + /* LCOV_EXCL_STOP */ } EMSTORAGE_FINISH_READ_TRANSACTION(transaction); @@ -3212,6 +3272,7 @@ FINISH_OFF: } #ifdef __FEATURE_BODY_SEARCH__ + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_query_mail_text_tbl(char *multi_user_name, const char *conditional_clause, int transaction, emstorage_mail_text_tbl_t** result_mail_text_tbl, int *result_count, int *err_code) { EM_DEBUG_FUNC_BEGIN("conditional_clause[%s], result_mail_text_tbl[%p], result_count [%p], transaction[%d], err_code[%p]", conditional_clause, result_mail_text_tbl, result_count, transaction, err_code); @@ -3284,7 +3345,7 @@ FINISH_OFF: if (err_code != NULL) *err_code = error; - + /* LCOV_EXCL_STOP */ EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } @@ -3309,9 +3370,12 @@ INTERNAL_FUNC int emstorage_query_mailbox_tbl(char *multi_user_name, const char EMSTORAGE_START_READ_TRANSACTION(input_transaction); - if (input_get_mail_count == 0) { /* without mail count */ + if (input_get_mail_count == 0) { + /* LCOV_EXCL_START */ + /* without mail count */ col_index = 15; SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl AS MBT %s %s", fields, input_conditional_clause, input_ordering_clause); + /* LCOV_EXCL_STOP */ } else { /* with read count and total count */ col_index = 17; SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s, total, read FROM mail_box_tbl AS MBT LEFT OUTER JOIN (SELECT mailbox_id, count(mail_id) AS total, SUM(flags_seen_field) AS read FROM mail_tbl WHERE flags_deleted_field = 0 GROUP BY mailbox_id) AS MT ON MBT.mailbox_id = MT.mailbox_id %s %s", fields, input_conditional_clause, input_ordering_clause); @@ -3326,15 +3390,19 @@ INTERNAL_FUNC int emstorage_query_mailbox_tbl(char *multi_user_name, const char EM_DEBUG_LOG_DEV("result count [%d]", count); if (count == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG_SEC("Can't find mailbox query[%s]", sql_query_string); error = EMAIL_ERROR_MAILBOX_NOT_FOUND; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if ((p_data_tbl = (emstorage_mailbox_tbl_t*)em_malloc(sizeof(emstorage_mailbox_tbl_t) * count)) == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_mallocfailed..."); error = EMAIL_ERROR_OUT_OF_MEMORY; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } for (i = 0; i < count; i++) { @@ -3382,6 +3450,7 @@ FINISH_OFF: } /* Query series --------------------------------------------------------------*/ + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_check_duplicated_account(char *multi_user_name, email_account_t* account, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN(); @@ -4169,16 +4238,18 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_STOP*/ INTERNAL_FUNC int emstorage_get_account_by_id(char *multi_user_name, int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN("account_id[%d], pulloption[%d], account[%p], transaction[%d], err_code[%p]", account_id, pulloption, account, transaction, err_code); if (!account) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("account_id[%d], account[%p]", account_id, account); if (err_code != NULL) *err_code = EMAIL_ERROR_INVALID_PARAM; return false; + /* LCOV_EXCL_STOP */ } int ret = false; @@ -4431,7 +4502,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_get_password_length_of_account(char *multi_user_name, int account_id, int password_type, int *password_length, int *err_code) { EM_DEBUG_FUNC_BEGIN("account_id[%d], password_length[%p], err_code[%p]", account_id, password_length, err_code); @@ -5245,7 +5316,7 @@ INTERNAL_FUNC int emstorage_delete_account(char *multi_user_name, int account_id EM_DEBUG_EXCEPTION("emcore_remove_password_in_key_manager failed : [%d]", error); goto FINISH_OFF; } - + /* LCOV_EXCL_STOP */ ret = true; FINISH_OFF: @@ -5310,7 +5381,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_get_mailbox_count(char *multi_user_name, int account_id, int local_yn, int *count, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], count[%p], transaction[%d], err_code[%p]", account_id, local_yn, count, transaction, err_code); @@ -5637,7 +5708,7 @@ INTERNAL_FUNC int emstorage_get_mailbox_by_name(char *multi_user_name, int accou goto FINISH_OFF; } } - + /* LCOV_EXCL_STOP */ ret = true; FINISH_OFF: @@ -5689,7 +5760,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_get_mailbox_by_id(char *multi_user_name, int input_mailbox_id, emstorage_mailbox_tbl_t** output_mailbox) { EM_DEBUG_FUNC_BEGIN("input_mailbox_id[%d], output_mailbox[%p]", input_mailbox_id, output_mailbox); @@ -6607,7 +6678,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t** mailbox_list, int count, int *err_code) { EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%d], err_code[%p]", mailbox_list, count, err_code); @@ -6644,7 +6715,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_get_count_read_mail_uid(char *multi_user_name, int account_id, char *mailbox_name, int *count, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], count[%p], transaction[%d], err_code[%p]", account_id, mailbox_name , count, transaction, err_code); @@ -8419,7 +8490,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emstorage_get_mail_by_id(char *multi_user_name, int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], transaction[%d], err_code[%p]", mail_id, mail, transaction, err_code); @@ -8459,6 +8530,7 @@ FINISH_OFF: } #ifdef __FEATURE_BODY_SEARCH__ + /* LCOV_EXCL_START */ INTERNAL_FUNC int emstorage_get_mail_text_by_id(char *multi_user_name, int mail_id, emstorage_mail_text_tbl_t **mail_text, int transaction, int *err_code) { EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail_text[%p], transaction[%d], err_code[%p]", mail_id, mail_text, transaction, err_code); @@ -10340,7 +10412,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } - + /* LCOV_EXCL_STOP */ INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t** mail_list, int count, int *err_code) { EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d], err_code[%p]", mail_list, count, err_code); @@ -10392,6 +10464,7 @@ INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t** mail_list, int coun } #ifdef __FEATURE_BODY_SEARCH__ + /* LCOV_EXCL_START */ INTERNAL_FUNC void emstorage_free_mail_text(emstorage_mail_text_tbl_t** mail_text_list, int count, int *err_code) { EM_DEBUG_FUNC_BEGIN("mail_text_list[%p], count[%d], err_code[%p]", mail_text_list, count, err_code); @@ -15444,7 +15517,7 @@ FINISH_OFF: if (err_code != NULL) *err_code = err; - + /* LCOV_EXCL_STOP */ EM_DEBUG_FUNC_END("ret [%d]", ret); return ret; } @@ -15952,7 +16025,7 @@ FINISH_OFF: } #endif /* __FEATURE_LOCAL_ACTIVITY__ */ - + /* LCOV_EXCL_START */ static int _get_key_value_string_for_list_filter_rule(email_list_filter_rule_t *input_list_filter_rule, char **output_key_value_string) { EM_DEBUG_FUNC_BEGIN("input_list_filter_rule [%p], output_key_value_string [%p]", input_list_filter_rule, output_key_value_string); @@ -18145,5 +18218,5 @@ FINISH_OFF: return error; } #endif /* __FEATURE_UPDATE_DB_TABLE_SCHEMA__ */ - + /* LCOV_EXCL_STOP */ /*EOF*/ diff --git a/email-ipc/email-activation/email-dbus-activation.c b/email-ipc/email-activation/email-dbus-activation.c index 15c8916..265b0a5 100755 --- a/email-ipc/email-activation/email-dbus-activation.c +++ b/email-ipc/email-activation/email-dbus-activation.c @@ -67,7 +67,7 @@ EXPORT_API const gchar introspection_xml[] = " </method>" " </interface>" "</node>"; - + /* LCOV_EXCL_START */ static gboolean on_timer_proxy_new(gpointer userdata) { EM_DEBUG_LOG("on_timer_proxy_new"); @@ -80,7 +80,7 @@ static gboolean on_timer_proxy_new(gpointer userdata) return false; } - + /* LCOV_EXCL_STOP */ /* called from clients */ EXPORT_API int emipc_launch_email_service() { @@ -107,10 +107,12 @@ EXPORT_API int emipc_launch_email_service() g_source_remove(timer_tag); if (!bproxy) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("g_dbus_proxy_new_for_bus_sync error [%s]", gerror->message); ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } GVariant *result = g_dbus_proxy_call_sync(bproxy, @@ -123,10 +125,12 @@ EXPORT_API int emipc_launch_email_service() if (!result) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("g_dbus_proxy_call_sync 'Launch' error [%s]", gerror->message); ret = EMAIL_ERROR_IPC_PROTOCOL_FAILURE; goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } g_variant_get(result, "(i)", &ret); @@ -140,18 +144,20 @@ FINISH_OFF: g_object_unref(proxy_cancel); if (gerror) + /* LCOV_EXCL_START */ g_error_free(gerror); + /* LCOV_EXCL_STOP */ return ret; } - + /* LCOV_EXCL_START */ void cancellable_connect_cb() { EM_DEBUG_LOG("Cancellable is now canceled"); } - + /* LCOV_EXCL_STOP */ EXPORT_API GCancellable *cancel = NULL; - + /* LCOV_EXCL_START */ GVariant* em_gdbus_get_display_name(GVariant *parameters) { char *email_address = NULL; @@ -199,4 +205,4 @@ GVariant* em_gdbus_check_blocking_mode(GVariant *parameters) return ret; } - + /* LCOV_EXCL_STOP */ diff --git a/email-ipc/email-ipc-api.c b/email-ipc/email-ipc-api.c index bf2503d..09a2bd9 100755 --- a/email-ipc/email-ipc-api.c +++ b/email-ipc/email-ipc-api.c @@ -47,8 +47,10 @@ EXPORT_API HIPC_API emipc_create_email_api(long api_id) emipc_email_api_info *api_info = (emipc_email_api_info *)calloc(1, sizeof(emipc_email_api_info)); if (api_info == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("calloc failed"); return NULL; + /* LCOV_EXCL_STOP */ } api_info->api_id = api_id; @@ -66,7 +68,7 @@ EXPORT_API void emipc_destroy_email_api(HIPC_API api) emipc_free_api_info(api_info); EM_SAFE_FREE(api_info); } - + /* LCOV_EXCL_START */ EXPORT_API unsigned int emipc_get_api_id(HIPC_API api) { EM_DEBUG_FUNC_BEGIN("API = %p", api); @@ -90,7 +92,7 @@ EXPORT_API int emipc_get_app_id(HIPC_API api) EM_DEBUG_FUNC_END("app_id [%d]", api_info->app_id); return api_info->app_id; } - + /* LCOV_EXCL_STOP */ /* note: there incurs additional cost (malloc & memcpy). */ /* if data is a dynamic variable, please use emipc_dynamic_parameter instead */ EXPORT_API bool emipc_add_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length) @@ -99,8 +101,10 @@ EXPORT_API bool emipc_add_parameter(HIPC_API api, EPARAMETER_DIRECTION direction emipc_param_list *parameters = emipc_get_api_parameters(api, direction); if (!parameters) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_api_parameters failed"); return false; + /* LCOV_EXCL_STOP */ } return emipc_add_param_to_param_list(parameters, data, data_length); @@ -114,8 +118,10 @@ EXPORT_API bool emipc_add_dynamic_parameter(HIPC_API api, EPARAMETER_DIRECTION d emipc_param_list *parameters = emipc_get_api_parameters(api, direction); if (!parameters) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_get_api_parameters failed"); return false; + /* LCOV_EXCL_STOP */ } emipc_add_dynamic_param_to_param_list(parameters, data, data_length); @@ -132,25 +138,33 @@ EXPORT_API int emipc_get_parameter(HIPC_API input_api_handle, EPARAMETER_DIRECTI void *local_buffer = NULL; if (input_parameter_buffer_size == 0 || output_parameter_buffer == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } parameters = emipc_get_api_parameters(input_api_handle, input_parameter_direction); if (parameters == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_IPC_PROTOCOL_FAILURE"); return EMAIL_ERROR_IPC_PROTOCOL_FAILURE; + /* LCOV_EXCL_STOP */ } local_buffer = emipc_get_param_of_param_list(parameters, input_parameter_index); if (local_buffer == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_IPC_PROTOCOL_FAILURE"); return EMAIL_ERROR_IPC_PROTOCOL_FAILURE; + /* LCOV_EXCL_STOP */ } if (emipc_get_param_len_of_param_list(parameters, input_parameter_index) != input_parameter_buffer_size) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_IPC_PROTOCOL_FAILURE"); return EMAIL_ERROR_IPC_PROTOCOL_FAILURE; + /* LCOV_EXCL_STOP */ } memcpy(output_parameter_buffer, local_buffer, input_parameter_buffer_size); @@ -168,21 +182,25 @@ EXPORT_API void* emipc_get_nth_parameter_data(HIPC_API api_handle, EPARAMETER_DI parameters = emipc_get_api_parameters(api_handle, direction); if (parameters == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_IPC_PROTOCOL_FAILURE"); return NULL; + /* LCOV_EXCL_STOP */ } buf = emipc_get_param_of_param_list(parameters, param_index); if (!buf) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_IPC_PROTOCOL_FAILURE"); return NULL; + /* LCOV_EXCL_STOP_ */ } EM_DEBUG_FUNC_END(); return buf; } - + /* LCOV_EXCL_START */ EXPORT_API int emipc_get_parameter_length(HIPC_API api, EPARAMETER_DIRECTION direction, int parameter_index) { EM_DEBUG_FUNC_BEGIN(); @@ -259,7 +277,7 @@ FINISH_OFF: EM_DEBUG_FUNC_END("err [%d]", err); return err; } - + /* LCOV_EXCL_STOP */ EXPORT_API int emipc_get_user_name(char **output_user_name) { EM_DEBUG_FUNC_BEGIN(); diff --git a/email-ipc/email-ipc-api/email-ipc-api-info.c b/email-ipc/email-ipc-api/email-ipc-api-info.c index a4e0be4..4eab913 100755 --- a/email-ipc/email-ipc-api/email-ipc-api-info.c +++ b/email-ipc/email-ipc-api/email-ipc-api-info.c @@ -37,15 +37,19 @@ EXPORT_API bool emipc_deserialize_api_info(emipc_email_api_info *api_info, EPARA EM_DEBUG_FUNC_BEGIN("emipc_email_api_info : [%p], direction : [%d]", api_info, direction); if (!api_info || !stream) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid parameter."); return false; + /* LCOV_EXCL_STOP */ } if (api_info->params[direction] == NULL) { api_info->params[direction] = emipc_create_param_list(); if (api_info->params[direction] == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_param_list failed"); return false; + /* LCOV_EXCL_STOP */ } } @@ -62,15 +66,19 @@ EXPORT_API unsigned char *emipc_serialize_api_info(emipc_email_api_info *api_inf unsigned char *stream = NULL; if (!api_info) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid parameter."); return stream; + /* LCOV_EXCL_STOP */ } if (api_info->params[direction] == NULL) { api_info->params[direction] = emipc_create_param_list(); if (api_info->params[direction] == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_create_param_list failed"); return NULL; + /* LCOV_EXCL_STOP */ } } @@ -90,8 +98,10 @@ EXPORT_API void *emipc_get_parameters_of_api_info(emipc_email_api_info *api_info EM_DEBUG_FUNC_BEGIN("emipc_email_api_info : [%p], direction : [%d]", api_info, direction); if (!api_info) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("INVALID_PARAM"); return NULL; + /* LCOV_EXCL_STOP */ } if (api_info->params[direction] == NULL) { diff --git a/email-ipc/email-ipc-api/email-ipc-param-list.c b/email-ipc/email-ipc-api/email-ipc-param-list.c index fe8df67..ac36d38 100755 --- a/email-ipc/email-ipc-api/email-ipc-param-list.c +++ b/email-ipc/email-ipc-api/email-ipc-param-list.c @@ -42,8 +42,10 @@ EXPORT_API emipc_param_list *emipc_create_param_list() new_param_list = (emipc_param_list *)em_malloc(sizeof(emipc_param_list)); if (new_param_list == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed."); return NULL; + /* LCOV_EXCL_STOP */ } memset(new_param_list, 0x00, sizeof(emipc_param_list)); @@ -74,13 +76,17 @@ EXPORT_API bool emipc_parse_stream_of_param_list(void *stream, emipc_param_list /* Get the parameter count */ memcpy(¶meter_count, stream + (sizeof(int) * eSTREAM_COUNT), sizeof(int)); if (parameter_count < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("INVALID_PARAM : count %d", parameter_count); return false; + /* LCOV_EXCL_STOP */ } if (parameter_count == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("count %d", parameter_count); return true; + /* LCOV_EXCL_STOP */ } int stream_len = malloc_usable_size(stream); @@ -95,8 +101,10 @@ EXPORT_API bool emipc_parse_stream_of_param_list(void *stream, emipc_param_list for (i = 0; i < parameter_count; i++) { if (remain_len < sizeof(int)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Not enough remain stream_len[%d]", remain_len); return false; + /* LCOV_EXCL_STOP */ } /* reading length */ @@ -108,7 +116,9 @@ EXPORT_API bool emipc_parse_stream_of_param_list(void *stream, emipc_param_list if (remain_len > 0 && len > 0 && remain_len >= len) { if (emipc_add_param_to_param_list(param_list, (void *)cur, len) != true) + /* LCOV_EXCL_START */ EM_DEBUG_LOG("emipc_add_param_to_param_list() failed"); + /* LCOV_EXCL_STOP */ } else { EM_DEBUG_EXCEPTION("data_len[%d] is not in the boundary of remain stream_len", len); @@ -131,29 +141,37 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis EM_DEBUG_FUNC_BEGIN("param_list [%p] stream_length [%p]", param_list, stream_length); if (!param_list) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("no data to be serialized"); return NULL; + /* LCOV_EXCL_STOP */ } EM_SAFE_FREE(param_list->byte_stream); int stream_len = emipc_sum_param_list_length(param_list); if (stream_len <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("stream_len error %d", stream_len); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } param_list->byte_stream = (unsigned char*)calloc(1, stream_len); if (param_list->byte_stream == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("calloc failed : [%d]", errno); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } int pos = sizeof(int) * eSTREAM_COUNT; if (pos + (int)sizeof(param_list->param_count) > stream_len) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("%zu > stream_len", pos + sizeof(param_list->param_count)); EM_SAFE_FREE(param_list->byte_stream); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } memcpy((param_list->byte_stream + pos), ¶m_list->param_count, sizeof(param_list->param_count)); @@ -168,24 +186,30 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis for (index = 0; index < param_list->param_count; index++) { length = emipc_get_length(param_list->params[index]); if (length < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("index = %d, length = %d", index, length); EM_SAFE_FREE(param_list->byte_stream); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } if (pos + (int)sizeof(int) > stream_len) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("%zu > stream_len", pos + sizeof(int)); EM_SAFE_FREE(param_list->byte_stream); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } /* write param i length */ memcpy((param_list->byte_stream+pos), &length, sizeof(int)); pos += sizeof(int); if (pos + length > stream_len) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("%d > stream_len", pos + length); EM_SAFE_FREE(param_list->byte_stream); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } /* write param i data if length is greater than 0 */ if (length > 0) { diff --git a/email-ipc/email-ipc-api/email-ipc-param.c b/email-ipc/email-ipc-api/email-ipc-param.c index 2d9543e..de89f5c 100755 --- a/email-ipc/email-ipc-api/email-ipc-param.c +++ b/email-ipc/email-ipc-api/email-ipc-param.c @@ -31,8 +31,10 @@ EXPORT_API bool emipc_set_param(emipc_param *param, void *data, int len) EM_DEBUG_FUNC_BEGIN(); if (!param) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid paramter"); return false; + /* LCOV_EXCL_STOP */ } if (len == 0) @@ -53,8 +55,10 @@ EXPORT_API void emipc_set_dynamic_param(emipc_param *param, void *data, int len) EM_DEBUG_FUNC_BEGIN(); if (!param) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid paramter"); return; + /* LCOV_EXCL_STOP */ } /* even take care of null data */ diff --git a/email-ipc/email-ipc-proxy.c b/email-ipc/email-ipc-proxy.c index 5c609b4..6ddd0be 100755 --- a/email-ipc/email-ipc-proxy.c +++ b/email-ipc/email-ipc-proxy.c @@ -71,8 +71,10 @@ EXPORT_API int emipc_execute_proxy_api(HIPC_API api) EM_DEBUG_LOG_DEV("API [%p]", api_info); if (api_info == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("EMAIL_ERROR_INVALID_PARAM"); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG_SEC("Request: API_ID[%s][0x%x] RES_ID[%d] APP_ID[%d]",\ @@ -85,6 +87,7 @@ EXPORT_API int emipc_execute_proxy_api(HIPC_API api) /* connection retry */ if (!ret) { + /* LCOV_EXCL_START */ if (emipc_end_proxy_socket() != true) EM_DEBUG_LOG("emipc_end_proxy_socket() failed"); EM_DEBUG_LOG("Launch email-service daemon"); @@ -100,6 +103,7 @@ EXPORT_API int emipc_execute_proxy_api(HIPC_API api) err = EMAIL_ERROR_CONNECTION_FAILURE; goto FINISH_OFF; } + /* LCOV_EXCL_STOP */ } FINISH_OFF: diff --git a/email-ipc/email-ipc-stub.c b/email-ipc/email-ipc-stub.c index fc6a581..3ab2fbd 100755 --- a/email-ipc/email-ipc-stub.c +++ b/email-ipc/email-ipc-stub.c @@ -25,7 +25,7 @@ #include "email-stub-main.h" #include "email-debug-log.h" - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_initialize_stub(PFN_EXECUTE_API api_mapper) { EM_DEBUG_LOG("[IPCLib] ipcEmailStub_Initialize "); @@ -48,4 +48,4 @@ EXPORT_API bool emipc_execute_stub_api(HIPC_API api) return emipc_execute_api_stub_to_proxy(api_info); } - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-ipc/email-proxy/email-proxy-callback-info.c b/email-ipc/email-proxy/email-proxy-callback-info.c index 4f28ed6..edaa7fd 100755 --- a/email-ipc/email-proxy/email-proxy-callback-info.c +++ b/email-ipc/email-proxy/email-proxy-callback-info.c @@ -21,10 +21,11 @@ #include "email-proxy-callback-info.h" - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_set_cb_info_value(emipc_email_cb_info *cb_info, int api_id, void *fn_callback) { cb_info->api_id = api_id; cb_info->fn_callback = fn_callback; return true; } + /* LCOV_EXCL_STOP */ diff --git a/email-ipc/email-proxy/email-proxy-main.c b/email-ipc/email-proxy/email-proxy-main.c index 0e74dd9..dd7dfea 100755 --- a/email-ipc/email-proxy/email-proxy-main.c +++ b/email-ipc/email-proxy/email-proxy-main.c @@ -47,11 +47,13 @@ EXPORT_API int emipc_initialize_proxy_main() } if ((err = emipc_start_proxy_socket()) != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Socket start failed"); if (err == EMAIL_ERROR_PERMISSION_DENIED) return err; return EMAIL_ERROR_IPC_CONNECTION_FAILURE; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("Socket ID : %d", emipc_get_proxy_socket_id()); @@ -63,8 +65,10 @@ EXPORT_API int emipc_finalize_proxy_main() { EM_DEBUG_FUNC_BEGIN(); if (!emipc_end_all_proxy_sockets()) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_end_all_proxy_sockets failed"); return EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END(); @@ -82,15 +86,19 @@ EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info) int sending_bytes; if (!api_info) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid Parameter"); return false; + /* LCOV_EXCL_STOP */ } in_stream = emipc_serialize_api_info(api_info, ePARAMETER_IN, &length); if (!in_stream) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("NULL stream"); return false; + /* LCOV_EXCL_STOP */ } sending_bytes = emipc_send_proxy_socket(in_stream, length); diff --git a/email-ipc/email-proxy/email-proxy-socket.c b/email-ipc/email-proxy/email-proxy-socket.c index d9ab750..736a48e 100755 --- a/email-ipc/email-proxy/email-proxy-socket.c +++ b/email-ipc/email-proxy/email-proxy-socket.c @@ -55,20 +55,26 @@ EXPORT_API int emipc_start_proxy_socket() ret = emipc_init_email_socket(&socket_fd); if (!ret) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_init_email_socket failed"); return false; + /* LCOV_EXCL_STOP */ } ret = emipc_connect_email_socket(socket_fd); if (ret != EMAIL_ERROR_NONE) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("emipc_connect_email_socket failed"); return ret; + /* LCOV_EXCL_STOP */ } thread_socket_t* cur = (thread_socket_t*) em_malloc(sizeof(thread_socket_t)); if (!cur) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("em_malloc failed"); return false; + /* LCOV_EXCL_STOP */ } /* add a socket */ @@ -82,7 +88,7 @@ EXPORT_API int emipc_start_proxy_socket() return true; } - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_end_proxy_socket() { EM_DEBUG_FUNC_BEGIN(); @@ -110,7 +116,7 @@ EXPORT_API bool emipc_end_proxy_socket() return true; } - + /* LCOV_EXCL_STOP */ EXPORT_API bool emipc_end_all_proxy_sockets() { EM_DEBUG_FUNC_BEGIN(); @@ -132,8 +138,9 @@ EXPORT_API bool emipc_end_all_proxy_sockets() socket_head = g_list_delete_link(socket_head, del); continue; } - + /* LCOV_EXCL_START */ cur = g_list_next(cur); + /* LCOV_EXCL_STOP */ } g_list_free(socket_head); socket_head = NULL; @@ -151,18 +158,22 @@ EXPORT_API int emipc_send_proxy_socket(unsigned char *data, int len) /* if thread socket is not created */ if (!socket_fd) { + /* LCOV_EXCL_START */ int ret = emipc_start_proxy_socket(); if (!ret) { EM_DEBUG_EXCEPTION("[IPCLib] emipc_send_proxy_socket not connected"); return EMAIL_ERROR_IPC_SOCKET_FAILURE; } socket_fd = emipc_get_proxy_socket_id(); + /* LCOV_EXCL_STOP */ } int send_len = emipc_send_email_socket(socket_fd, data, len); if (send_len == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("[IPCLib] server closed connection %x", socket_fd); emipc_end_proxy_socket(); + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END("send_len [%d]", send_len); @@ -199,8 +210,10 @@ EXPORT_API int emipc_get_proxy_socket_id() static bool wait_for_reply(int fd) { if (fd < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Invalid file description : [%d]", fd); return false; + /* LCOV_EXCL_STOP */ } #if 0 int err = -1; @@ -237,26 +250,34 @@ static bool wait_for_reply(int fd) proxy_epfd = epoll_create(MAX_PROXY_EPOLL_EVENT); if (proxy_epfd < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("epoll_create failed : [%d][%s]", errno, EM_STRERROR(errno_buf)); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } proxy_ev.data.fd = fd; proxy_ev.events = EPOLLIN | EPOLLONESHOT; if (epoll_ctl(proxy_epfd, EPOLL_CTL_ADD, fd, &proxy_ev) == -1) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("epoll_ctl wait : [%d][%s]", errno, EM_STRERROR(errno_buf)); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("Wait for response poll_fd:[%d], proxy_fd:[%d]", proxy_epfd, fd); event_num = epoll_wait(proxy_epfd, proxy_ev_events, MAX_PROXY_EPOLL_EVENT, timeout); if (event_num == -1) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("epoll_wait failed : [%d][%s]", errno, EM_STRERROR(errno_buf)); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } else if (event_num == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Occured timeout proxy_fd[%d]", fd); goto FINISH_OFF; + /* LCOV_EXCL_STOP */ } else { for (i = 0; i < event_num; i++) { if (proxy_ev_events[i].events & EPOLLIN) { @@ -282,8 +303,10 @@ EXPORT_API int emipc_recv_proxy_socket(char **data) EM_DEBUG_FUNC_BEGIN(); int socket_fd = emipc_get_proxy_socket_id(); if (!socket_fd) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("[IPCLib] proxy_socket_fd[%d] is not available or disconnected", socket_fd); return EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ } if (!wait_for_reply(socket_fd)) { @@ -292,8 +315,10 @@ EXPORT_API int emipc_recv_proxy_socket(char **data) int recv_len = emipc_recv_email_socket(socket_fd, data); if (recv_len == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("[IPCLib] server closed connection %x", socket_fd); emipc_end_proxy_socket(); + /* LCOV_EXCL_STOP */ } return recv_len; diff --git a/email-ipc/email-socket/email-ipc-socket.c b/email-ipc/email-socket/email-ipc-socket.c index 9916f3b..ef3d656 100755 --- a/email-ipc/email-socket/email-ipc-socket.c +++ b/email-ipc/email-socket/email-ipc-socket.c @@ -50,8 +50,10 @@ EXPORT_API bool emipc_init_email_socket(int *fd) *fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (*fd < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("socket failed: %s", EM_STRERROR(errno_buf)); ret = false; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("Socket fd = %d", *fd); @@ -77,10 +79,12 @@ static int emipc_writen(int fd, const char *buf, int len) while (length > 0) { passed_len = send(fd, (const void *)buf, length, MSG_NOSIGNAL); if (passed_len == -1) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("send error [%d]", errno); if (errno == EINTR) continue; else if (errno == EPIPE) return 0; /* connection closed */ else return passed_len; /* -1 */ + /* LCOV_EXCL_STOP */ } else if (passed_len == 0) break; length -= passed_len; @@ -98,8 +102,10 @@ EXPORT_API int emipc_send_email_socket(int fd, unsigned char *buf, int len) EM_DEBUG_FUNC_BEGIN("fd [%d], buffer [%p], buf_len [%d]", fd, buf, len); if (!buf || len <= 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("No data to send %p, %d", buf, len); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG("Sending %dB data to [fd = %d]", len, fd); @@ -108,8 +114,10 @@ EXPORT_API int emipc_send_email_socket(int fd, unsigned char *buf, int len) if (write_len == 0) /* connection closed */ return 0; if (write_len != len) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("WARNING: buf_size [%d] != write_len[%d]", len, write_len); return EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END("write_len [%d]", write_len); return write_len; @@ -123,10 +131,12 @@ static int emipc_readn(int fd, char *buf, int len) while (length > 0) { read_len = read(fd, (void *)buf, length); if (read_len < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("read err %d", errno); if (errno == EINTR) continue; else if (errno == EPIPE) return 0; /* connection closed */ return read_len; + /* LCOV_EXCL_STOP */ } else if (read_len == 0) break; @@ -146,26 +156,34 @@ EXPORT_API int emipc_recv_email_socket(int fd, char **buf) char errno_buf[ERRNO_BUF_SIZE] = {0}; if (!buf) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("Buffer must not null"); return EMAIL_ERROR_INVALID_PARAM; + /* LCOV_EXCL_STOP */ } int read_len = 0; /* read the size of message. note that ioctl is non-blocking */ if (ioctl(fd, FIONREAD, &read_len)) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("ioctl failed: %s", EM_STRERROR(errno_buf)); return EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ } /* when server or client closed socket */ if (read_len == 0) { + /* LCOV_EXCL_START */ EM_DEBUG_LOG("[IPC Socket] connection is closed"); return 0; + /* LCOV_EXCL_STOP */ } *buf = (char *) malloc(read_len); if (*buf == NULL) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("Malloc failed"); return EMAIL_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } memset(*buf, 0x00, read_len); @@ -174,16 +192,18 @@ EXPORT_API int emipc_recv_email_socket(int fd, char **buf) if (len == 0) /* connection closed */ return 0; if (read_len != len) { + /* LCOV_EXCL_START */ EM_SAFE_FREE(*buf); EM_DEBUG_LOG("WARNING: buf_size [%d] != read_len[%d]", read_len, len); return EMAIL_ERROR_IPC_SOCKET_FAILURE; + /* LCOV_EXCL_STOP */ } EM_DEBUG_LOG_DEV("[IPC Socket] Receiving [%d] bytes Completed", len); return len; } - + /* LCOV_EXCL_START */ EXPORT_API int emipc_accept_email_socket(int fd) { EM_DEBUG_FUNC_BEGIN(); @@ -207,7 +227,6 @@ EXPORT_API int emipc_accept_email_socket(int fd) EM_DEBUG_FUNC_END(); return client_fd; } - EXPORT_API int emipc_open_email_socket(int fd, const char *path) { EM_DEBUG_FUNC_BEGIN("path [%s]", path); @@ -285,7 +304,7 @@ EXPORT_API int emipc_open_email_socket(int fd, const char *path) EM_DEBUG_FUNC_END(); return fd; } - + /* LCOV_EXCL_STOP */ EXPORT_API int emipc_connect_email_socket(int fd) { EM_DEBUG_FUNC_BEGIN(); @@ -303,8 +322,10 @@ EXPORT_API int emipc_connect_email_socket(int fd) server.sun_family = AF_UNIX; if (NULL == ipc_socket_path) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("ipc_socket_path is null"); return EMAIL_ERROR_SYSTEM_FAILURE; + /* LCOV_EXCL_STOP */ } strncpy(server.sun_path, ipc_socket_path, sizeof(server.sun_path)-1); @@ -312,6 +333,7 @@ EXPORT_API int emipc_connect_email_socket(int fd) EM_SAFE_FREE(ipc_socket_path); if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0) { + /* LCOV_EXCL_START */ EM_DEBUG_EXCEPTION("connect failed: [%s][errno=%d][fd=%d]", EM_STRERROR(errno_buf), errno, fd); p_errno = errno; @@ -321,6 +343,7 @@ EXPORT_API int emipc_connect_email_socket(int fd) err = EMAIL_ERROR_SYSTEM_FAILURE; return err; + /* LCOV_EXCL_STOP */ } EM_DEBUG_FUNC_END(); diff --git a/email-ipc/email-stub/email-stub-main.c b/email-ipc/email-stub/email-stub-main.c index 1a9f727..d11e6c1 100755 --- a/email-ipc/email-stub/email-stub-main.c +++ b/email-ipc/email-stub/email-stub-main.c @@ -33,7 +33,7 @@ static bool stub_socket = false; static PFN_EXECUTE_API this_fn_api_mapper = NULL; - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_initialize_stub_main(PFN_EXECUTE_API fn_api_mapper) { EM_DEBUG_FUNC_BEGIN(); @@ -115,3 +115,4 @@ EXPORT_API bool emipc_execute_api_stub_to_proxy(emipc_email_api_info *api_info) EM_DEBUG_FUNC_END(); return true; } + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-ipc/email-stub/email-stub-socket.c b/email-ipc/email-stub/email-stub-socket.c index 484f696..abbdc1d 100755 --- a/email-ipc/email-stub/email-stub-socket.c +++ b/email-ipc/email-stub/email-stub-socket.c @@ -48,7 +48,7 @@ static bool stop_thread = false; GList *connected_fd = NULL; static void *emipc_stub_socket_thread_proc(); - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_start_stub_socket() { bool ret = true; @@ -255,4 +255,4 @@ EXPORT_API int emipc_send_stub_socket(int sock_fd, void *data, int len) return sending_bytes; } /* stub socket accpet, recv, send */ - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-ipc/email-stub/email-stub-task-manager.c b/email-ipc/email-stub/email-stub-task-manager.c index f55fa60..a0d17a2 100755 --- a/email-ipc/email-stub/email-stub-task-manager.c +++ b/email-ipc/email-stub/email-stub-task-manager.c @@ -42,7 +42,7 @@ static GQueue *task_queue = NULL; pthread_mutex_t ipc_task_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t ipc_task_cond = PTHREAD_COND_INITIALIZER; - + /* LCOV_EXCL_START */ EXPORT_API bool emipc_start_task_thread() { EM_DEBUG_FUNC_BEGIN(); @@ -178,4 +178,4 @@ EXPORT_API void emipc_close_fd_in_task_queue(int fd) LEAVE_CRITICAL_SECTION(ipc_task_mutex); } - + /* LCOV_EXCL_STOP */
\ No newline at end of file diff --git a/email-ipc/email-stub/email-stub-task.c b/email-ipc/email-stub/email-stub-task.c index 36065c5..2312ab0 100755 --- a/email-ipc/email-stub/email-stub-task.c +++ b/email-ipc/email-stub/email-stub-task.c @@ -31,7 +31,7 @@ #include "email-stub-main.h" #include "email-debug-log.h" - + /* LCOV_EXCL_START */ EXPORT_API void emipc_free_email_task(emipc_email_task *task) { EM_DEBUG_FUNC_BEGIN("task [%p]", task); @@ -93,4 +93,4 @@ EXPORT_API bool emipc_run_task(emipc_email_task *task) return true; } - + /* LCOV_EXCL_STOP */ |