EM_DEBUG_EXCEPTION("tpl_map failed");
return;
}
+
tpl_load(tn, TPL_MEM, stream, stream_len);
tpl_unpack(tn, 0);
tpl_free(tn);
}
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);
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;
/* 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;
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;
}
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__ */
/* 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 ");
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))
return err;
}
+#ifdef __FEATURE_CONTAINER_ENABLE__
+
int buffer_size = 0;
char *user_name = NULL;
if (hAPI)
emipc_destroy_email_api(hAPI);
+#endif /* __FEATURE_CONTAINER_ENABLE__ */
+
EM_DEBUG_FUNC_END();
return err;
}
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);
}
{
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;
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;
memcpy((param_list->byte_stream + pos), ¶m_list->param_count, sizeof(param_list->param_count));
+ /* Add param count */
pos += sizeof(long);
int index = 0, length = 0;
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);
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;
}
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;
}IPC_STREAM_INFO;
typedef struct {
- int param_count;
+ long param_count;
emipc_param params[10];
unsigned char *byte_stream;
} emipc_param_list;