static int __ctsvc_ipc_unmarshal_composite_filter(const pims_ipc_data_h ipc_data, ctsvc_composite_filter_s* filter)
{
- int ret = CONTACTS_ERROR_NONE;
unsigned int size = 0;
char* str = NULL;
int count =0, i=0;
filter->view_uri = (char*)SAFE_STRDUP(str);
// filters
- if (ctsvc_ipc_unmarshal_int(ipc_data,&count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&count)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
for (i=0;i<count;i++) {
- if (ctsvc_ipc_unmarshal_int(ipc_data,(int*)&filter_type) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int*)&filter_type)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_IPC;
}
if (filter_type == CTSVC_FILTER_COMPOSITE) {
- ctsvc_composite_filter_s* com_filter = NULL;
+ ctsvc_composite_filter_s *com_filter = NULL;
com_filter = (ctsvc_composite_filter_s*)calloc(1,sizeof(ctsvc_composite_filter_s));
if (com_filter == NULL) {
- CTS_ERR("calloc fail");
- ret = CONTACTS_ERROR_OUT_OF_MEMORY;
- goto ERROR_RETURN;
+ CTS_ERR("calloc() Fail");
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
}
- if (__ctsvc_ipc_unmarshal_composite_filter(ipc_data, com_filter) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, com_filter)) {
+ CTS_ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
CONTACTS_FREE(com_filter);
- goto ERROR_RETURN;
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_IPC;
}
- filter->filters = g_slist_append(filter->filters,com_filter);
+ filter->filters = g_slist_append(filter->filters, com_filter);
}
else {
- ctsvc_attribute_filter_s* attr_filter = NULL;
+ ctsvc_attribute_filter_s *attr_filter = NULL;
attr_filter = (ctsvc_attribute_filter_s*)calloc(1,sizeof(ctsvc_attribute_filter_s));
if (attr_filter == NULL) {
- CTS_ERR("calloc fail");
- ret = CONTACTS_ERROR_OUT_OF_MEMORY;
- goto ERROR_RETURN;
+ CTS_ERR("calloc() Fail");
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
}
- if (__ctsvc_ipc_unmarshal_attribute_filter(ipc_data, filter_type, attr_filter) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_attribute_filter(ipc_data, filter_type, attr_filter)) {
+ CTS_ERR("__ctsvc_ipc_unmarshal_attribute_filter() Fail");
CONTACTS_FREE(attr_filter);
- goto ERROR_RETURN;
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_IPC;
}
filter->filters = g_slist_append(filter->filters,attr_filter);
}
}
// filters
- if (ctsvc_ipc_unmarshal_int(ipc_data,&count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &count)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_IPC;
}
for (i=0;i<count;i++) {
- if (ctsvc_ipc_unmarshal_int(ipc_data,(int*)&op) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, (int *)&op)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
+ __ctsvc_ipc_unmarshal_composite_filter_free(filter);
+ return CONTACTS_ERROR_IPC;
}
filter->filter_ops = g_slist_append(filter->filter_ops, (void*)op);
}
filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(filter->view_uri, &filter->property_count);
return CONTACTS_ERROR_NONE;
-
-ERROR_RETURN:
- __ctsvc_ipc_unmarshal_composite_filter_free(filter);
- return ret;
}
static int __ctsvc_ipc_marshal_composite_filter(const ctsvc_composite_filter_s* filter, pims_ipc_data_h ipc_data)
{
- if (ctsvc_ipc_marshal_int((filter->filter_type),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
// view_uri
int length = strlen(filter->view_uri);
if (pims_ipc_data_put(ipc_data,(void*)filter->view_uri,length+1) < 0) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ CTS_ERR("pims_ipc_data_put() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
// filter->filters
GSList *cursor = filter->filters;
ctsvc_filter_s* child_filter;
- if (ctsvc_ipc_marshal_int(count,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
while (cursor) {
child_filter = (ctsvc_filter_s*)cursor->data;
if (child_filter->filter_type == CTSVC_FILTER_COMPOSITE) {
- if (__ctsvc_ipc_marshal_composite_filter((ctsvc_composite_filter_s*)child_filter, ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("__ctsvc_ipc_marshal_composite_filter fail");
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter((ctsvc_composite_filter_s*)child_filter, ipc_data)) {
+ CTS_ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
else {
- if (__ctsvc_ipc_marshal_attribute_filter((ctsvc_attribute_filter_s*)child_filter, ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("__ctsvc_ipc_marshal_attribute_filter fail");
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_attribute_filter((ctsvc_attribute_filter_s*)child_filter, ipc_data)) {
+ CTS_ERR("__ctsvc_ipc_marshal_attribute_filter() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
}
}
else {
- if (ctsvc_ipc_marshal_int(0,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
int count = g_slist_length(filter->filter_ops);
GSList *cursor = filter->filter_ops;
- if (ctsvc_ipc_marshal_int(count,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
while (cursor) {
contacts_filter_operator_e op = (contacts_filter_operator_e)cursor->data;
- if (ctsvc_ipc_marshal_int(op,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(op,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
}
else {
- if (ctsvc_ipc_marshal_int(0,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
static int __ctsvc_ipc_unmarshal_attribute_filter(const pims_ipc_data_h ipc_data, const ctsvc_filter_type_e filter_type, ctsvc_attribute_filter_s* filter)
{
filter->filter_type = filter_type;
- if (ctsvc_ipc_unmarshal_int(ipc_data,&filter->property_id) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->property_id)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_unmarshal_int(ipc_data,&filter->match) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->match)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
switch(filter->filter_type) {
case CTSVC_FILTER_STR:
- if (ctsvc_ipc_unmarshal_string(ipc_data,&filter->value.s) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_string(ipc_data,&filter->value.s)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_string() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_INT:
- if (ctsvc_ipc_unmarshal_int(ipc_data,&filter->value.i) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&filter->value.i)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_BOOL:
- if (ctsvc_ipc_unmarshal_bool(ipc_data,&filter->value.b) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&filter->value.b)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_DOUBLE:
- if (ctsvc_ipc_unmarshal_double(ipc_data,&filter->value.d) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_double(ipc_data,&filter->value.d)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_double() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_LLI:
- if (ctsvc_ipc_unmarshal_lli(ipc_data,&filter->value.l) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_lli(ipc_data,&filter->value.l)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_lli() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
static int __ctsvc_ipc_marshal_attribute_filter(const ctsvc_attribute_filter_s* filter, pims_ipc_data_h ipc_data)
{
- if (ctsvc_ipc_marshal_int((filter->filter_type),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->filter_type),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_int((filter->property_id),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->property_id),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_int((filter->match),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->match),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
switch(filter->filter_type) {
case CTSVC_FILTER_STR:
- if (ctsvc_ipc_marshal_string((filter->value.s),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_string((filter->value.s),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_string() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_INT:
- if (ctsvc_ipc_marshal_int((filter->value.i),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int((filter->value.i),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_BOOL:
- if (ctsvc_ipc_marshal_bool((filter->value.b),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool((filter->value.b),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_DOUBLE:
- if (ctsvc_ipc_marshal_double((filter->value.d),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_double((filter->value.d),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_double() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
case CTSVC_FILTER_LLI:
- if (ctsvc_ipc_marshal_lli((filter->value.l),ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_lli((filter->value.l),ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_lli() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
break;
RETVM_IF(NULL == precord || NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter");
- if (ctsvc_ipc_unmarshal_record_common(ipc_data, &common) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_unmarshal_common fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record_common(ipc_data, &common)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_record_common() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
ret = contacts_record_create(common.view_uri, precord);
- if (ret != CONTACTS_ERROR_NONE) {
- CTS_ERR("create activity record fail");
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("contacts_record_create() Fail");
free(common.properties_flags);
return ret;
}
ctsvc_record_s *common = (ctsvc_record_s*)(record);
- if (ctsvc_ipc_marshal_record_common(common, ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_marshal_common fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record_common(common, ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_record_common() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
tmp = pims_ipc_data_get(ipc_data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get string fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
length = *(int*)tmp;
unsigned int size = 0;
void *tmp = pims_ipc_data_get(data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get int fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
unsigned int size = 0;
void *tmp = pims_ipc_data_get(data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get unsigned int fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
unsigned int size = 0;
void *tmp = pims_ipc_data_get(data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get bool fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
unsigned int size = 0;
void *tmp = pims_ipc_data_get(data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get lli fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
unsigned int size = 0;
void *tmp = pims_ipc_data_get(data, &size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get long fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
unsigned int size = 0;
void* tmp = pims_ipc_data_get(data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get double fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
RETV_IF(ipc_data==NULL,CONTACTS_ERROR_NO_DATA);
tmp = pims_ipc_data_get(ipc_data,&size);
if (tmp == NULL) {
- CTS_ERR("pims_ipc_data_get fail");
+ CTS_ERR("pims_ipc_data_get() Fail");
return CONTACTS_ERROR_NO_DATA;
}
else {
tmp_properties_flags = (unsigned char*)pims_ipc_data_get(ipc_data, &size);
common->properties_flags = calloc(common->property_max_count, sizeof(char));
if (common->properties_flags == NULL) {
- CTS_ERR("calloc fail");
+ CTS_ERR("calloc() Fail");
return CONTACTS_ERROR_OUT_OF_MEMORY;
}
memcpy(common->properties_flags, tmp_properties_flags, sizeof(char)*common->property_max_count);
int length = strlen(common->view_uri);
if (pims_ipc_data_put(ipc_data,(void*)common->view_uri,length+1) < 0) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ CTS_ERR("pims_ipc_data_put() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
if (0 < common->property_max_count) {
if (pims_ipc_data_put(ipc_data,(void*)common->properties_flags,sizeof(unsigned char)*common->property_max_count) < 0) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ CTS_ERR("pims_ipc_data_put() Fail");
return CONTACTS_ERROR_NO_DATA;
}
}
return CONTACTS_ERROR_NONE;
}
-int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *query)
+int ctsvc_ipc_unmarshal_query(const pims_ipc_data_h ipc_data, contacts_query_h *out_query)
{
- ctsvc_query_s *que = NULL;
+ ctsvc_query_s *query = NULL;
unsigned int size = 0;
char* str = NULL;
unsigned int count = 0, i = 0;
int ret = CONTACTS_ERROR_NONE;
- RETV_IF(NULL == query, CONTACTS_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_query, CONTACTS_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
// view_uri
- str = (char*)pims_ipc_data_get(ipc_data,&size);
+ str = (char*)pims_ipc_data_get(ipc_data, &size);
- ret = contacts_query_create(str, query);
- if (ret != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_query_create fail");
+ ret = contacts_query_create(str, out_query);
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("contacts_query_create() Fail");
return ret;
}
+ query = (ctsvc_query_s *)*out_query;
- que = (ctsvc_query_s *) *query;
-
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) {
+ CTS_ERR("contacts_query_create() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (count == 0) {
- que->filter = NULL;
+ if (0 == count) {
+ query->filter = NULL;
}
else {
ctsvc_composite_filter_s *filter = NULL;
filter = (ctsvc_composite_filter_s *)calloc(1, sizeof(ctsvc_composite_filter_s));
if (NULL == filter) {
- CTS_ERR("calloc fail");
- ret = CONTACTS_ERROR_OUT_OF_MEMORY;
- goto ERROR_RETURN;
+ CTS_ERR("calloc() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
}
filter->filter_type = CTSVC_FILTER_COMPOSITE;
- filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(que->view_uri, &filter->property_count);
- que->filter = filter;
+ filter->properties = (property_info_s *)ctsvc_view_get_all_property_infos(query->view_uri, &filter->property_count);
+ query->filter = filter;
// for filter_type
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &count)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (__ctsvc_ipc_unmarshal_composite_filter(ipc_data,que->filter) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_unmarshal_composite_filter(ipc_data, query->filter)) {
+ CTS_ERR("__ctsvc_ipc_unmarshal_composite_filter() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
}
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(que->projection_count)) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &(query->projection_count))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (0 < que->projection_count) {
- que->projection = (unsigned int*)malloc(sizeof(unsigned int)*que->projection_count);
- if (que->projection == NULL) {
- CTS_ERR("malloc fail");
- ret = CONTACTS_ERROR_OUT_OF_MEMORY;
- goto ERROR_RETURN;
+ if (0 < query->projection_count) {
+ query->projection = (unsigned int*)malloc(sizeof(unsigned int)*query->projection_count);
+ if (query->projection == NULL) {
+ CTS_ERR("malloc() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
}
- for (i=0;i<que->projection_count;i++) {
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(que->projection[i])) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ for (i=0;i<query->projection_count;i++) {
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(query->projection[i]))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
}
}
else {
- que->projection = NULL;
+ query->projection = NULL;
}
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(que->sort_property_id)) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&(query->sort_property_id))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (ctsvc_ipc_unmarshal_bool(ipc_data,&(que->sort_asc)) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&(query->sort_asc))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (ctsvc_ipc_unmarshal_bool(ipc_data,&(que->distinct)) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_bool(ipc_data,&(query->distinct))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_bool() Fail");
+ contacts_query_destroy(*out_query);
+ *out_query = NULL;
+ return CONTACTS_ERROR_IPC;
}
return CONTACTS_ERROR_NONE;
-
-ERROR_RETURN:
- contacts_query_destroy(*query);
- *query = NULL;
-
- return ret;
}
int ctsvc_ipc_marshal_query(const contacts_query_h query, pims_ipc_data_h ipc_data)
//view_uri
length = strlen(que->view_uri);
if (pims_ipc_data_put(ipc_data,(void*)que->view_uri,length+1) < 0) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ CTS_ERR("pims_ipc_data_put() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
if (que->filter) {
- if (ctsvc_ipc_marshal_int(1,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(1,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (__ctsvc_ipc_marshal_composite_filter(que->filter,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != __ctsvc_ipc_marshal_composite_filter(que->filter,ipc_data)) {
+ CTS_ERR("__ctsvc_ipc_marshal_composite_filter() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
else {
- if (ctsvc_ipc_marshal_int(0,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(0,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
- if (ctsvc_ipc_marshal_unsigned_int(que->projection_count,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection_count,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
for (i=0;i<que->projection_count;i++) {
- if (ctsvc_ipc_marshal_unsigned_int(que->projection[i],ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->projection[i],ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
- if (ctsvc_ipc_marshal_unsigned_int(que->sort_property_id,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_unsigned_int(que->sort_property_id,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_unsigned_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_bool(que->sort_asc,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->sort_asc,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_bool(que->distinct,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_bool(que->distinct,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_bool() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
int count = 0;
unsigned int deleted_count = 0;
contacts_record_h record;
- int ret = CONTACTS_ERROR_NONE;
RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
- if (contacts_list_create(list) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_create fail");
+ if (CONTACTS_ERROR_NONE != contacts_list_create(list)) {
+ CTS_ERR("contacts_list_create() Fail");
return CONTACTS_ERROR_OUT_OF_MEMORY;
}
- if (ctsvc_ipc_unmarshal_int(ipc_data,&(count)) != CONTACTS_ERROR_NONE) {
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data, &(count))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
contacts_list_destroy(*list, true);
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- return CONTACTS_ERROR_INVALID_PARAMETER;
+ *list = NULL;
+ return CONTACTS_ERROR_IPC;
}
unsigned int i = 0;
for (i=0;i<count;i++) {
- if (ctsvc_ipc_unmarshal_record(ipc_data,&record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+ contacts_list_destroy(*list, true);
+ *list = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (contacts_list_add(*list,record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_add fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != contacts_list_add(*list, record)) {
+ CTS_ERR("contacts_list_add() Fail");
+ contacts_list_destroy(*list, true);
+ *list = NULL;
+ return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&deleted_count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data, &deleted_count)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
+ contacts_list_destroy(*list, true);
+ *list = NULL;
+ return CONTACTS_ERROR_IPC;
}
i = 0;
for (i=0;i<deleted_count;i++) {
- if (ctsvc_ipc_unmarshal_record(ipc_data,&record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_unmarshal fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data, &record)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
+ contacts_list_destroy(*list, true);
+ *list = NULL;
+ return CONTACTS_ERROR_IPC;
}
- if (ctsvc_list_append_deleted_record(*list,record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_add fail");
- ret = CONTACTS_ERROR_INVALID_PARAMETER;
- goto ERROR_RETURN;
+ if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list, record)) {
+ CTS_ERR("ctsvc_list_append_deleted_record() Fail");
+ contacts_list_destroy(*list, true);
+ *list = NULL;
+ return CONTACTS_ERROR_IPC;
}
}
return CONTACTS_ERROR_NONE;
-
-ERROR_RETURN:
- if (*list) {
- contacts_list_destroy(*list, true);
- *list = NULL;
- }
-
- return ret;
}
int ctsvc_ipc_unmarshal_child_list(const pims_ipc_data_h ipc_data, contacts_list_h* list)
RETV_IF(NULL == list, CONTACTS_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
- if (ctsvc_ipc_unmarshal_int(ipc_data,&(count)) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_unmarshal_int fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_int(ipc_data,&(count))) {
+ CTS_ERR("ctsvc_ipc_unmarshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
for (i=0;i<count;i++) {
- if (ctsvc_ipc_unmarshal_record(ipc_data,&record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_unmarshal_record fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data,&record)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (contacts_list_add(*list,record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_add fail");
+ if (CONTACTS_ERROR_NONE != contacts_list_add(*list,record)) {
+ CTS_ERR("contacts_list_add() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
- if (ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&deleted_count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_unsigned_int(ipc_data,&deleted_count)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_unsigned_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
i = 0;
for (i=0;i<deleted_count;i++) {
- if (ctsvc_ipc_unmarshal_record(ipc_data,&record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_ipc_unmarshal_record fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_unmarshal_record(ipc_data,&record)) {
+ CTS_ERR("ctsvc_ipc_unmarshal_record() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_list_append_deleted_record(*list,record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("ctsvc_list_append_deleted_record fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_list_append_deleted_record(*list,record)) {
+ CTS_ERR("ctsvc_list_append_deleted_record() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
RETV_IF(NULL == ipc_data, CONTACTS_ERROR_INVALID_PARAMETER);
// count
- if (contacts_list_get_count(list, &count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_get_count fail");
+ if (CONTACTS_ERROR_NONE != contacts_list_get_count(list, &count)) {
+ CTS_ERR("contacts_list_get_count() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_int(count,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(count,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
unsigned int i = 0;
for (i=0;i<count;i++) {
- if (contacts_list_get_current_record_p(list,&record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_get_count fail");
+ if (CONTACTS_ERROR_NONE != contacts_list_get_current_record_p(list,&record)) {
+ CTS_ERR("contacts_list_get_current_record_p() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_record(record,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_record() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (contacts_list_next(list) == CONTACTS_ERROR_NO_DATA) {
+ if (CONTACTS_ERROR_NO_DATA == contacts_list_next(list)) {
break;
}
}
// count
- if (ctsvc_list_get_deleted_count(list, &deleted_count) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_get_count fail");
+ if (ctsvc_list_get_deleted_count(list, &deleted_count)) {
+ CTS_ERR("ctsvc_list_get_deleted_count() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_int(deleted_count,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(deleted_count,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_int() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
i = 0;
for (i=0;i<deleted_count;i++) {
- if (ctsvc_list_get_deleted_nth_record_p(list, i, &record) != CONTACTS_ERROR_NONE) {
- CTS_ERR("contacts_list_get_count fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_list_get_deleted_nth_record_p(list, i, &record)) {
+ CTS_ERR("ctsvc_list_get_deleted_nth_record_p() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
- if (ctsvc_ipc_marshal_record(record,ipc_data) != CONTACTS_ERROR_NONE) {
- CTS_ERR("_ctsvc_ipc_marshal fail");
+ if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_record(record,ipc_data)) {
+ CTS_ERR("ctsvc_ipc_marshal_record() Fail");
return CONTACTS_ERROR_INVALID_PARAMETER;
}
}
static int __ctsvc_normalize_str(const char *src, char **dest)
{
- int ret = CONTACTS_ERROR_NONE;
int32_t tmp_size = 100;
int32_t upper_size;
int32_t size = 100;
UChar *result = NULL;
tmp_result = calloc(1, sizeof(UChar)*(tmp_size+1));
- u_strFromUTF8(tmp_result, tmp_size + 1, &tmp_size, src, -1, &status);
+ if (NULL == tmp_result) {
+ CTS_ERR("calloc() Fail");
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+ u_strFromUTF8(tmp_result, tmp_size + 1, &tmp_size, src, -1, &status);
if (status == U_BUFFER_OVERFLOW_ERROR) {
status = U_ZERO_ERROR;
free(tmp_result);
tmp_result = calloc(1, sizeof(UChar) * (tmp_size + 1));
+ if (NULL == tmp_result) {
+ CTS_ERR("calloc() Fail");
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
u_strFromUTF8(tmp_result, tmp_size + 1, NULL, src, -1, &status);
if (U_FAILURE(status)) {
CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ return CONTACTS_ERROR_SYSTEM;
}
}
else if (U_FAILURE(status)) {
CTS_ERR("u_strFromUTF8() Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ return CONTACTS_ERROR_SYSTEM;
}
tmp_upper = calloc(1, sizeof(UChar)*(tmp_size+1));
+ if (NULL == tmp_upper) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
upper_size = u_strToUpper(tmp_upper, tmp_size+1, tmp_result, -1, NULL, &status);
if (status == U_BUFFER_OVERFLOW_ERROR) {
status = U_ZERO_ERROR;
free(tmp_upper);
tmp_upper = calloc(1, sizeof(UChar) * (upper_size + 1));
+ if (NULL == tmp_upper) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
u_strFromUTF8(tmp_upper, upper_size + 1, NULL, src, -1, &status);
if (U_FAILURE(status)) {
CTS_ERR("u_strFromUTF8()Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ free(tmp_upper);
+ return CONTACTS_ERROR_SYSTEM;
}
}
else if (U_FAILURE(status)) {
CTS_ERR("u_strToUpper() Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ free(tmp_upper);
+ return CONTACTS_ERROR_SYSTEM;
}
result = calloc(1, sizeof(UChar)*(size+1));
- size = unorm_normalize(tmp_upper, -1, UNORM_NFD, 0,
- result, size+1, &status);
+ if (NULL == result) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ free(tmp_upper);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
+ size = unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status);
if (status == U_BUFFER_OVERFLOW_ERROR) {
status = U_ZERO_ERROR;
free(result);
result = calloc(1, sizeof(UChar)*(size + 1));
+ if (NULL == result) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ free(tmp_upper);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
unorm_normalize(tmp_upper, -1, UNORM_NFD, 0, result, size+1, &status);
if (U_FAILURE(status)) {
CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ free(tmp_upper);
+ free(result);
+ return CONTACTS_ERROR_SYSTEM;
}
}
else if (U_FAILURE(status)) {
CTS_ERR("unorm_normalize() Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
- goto DATA_FREE;
+ free(tmp_result);
+ free(tmp_upper);
+ free(result);
+ return CONTACTS_ERROR_SYSTEM;
}
- ret = ctsvc_check_language(result);
+ ctsvc_check_language(result);
ctsvc_extra_normalize(result, size);
// remove diacritical : U+3000 ~ U+034F
int i, j;
UChar *temp_result = NULL;
temp_result = calloc(1, sizeof(UChar)*(size+1));
+ if (NULL == temp_result) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ free(tmp_upper);
+ free(result);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
+
bool replaced = false;
for (i=0,j=0; i<size;i++) {
if (CTSVC_COMPARE_BETWEEN((UChar)CTSVC_COMBINING_DIACRITICAL_MARKS_START,
u_strToUTF8(NULL, 0, &size, result, -1, &status);
status = U_ZERO_ERROR;
*dest = calloc(1, sizeof(char) * (size+1));
+ if (NULL == *dest) {
+ CTS_ERR("calloc() Fail");
+ free(tmp_result);
+ free(tmp_upper);
+ free(result);
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ }
u_strToUTF8(*dest, size+1, NULL, result, -1, &status);
if (U_FAILURE(status)) {
CTS_ERR("u_strToUTF8() Fail(%s)", u_errorName(status));
- ret = CONTACTS_ERROR_SYSTEM;
free(*dest);
*dest = NULL;
- goto DATA_FREE;
+ free(tmp_result);
+ free(tmp_upper);
+ free(result);
+ return CONTACTS_ERROR_SYSTEM;
}
-
-DATA_FREE:
free(tmp_result);
free(tmp_upper);
free(result);
- return ret;
+ return CONTACTS_ERROR_NONE;
}
static int __ctsvc_convert_halfwidth_ascii_and_symbol(const char *src, UChar *dest, int dest_size, int* str_size)
UChar unicodes[LARGE_BUFFER_SIZE+1];
int ustr_size = 0;
- if (__ctsvc_convert_halfwidth_ascii_and_symbol(src, unicodes, LARGE_BUFFER_SIZE, &ustr_size) != CONTACTS_ERROR_NONE) {
+ if (CONTACTS_ERROR_NONE != __ctsvc_convert_halfwidth_ascii_and_symbol(src, unicodes, LARGE_BUFFER_SIZE, &ustr_size)) {
CTS_ERR("convert to halfwidth Fail! %s ", src);
return CONTACTS_ERROR_SYSTEM;
if (first_str[0] == '\0' || __ctsvc_check_range_out_index(first_str)) {
length = ctsvc_check_utf8(src[0]);
- RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8 is Fail");
+
+ RETVM_IF(length <= 0, CONTACTS_ERROR_INTERNAL, "check_utf8() Fail");
memset(first_str,0x00, sizeof(first_str));
strncpy(first_str, src, length);
if (length != strlen(first_str)) {
}
}
ret = __ctsvc_normalize_str(first_str, dest);
- RETVM_IF(dest == NULL, ret, "__ctsvc_normalize_str is Fail");
+
+ RETVM_IF(dest == NULL, ret, "__ctsvc_normalize_str() Fail");
if ((*dest)[0] != '\0') {
length = ctsvc_check_utf8((*dest)[0]);
if (NULL == sim_info) {
CTS_ERR("sim_info is NULL, result = %d", access_rt);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
info = __ctsvc_server_sim_get_handle_by_tapi_handle(handle);
if (info == NULL) {
- CTS_ERR("__ctsvc_server_sim_get_handle_by_tapi_handle fail");
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ CTS_ERR("__ctsvc_server_sim_get_handle_by_tapi_handle() Fail");
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
if (access_rt == TAPI_SIM_PB_INVALID_INDEX) {
if (info->file_record[TAPI_PB_3G_NAME].index_max < start_index) {
CTS_ERR("start_index is invalid start_index = %d, total = %d", start_index,
info->file_record[TAPI_PB_3G_NAME].index_max);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
ret = tel_read_sim_pb_record(handle, info->sim_type, start_index,
__ctsvc_server_sim_import_contact_cb, (void*)start_index);
if (ret != TAPI_API_SUCCESS) {
CTS_ERR("SIM phonebook access Fail(%d) start_indext(%d)", access_rt,start_index);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
}
if (TAPI_SIM_PB_SUCCESS != access_rt) {
CTS_ERR("SIM phonebook access Fail(%d)", access_rt);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
switch (sim_info->phonebook_type) {
case TAPI_SIM_PB_SDN:
default:
CTS_ERR("Unknown storage type(%d)", sim_info->phonebook_type);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) {
sim_info->next_index, __ctsvc_server_sim_import_contact_cb, NULL);
if (TAPI_API_SUCCESS != ret) {
CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
- ret = CONTACTS_ERROR_SYSTEM;
- goto ERROR_RETURN;
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
+ return;
}
}
else {
// insert imported contact to DB
__ctsvc_server_sim_insert_records_to_db(info);
- if (__ctsvc_server_sim_get_return_data()) {
- ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_NONE, 0, NULL);
- WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
- __ctsvc_server_sim_set_return_data(NULL);
- }
- }
- return;
-
-ERROR_RETURN:
- if (__ctsvc_server_sim_get_return_data()) {
ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
__ctsvc_server_sim_set_return_data(NULL);
}
- return;
+
+ ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), ret, 0, NULL);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+ __ctsvc_server_sim_set_return_data(NULL);
}
int ctsvc_server_sim_import_contact(void* data, int sim_slot_no)
RETM_IF(ret != TAPI_API_SUCCESS, "tel_read_sim_pb_record() Fail(%d)", ret);
}
CTS_ERR("SIM phonebook access Fail(%d)", sec_rt);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return;
}
switch (sim_info->phonebook_type) {
case TAPI_SIM_PB_FDN:
default:
CTS_ERR("Not SDN type(%d)", sim_info->phonebook_type);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return;
}
if (sim_info->next_index && CTSVC_TAPI_SIM_PB_MAX != sim_info->next_index) {
__ctsvc_server_sim_sdn_read_cb, info);
if (TAPI_API_SUCCESS != ret) {
CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return;
}
}
else {
ctsvc_server_trim_memory();
}
- return;
-ERROR_RETURN:
- ctsvc_server_trim_memory();
}
static void __ctsvc_server_sim_sdn_meta_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
ret = tel_read_sim_pb_record(info->handle, TAPI_SIM_PB_SDN, 1, __ctsvc_server_sim_sdn_read_cb, info);
if (TAPI_API_SUCCESS != ret) {
CTS_ERR("tel_read_sim_pb_record() Fail(%d)", ret);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return;
}
}
- else
+ else {
CTS_ERR("pe->PbUsedCount : 0 no sdn!!!!", ret);
-
-ERROR_RETURN:
+ }
ctsvc_server_trim_memory();
}
if (TAPI_API_SUCCESS != ret) {
CTS_ERR("tel_get_sim_init_info() Fail(%d)", ret);
CTS_DBG("sim_status = %d, card_changed = %d", sim_status, card_changed);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return CONTACTS_ERROR_SYSTEM;
}
if (TAPI_SIM_STATUS_CARD_NOT_PRESENT == sim_status ||
ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no);
if (CONTACTS_ERROR_NONE != ret) {
CTS_ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return ret;
}
}
else if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED == sim_status) {
ret = ctsvc_server_delete_sdn_contact(info->sim_slot_no);
if (CONTACTS_ERROR_NONE != ret) {
CTS_ERR("ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return ret;
}
ret = tel_get_sim_pb_meta_info(info->handle, TAPI_SIM_PB_SDN, __ctsvc_server_sim_sdn_meta_info_cb, info);
if (TAPI_API_SUCCESS != ret) {
CTS_ERR("tel_get_sim_pb_meta_info() Fail(%d)", ret);
- goto ERROR_RETURN;
+ ctsvc_server_trim_memory();
+ return CONTACTS_ERROR_SYSTEM;
}
}
- else
+ else {
CTS_ERR("sim_status Fail(%d)", sim_status);
- return CONTACTS_ERROR_NONE;
+ }
-ERROR_RETURN:
- ctsvc_server_trim_memory();
- return ret;
+ return CONTACTS_ERROR_NONE;
}
static void __ctsvc_server_sim_get_meta_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
}
RETVM_IF(ret != TAPI_API_SUCCESS, CONTACTS_ERROR_SYSTEM,
- "tel_get_sim_(usim)_meta_info(type:%d) fail (%d)", info->sim_type, ret);
+ "tel_get_sim_(usim)_meta_info(type:%d) Fail(%d)", info->sim_type, ret);
return CONTACTS_ERROR_NONE;
}
g_type_init();
#endif
cp_name = tel_get_cp_name_list();
- RETVM_IF(cp_name == NULL, CONTACTS_ERROR_SYSTEM, "tel_get_cp_name_list fail (cp_name is NULL)");
+ RETVM_IF(cp_name == NULL, CONTACTS_ERROR_SYSTEM, "tel_get_cp_name_list() Fail(cp_name is NULL)");
ret = ctsvc_server_delete_sdn_contact(-1);
WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_delete_sdn_contact() Fail(%d)", ret);
WARN_IF(TAPI_API_SUCCESS != ret, "tel_register_noti_event() Fail(%d)", ret);
}
else {
- CTS_ERR("tel_init fail");
+ CTS_ERR("tel_init() Fail");
}
__ctsvc_sim_info = g_slist_append(__ctsvc_sim_info, (void*)info);