summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunghyun Kwon <sh0701.kwon@samsung.com>2015-08-28 18:19:53 +0900
committerSunghyun Kwon <sh0701.kwon@samsung.com>2015-08-28 18:19:53 +0900
commitf7ed1bdee11cda0ebe5ae47092c4bbc1913356a2 (patch)
tree02ddb09d184481345e5cd90d17b1f78312493b44
parentbd13a59c8d509d7b6609635db6c17061f941ade9 (diff)
downloademail-service-accepted/tizen/mobile/20150829.030100.tar.gz
email-service-accepted/tizen/mobile/20150829.030100.tar.bz2
email-service-accepted/tizen/mobile/20150829.030100.zip
Change-Id: I28e0b72be8230fda019c77a0708f360285d794dc
-rwxr-xr-xemail-common-use/email-convert.c1
-rw-r--r--email-core/email-core-key-manager.c3
-rwxr-xr-xemail-core/email-core-mm-callbacks.c2
-rwxr-xr-xemail-daemon/main.c23
-rwxr-xr-xemail-ipc/email-ipc-api.c4
-rwxr-xr-xemail-ipc/email-ipc-api/email-ipc-api-info.c4
-rwxr-xr-xemail-ipc/email-ipc-api/email-ipc-param-list.c28
-rwxr-xr-xemail-ipc/email-ipc-api/include/email-ipc-param-list.h2
8 files changed, 37 insertions, 30 deletions
diff --git a/email-common-use/email-convert.c b/email-common-use/email-convert.c
index 6b1de39..8832ef1 100755
--- a/email-common-use/email-convert.c
+++ b/email-common-use/email-convert.c
@@ -727,6 +727,7 @@ INTERNAL_FUNC void em_convert_byte_stream_to_account(char *stream, int stream_le
EM_DEBUG_EXCEPTION("tpl_map failed");
return;
}
+
tpl_load(tn, TPL_MEM, stream, stream_len);
tpl_unpack(tn, 0);
tpl_free(tn);
diff --git a/email-core/email-core-key-manager.c b/email-core/email-core-key-manager.c
index 3a177f4..be032b4 100644
--- a/email-core/email-core-key-manager.c
+++ b/email-core/email-core-key-manager.c
@@ -119,11 +119,12 @@ INTERNAL_FUNC int emcore_get_password_in_key_manager(char *data_name, char **sto
}
EM_DEBUG_LOG("stored_data : [%s]", email_data->data);
+ EM_DEBUG_LOG("stored_data length : [%d]", email_data->size);
FINISH_OFF:
if (stored_data)
- *stored_data = EM_SAFE_STRDUP(email_data->data);
+ *stored_data = g_strndup(email_data->data, email_data->size);
if (email_data)
ckmc_buffer_free(email_data);
diff --git a/email-core/email-core-mm-callbacks.c b/email-core/email-core-mm-callbacks.c
index ed66d59..8990b9f 100755
--- a/email-core/email-core-mm-callbacks.c
+++ b/email-core/email-core-mm-callbacks.c
@@ -291,7 +291,7 @@ INTERNAL_FUNC void mm_dlog(char *string)
INTERNAL_FUNC void mm_log(char *string, long errflg)
{
- switch ((short)errflg) {
+ switch (errflg) {
case NIL:
EM_DEBUG_LOG("IMAP_TOOLKIT_LOG [%s]", string);
break;
diff --git a/email-daemon/main.c b/email-daemon/main.c
index f75d62d..95ec925 100755
--- a/email-daemon/main.c
+++ b/email-daemon/main.c
@@ -2641,20 +2641,19 @@ void stb_add_account_with_validation(HIPC_API a_hAPI)
/* get account info */
buffer_size = emipc_get_nth_parameter_length(a_hAPI, ePARAMETER_IN, 0);
EM_DEBUG_LOG("size [%d]", buffer_size);
- if(buffer_size <= 0) {
+ if (buffer_size <= 0) {
err = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
- stream =(char*) emipc_get_nth_parameter_data(a_hAPI, ePARAMETER_IN, 0);
- if(!stream) {
+ stream = (char *)emipc_get_nth_parameter_data(a_hAPI, ePARAMETER_IN, 0);
+ if (!stream) {
err = EMAIL_ERROR_INVALID_PARAM;
goto FINISH_OFF;
}
account = em_malloc(sizeof(email_account_t));
-
- if(account == NULL) {
+ if (account == NULL) {
EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY");
err = EMAIL_ERROR_OUT_OF_MEMORY;
goto FINISH_OFF;
@@ -2663,7 +2662,7 @@ void stb_add_account_with_validation(HIPC_API a_hAPI)
em_convert_byte_stream_to_account(stream, buffer_size, account);
account->user_name = EM_SAFE_STRDUP(multi_user_name);
- if((err = emcore_add_account_to_unvalidated_account_list(account)) != EMAIL_ERROR_NONE) {
+ if ((err = emcore_add_account_to_unvalidated_account_list(account)) != EMAIL_ERROR_NONE) {
EM_DEBUG_EXCEPTION("emcore_add_account_to_unvalidated_account_list failed [%d]", err);
goto FINISH_OFF;
}
@@ -2677,18 +2676,18 @@ void stb_add_account_with_validation(HIPC_API a_hAPI)
ref_check_interval = ref_account->check_interval;
ref_account_id = ref_account->account_id;
- if(!emdaemon_validate_account_and_create(multi_user_name, ref_account, &handle, &err)) {
+ if (!emdaemon_validate_account_and_create(multi_user_name, ref_account, &handle, &err)) {
EM_DEBUG_EXCEPTION("emdaemon_validate_account_and_create fail [%d]", err);
goto FINISH_OFF;
}
#ifdef __FEATURE_AUTO_POLLING__
/* start auto polling, if check_interval not zero */
- if(ref_check_interval > 0 || (ref_account->peak_days > 0 && ref_account->peak_interval > 0)) {
+ if (ref_check_interval > 0 || (ref_account->peak_days > 0 && ref_account->peak_interval > 0)) {
if(!emdaemon_add_polling_alarm(multi_user_name, ref_account_id))
EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm[NOTI_ACCOUNT_ADD] : start auto poll failed >>> ");
}
#ifdef __FEATURE_IMAP_IDLE__
- else if(ref_check_interval == 0 || (ref_account->peak_days > 0 && ref_account->peak_interval == 0))
+ else if (ref_check_interval == 0 || (ref_account->peak_days > 0 && ref_account->peak_interval == 0))
emcore_refresh_imap_idle_thread();
#endif /* __FEATURE_IMAP_IDLE__ */
#endif /* __FEATURE_AUTO_POLLING__ */
@@ -2696,9 +2695,9 @@ void stb_add_account_with_validation(HIPC_API a_hAPI)
/* emdaemon_insert_accountinfo_to_contact(account); */
local_result = 1;
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+ if (!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
- if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+ if (!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
if (!emipc_execute_stub_api(a_hAPI))
EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed ");
@@ -3818,7 +3817,7 @@ void stb_get_user_name(HIPC_API a_hAPI)
EM_DEBUG_LOG("Domain name : [%s]", user_name);
if (!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
- EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+ EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
if (user_name) {
if (!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, user_name, EM_SAFE_STRLEN(user_name) + 1))
diff --git a/email-ipc/email-ipc-api.c b/email-ipc/email-ipc-api.c
index 7eeb889..c4532f7 100755
--- a/email-ipc/email-ipc-api.c
+++ b/email-ipc/email-ipc-api.c
@@ -271,6 +271,8 @@ EXPORT_API int emipc_get_user_name(char **output_user_name)
return err;
}
+#ifdef __FEATURE_CONTAINER_ENABLE__
+
int buffer_size = 0;
char *user_name = NULL;
@@ -301,6 +303,8 @@ FINISH_OFF:
if (hAPI)
emipc_destroy_email_api(hAPI);
+#endif /* __FEATURE_CONTAINER_ENABLE__ */
+
EM_DEBUG_FUNC_END();
return err;
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 76e1ee4..de8e88f 100755
--- a/email-ipc/email-ipc-api/email-ipc-api-info.c
+++ b/email-ipc/email-ipc-api/email-ipc-api-info.c
@@ -50,8 +50,8 @@ EXPORT_API bool emipc_deserialize_api_info(emipc_email_api_info *api_info, EPARA
}
api_info->api_id = *((long *)stream + eSTREAM_APIID);
- api_info->app_id = *((long*)stream + eSTREAM_APPID);
- api_info->response_id = *((long*)stream + eSTREAM_RESID);
+ api_info->app_id = *((long *)stream + eSTREAM_APPID);
+ api_info->response_id = *((long *)stream + eSTREAM_RESID);
return emipc_parse_stream_of_param_list(api_info->params[direction], stream);
}
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 aeb471e..708b955 100755
--- a/email-ipc/email-ipc-api/email-ipc-param-list.c
+++ b/email-ipc/email-ipc-api/email-ipc-param-list.c
@@ -70,27 +70,28 @@ EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, v
{
EM_DEBUG_FUNC_BEGIN();
long parameter_count = *((long *)stream + eSTREAM_COUNT);
- if(parameter_count < 0) {
+
+ if (parameter_count < 0) {
EM_DEBUG_LOG("INVALID_PARAM : count %d", parameter_count);
return false;
}
- if(parameter_count == 0) {
+ if (parameter_count == 0) {
EM_DEBUG_LOG("count %d", parameter_count);
return true;
}
int stream_len = malloc_usable_size(stream);
int remain_len = stream_len - (sizeof(long) * eSTREAM_DATA);
- EM_DEBUG_LOG_DEV ("Allocated stream size : %dbyte", stream_len);
+ EM_DEBUG_LOG_DEV("Allocated stream size : %dbyte", stream_len);
- unsigned char* cur = ((unsigned char*)stream) + sizeof(int)*eSTREAM_DATA;
+ unsigned char* cur = ((unsigned char *)stream) + (sizeof(long) * eSTREAM_DATA);
int i = 0;
/* stream is composed of data type which is encoded into length and data field */
int len = 0;
- for(i = 0; i < parameter_count; i++) {
+ for (i = 0; i < parameter_count; i++) {
if (remain_len < sizeof(int)) {
EM_DEBUG_EXCEPTION("Not enough remain stream_len[%d]", remain_len);
return false;
@@ -104,13 +105,13 @@ EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, v
remain_len -= sizeof(int);
if (remain_len > 0 && len > 0 && remain_len >= len)
- emipc_add_param_to_param_list(param_list, (void*)cur, len);
+ emipc_add_param_to_param_list(param_list, (void *)cur, len);
else {
EM_DEBUG_EXCEPTION("data_len[%d] is not in the boundary of remain stream_len", len);
return false;
}
- EM_DEBUG_LOG("Parsing stream : element %d is %dbyte long ", i, len);
+ EM_DEBUG_LOG("Parsing stream : element %d is %dbyte integer", i, len);
/* move to next parameter */
cur += len;
@@ -151,6 +152,7 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
memcpy((param_list->byte_stream + pos), &param_list->param_count, sizeof(param_list->param_count));
+ /* Add param count */
pos += sizeof(long);
int index = 0, length = 0;
@@ -165,14 +167,14 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
goto FINISH_OFF;
}
- if (pos + (int)sizeof(long) > stream_len) {
- EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(long));
+ if (pos + (int)sizeof(int) > stream_len) {
+ EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(int));
EM_SAFE_FREE(param_list->byte_stream);
goto FINISH_OFF;
}
/* write param i length */
- memcpy((param_list->byte_stream+pos), &length, sizeof(long));
- pos += sizeof(long);
+ memcpy((param_list->byte_stream+pos), &length, sizeof(int));
+ pos += sizeof(int);
if (pos + length > stream_len) {
EM_DEBUG_EXCEPTION("%d > stream_len", pos + length);
@@ -180,7 +182,7 @@ EXPORT_API unsigned char *emipc_serialize_param_list(emipc_param_list *param_lis
goto FINISH_OFF;
}
/* write param i data if length is greater than 0 */
- if( length > 0 ) {
+ if (length > 0) {
memcpy((param_list->byte_stream+pos), emipc_get_data(param_list->params[index]), length);
pos += length;
}
@@ -198,7 +200,7 @@ EXPORT_API int emipc_sum_param_list_length(emipc_param_list *param_list)
int length = sizeof(long) * eSTREAM_DATA;
int index;
for (index = 0; index < param_list->param_count; index++) {
- length += sizeof(long);
+ length += sizeof(int);
length += emipc_get_length(param_list->params[index]);
}
return length;
diff --git a/email-ipc/email-ipc-api/include/email-ipc-param-list.h b/email-ipc/email-ipc-api/include/email-ipc-param-list.h
index e12c17b..dab2e0b 100755
--- a/email-ipc/email-ipc-api/include/email-ipc-param-list.h
+++ b/email-ipc/email-ipc-api/include/email-ipc-param-list.h
@@ -36,7 +36,7 @@ typedef enum {
}IPC_STREAM_INFO;
typedef struct {
- int param_count;
+ long param_count;
emipc_param params[10];
unsigned char *byte_stream;
} emipc_param_list;