pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
CAL_RECORD_RESET_COMMON((cal_record_s*)record);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(id<=0,CALENDAR_ERROR_INVALID_PARAMETER,"id <= 0");
- retvm_if(out_record==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "id(%d) <= 0", id);
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
cal_record_s *rec = (cal_record_s *)record;
CAL_LIMIT_ACCESS_FRONT(rec->view_uri);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(id<=0,CALENDAR_ERROR_INVALID_PARAMETER,"id <= 0");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(id <= 0, CALENDAR_ERROR_INVALID_PARAMETER,"id(%d) <= 0", id);
CAL_LIMIT_ACCESS_FRONT(view_uri);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(out_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"list is NULL");
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(query==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"query is NULL");
- retvm_if(out_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"list is NULL");
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
return ret;
}
-API int calendar_db_clean_after_sync( int calendar_book_id, int calendar_db_version)
+API int calendar_db_clean_after_sync(int book_id, int calendar_db_version)
{
int ret = CALENDAR_ERROR_NONE;
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(calendar_book_id <= 0,CALENDAR_ERROR_INVALID_PARAMETER,"calendar_book_id < 0");
+ RETVM_IF(book_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "book_id(%d) < 0", book_id);
// make indata
indata = pims_ipc_data_create(0);
ret = CALENDAR_ERROR_OUT_OF_MEMORY;
return ret;
}
- ret = _cal_ipc_marshal_int(calendar_book_id,indata);
+ ret = _cal_ipc_marshal_int(book_id, indata);
if (ret != CALENDAR_ERROR_NONE)
{
ERR("marshal fail");
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(out_count==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"count pointer is NULL");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(query==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(record_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"list is NULL");
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
calendar_list_h clone_list = NULL;
bool result = false;
- retvm_if(list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"list is NULL");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
ret = _cal_list_clone(list, &clone_list);
if (CALENDAR_ERROR_NONE != ret)
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(record_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
calendar_list_h clone_list = NULL;
bool result = false;
- retvm_if(list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
ret = _cal_list_clone(list, &clone_list);
if (CALENDAR_ERROR_NONE != ret)
pims_ipc_data_h outdata = NULL;
int i = 0;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(record_id_array==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record_id_array is NULL");
- retvm_if(count<=0,CALENDAR_ERROR_INVALID_PARAMETER,"count <= 0 ");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
// make indata
indata = pims_ipc_data_create(0);
cal_client_db_async_userdata_s *async_data = NULL;
bool result = false;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(ids==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"ids is NULL");
- retvm_if(count <= 0,CALENDAR_ERROR_INVALID_PARAMETER,"count is 0");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ids, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(record_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record_list is NULL");
- retvm_if(current_calendar_db_version==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"current_calendar_db_version is NULL");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == current_calendar_db_version, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(calendar_db_version==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"calendar_db_version is null");
+ RETV_IF(NULL == calendar_db_version, CALENDAR_ERROR_INVALID_PARAMETER);
// ipc call
if (_cal_client_ipc_call(CAL_IPC_MODULE, CAL_IPC_SERVER_DB_GET_CURRENT_VERSION, indata, &outdata) != 0)
API int calendar_db_add_changed_cb(const char* view_uri, calendar_db_changed_cb callback, void* user_data )
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
int ret;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retv_if(NULL == view_uri || NULL == callback , CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
ERR("Invalid view_uri(%s)", view_uri);
return CALENDAR_ERROR_INVALID_PARAMETER;
}
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_inotify_subscribe() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_inotify_subscribe() Failed(%d)", ret);
return CALENDAR_ERROR_NONE;
}
API int calendar_db_remove_changed_cb( const char* view_uri, calendar_db_changed_cb callback, void* user_data )
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
int ret;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retv_if(NULL == view_uri || NULL == callback , CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
ERR("Invalid view_uri(%s)", view_uri);
return CALENDAR_ERROR_INVALID_PARAMETER;
}
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_inotify_unsubscribe_with_data() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_inotify_unsubscribe_with_data() Failed(%d)", ret);
return CALENDAR_ERROR_NONE;
}
pims_ipc_data_h outdata = NULL;
int i = 0;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
cal_client_db_async_insert_userdata_s *async_data = NULL;
bool result = false;
- retvm_if(vcalendar_stream==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"list is NULL");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h outdata = NULL;
int i = 0;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
// make indata
indata = pims_ipc_data_create(0);
int i = 0;
bool result = false;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
// make indata
indata = pims_ipc_data_create(0);
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
- retvm_if(record_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(record_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d) < 0", record_id);
cal_record_s *rec = (cal_record_s *)record;
CAL_LIMIT_ACCESS_FRONT(rec->view_uri);
pims_ipc_data_h outdata = NULL;
int i = 0;
- retvm_if(record_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record is NULL");
- retvm_if(record_id_array==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record_id_array is NULL");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
// make indata
indata = pims_ipc_data_create(0);
int i = 0;
bool result = false;
- retvm_if(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: list is NULL");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: id is NULL");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: count <= 0");
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_WRITE, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
// make indata
indata = pims_ipc_data_create(0);
{
int ret = CALENDAR_ERROR_NONE;
bool result = false;
- retvm_if(NULL == last_version, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == last_version, CALENDAR_ERROR_INVALID_PARAMETER);
*last_version = 0;
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_READ, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "cal_client_ipc_client_check_permission() is fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_ipc_client_check_permission() is fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
*last_version = _cal_client_ipc_get_change_version();
return ret;
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(view_uri==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"view_uri is NULL");
- retvm_if(record_list==NULL,CALENDAR_ERROR_INVALID_PARAMETER,"record_list is NULL");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
// make indata
indata = pims_ipc_data_create(0);
API int calendar_connect(void)
{
int ret = 0;
- CAL_FN_CALL;
+ CAL_FN_CALL();
_cal_mutex_lock(CAL_MUTEX_CONNECTION);
if (0 == calendar_connection_count) {
int ret = CALENDAR_ERROR_NONE;
pims_ipc_data_h outdata = NULL;
- retvm_if(NULL == calendar_ipc, CALENDAR_ERROR_IPC,
+ RETVM_IF(NULL == calendar_ipc, CALENDAR_ERROR_IPC,
"[GLOBAL_IPC_CHANNEL] calendar not connected");
if (pims_ipc_call(calendar_ipc, CAL_IPC_MODULE, CAL_IPC_SERVER_DISCONNECT, NULL, &outdata) != 0) {
{
int ret = 0;
- CAL_FN_CALL;
+ CAL_FN_CALL();
_cal_mutex_lock(CAL_MUTEX_CONNECTION);
if (1 == calendar_connection_count) {
_cal_client_reminder_destroy_for_subscribe();
int ret = CALENDAR_ERROR_NONE;
pims_ipc_data_h outdata = NULL;
- CAL_FN_CALL;
+ CAL_FN_CALL();
// ipc create
if (calendar_ipc_thread == NULL) {
pims_ipc_data_h indata = NULL;
pims_ipc_data_h outdata = NULL;
- retvm_if(calendar_ipc_thread==NULL,CALENDAR_ERROR_NOT_PERMITTED,"calendar_thread not connected");
+ RETVM_IF(calendar_ipc_thread==NULL,CALENDAR_ERROR_NOT_PERMITTED,"calendar_thread not connected");
- CAL_FN_CALL;
+ CAL_FN_CALL();
// ipc call
if (pims_ipc_call(calendar_ipc_thread, CAL_IPC_MODULE, CAL_IPC_SERVER_DISCONNECT, indata, &outdata) != 0)
if (calendar_ipc_thread == NULL)
{
calendar_change_version = version;
- CAL_DBG("change_version=%d",version);
+ DBG("change_version=%d",version);
return ;
}
calendar_change_version_thread = version;
- CAL_DBG("change_version=%d",version);
+ DBG("change_version=%d",version);
}
int _cal_client_ipc_get_change_version(void)
int ret;
bool result = false;
- if (NULL == callback) {
- ERR("Invalid parameter: callback is NULL");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
ret = cal_client_ipc_client_check_permission(CAL_PERMISSION_READ, &result);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
- retvm_if(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
+ RETVM_IF(result == false, CALENDAR_ERROR_PERMISSION_DENIED, "Permission denied (calendar read)");
_cal_mutex_lock(CAL_MUTEX_PIMS_IPC_PUBSUB);
{
GSList *it = NULL;
- if (NULL == callback) {
- ERR("Invalid parameter: callback is NULL");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
_cal_mutex_lock(CAL_MUTEX_PIMS_IPC_PUBSUB);
{
cal_composite_filter_s *com_filter;
- retv_if(NULL == view_uri || NULL == out_filter, CALENDAR_ERROR_INVALID_PARAMETER);
- com_filter = (cal_composite_filter_s *)calloc(1, sizeof(cal_composite_filter_s));
- retv_if(NULL == com_filter, CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ com_filter = calloc(1, sizeof(cal_composite_filter_s));
+ RETV_IF(NULL == com_filter, CALENDAR_ERROR_OUT_OF_MEMORY);
com_filter->filter_type = CAL_FILTER_COMPOSITE;
com_filter->view_uri = strdup(view_uri);
{
cal_composite_filter_s *com_filter;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(op >= CALENDAR_FILTER_OPERATOR_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: operator(%d)", op);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_FILTER_OPERATOR_MAX <= op, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= operator(%d)", CALENDAR_FILTER_OPERATOR_MAX, op);
com_filter = (cal_composite_filter_s*)filter;
- retvm_if(g_slist_length(com_filter->filter_ops) != (g_slist_length(com_filter->filters)-1),
+ RETVM_IF(g_slist_length(com_filter->filter_ops) != (g_slist_length(com_filter->filters)-1),
CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter : Please check the operator of filter");
com_filter->filter_ops = g_slist_append(com_filter->filter_ops, (void*)op);
return CALENDAR_ERROR_NONE;
calendar_filter_h f = NULL;
int ret = CALENDAR_ERROR_NONE;
- retv_if(NULL == filter || NULL == add_filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == add_filter, CALENDAR_ERROR_INVALID_PARAMETER);
com_filter = (cal_composite_filter_s*)filter;
com_filter2 = (cal_composite_filter_s*)add_filter;
- retvm_if(g_slist_length(com_filter->filter_ops) != g_slist_length(com_filter->filters),
+ RETVM_IF(g_slist_length(com_filter->filter_ops) != g_slist_length(com_filter->filters),
CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter :Please check the operator of filter");
- retvm_if (0 != strcmp(com_filter->view_uri, com_filter2->view_uri), CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(0 != strcmp(com_filter->view_uri, com_filter2->view_uri), CALENDAR_ERROR_INVALID_PARAMETER,
"The filter view_uri is different (filter1:%s, filter2:%s)", com_filter->view_uri, com_filter2->view_uri);
ret = _cal_filter_clone(add_filter, &f);
- retv_if(ret != CALENDAR_ERROR_NONE, ret);
+ RETV_IF(ret != CALENDAR_ERROR_NONE, ret);
com_filter->filters = g_slist_append(com_filter->filters, f);
//int type;
//bool find = false;
- retvm_if(g_slist_length(com_filter->filter_ops) != g_slist_length(com_filter->filters),
+ RETVM_IF(g_slist_length(com_filter->filter_ops) != g_slist_length(com_filter->filters),
CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter :Please check the operator of filter");
- filter = (cal_attribute_filter_s *)calloc(1, sizeof(cal_attribute_filter_s));
+ filter = calloc(1, sizeof(cal_attribute_filter_s));
filter->filter_type = filter_type;
filter->property_id = property_id;
filter->match = match;
int ret;
bool bcheck;
- retv_if(NULL == filter || NULL == match_value, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(match >= CALENDAR_MATCH_STR_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check match value(%d)", match);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == match_value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_MATCH_STR_MAX <= match, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= match(%d)", CALENDAR_MATCH_STR_MAX, match);
bcheck = CAL_PROPERTY_CHECK_DATA_TYPE(property_id,CAL_PROPERTY_DATA_TYPE_STR);
- retvm_if(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
bcheck = CAL_PROPERTY_CHECK_FLAGS(property_id,CAL_PROPERTY_FLAGS_PROJECTION);
- retvm_if(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
com_filter = (cal_composite_filter_s*)filter;
ret = __cal_filter_create_attribute(com_filter, property_id, match, CAL_FILTER_STR, &str_filter);
- retvm_if(CALENDAR_ERROR_NONE !=ret, ret,
- "Invalid parameter : The paramter is not proper (view_uri:, property_id:%d, match:%d, match_value :%s",
- property_id, match, match_value);
+ RETVM_IF(CALENDAR_ERROR_NONE !=ret, ret, "property_id(%d), match(%d), match_value(%s)", property_id, match, match_value);
str_filter->value.s = SAFE_STRDUP(match_value);
return CALENDAR_ERROR_NONE;
int ret;
bool bcheck;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(match >= CALENDAR_MATCH_INT_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check match value(%d)", match);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_MATCH_INT_MAX <= match, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= match(%d)", CALENDAR_MATCH_INT_MAX, match);
bcheck = CAL_PROPERTY_CHECK_DATA_TYPE(property_id,CAL_PROPERTY_DATA_TYPE_INT);
- retvm_if(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
bcheck = CAL_PROPERTY_CHECK_FLAGS(property_id,CAL_PROPERTY_FLAGS_PROJECTION);
- retvm_if(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
com_filter = (cal_composite_filter_s*)filter;
ret = __cal_filter_create_attribute(com_filter, property_id, match, CAL_FILTER_INT, &int_filter);
- retvm_if(CALENDAR_ERROR_NONE !=ret, ret,
- "Invalid parameter : The paramter is not proper (view_uri:, property_id:%d, match:%d, match_value :%d",
- property_id, match, match_value);
+ RETVM_IF(CALENDAR_ERROR_NONE !=ret, ret, "property_id(%d), match(%d), match_value(%d)", property_id, match, match_value);
int_filter->value.i = match_value;
int ret;
bool bcheck;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(match >= CALENDAR_MATCH_INT_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check match value(%d)", match);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_MATCH_INT_MAX <= match, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= match(%d)", CALENDAR_MATCH_INT_MAX, match);
bcheck = CAL_PROPERTY_CHECK_DATA_TYPE(property_id,CAL_PROPERTY_DATA_TYPE_DOUBLE);
- retvm_if(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
bcheck = CAL_PROPERTY_CHECK_FLAGS(property_id,CAL_PROPERTY_FLAGS_PROJECTION);
- retvm_if(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
com_filter = (cal_composite_filter_s*)filter;
ret = __cal_filter_create_attribute(com_filter, property_id, match, CAL_FILTER_DOUBLE, &int_filter);
- retvm_if(CALENDAR_ERROR_NONE !=ret, ret,
- "Invalid parameter : The paramter is not proper (view_uri:, property_id:%d, match:%d, match_value :%d",
- property_id, match, match_value);
+ RETVM_IF(CALENDAR_ERROR_NONE !=ret, ret, "property_id(%d), match(%d), match_value(%d)", property_id, match, match_value);
int_filter->value.d = match_value;
int ret;
bool bcheck;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(match >= CALENDAR_MATCH_INT_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check match value(%d)", match);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_MATCH_INT_MAX <= match, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= match(%d)", CALENDAR_MATCH_INT_MAX, match);
bcheck = CAL_PROPERTY_CHECK_DATA_TYPE(property_id,CAL_PROPERTY_DATA_TYPE_LLI);
- retvm_if(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
bcheck = CAL_PROPERTY_CHECK_FLAGS(property_id,CAL_PROPERTY_FLAGS_PROJECTION);
- retvm_if(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
com_filter = (cal_composite_filter_s*)filter;
ret = __cal_filter_create_attribute(com_filter, property_id, match, CAL_FILTER_LLI, &int_filter);
- retvm_if(CALENDAR_ERROR_NONE !=ret, ret,
- "Invalid parameter : The paramter is not proper (view_uri:, property_id:%d, match:%d, match_value :%d",
- property_id, match, match_value);
+ RETVM_IF(CALENDAR_ERROR_NONE !=ret, ret, "property_id(%d), match(%d), match_value(%d)", property_id, match, match_value);
int_filter->value.lli = match_value;
int ret;
bool bcheck;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(match >= CALENDAR_MATCH_INT_MAX, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check match value(%d)", match);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(CALENDAR_MATCH_INT_MAX <= match, CALENDAR_ERROR_INVALID_PARAMETER, "max(%d) <= match(%d)", CALENDAR_MATCH_INT_MAX, match);
bcheck = CAL_PROPERTY_CHECK_DATA_TYPE(property_id,CAL_PROPERTY_DATA_TYPE_CALTIME);
- retvm_if(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(false == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
bcheck = CAL_PROPERTY_CHECK_FLAGS(property_id,CAL_PROPERTY_FLAGS_PROJECTION);
- retvm_if(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter : property_id(%d) is not supported)", property_id);
+ RETVM_IF(true == bcheck, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d)", property_id);
com_filter = (cal_composite_filter_s*)filter;
ret = __cal_filter_create_attribute(com_filter, property_id, match, CAL_FILTER_CALTIME, &int_filter);
- retvm_if(CALENDAR_ERROR_NONE !=ret, ret,
- "Invalid parameter : The paramter is not proper (view_uri:, property_id:%d, match:%d, match_value :%d",
- property_id, match, match_value);
+ RETVM_IF(CALENDAR_ERROR_NONE !=ret, ret, "property_id(%d), match(%d), match_value(%d)", property_id, match, match_value);
int_filter->value.caltime = match_value;
API int calendar_filter_destroy(calendar_filter_h filter)
{
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
return __cal_filter_destroy_composite((cal_composite_filter_s*)filter);
}
int _cal_filter_clone(calendar_filter_h filter, calendar_filter_h* out_filter)
{
- retv_if(NULL == filter || NULL == out_filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_filter, CALENDAR_ERROR_INVALID_PARAMETER);
return __cal_filter_clone_composite((cal_composite_filter_s*)filter, (cal_composite_filter_s**)out_filter);
}
{
GSList *cursor = NULL;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
for(cursor=filter->filters;cursor;cursor=cursor->next)
{
cal_filter_s *src = (cal_filter_s *)cursor->data;
static int __cal_filter_destroy_attribute(cal_attribute_filter_s* filter)
{
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
if (filter->filter_type == CAL_FILTER_STR)
{
cal_composite_filter_s *out;
int ret = CALENDAR_ERROR_NONE;
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+
ret = calendar_filter_create(filter->view_uri, (calendar_filter_h *)&out);
- retv_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_OUT_OF_MEMORY);
for(cursor=filter->filters; cursor ; cursor=cursor->next)
{
cal_attribute_filter_s **out_filter)
{
cal_attribute_filter_s *out;
- out = (cal_attribute_filter_s *)calloc(1, sizeof(cal_attribute_filter_s));
- retv_if(NULL == out, CALENDAR_ERROR_OUT_OF_MEMORY);
+ out = calloc(1, sizeof(cal_attribute_filter_s));
+ RETV_IF(NULL == out, CALENDAR_ERROR_OUT_OF_MEMORY);
out->filter_type = filter->filter_type;
out->match = filter->match;
if (calendar_inoti_count > 1)
{
- CAL_DBG("inotify count =%d",calendar_inoti_count);
+ DBG("inotify count =%d",calendar_inoti_count);
_cal_mutex_unlock(CAL_MUTEX_INOTIFY);
return CALENDAR_ERROR_NONE;
}
- CAL_DBG("inotify count =%d",calendar_inoti_count);
+ DBG("inotify count =%d",calendar_inoti_count);
_cal_mutex_unlock(CAL_MUTEX_INOTIFY);
#endif
inoti_fd = inotify_init();
}
ret = fcntl(inoti_fd, F_SETFD, FD_CLOEXEC);
- warn_if(ret < 0, "fcntl failed(%d)", ret);
+ WARN_IF(ret < 0, "fcntl failed(%d)", ret);
ret = fcntl(inoti_fd, F_SETFL, O_NONBLOCK);
- warn_if(ret < 0, "fcntl failed(%d)", ret);
+ WARN_IF(ret < 0, "fcntl failed(%d)", ret);
inoti_handler = _inotify_attach_handler(inoti_fd);
if (inoti_handler <= 0)
if (calendar_inoti_count > 0)
{
- CAL_DBG("inotify count =%d",calendar_inoti_count);
+ DBG("inotify count =%d",calendar_inoti_count);
_cal_mutex_unlock(CAL_MUTEX_INOTIFY);
return ;
}
- CAL_DBG("inotify count =%d",calendar_inoti_count);
+ DBG("inotify count =%d",calendar_inoti_count);
_cal_mutex_unlock(CAL_MUTEX_INOTIFY);
#endif
if (inoti_handler)
#define LOG_TAG "CALENDAR_SVC"
#include <dlog.h>
-#define COLOR_GREEN "\033[0;32m"
-#define COLOR_END "\033[0;m"
-
-#define ENTER() SLOGD(COLOR_GREEN"BEGIN >>>>"COLOR_END)
-#define LEAVE() SLOGD(COLOR_GREEN"END <<<<"COLOR_END)
-
-#define DLOG(prio, fmt, arg...) \
- do { SLOG(prio, LOG_TAG, fmt, ##arg); } while(0);
-#define INFO(fmt, arg...) SLOGI(fmt, ##arg)
-#define WARN(fmt, arg...) SLOGW(fmt, ##arg)
-#define ERR(fmt, arg...) SLOGE(fmt, ##arg)
-#define DBG(fmt, arg...) SLOGD(fmt, ##arg)
-#define SEC_INFO(fmt, arg...) SECURE_LOGI(fmt, ##arg)
-#define SEC_ERR(fmt, arg...) SECURE_LOGE(fmt, ##arg)
-#define SEC_DBG(fmt, arg...) SECURE_LOGD(fmt, ##arg)
+#define COLOR_RED "\033[0;31m"
+#define COLOR_GREEN "\033[0;32m"
+#define COLOR_BROWN "\033[0;33m"
+#define COLOR_BLUE "\033[0;34m"
+#define COLOR_PURPLE "\033[0;35m"
+#define COLOR_CYAN "\033[0;36m"
+#define COLOR_END "\033[0;m"
-//#define CAL_DEBUGGING
-#ifdef CAL_DEBUGGING
#if defined(CAL_IPC_SERVER)
-#define CAL_FN_CALL DBG("SERVER:>>>>>>>>%s called", __FUNCTION__)
-#define CAL_FN_END DBG("SERVER:<<<<<<<<%s ended", __FUNCTION__)
+#define IPC_ROLE COLOR_BLUE"[SERVER]"COLOR_END
#elif defined(CAL_IPC_CLIENT)
-#define CAL_FN_CALL DBG("CLIENT:>>>>>>>>%s called", __FUNCTION__)
-#define CAL_FN_END DBG("CLIENT:<<<<<<<<%s ended", __FUNCTION__)
+#define IPC_ROLE COLOR_BROWN"[CLIENT]"COLOR_END
#else
-#define CAL_FN_CALL DBG(">>>>>>>>%s called", __FUNCTION__)
-#define CAL_FN_END DBG("<<<<<<<<%s ended", __FUNCTION__)
+#define IPC_ROLE COLOR_GREEN"[LIB]"COLOR_END
#endif
-#if defined(CAL_IPC_SERVER)
-#define CAL_DBG(fmt, arg...) DBG("SERVER:%d " fmt, __LINE__, ##arg)
-#elif defined(CAL_IPC_CLIENT)
-#define CAL_DBG(fmt, arg...) DBG("CLIENT:%d " fmt, __LINE__, ##arg)
-#else
-#define CAL_DBG(fmt, arg...) DBG("%d " fmt, __LINE__, ##arg)
-#endif
+#define INFO(fmt, arg...) SLOGI(IPC_ROLE" "fmt, ##arg)
+#define ERR(fmt, arg...) SLOGE(IPC_ROLE" "fmt, ##arg)
+#define DBG(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
+#define WARN(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
+#define VERBOSE(fmt, arg...) SLOGV(IPC_ROLE" "fmt, ##arg)
+
+#define SEC_INFO(fmt, arg...) SECURE_LOGI(fmt, ##arg)
+#define SEC_ERR(fmt, arg...) SECURE_LOGE(fmt, ##arg)
+#define SEC_DBG(fmt, arg...) SECURE_LOGD(fmt, ##arg)
+
+#ifdef CAL_DEBUGGING
+ #define CAL_FN_CALL() DBG(">>>>>>>> called")
+ #define CAL_FN_END() DBG("<<<<<<<< ended")
+ #define CAL_DBG(fmt, arg...) DBG(fmt, ##arg)
+ #define CAL_WARN(fmt, arg...) WARN(fmt, ##arg)
+ #define CAL_ERR(fmt, arg...) ERR(fmt, ##arg)
+ #define CAL_INFO(fmt, arg...) INFO(fmt, ##arg)
+ #define CAL_VERBOSE(fmt, arg...) VERBOSE(fmt, ##arg)
#else /* CAL_DEBUGGING */
-#define CAL_FN_CALL
-#define CAL_FN_END
-#define CAL_DBG(fmt, arg...)
+ #define CAL_FN_CALL()
+ #define CAL_FN_END()
+ #define CAL_DBG(fmt, arg...)
+ #define CAL_WARN(fmt, arg...)
+ #define CAL_ERR(fmt, arg...)
+ #define CAL_INFO(fmt, arg...)
#endif /* CAL_DEBUGGING */
-#define warn_if(expr, fmt, arg...) do { \
+#define WARN_IF(expr, fmt, arg...) do { \
if (expr) { \
WARN(fmt, ##arg); \
} \
} while (0)
-#define ret_if(expr) do { \
+#define RET_IF(expr) do { \
if (expr) { \
ERR("(%s)", #expr); \
return; \
} \
} while (0)
-#define retv_if(expr, val) do { \
+#define RETV_IF(expr, val) do { \
if (expr) { \
ERR("(%s)", #expr); \
return (val); \
} \
} while (0)
-#define retm_if(expr, fmt, arg...) do { \
+#define RETM_IF(expr, fmt, arg...) do { \
if (expr) { \
ERR(fmt, ##arg); \
return; \
} \
} while (0)
-#define retvm_if(expr, val, fmt, arg...) do { \
+#define RETVM_IF(expr, val, fmt, arg...) do { \
if (expr) { \
ERR(fmt, ##arg); \
return (val); \
} \
} while (0)
-#define retex_if(expr, val, fmt, arg...) do { \
- if(expr) { \
- ERR(fmt, ##arg); \
- val; \
- goto CATCH; \
- } \
-} while (0);
-
#define CAL_PROFILE
#ifdef CAL_PROFILE
#define CAL_PROFILE_GET_TIME() (clock() / (CLOCKS_PER_SEC / 1000));
}
cal_list_s *l;
- l = (cal_list_s *)calloc(1, sizeof(cal_list_s));
+ l = calloc(1, sizeof(cal_list_s));
if (l == NULL) {
ERR("Failed to calloc");
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_list_get_nth_record_p(cal_list_s *list_s, int index, calendar_record_h *record)
{
- retv_if(index < 0, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(index < 0, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
*record = NULL;
- retv_if(NULL == list_s, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list_s, CALENDAR_ERROR_INVALID_PARAMETER);
if (index < list_s->count) {
*record = g_list_nth_data(list_s->record, index);
int ret = CALENDAR_ERROR_NONE;
calendar_record_h record = NULL;
calendar_list_h list = (calendar_list_h)list_s;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_list_first(list);
while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
if (mutex != NULL)
{
ret = pthread_mutex_lock(mutex);
- retm_if(ret, "mutex_lock Failed(%d)", ret);
+ RETM_IF(ret, "mutex_lock Failed(%d)", ret);
}
}
if (mutex != NULL)
{
ret = pthread_mutex_unlock(mutex);
- retm_if(ret, "mutex_unlock Failed(%d)", ret);
+ RETM_IF(ret, "mutex_unlock Failed(%d)", ret);
}
}
{
cal_query_s *query;
- retv_if(NULL == view_uri || NULL == out_query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_query, CALENDAR_ERROR_INVALID_PARAMETER);
- query = (cal_query_s *)calloc(1, sizeof(cal_query_s));
- retv_if(NULL == query, CALENDAR_ERROR_OUT_OF_MEMORY);
+ query = calloc(1, sizeof(cal_query_s));
+ RETV_IF(NULL == query, CALENDAR_ERROR_OUT_OF_MEMORY);
query->view_uri = strdup(view_uri);
query->properties = (cal_property_info_s *)_cal_view_get_property_info(view_uri, &query->property_count);
int i;
bool find;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(NULL == property_ids, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid paramter: property_ids is NULL");
- retvm_if(count < 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: check count(%d)", count);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == property_ids, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count < 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d) < 0", count);
que = (cal_query_s *)query;
for (i=0;i<count;i++)
{
find = __cal_query_property_check(que->properties, que->property_count, property_ids[i]);
- retvm_if(false == find, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(false == find, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property_id(%d) is not supported on view_uri(%s)", property_ids[i], que->view_uri);
find = CAL_PROPERTY_CHECK_FLAGS(property_ids[i], CAL_PROPERTY_FLAGS_FILTER);
- retvm_if(true == find, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(true == find, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property_id(%d) is not supported on view_uri(%s)", property_ids[i], que->view_uri);
}
{
cal_query_s *que = NULL;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
que->distinct = set;
calendar_filter_h new_filter;
int ret = CALENDAR_ERROR_NONE;
- retv_if(NULL == query || NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
}
ret = _cal_filter_clone(filter,&new_filter);
- retv_if(ret!=CALENDAR_ERROR_NONE, ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE, ret);
if (que->filter)
{
cal_query_s *que;
bool find = false;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
find = __cal_query_property_check(que->properties, que->property_count, property_id);
- retvm_if(false == find, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(false == find, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid paramter : property_id(%d) is not supported on view_uri(%s)", property_id, que->view_uri);
que->sort_property_id = property_id;
{
cal_query_s *que;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
if (que->filter)
cal_filter_s *out_filter = NULL;
int ret = CALENDAR_ERROR_NONE;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
ret = calendar_query_create(que->view_uri, out_query);
- retv_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_OUT_OF_MEMORY);
out_que = (cal_query_s *)*out_query;
if (que->filter)
cal_record_s *_record = NULL;
- retv_if(record == NULL, -1);
+ RETV_IF(record == NULL, -1);
_record = (cal_record_s *)record;
CAL_FREE(_record->properties_flags);
_record->properties_flags = calloc(properties_max_count, sizeof(char));
- retvm_if(NULL == _record->properties_flags, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == _record->properties_flags, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
_record->properties_max_count = properties_max_count;
int ret = CALENDAR_ERROR_NONE;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "uri[%s]", view_uri);
- retvm_if(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
type =_cal_view_get_type(view_uri);
- retv_if(CAL_RECORD_TYPE_INVALID == type, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(CAL_RECORD_TYPE_INVALID == type, CALENDAR_ERROR_INVALID_PARAMETER);
cal_record_plugin_cb_s *plugin_cb = _cal_record_get_plugin_cb(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->create, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", view_uri);
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->create, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", view_uri);
ret = plugin_cb->create(out_record);
{
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->destroy, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->destroy, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
CAL_FREE(temp->properties_flags);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->clone, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->clone, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted in [%s]", temp->view_uri);
ret = temp->plugin_cb->clone(record, out_record);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
*out_str = (char*)(temp->view_uri);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_str(record, property_id, out_str);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_str_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_str, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_str_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_str_p(record, property_id, out_str);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_int(record, property_id, out_value);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_double(record, property_id, out_value);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_lli(record, property_id, out_value);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_caltime(record, property_id, out_value);
API int calendar_record_set_str( calendar_record_h record, unsigned int property_id, const char* value )
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
__CHECK_READ_ONLY_PROPERTY();
int ret = _cal_record_set_str(record, property_id, value);
API int calendar_record_set_int( calendar_record_h record, unsigned int property_id, int value )
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
__CHECK_READ_ONLY_PROPERTY();
int ret = _cal_record_set_int(record, property_id, value);
API int calendar_record_set_double( calendar_record_h record, unsigned int property_id, double value )
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
__CHECK_READ_ONLY_PROPERTY();
int ret = _cal_record_set_double(record, property_id, value);
API int calendar_record_set_lli( calendar_record_h record, unsigned int property_id, long long int value )
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
__CHECK_READ_ONLY_PROPERTY();
int ret = _cal_record_set_lli(record, property_id, value);
API int calendar_record_set_caltime( calendar_record_h record, unsigned int property_id, calendar_time_s value )
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
__CHECK_READ_ONLY_PROPERTY();
int ret = _cal_record_set_caltime(record, property_id, value);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->add_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->add_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->add_child_record(record, property_id, child_record);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->remove_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->remove_child_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->remove_child_record(record, property_id, child_record);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_child_record_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_child_record_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_child_record_count(record, property_id, count);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->get_child_record_at_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->get_child_record_at_p, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->get_child_record_at_p(record, property_id, index, child_record);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb || NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->clone_child_record_list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->clone_child_record_list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->clone_child_record_list(record, property_id, out_list);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->set_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->set_str, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->set_str(record, property_id, value);
if (ret == CALENDAR_ERROR_NONE)
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->set_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->set_int, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->set_int(record, property_id, value);
if (ret == CALENDAR_ERROR_NONE)
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->set_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->set_double, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->set_double(record, property_id, value);
if (ret == CALENDAR_ERROR_NONE)
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->set_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->set_lli, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->set_lli(record, property_id, value);
if (ret == CALENDAR_ERROR_NONE)
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == temp->plugin_cb->set_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
- retvm_if(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == temp->plugin_cb->set_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+ RETVM_IF(false == _cal_record_check_property_flag(record, property_id,CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = temp->plugin_cb->set_caltime(record, property_id, value);
if (ret == CALENDAR_ERROR_NONE)
cal_alarm_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_alarm_s*)calloc(1,sizeof(cal_alarm_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_alarm_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_alarm_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_alarm_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_alarm_struct_init(temp);
src_data = (cal_alarm_s*)(record);
out_data = calloc(1, sizeof(cal_alarm_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_alarm_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_alarm_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_attendee_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_attendee_s*)calloc(1,sizeof(cal_attendee_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_attendee_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_attendee_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_attendee_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_attendee_struct_init(temp);
src_data = (cal_attendee_s*)(record);
out_data = calloc(1, sizeof(cal_attendee_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_attendee_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_attendee_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_calendar_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_calendar_s*)calloc(1,sizeof(cal_calendar_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_calendar_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_calendar_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_calendar_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_calendar_struct_init(temp);
src_data = (cal_calendar_s*)(record);
out_data = calloc(1, sizeof(cal_calendar_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_calendar_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_calendar_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
(cal_rec->visibility) = value;
break;
case CAL_PROPERTY_CALENDAR_ACCOUNT_ID:
- retvm_if(cal_rec->index > 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter : property_id(%d) is a write-once value (calendar)", property_id);
+ RETVM_IF(cal_rec->index > 0, CALENDAR_ERROR_INVALID_PARAMETER, "property_id(%d) is a write-once value (calendar)", property_id);
(cal_rec->account_id) = value;
break;
case CAL_PROPERTY_CALENDAR_STORE_TYPE:
}
break;
case CAL_PROPERTY_CALENDAR_MODE:
- retvm_if (value != CALENDAR_BOOK_MODE_NONE && value != CALENDAR_BOOK_MODE_RECORD_READONLY,
+ RETVM_IF(value != CALENDAR_BOOK_MODE_NONE && value != CALENDAR_BOOK_MODE_RECORD_READONLY,
CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter : mode type is invalid value (%d)", value);
(cal_rec->mode) = value;
break;
cal_event_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_event_s*)calloc(1, sizeof(cal_event_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_event_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1, sizeof(cal_event_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() Fail");
__cal_record_event_struct_init(temp);
src_data = (cal_event_s*)(record);
out_data = calloc(1, sizeof(cal_event_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_event_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_event_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
static int __cal_record_event_reset_child_record_id(calendar_record_h child_record)
{
cal_record_s *record = (cal_record_s*)child_record;
- retv_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
switch (record->type) {
case CAL_RECORD_TYPE_ALARM:
int ret = CALENDAR_ERROR_NONE;
cal_event_s *rec = (cal_event_s *)record;
- retv_if(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
*count = 0;
switch (property_id) {
int ret;
cal_event_s *rec = (cal_event_s*)(record);
- retv_if(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
*child_record = NULL;
switch (property_id) {
int ret;
cal_event_s *rec = (cal_event_s*)(record);
- retv_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
*out_list = NULL;
switch (property_id) {
cal_extended_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_extended_s*)calloc(1,sizeof(cal_extended_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_extended_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_extended_struct_init(temp);
src_data = (cal_extended_s*)(record);
out_data = calloc(1, sizeof(cal_extended_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
(rec->id) = value;
break;
case CAL_PROPERTY_EXTENDED_RECORD_ID:
- retvm_if(rec->id > 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter : property_id(%d) is a write-once value (calendar)", property_id);
+ RETVM_IF(rec->id > 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter : property_id(%d) is a write-once value (calendar)", property_id);
(rec->record_id) = value;
break;
case CAL_PROPERTY_EXTENDED_RECORD_TYPE:
cal_instance_allday_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_instance_allday_s*)calloc(1,sizeof(cal_instance_allday_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_allday_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_instance_allday_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_allday_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_instance_allday_struct_init(temp);
src_data = (cal_instance_allday_s*)(record);
out_data = calloc(1, sizeof(cal_instance_allday_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_allday_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_allday_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_instance_allday_extended_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_instance_allday_extended_s*)calloc(1,sizeof(cal_instance_allday_extended_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_allday_extended_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_instance_allday_extended_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_allday_extended_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_instance_allday_extended_struct_init(temp);
src_data = (cal_instance_allday_extended_s*)(record);
out_data = calloc(1, sizeof(cal_instance_allday_extended_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_allday_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_allday_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_instance_normal_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_instance_normal_s*)calloc(1,sizeof(cal_instance_normal_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_normal_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_instance_normal_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_normal_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_instance_normal_struct_init(temp);
src_data = (cal_instance_normal_s*)(record);
out_data = calloc(1, sizeof(cal_instance_normal_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_normal_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_normal_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_instance_normal_extended_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_instance_normal_extended_s*)calloc(1,sizeof(cal_instance_normal_extended_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_normal_extended_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_instance_normal_extended_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_instance_normal_extended_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_instance_normal_extended_struct_init(temp);
src_data = (cal_instance_normal_extended_s*)(record);
out_data = calloc(1, sizeof(cal_instance_normal_extended_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_normal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_instance_normal_extended_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_search_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_search_s*)calloc(1, sizeof(cal_search_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1, sizeof(cal_search_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
*out_record = (calendar_record_h)temp;
src_data = (cal_search_s*)(record);
out_data = calloc(1, sizeof(cal_search_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
}
data = calloc(1, sizeof(cal_search_value_s));
- retvm_if(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
+ RETVM_IF(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
data->property_id = property_id;
data->value.s = SAFE_STRDUP(value);
rec->values = g_slist_append(rec->values, data);
}
data = calloc(1, sizeof(cal_search_value_s));
- retvm_if(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
+ RETVM_IF(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
data->property_id = property_id;
(data->value.i) = value;
rec->values = g_slist_append(rec->values, data);
}
data = calloc(1, sizeof(cal_search_value_s));
- retvm_if(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
+ RETVM_IF(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
data->property_id = property_id;
(data->value.d) = value;
rec->values = g_slist_append(rec->values, data);
}
data = calloc(1, sizeof(cal_search_value_s));
- retvm_if(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
+ RETVM_IF(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
data->property_id = property_id;
(data->value.lli) = value;
rec->values = g_slist_append(rec->values, data);
}
data = calloc(1, sizeof(cal_search_value_s));
- retvm_if(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
+ RETVM_IF(NULL == data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_search_s) Failed");
data->property_id = property_id;
(data->value.caltime) = value;
rec->values = g_slist_append(rec->values, data);
cal_timezone_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_timezone_s*)calloc(1,sizeof(cal_timezone_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_timezone_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_timezone_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_timezone_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_timezone_struct_init(temp);
src_data = (cal_timezone_s*)(record);
out_data = calloc(1, sizeof(cal_timezone_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_timezone_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_timezone_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
cal_todo_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_todo_s*)calloc(1,sizeof(cal_todo_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_todo_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_todo_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_todo_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
__cal_record_todo_struct_init(temp);
src_data = (cal_todo_s*)(record);
out_data = calloc(1, sizeof(cal_todo_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_todo_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_todo_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
static int __cal_record_todo_reset_child_record_id(calendar_record_h child_record)
{
cal_record_s *record = (cal_record_s*)child_record;
- retv_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
switch (record->type) {
case CAL_RECORD_TYPE_ALARM:
int ret = CALENDAR_ERROR_NONE;
cal_todo_s *rec = (cal_todo_s *)record;
- retv_if(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
*count = 0;
switch (property_id) {
int ret;
cal_todo_s *rec = (cal_todo_s*)(record);
- retv_if(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == child_record, CALENDAR_ERROR_INVALID_PARAMETER);
*child_record = NULL;
switch (property_id) {
int ret;
cal_todo_s *rec = (cal_todo_s*)(record);
- retv_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
*out_list = NULL;
switch (property_id) {
cal_updated_info_s *temp = NULL;
int ret= CALENDAR_ERROR_NONE;
- temp = (cal_updated_info_s*)calloc(1,sizeof(cal_updated_info_s));
- retvm_if(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_updated_info_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ temp = calloc(1,sizeof(cal_updated_info_s));
+ RETVM_IF(NULL == temp, CALENDAR_ERROR_OUT_OF_MEMORY, "malloc(cal_updated_info_s:sch) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
*out_record = (calendar_record_h)temp;
src_data = (cal_updated_info_s*)(record);
out_data = calloc(1, sizeof(cal_updated_info_s));
- retvm_if(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_updated_info_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
+ RETVM_IF(NULL == out_data, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc(cal_updated_info_s) Failed(%d)", CALENDAR_ERROR_OUT_OF_MEMORY);
CAL_RECORD_COPY_COMMON(&(out_data->common), &(src_data->common));
{
UErrorCode ec = U_ZERO_ERROR;
- retm_if (NULL == registered_tzid, "Invalid parameter: registered_tzid is NULL");
+ RET_IF(NULL == registered_tzid);
StringEnumeration* s = TimeZone::createEnumeration(sec2ms(offset));
if (0 == s->count(ec)) {
tzid = CAL_TZID_GMT;
}
- utzid = (UChar*)calloc(strlen(tzid) + 1, sizeof(UChar));
+ utzid = (UChar *)calloc(strlen(tzid) + 1, sizeof(UChar));
if (utzid == NULL)
{
ERR("Failed to calloc");
{
case CALENDAR_TIME_UTIME:
ucal_setMillis(ucal, sec2ms(ct->time.utime), &status);
- retm_if(U_FAILURE(status), "ucal_setMillis() failed(%s)",
+ RETM_IF(U_FAILURE(status), "ucal_setMillis() failed(%s)",
u_errorName(status));
break;
ct->time.date.minute,
ct->time.date.second,
&status);
- retm_if(U_FAILURE(status), "ucal_setMillis() failed(%s)",
+ RETM_IF(U_FAILURE(status), "ucal_setMillis() failed(%s)",
u_errorName(status));
break;
UChar *utzid = NULL;
const char *tzid = CAL_TZID_GMT;
- utzid = (UChar*)calloc(strlen(tzid) + 1, sizeof(UChar));
+ utzid = (UChar *)calloc(strlen(tzid) + 1, sizeof(UChar));
if (utzid == NULL)
{
ERR("Failed to calloc");
if (NULL == _g_ucal_gmt) {
ucal = _cal_time_get_ucal(NULL, -1);
- retvm_if (NULL == ucal, CALENDAR_ERROR_SYSTEM, "_cal_time_get_ucal() is failed");
+ RETVM_IF(NULL == ucal, CALENDAR_ERROR_SYSTEM, "_cal_time_get_ucal() is failed");
_g_ucal_gmt = ucal;
}
return CALENDAR_ERROR_NONE;
void _cal_time_modify_caltime(calendar_time_s *caltime, long long int diff)
{
UErrorCode status = U_ZERO_ERROR;
- retm_if (NULL == caltime, "Invalid parameter: caltime is NULL");
+ RET_IF(NULL == caltime);
UCalendar *ucal = __get_gmt_ucal();
long long int lli = 0;
void _cal_time_get_nth_wday(long long int t, int *nth, int *wday)
{
- retm_if (NULL == nth, "Invalid parameter: nth is NULL");
- retm_if (NULL == wday, "Invalid parameter: wday is NULL");
+ RET_IF(NULL == nth);
+ RET_IF(NULL == wday);
UErrorCode status = U_ZERO_ERROR;
UCalendar *ucal = __get_gmt_ucal();
cal_make_s *b;
char *ical = NULL;
- retvm_if(list == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: calendar_list_h is NULL");
- retvm_if(vcalendar_stream == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: vcalendar_stream is NULL");
+ RETV_IF(list == NULL, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(vcalendar_stream == NULL, CALENDAR_ERROR_INVALID_PARAMETER);
b = _cal_vcalendar_make_new();
- retvm_if(!b, CALENDAR_ERROR_OUT_OF_MEMORY,
+ RETVM_IF(!b, CALENDAR_ERROR_OUT_OF_MEMORY,
"_cal_vcalendar_make_new() Failed");
ret = _cal_vcalendar_make_vcalendar(b, list);
bool new_line = false;
char *vcalendar_object = NULL;
- retv_if(NULL == pvcalendar_object, original);
+ RETV_IF(NULL == pvcalendar_object, original);
*pvcalendar_object = NULL;
while ('\n' == *vcal_start || '\r' == *vcal_start)
calendar_error_e err;
calendar_list_h list = NULL;
- retvm_if(vcalendar_stream == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: vcalendar_stream is NULL");
- retvm_if(out_list == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: calendar_list_h * is NULL");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
// get vcalendar object
cursor = vcalendar_stream;
int ret = 0;
ret = calendar_list_create(&list);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "Failed to calendar_list_create()");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "Failed to calendar_list_create()");
_cal_time_init();
char buf[1024];
vcalendar_foreach_s *foreach_data = NULL;
- retvm_if(vcalendar_file_path == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: vcalendar_file_path is NULL");
- retvm_if(callback == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid argument: callback is NULL");
+ RETV_IF(NULL == vcalendar_file_path, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
int ret = 0;
calendar_list_h list = NULL;
ret = calendar_list_create(&list);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "Failed to calendar_list_create()");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "Failed to calendar_list_create()");
file = fopen(vcalendar_file_path, "r");
if (file == NULL) {
{
b->data = realloc(b->data, b->size + n);
- retvm_if(!b->data, CALENDAR_ERROR_OUT_OF_MEMORY, "Failed to realloc");
+ RETVM_IF(!b->data, CALENDAR_ERROR_OUT_OF_MEMORY, "Failed to realloc");
b->size += n;
return CALENDAR_ERROR_NONE;
{
int ret;
ret = __cal_vcalendar_make_alloc(b, _strlen(b->lbuf) + 3);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
strncat(b->data, b->lbuf, b->size - _strlen(b->data) - 1);
strncat(b->data, "\r\n ", b->size - _strlen(b->data) - 1);
k += remain_lbuf - 1;
remain_str -= remain_lbuf - 1;
ret = __cal_vcalendar_make_folding(b);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
remain_lbuf = sizeof(b->lbuf);
}
{
int ret;
ret = __cal_vcalendar_make_alloc(b, _strlen(b->lbuf) + 2);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
strncat(b->data, b->lbuf, b->size - _strlen(b->data) - 1);
strncat(b->data, "\r\n", b->size - _strlen(b->data) - 1);
if (s1) {
ret = __cal_vcalendar_make_set_str(b, s1);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
if (s2) {
ret = __cal_vcalendar_make_set_str(b, s2);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
return __cal_vcalendar_make_flush(b);
static int __cal_vcalendar_make_time(cal_make_s *b, char *tzid, calendar_time_s *t, const char *prop)
{
- retvm_if (NULL == b, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: b is NULL");
- retvm_if (NULL == t, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: t is NULL");
+ RETV_IF(NULL == b, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == t, CALENDAR_ERROR_INVALID_PARAMETER);
if (CALENDAR_TIME_UTIME == t->type && CALENDAR_TODO_NO_START_DATE == t->time.utime) {
DBG("No start date");
static void __encode_escaped_char(char *p, char **r)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter:p is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
int len = strlen(p) * 2;
char *q = calloc(len, sizeof(char));
- retm_if (NULL == q, "calloc() is failed");
+ RETM_IF(NULL == q, "calloc() is failed");
*r = q;
DBG("Before [%s]", p);
int __cal_vcalendar_make_audio(cal_make_s *b, calendar_record_h alarm)
{
- retvm_if (NULL == b, CALENDAR_ERROR_INVALID_PARAMETER, "b is NULL");
- retvm_if (NULL == alarm, CALENDAR_ERROR_INVALID_PARAMETER, "alarm is NULL");
+ RETV_IF(NULL == b, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == alarm, CALENDAR_ERROR_INVALID_PARAMETER);
int ret = 0;
int unit = 0;
ret = calendar_record_get_int(alarm, _calendar_alarm.tick_unit, &unit);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "failed to get unit");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "failed to get unit");
if (CALENDAR_ALARM_TIME_UNIT_SPECIFIC == unit) {
calendar_time_s at = {0};
ret = calendar_record_get_caltime(alarm, _calendar_alarm.alarm_time, &at);
- warn_if (CALENDAR_ERROR_NONE != ret, "failed to get alarm_time");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "failed to get alarm_time");
if (CALENDAR_TIME_UTIME == at.type) {
char *datetime = _cal_time_convert_ltos(NULL, at.time.utime, 0);
} else {
int tick = 0;
ret = calendar_record_get_int(alarm, _calendar_alarm.tick, &tick);
- warn_if (CALENDAR_ERROR_NONE != ret, "failed to get tick");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "failed to get tick");
__cal_vcalendar_make_printf(b, "TRIGGER:", vl_tick(unit, tick));
}
*/
static void __cal_vcalendar_make_aalarm(cal_make_s *b, calendar_record_h record, calendar_record_h alarm)
{
- retm_if (NULL == b, "b is NULL");
- retm_if (NULL == record, "record is NULL");
- retm_if (alarm == NULL, "alarm is NULL");
+ RETM_IF(NULL == b, "b is NULL");
+ RETM_IF(NULL == record, "record is NULL");
+ RETM_IF(alarm == NULL, "alarm is NULL");
int ret = CALENDAR_ERROR_NONE;
// set alarm
int unit = 0;
ret = calendar_record_get_int(alarm, _calendar_alarm.tick_unit, &unit);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
char datetime[32] = {0};
if (CALENDAR_ALARM_TIME_UNIT_SPECIFIC == unit) {
calendar_time_s at = {0};
ret = calendar_record_get_caltime(alarm, _calendar_alarm.alarm_time, &at);
- warn_if (CALENDAR_ERROR_NONE != ret, "failed to get alarm_time");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "failed to get alarm_time");
if (CALENDAR_TIME_UTIME == at.type) {
char *buf = _cal_time_convert_ltos(NULL, at.time.utime, 0);
} else { // has tick, unit
int tick = 0;
ret = calendar_record_get_int(alarm, _calendar_alarm.tick, &tick);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
char *uri = NULL;
ret = calendar_record_get_uri_p(record, &uri);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_uri_p() failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_uri_p() failed(%d)", ret);
calendar_time_s st = {0};
if (!strncmp(uri, _calendar_event._uri, strlen(_calendar_event._uri))) {
ret = calendar_record_get_caltime(record, _calendar_event.start_time, &st);
- retm_if (CALENDAR_ERROR_NONE != ret, "Failed to get start");
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "Failed to get start");
} else if (!strncmp(uri, _calendar_todo._uri, strlen(_calendar_todo._uri))) {
ret = calendar_record_get_caltime(record, _calendar_todo.due_time, &st);
- retm_if (CALENDAR_ERROR_NONE != ret, "Failed to get due");
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "Failed to get due");
}
if (CALENDAR_TIME_UTIME == st.type) {
static void __cal_vcalendar_make_alarm(cal_make_s *b, calendar_record_h alarm)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == alarm);
int ret;
// TODO : No action type is defined
ret = __cal_vcalendar_make_printf(b, "BEGIN:VALARM", NULL);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
ret = __cal_vcalendar_make_audio(b, alarm);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_audio() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_audio() is failed(%d)", ret);
int action = 0;
ret = calendar_record_get_int(alarm, _calendar_alarm.action, &action);
- retm_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
switch (action)
{
default:
ret = __cal_vcalendar_make_printf(b, "ACTION:", "EMAIL");
break;
}
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
char *summary = NULL;
ret = calendar_record_get_str_p(alarm, _calendar_alarm.summary, &summary);
if (summary && *summary) {
ret = __cal_vcalendar_make_printf(b, "SUMMARY:", summary);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
}
char *description = NULL;
ret = calendar_record_get_str_p(alarm, _calendar_alarm.description, &description);
if (description && *description) {
ret = __cal_vcalendar_make_printf(b, "DESCRIPTION:", description);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
}
__cal_vcalendar_make_printf(b, "END:VALARM", NULL);
char **t = NULL;
char *p = NULL;
- if (NULL == buf || NULL == mday)
- {
- ERR("Invalid parameter");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == buf, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == mday, CALENDAR_ERROR_INVALID_PARAMETER);
t = g_strsplit_set(mday, " ,", -1);
if (!t) {
char *bysetpos = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.bysetpos, &bysetpos);
- retm_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() failed(%d)", ret);
if (bysetpos && '\0' != bysetpos[0]) {
// in ver1.0, "3, 5, -4" -> "3+ 5+ 4-"
// in ver2.0, 3TH should be changed to setpos:3, byday:TH
char *byday = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.byday, &byday);
- retm_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() failed(%d)", ret);
if (NULL == byday || '\0' == byday[0])
{
strcat(buf, "1+ ");
char *p = NULL;
char buf_temp[8] = {0};
- if (NULL == buf || NULL == wday) {
- ERR("Invalid parameter");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == buf, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == wday, CALENDAR_ERROR_INVALID_PARAMETER);
num_past = 0;
t = g_strsplit_set(wday, " ,", -1);
static void __make_begin(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
switch (b->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = __cal_vcalendar_make_printf(b, "BEGIN:VEVENT", NULL);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = __cal_vcalendar_make_printf(b, "BEGIN:VTODO", NULL);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
break;
}
}
static void __make_dtstart(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *tzid = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.start_tzid, &tzid);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_caltime(record, _calendar_event.start_time, &ct);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.start_tzid, &tzid);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_caltime(record, _calendar_todo.start_time, &ct);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
break;
}
if (tzid && *tzid) {
static void __make_dtend(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *tzid = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.end_tzid, &tzid);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_caltime(record, _calendar_event.end_time, &ct);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
if (tzid && *tzid) {
__cal_vcalendar_make_time(b, tzid, &ct, "DTEND");
}
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.due_tzid, &tzid);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_caltime(record, _calendar_todo.due_time, &ct);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
if (tzid && *tzid) {
__cal_vcalendar_make_time(b, tzid, &ct, "DUE");
}
static void __make_sensitivity(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
int value = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_int(record, _calendar_event.sensitivity, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_int(record, _calendar_todo.sensitivity, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
break;
}
char *sensitivity = NULL;
}
static void __make_rrule_ver1_default(calendar_record_h record, int freq, int interval, char *buf, int buf_size)
{
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == record);
int ret = 0;
calendar_time_s caltime = {0};
ret = calendar_record_get_caltime(record, _calendar_event.start_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
switch (freq)
{
static void __make_rrule_ver1(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char buf[1024] = {0};
int freq = 0;
ret = calendar_record_get_int(record, _calendar_event.freq, &freq);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
int interval = 1;
ret = calendar_record_get_int(record, _calendar_event.interval, &interval);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
interval = interval > 0 ? interval : 1;
char *byyearday = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.byyearday, &byyearday);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
char *bymonth = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.bymonth, &bymonth);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
char *byday = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.byday, &byday);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
char *bymonthday = NULL;
ret = calendar_record_get_str_p(record, _calendar_event.bymonthday, &bymonthday);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
switch (freq)
{
static void __make_rrule_ver2(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *text = NULL;
int freq = 0;
ret = calendar_record_get_int(record, _calendar_event.freq, &freq);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
switch (freq) {
case CALENDAR_RECURRENCE_DAILY:
int interval = 1;
ret = calendar_record_get_int(record, _calendar_event.interval, &interval);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
interval = interval > 0 ? interval : 1;
snprintf(tmp, sizeof(tmp), ";INTERVAL=%d", interval);
__cal_vcalendar_make_set_str(b, tmp);
ret = calendar_record_get_str_p(record, _calendar_event.bysecond, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYSECOND= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYSECOND=");
}
ret = calendar_record_get_str_p(record, _calendar_event.byminute, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYMINUTE= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYMINUTE=");
}
ret = calendar_record_get_str_p(record, _calendar_event.byhour, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYHOUR= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYHOUR=");
}
ret = calendar_record_get_str_p(record, _calendar_event.byday, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYDAY= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYDAY=");
}
ret = calendar_record_get_str_p(record, _calendar_event.bymonthday, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYMONTHDAY= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYMONTHDAY=");
}
ret = calendar_record_get_str_p(record, _calendar_event.byyearday, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYYEARDAY= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYYEARDAY=");
}
ret = calendar_record_get_str_p(record, _calendar_event.byweekno, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYWEEKNO= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYWEEKNO=");
}
ret = calendar_record_get_str_p(record, _calendar_event.bymonth, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYMONTH= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYMONTH=");
}
ret = calendar_record_get_str_p(record, _calendar_event.bysetpos, &text);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() Failed(%d)", ret);
if (text && *text) {
DBG("BYSETPOS= [%s]", text);
__cal_vcalendar_make_set_str(b, ";BYSETPOS=");
int wkst = 0;
ret = calendar_record_get_int(record, _calendar_event.wkst, &wkst);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
if (wkst >= CALENDAR_SUNDAY && wkst <= CALENDAR_SATURDAY) {
__cal_vcalendar_make_set_str(b, ";WKST=");
switch (wkst) {
int range_type = 0;
int count = 0;
ret = calendar_record_get_int(record, _calendar_event.range_type, &range_type);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
switch (range_type) {
case CALENDAR_RANGE_COUNT:
ret = calendar_record_get_int(record, _calendar_event.count, &count);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() Failed(%d)", ret);
snprintf(tmp, sizeof(tmp), ";COUNT=%d", count);
__cal_vcalendar_make_set_str(b, tmp);
break;
case CALENDAR_RANGE_UNTIL:
ret = calendar_record_get_caltime(record, _calendar_event.until_time, &caltime);
- warn_if(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() Failed(%d)", ret);
if (caltime.type == CALENDAR_TIME_UTIME) {
char *tmp_tzid = NULL;
static void __make_rrule(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
switch (b->type)
{
{
int ret;
- retvm_if(attendee == NULL, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: attendee is NULL");
+ RETV_IF(attendee == NULL, CALENDAR_ERROR_INVALID_PARAMETER);
ret = __cal_vcalendar_make_set_str(b, "ATTENDEE");
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
int cutype = 0;
ret = calendar_record_get_int(attendee, _calendar_attendee.cutype, &cutype);
ret = __cal_vcalendar_make_set_str(b, "UNKNOWN");
break;
}
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
char *member = NULL;
ret = calendar_record_get_str_p(attendee, _calendar_attendee.member, &member);
if (member && *member) {
ret = __cal_vcalendar_make_set_str(b, ";MEMBER=");
ret = __cal_vcalendar_make_set_str(b, member);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
int role = 0;
{
ret = __cal_vcalendar_make_set_str(b, ";ROLE=");
ret = __cal_vcalendar_make_set_str(b, _att_role[role]);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
int status = 0;
{
ret = __cal_vcalendar_make_set_str(b, ";PARTSTAT=");
ret = __cal_vcalendar_make_set_str(b, _att_st[status]);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
int rsvp = 0;
{
ret = __cal_vcalendar_make_set_str(b, ";RSVP=");
ret = __cal_vcalendar_make_set_str(b, rsvp ? "TRUE" : "FALSE");
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
char *delegatee_uri = NULL;
{
ret = __cal_vcalendar_make_set_str(b, ";DELEGATED-TO=");
ret = __cal_vcalendar_make_set_str(b, delegatee_uri);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
char *delegator_uri = NULL;
{
ret = __cal_vcalendar_make_set_str(b, ";DELEGATED-FROM=");
ret = __cal_vcalendar_make_set_str(b, delegator_uri);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
// TODO : No 'sentby' member in cal_participant_info_t
if (name && *name) {
ret = __cal_vcalendar_make_set_str(b, ";CN=");
ret = __cal_vcalendar_make_set_str(b, name);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
char *email = NULL;
{
ret = __cal_vcalendar_make_set_str(b, ":mailto:");
ret = __cal_vcalendar_make_set_str(b, email);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
}
__cal_vcalendar_make_flush(b);
static void __make_attendee(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
unsigned int count = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_child_record_count(record, _calendar_event.calendar_attendee, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_event.calendar_attendee, i, &child);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_child_record_count(record, _calendar_todo.calendar_attendee, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_todo.calendar_attendee, i, &child);
static void __make_alarm_ver1(cal_make_s *b, calendar_record_h record)
{
// In ver 1.0, only first alarm will be dealt with.
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
unsigned int count = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_child_record_count(record, _calendar_event.calendar_alarm, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_event.calendar_alarm, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_aalarm(b, record, child);
}
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_child_record_count(record, _calendar_todo.calendar_alarm, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_todo.calendar_alarm, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_aalarm(b, record, child);
}
static void __make_alarm_ver2(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
unsigned int count = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_child_record_count(record, _calendar_event.calendar_alarm, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_event.calendar_alarm, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_alarm(b, child);
}
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_child_record_count(record, _calendar_todo.calendar_alarm, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_todo.calendar_alarm, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_alarm(b, child);
}
static void __make_alarm(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
switch (b->type)
{
}
static void __make_created_time(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
long long int value = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_lli(record, _calendar_event.created_time, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_lli(record, _calendar_todo.created_time, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
}
int y = 0, m = 0, d = 0;
static void __make_summary(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *value = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.summary, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.summary, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
}
if (value && *value) {
static void __make_description(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *value = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.description, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.description, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
}
if (value && *value) {
static void __make_location(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *value = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.location, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.location, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
}
if (value && *value) {
static void __make_organizer(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
if (VCAL_VER_1 == b->version) // Invalid component in ver 1
return;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.organizer_name, &name);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_str_p(record, _calendar_event.organizer_email, &email);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.organizer_name, &name);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_str_p(record, _calendar_todo.organizer_email, &email);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
}
if ((NULL == name || '\0' == *name) && (NULL == email || '\0' == *email))
static void __make_last_modified(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
if (VCAL_VER_1 == b->version) // kies want to skip
return;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_lli(record, _calendar_event.last_modified_time, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_lli(record, _calendar_todo.last_modified_time, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
}
static void __make_status(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
int value = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_int(record, _calendar_event.event_status, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
switch (value)
{
case CALENDAR_EVENT_STATUS_NONE:
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_int(record, _calendar_todo.todo_status, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
switch (value)
{
case CALENDAR_TODO_STATUS_NONE:
static void __make_completed(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
if (CALENDAR_BOOK_TYPE_EVENT == b->type) // Invalid component in event
return;
int ret = 0;
long long int value = 0;
ret = calendar_record_get_lli(record, _calendar_todo.completed_time, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
int y = 0, m = 0, d = 0;
int h = 0, n = 0, s = 0;
static void __make_priority(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
int value = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_int(record, _calendar_event.priority, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_int(record, _calendar_todo.priority, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_int() is failed(%d)", ret);
break;
}
int priority = 0;
static void __make_dtstamp(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
if (VCAL_VER_1 == b->version) // Not support in ver 1
return;
static void __make_categories(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *value = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.categories, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.categories, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
}
if (value && *value)
}
static void __make_uid(cal_make_s *b, calendar_record_h record)
{
- ENTER();
+ CAL_FN_CALL();
char *uid = NULL;
// search if original_event_id > 0.
}
static void __make_exdate(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
char *value = NULL;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.exdate, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ERR("Not support exdate in TODO");
static void __cal_vcalendar_make_child_extended(cal_make_s *b, calendar_record_h child, bool *has_lunar)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == child, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == child);
int ret = 0;;
char *key = NULL;
char *value = NULL;
ret = calendar_record_get_str_p(child, _calendar_extended_property.key, &key);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
if (NULL == key || '\0' == *key || (0 != strncmp(key, "X-", strlen("X-")))) {
DBG("Not extended for vcalendar[%s]", key);
return;
}
ret = calendar_record_get_str_p(child, _calendar_extended_property.value, &value);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
// check lunar: will handle next
if (has_lunar) {
}
ret = __cal_vcalendar_make_printf(b, key, value);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
}
static void __make_extended(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
unsigned int count = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_child_record_count(record, _calendar_event.extended, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_event.extended, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_child_extended(b, child, &has_lunar);
}
// lunar
ret = calendar_record_get_int(record, _calendar_event.calendar_system_type, &calendar_system_type);
- retm_if (CALENDAR_ERROR_NONE != ret, "Failed to get calendar_record_type(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "Failed to get calendar_record_type(%d)", ret);
if (true == has_lunar || CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR == calendar_system_type)
__cal_vcalendar_make_printf(b, "X-LUNAR:SET", NULL);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_child_record_count(record, _calendar_todo.extended, &count);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_child_record_count() is failed(%d)", ret);
for (i = 0; i < count; i++) {
calendar_record_h child = NULL;
ret = calendar_record_get_child_record_at_p(record, _calendar_todo.extended, i, &child);
- warn_if(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to get child alarm(%d)", ret);
__cal_vcalendar_make_child_extended(b, child, NULL);
}
static void __make_end(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
int ret = 0;
switch (b->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = __cal_vcalendar_make_printf(b, "END:VEVENT", NULL);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = __cal_vcalendar_make_printf(b, "END:VTODO", NULL);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
break;
}
}
static void __cal_vcalendar_make_schedule(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
__make_begin(b, record);
__make_summary(b, record);
static void __append_header(cal_make_s *b)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
+ RET_IF(NULL == b);
int ret = 0;
ret = __cal_vcalendar_make_printf(b, "BEGIN:VCALENDAR", NULL);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
ret = __cal_vcalendar_make_printf(b, "PRODID:vCal ID Default", NULL);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
char buf[32] = {0};
snprintf(buf, sizeof(buf), "VERSION:%d.0", b->version);
ret = __cal_vcalendar_make_printf(b, buf, NULL);
- retm_if (CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
}
static void __make_footer(cal_make_s *b)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
-
int ret = 0;
+ RET_IF(NULL == b);
+
ret = __cal_vcalendar_make_printf(b, "END:VCALENDAR", NULL);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed(%d)", ret);
}
static void __make_tz(cal_make_s *b, char *tzid, long long int created)
{
- retm_if (NULL == b, "Invalid parameter: cal_make_s is NULL");
- retm_if (NULL == tzid || '\0' == *tzid, "Invalid parameter: tzid is NULL");
-
int ret = 0;
+ RET_IF(NULL == b);
+ RET_IF(NULL == tzid);
+ RET_IF('\0' == *tzid);
+
time_t zone = 0;
time_t dst = 0;
_cal_time_get_tz_offset(tzid, &zone, &dst);
h < 0 ? (-1 * h) : h, m < 0 ? (-1 * m) : m);
ret = __cal_vcalendar_make_printf(b, buf, NULL);
- retm_if(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed");
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "__cal_vcalendar_make_printf() is failed");
DBG("append tzid[%s]", buf);
}
static void __devide_vcalendar_with_header(cal_make_s *b, calendar_record_h record)
{
- retm_if (NULL == b, "cal_make_s is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == b);
+ RET_IF(NULL == record);
if (2 == b->version)
return;
int ret = 0;
char *uri = NULL;
ret = calendar_record_get_uri_p(record, &uri);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_uri_p() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_uri_p() is failed(%d)", ret);
char *tzid = NULL;
long long int created = 0;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_str_p(record, _calendar_event.start_tzid, &tzid);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_lli(record, _calendar_event.created_time, &created);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_str_p(record, _calendar_todo.due_tzid, &tzid);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_str_p() is failed(%d)", ret);
ret = calendar_record_get_lli(record, _calendar_todo.created_time, &created);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_lli() is failed(%d)", ret);
break;
}
}
static int __make_vcalendar(cal_make_s *b, calendar_list_h list)
{
- retvm_if (NULL == b, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: cal_make_s is NULL");
- retvm_if (NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid paramter: list is NULL");
+ RETV_IF(NULL == b, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
int ret = CALENDAR_ERROR_NONE;
calendar_record_h record = NULL;
// start
ret = calendar_list_first(list);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "calendar_list_first() Failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_first() Failed");
do {
ret = calendar_list_get_current_record_p(list, &record);
if (CALENDAR_ERROR_NONE != ret) break;
int _cal_vcalendar_make_vcalendar(cal_make_s *b, calendar_list_h list)
{
- retvm_if (NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid paramter:list is NULL");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
int ret = CALENDAR_ERROR_NONE;
calendar_record_h record = NULL;
int version = 2; // set default as ver 2.0
ret = calendar_list_first(list);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "calendar_list_first() Failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_first() Failed");
do {
ret = calendar_list_get_current_record_p(list, &record);
if(CALENDAR_ERROR_NONE != ret) break;
static inline char* __crlf(char *p)
{
- ENTER();
+ CAL_FN_CALL();
while (VCAL_LF != *p) {
if ('\0' == *p) {
static void __get_rest_string(char *p, char **value)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter: p is NULL");
- retm_if (NULL == value, "Invalid parameter: p is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
+ RET_IF(NULL == value);
int i = 0;
while (VCAL_LF != *(p +i)) {
i++;
}
char *v = calloc(i, sizeof(char));
- retm_if (NULL == v, "calloc() is failed");
+ RETM_IF(NULL == v, "calloc() is failed");
snprintf(v, i, "%s", p);
*value = strdup(v);
}
static char* __get_value(char *cursor, char **value)
{
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
- retvm_if (NULL == value, NULL, "Invalid parameter: value is NULL");
+ RETV_IF(NULL == cursor, NULL);
+ RETV_IF(NULL == value, NULL);
int offset = 0;
while (':' != *(cursor + offset) && ';' != *(cursor + offset)) {
}
char *p = calloc(i + 1, sizeof(char));
- retvm_if (NULL == p, NULL, "calloc() is failed");
+ RETVM_IF(NULL == p, NULL, "calloc() is failed");
if (VCAL_CR == *(cursor + offset + i -1)) {
memcpy(p, cursor + offset, i -1);
static char* __check_word(char *src, const char *word)
{
- retvm_if (NULL == src, NULL, "Invalid parameter: src is NULL");
+ RETV_IF(NULL == src, NULL);
src = __remove_empty_line(src);
src = __remove_invalid_space(src);
static void __unfolding(char *p)
{
- retm_if(p == NULL || '\0' == *p, "Invalid parameter: p is NULL");
+ RET_IF(p == NULL);
+ RET_IF('\0' == *p);
char *q = p;
while ('\0' != *p) {
static void __decode_escaped_char(char *p)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter:p is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
DBG("Before [%s]", p);
char *q = p;
static void __decode_base64(char *p)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter: p is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
DBG("Before [%s]", p);
guchar *buf = NULL;
static void __decode_quoted_printable(char *p)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter: p is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
int i = 0, j = 0;
char ch;
{
char **t = NULL;
t = g_strsplit(p, ":", 2);
- retvm_if (NULL == t, NULL, "g_strsplit() is failed");
+ RETVM_IF(NULL == t, NULL, "g_strsplit() is failed");
if ('\0' == *t[0]) { // no param
g_strfreev(t);
{
char **t = NULL;
t = g_strsplit(p, ":", -1);
- retvm_if (NULL == t, NULL, "g_strsplit() is failed");
+ RETVM_IF(NULL == t, NULL, "g_strsplit() is failed");
if ('\0' == *t[0]) { // no param
g_strfreev(t);
// param start
char **s = NULL;
s = g_strsplit(p, ";", -1);
- retvm_if (NULL == s, p + strlen(p) - len_param, "g_strsplit() failed");
+ RETVM_IF(NULL == s, p + strlen(p) - len_param, "g_strsplit() failed");
int count_param = g_strv_length(s);
DBG("count_param(%d)", count_param);
static void __decode_duration(char *cursor, int len, int *tick, int *unit)
{
- retm_if (NULL == cursor || '\0' == *cursor, "Invalid parameter: cursor is NULL");
- retm_if (NULL == tick, "Invalid parameter: tick is NULL");
- retm_if (NULL == unit, "Invalid parameter: unit is NULL");
+ RET_IF(NULL == cursor );
+ RET_IF('\0' == *cursor);
+ RET_IF(NULL == tick);
+ RET_IF(NULL == unit);
char buf[8] = {0};
int sign = 1;
static char* __get_index(char *cursor, const char **array, int len, int *index)
{
- retvm_if (NULL == index, NULL, "Invalid parameter: index is NULL");
+ RETV_IF(NULL == index, NULL);
int i;
char *new = NULL;
static int __get_version(char *value, int *version)
{
- ENTER();
+ CAL_FN_CALL();
- retvm_if (NULL == value, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: value is NULL");
- retvm_if (NULL == version, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: version is NULL");
+ RETV_IF(NULL == value, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == version, CALENDAR_ERROR_INVALID_PARAMETER);
if (!strncmp(value, ":1.0", strlen(":1.0"))) {
*version = 1;
static void __get_caltime(char *p, calendar_time_s *caltime, struct user_data *ud)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter: p is NULL");
- retm_if (NULL == caltime, "Invalid parameter: caltime is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
+ RET_IF(NULL == caltime);
+ RET_IF(NULL == ud);
switch (strlen(p))
{
*/
static void __parse_tz(const char *tz, int *h, int *m)
{
- retm_if(NULL == tz, "Invalid parameter: tz is NULL");
+ RET_IF(NULL == tz);
char **t = g_strsplit(tz, ":", -1);
- retm_if(NULL == t, "g_strsplit() is NULL");
+ RETM_IF(NULL == t, "g_strsplit() is NULL");
int sign = 0;
if (*t[0] == '-') sign = -1;
static void __get_tz(char *value, char **tz)
{
- retm_if (NULL == value, "Invalid parameter: cursor is NULL");
- retm_if (NULL == tz, "Invalid parameter: tz is NULL");
+ RET_IF(NULL == value);
+ RET_IF(NULL == tz);
int h = 0, m = 0;
__parse_tz(value +1, &h, &m); // +1 to skip ':'
static void __work_component_property_uid(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
value = __decode_charset(value);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.uid, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_str(record, _calendar_todo.uid, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
}
}
static void __work_component_property_recurrence_id(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
switch (ud->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.recurrence_id, value +1);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
DBG("Not supported in todo");
static void __work_component_property_dtstart(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
value = __decode_datetime(value, ud);
calendar_time_s caltime = {0};
case CALENDAR_BOOK_TYPE_EVENT:
if (tzid && *tzid) {
ret = _cal_record_set_str(record, _calendar_event.start_tzid, tzid);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
ret = _cal_record_set_caltime(record, _calendar_event.start_time, caltime);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
if (tzid && *tzid) {
ret = _cal_record_set_str(record, _calendar_todo.start_tzid, tzid);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
ret = _cal_record_set_caltime(record, _calendar_todo.start_time, caltime);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
break;
}
}
static void __work_component_property_created(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
switch (ud->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_lli(record, _calendar_event.created_time, _cal_time_convert_lli(value));
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_lli(record, _calendar_todo.created_time, _cal_time_convert_lli(value));
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
break;
}
}
static void __work_component_property_description(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
value = __decode_charset(value);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.description, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_str(record, _calendar_todo.description, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
}
}
static void __work_component_property_last_modified(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
switch (ud->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_lli(record, _calendar_event.last_modified_time, _cal_time_convert_lli(value));
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_lli(record, _calendar_todo.last_modified_time, _cal_time_convert_lli(value));
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_lli() Failed(%d)", ret);
break;
}
}
static void __work_component_property_location(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
value = __decode_charset(value);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.location, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_str(record, _calendar_todo.location, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
}
}
static void __work_component_property_priority(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
- retm_if (*value < '0' || *value > '9', "out of range[%s]", value);
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
+ RETM_IF(*value < '0' || *value > '9', "out of range[%s]", value);
int ret = 0;
int modified_priority = __decode_priority(value, ud);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_int(record, _calendar_event.priority, modified_priority);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_int(record, _calendar_todo.priority, modified_priority);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
}
}
static void __work_component_property_status(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
int status = 0;
status = CALENDAR_EVENT_STATUS_NONE;
}
ret = _cal_record_set_int(record, _calendar_event.event_status, status);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
if (!strncmp(value, ":NEEDS-ACTION", strlen(":NEEDS-ACTION"))) {
status = CALENDAR_TODO_STATUS_NONE;
}
ret = _cal_record_set_int(record, _calendar_todo.todo_status, status);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
}
}
static void __work_component_property_summary(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
value = __decode_charset(value);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.summary, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_str(record, _calendar_todo.summary, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
}
}
static bool __is_wday_string(char *p)
{
- retvm_if (NULL == p || '\0' == *p, false, "Invalid parameter: p is NULL");
+ RETV_IF(NULL == p, false);
+ RETV_IF('0' == *p, false);
if ('S' == *p && 'U' == *(p +1)) {
return true;
static void __set_bystr(int freq_mode, calendar_record_h record, char *bystr)
{
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == bystr || '\0' == *bystr, "Invalid parameter: bystr is NULL");
+ RET_IF(NULL == record);
+ RET_IF(NULL == bystr);
+ RET_IF('\0' == *bystr);
DBG("bystr[%s]", bystr);
bystr[strlen(bystr) -1] = '\0'; // to remove ','
{
case VCAL_RECURRENCE_YEARLY_BYMONTH:
ret = _cal_record_set_str(record, _calendar_event.bymonth, bystr);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case VCAL_RECURRENCE_YEARLY_BYYEARDAY:
ret = _cal_record_set_str(record, _calendar_event.byyearday, bystr);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case VCAL_RECURRENCE_MONTHLY_BYMONTHDAY:
ret = _cal_record_set_str(record, _calendar_event.bymonthday, bystr);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case VCAL_RECURRENCE_MONTHLY_BYDAY:
ret = _cal_record_set_str(record, _calendar_event.byday, bystr);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case VCAL_RECURRENCE_WEEKLY:
ret = _cal_record_set_str(record, _calendar_event.byday, bystr);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case VCAL_RECURRENCE_DAILY:
break;
*/
static void __work_component_property_rrule_ver_1(char *value, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
char **t = NULL;
t = g_strsplit_set(value, ": ", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
// start
int len = g_strv_length(t);
} else if ('W' == *t[i] && 'K' == *(t[i] +1) && 'S' == *(t[i] +2) && 'T' == *(t[i] +3)) { // +4 is '='
if ('S' == *(t[i] +5) && 'U' == *(t[i] +6)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_SUNDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('M' == *(t[i] +5)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_MONDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('T' == *(t[i] +5) && 'U' == *(t[i] +6)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_TUESDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('W' == *(t[i] +5)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_WEDNESDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('T' == *(t[i] +5) && 'H' == *(t[i] +6)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_THURSDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('F' == *(t[i] +5)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_FRIDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if ('S' == *(t[i] +5) && 'A' == *(t[i] +6)) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_SATURDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
ERR("Invalid parameter[ %s ]", t[i]);
}
break;
}
ret = _cal_record_set_int(record, _calendar_event.freq, frequency);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_event.interval, interval);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
DBG("frequency[%d] interval(%d)", frequency, interval);
}
} else {
calendar_time_s caltime = {0};
__get_caltime(t[i], &caltime, ud);
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_UNTIL);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_caltime(record, _calendar_event.until_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
} else if ('#' == *t[i]) { // count
if (true == __is_digit(t[i] +1)) {
if (0 == atoi(t[i] +1)) {
DBG("endless");
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_NONE);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
DBG("count (%d)", atoi(t[i] +1));
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_COUNT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_event.count, atoi(t[i] +1));
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
}
} else {
ERR("Unable to parse count[%s]", t[i]);
{
int ret = 0;
char **t = NULL;
+
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
+
t = g_strsplit_set(value, ";:", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_NONE);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
// start
int len = g_strv_length(t);
}
DBG("frequency(%d) [%s]", frequency, t[i] + strlen("FREQ") + 1);
ret = _cal_record_set_int(record, _calendar_event.freq, frequency);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i], "UNTIL=", strlen("UNTIL="))) {
calendar_time_s caltime = {0};
__get_caltime(t[i] + strlen("UNTIL="), &caltime, ud);
ret = _cal_record_set_caltime(record, _calendar_event.until_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_UNTIL);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i], "COUNT=", strlen("COUNT="))) {
int count = atoi(t[i] + strlen("COUNT="));
if (count < 1) count = 1;
ret = _cal_record_set_int(record, _calendar_event.count, count);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_event.range_type, CALENDAR_RANGE_COUNT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i], "INTERVAL=", strlen("INTERVAL="))) {
int interval = atoi(t[i] + strlen("INTERVAL="));
if (interval < 1) interval = 1;
ret = _cal_record_set_int(record, _calendar_event.interval, interval);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i], "BYYEARDAY=", strlen("BYYEARDAY="))) {
ret = _cal_record_set_str(record, _calendar_event.byyearday, t[i] + strlen("BYYEARDAY="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "BYWEEKNO=", strlen("BYWEEKNO="))) {
ret = _cal_record_set_str(record, _calendar_event.byweekno, t[i] + strlen("BYWEEKNO="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "BYMONTH=", strlen("BYMONTH="))) {
ret = _cal_record_set_str(record, _calendar_event.bymonth, t[i] + strlen("BYMONTH="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "BYMONTHDAY=", strlen("BYMONTHDAY="))) {
ret = _cal_record_set_str(record, _calendar_event.bymonthday, t[i] + strlen("BYMONTHDAY="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "BYDAY=", strlen("BYDAY="))) {
ret = _cal_record_set_str(record, _calendar_event.byday, t[i] + strlen("BYDAY="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "BYSETPOS=", strlen("BYSETPOS="))) {
ret = _cal_record_set_str(record, _calendar_event.bysetpos, t[i] + strlen("BYSETPOS="));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (!strncmp(t[i], "WKST=", strlen("WKST="))) {
if (!strncmp(t[i] + strlen("WKST="), "SU", strlen("SU"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_SUNDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "MO", strlen("MO"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_MONDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "TU", strlen("TU"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_TUESDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "WE", strlen("WE"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_WEDNESDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "TH", strlen("TH"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_THURSDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "FR", strlen("FR"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_FRIDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(t[i] + strlen("WKST="), "SA", strlen("SA"))) {
ret = _cal_record_set_int(record, _calendar_event.wkst, CALENDAR_SATURDAY);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
DBG("Unable to parse[%s]", t[i]);
}
static void __work_component_property_rrule(char *value, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
switch (ud->type)
{
static void __work_component_property_dtend(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
value = __decode_datetime(value, ud);
calendar_time_s caltime = {0};
case CALENDAR_BOOK_TYPE_EVENT:
if (tzid && *tzid) {
ret = _cal_record_set_str(record, _calendar_event.end_tzid, tzid);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
ret = _cal_record_set_caltime(record, _calendar_event.end_time, caltime);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
if (tzid && *tzid) {
ret = _cal_record_set_str(record, _calendar_todo.due_tzid, tzid);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
ret = _cal_record_set_caltime(record, _calendar_todo.due_time, caltime);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() Failed(%d)", ret);
break;
}
}
// attendee
static void __work_component_property_attendee_cutype(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
-
int ret = 0;
-DBG("[%s]", value);
+
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
+
if (!strncmp(value, "INDIVIDUAL", strlen("INDIVIDUAL"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_CUTYPE_INDIVIDUAL);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "GROUP", strlen("GROUP"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_CUTYPE_GROUP);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "RESOURCE", strlen("RESOURCE"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_CUTYPE_RESOURCE);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "ROOM", strlen("ROOM"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_CUTYPE_ROOM);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "UNKNOWN", strlen("UNKNOWN"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_CUTYPE_UNKNOWN);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
ERR("Invalid value[%s]", value);
}
}
static void __work_component_property_attendee_member(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = _cal_record_set_str(attendee, _calendar_attendee.member, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
static void __work_component_property_attendee_role(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
if (!strncmp(value, "REQ-PARTICIPANT", strlen("REQ-PARTICIPANT"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_ROLE_REQ_PARTICIPANT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "OPT-PARTICIPANT", strlen("OPT-PARTICIPANT"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_ROLE_OPT_PARTICIPANT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "NON-PARTICIPANT", strlen("NON-PARTICIPANT"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_ROLE_NON_PARTICIPANT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "CHAIR", strlen("CHAIR"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_ROLE_CHAIR);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
ERR("Invalid value[%s]", value);
}
}
static void __work_component_property_attendee_partstat(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
if (!strncmp(value, "NEEDS-ACTION", strlen("NEEDS-ACTION"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_PENDING);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "ACCEPTED", strlen("ACCEPTED"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_ACCEPTED);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "DECLINED", strlen("DECLINED"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_DECLINED);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "TENTATIVE", strlen("TENTATIVE"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_TENTATIVE);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "DELEGATED", strlen("DELEGATED"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_DELEGATED);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "COMPLETED", strlen("COMPLETED"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_COMPLETED);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else if (!strncmp(value, "IN-PROCESS", strlen("IN-PROCESS"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.cutype, CALENDAR_ATTENDEE_STATUS_IN_PROCESS);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
ERR("Invalid value[%s]", value);
}
}
static void __work_component_property_attendee_rsvp(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
if (!strncmp(value, "TRUE", strlen("TRUE"))) {
ret = _cal_record_set_int(attendee, _calendar_attendee.rsvp, 1);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
} else {
ret = _cal_record_set_int(attendee, _calendar_attendee.rsvp, 0);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
}
}
static void __work_component_property_attendee_delegated_to(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
ret = _cal_record_set_str(attendee, _calendar_attendee.delegatee_uri, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
}
static void __work_component_property_attendee_delegated_from(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
ret = _cal_record_set_str(attendee, _calendar_attendee.delegator_uri, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
}
static void __work_component_property_attendee_sent_by(calendar_record_h attendee, char *value)
{
}
static void __work_component_property_attendee_cn(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
ret = _cal_record_set_str(attendee, _calendar_attendee.name, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
}
static void __work_component_property_attendee_dir(calendar_record_h attendee, char *value)
{
}
static void __work_component_property_attendee_mailto(calendar_record_h attendee, char *value)
{
- retm_if (NULL == attendee, "Invalid parameter: attendee is NULL");
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == attendee);
int ret = 0;
ret = _cal_record_set_str(attendee, _calendar_attendee.email, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed");
}
/*
* example
*/
static void __work_component_property_attendee(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
calendar_record_h attendee = NULL;
ret = calendar_record_create(_calendar_attendee._uri, &attendee);
- retm_if (CALENDAR_ERROR_NONE != ret, "calendar_record_create() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_create() is failed(%d)", ret);
char **t = NULL;
t = g_strsplit(value, ";", -1);
- retm_if (NULL == t, "g_strsplit() is failed");
+ RETM_IF(NULL == t, "g_strsplit() is failed");
int len = g_strv_length(t);
-DBG("len(%d)", len);
int i;
for (i = 0; i < len; i++) {
if (NULL == t[i] || '\0' == *t[i]) continue;
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_add_child_record(record, _calendar_event.calendar_attendee, attendee);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_add_child_record(record, _calendar_event.calendar_attendee, attendee);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() Failed(%d)", ret);
break;
}
}
static void __work_component_property_categories(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
value = __decode_charset(value);
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.categories, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = _cal_record_set_str(record, _calendar_todo.categories, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
}
}
static void __work_component_property_dalarm(char *value, calendar_record_h record, struct user_data *ud)
{
// diff with aalarm:
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
char **t = NULL;
t = g_strsplit_set(value, ";:", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
calendar_record_h alarm = NULL;
ret = calendar_record_create(_calendar_alarm._uri, &alarm);
return;
}
ret = _cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_DISPLAY);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
int len = g_strv_length(t);
int i;
calendar_time_s caltime = {0};
__get_caltime(t[i], &caltime, ud);
ret = _cal_record_set_caltime(alarm, _calendar_alarm.alarm_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, CALENDAR_ALARM_TIME_UNIT_SPECIFIC);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
} else if (4 == index) { // displayString
DBG("displayString [%s]", t[i]);
ret = _cal_record_set_str(alarm, _calendar_alarm.summary, t[i]);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else { // TYPE, VALUE
{
case VCALENDAR_TYPE_VEVENT:
ret = calendar_record_add_child_record(record, _calendar_event.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
case VCALENDAR_TYPE_VTODO:
ret = calendar_record_add_child_record(record, _calendar_todo.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
}
g_strfreev(t);
static void __work_component_property_malarm(char *value, calendar_record_h record, struct user_data *ud)
{
// diff with aalarm: action
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
char **t = NULL;
t = g_strsplit_set(value, ";:", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
calendar_record_h alarm = NULL;
ret = calendar_record_create(_calendar_alarm._uri, &alarm);
return;
}
ret = _cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_EMAIL);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
int len = g_strv_length(t);
int i;
calendar_time_s caltime = {0};
__get_caltime(t[i], &caltime, ud);
ret = _cal_record_set_caltime(alarm, _calendar_alarm.alarm_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, CALENDAR_ALARM_TIME_UNIT_SPECIFIC);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
} else if (4 == index) { // addressString
DBG("addressString [%s]", t[i]);
ret = _cal_record_set_str(alarm, _calendar_alarm.attach, t[i]);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else if (5 == index) { // noteString
DBG("noteString [%s]", t[i]);
ret = _cal_record_set_str(alarm, _calendar_alarm.description, t[i]);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else { // TYPE, VALUE
{
case VCALENDAR_TYPE_VEVENT:
ret = calendar_record_add_child_record(record, _calendar_event.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
case VCALENDAR_TYPE_VTODO:
ret = calendar_record_add_child_record(record, _calendar_todo.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
}
g_strfreev(t);
*/
static void __work_component_property_aalarm(char *value, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
char **t = NULL;
t = g_strsplit_set(value, ";:", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
calendar_record_h alarm = NULL;
ret = calendar_record_create(_calendar_alarm._uri, &alarm);
return;
}
ret = _cal_record_set_int(alarm, _calendar_alarm.action, CALENDAR_ALARM_ACTION_AUDIO);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
int len = g_strv_length(t);
int i;
calendar_time_s caltime = {0};
__get_caltime(t[i], &caltime, ud);
ret = _cal_record_set_caltime(alarm, _calendar_alarm.alarm_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, CALENDAR_ALARM_TIME_UNIT_SPECIFIC);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
} else if (4 == index) { //audioContent
DBG("Content [%s]", t[i]);
ret = _cal_record_set_str(alarm, _calendar_alarm.attach, t[i]);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
} else { // TYPE, VALUE
}
}
{
case VCALENDAR_TYPE_VEVENT:
ret = calendar_record_add_child_record(record, _calendar_event.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
case VCALENDAR_TYPE_VTODO:
ret = calendar_record_add_child_record(record, _calendar_todo.calendar_alarm, alarm);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_add_child_record() is failed(%d)", ret);
break;
}
g_strfreev(t);
static void __work_component_property_exdate(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
switch (ud->type)
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_str(record, _calendar_event.exdate, value + 1);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
ERR("No exdate in todo");
static void __work_component_property_x_allday(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
if (!strncmp(value, ":SET", strlen(":SET"))) {
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = calendar_record_get_caltime(record, _calendar_event.start_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
if (CALENDAR_TIME_LOCALTIME == caltime.type) {
caltime.time.date.hour = 0;
caltime.time.date.minute = 0;
caltime.time.date.second = 0;
ret = _cal_record_set_caltime(record, _calendar_event.start_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
}
ret = calendar_record_get_caltime(record, _calendar_event.end_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
if (CALENDAR_TIME_LOCALTIME == caltime.type) {
caltime.time.date.hour = 0;
caltime.time.date.minute = 0;
caltime.time.date.second = 0;
ret = _cal_record_set_caltime(record, _calendar_event.end_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
}
ret = calendar_record_get_caltime(record, _calendar_event.until_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
if (CALENDAR_TIME_LOCALTIME == caltime.type) {
caltime.time.date.hour = 0;
caltime.time.date.minute = 0;
caltime.time.date.second = 0;
ret = _cal_record_set_caltime(record, _calendar_event.until_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
}
break;
case CALENDAR_BOOK_TYPE_TODO:
ret = calendar_record_get_caltime(record, _calendar_todo.start_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
if (CALENDAR_TIME_LOCALTIME == caltime.type) {
caltime.time.date.hour = 0;
caltime.time.date.minute = 0;
caltime.time.date.second = 0;
ret = _cal_record_set_caltime(record, _calendar_todo.start_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
}
ret = calendar_record_get_caltime(record, _calendar_todo.due_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed");
if (CALENDAR_TIME_LOCALTIME == caltime.type) {
caltime.time.date.hour = 0;
caltime.time.date.minute = 0;
caltime.time.date.second = 0;
ret = _cal_record_set_caltime(record, _calendar_todo.due_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed");
}
break;
}
static void __work_component_property_x_lunar(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
+ RET_IF(NULL == ud);
int ret = 0;
if (!strncmp(value, ":SET", strlen(":SET"))) {
{
case CALENDAR_BOOK_TYPE_EVENT:
ret = _cal_record_set_int(record, _calendar_event.calendar_system_type, CALENDAR_SYSTEM_EAST_ASIAN_LUNISOLAR);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
case CALENDAR_BOOK_TYPE_TODO:
DBG("Not supported lunar in todo");
// valarm
static void __work_component_property_valarm_action(char *value, calendar_record_h alarm, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == alarm);
const char *prop[CALENDAR_ALARM_ACTION_MAX] = {":AUDIO", ":DISPLAY", ":EMAIL"};
for (i = 0; i < CALENDAR_ALARM_ACTION_MAX; i++) {
if (!strncmp(value, prop[i], strlen(prop[i]))) {
ret = _cal_record_set_int(alarm, _calendar_alarm.action, i);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
break;
}
}
static void __work_component_property_valarm_trigger(char *value, calendar_record_h record, calendar_record_h alarm, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
- retm_if (NULL == ud, "Invalid parameter: ud is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == alarm);
+ RET_IF(NULL == ud);
int ret = 0;
char **t = NULL;
t = g_strsplit_set(value, ";:", -1);
- retm_if (NULL == t, "g_strsplit_set() is failed");
+ RETM_IF(NULL == t, "g_strsplit_set() is failed");
int related = VCAL_RELATED_NONE;
// start
calendar_time_s caltime = {0};
__get_caltime(t[i], &caltime, ud);
ret = _cal_record_set_caltime(alarm, _calendar_alarm.alarm_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, CALENDAR_ALARM_TIME_UNIT_SPECIFIC);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
} else {
int unit = 0;
int tick = 0;
{
case VCAL_RELATED_START:
ret = calendar_record_get_caltime(record, _calendar_event.start_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
_cal_time_modify_caltime(&caltime, tick * unit);
ret = _cal_record_set_caltime(record, _calendar_event.start_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
break;
case VCAL_RELATED_END:
ret = calendar_record_get_caltime(record, _calendar_event.end_time, &caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "calendar_record_get_caltime() is failed(%d)", ret);
_cal_time_modify_caltime(&caltime, tick * unit);
ret = _cal_record_set_caltime(record, _calendar_event.end_time, caltime);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_caltime() is failed(%d)", ret);
break;
}
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, CALENDAR_ALARM_TIME_UNIT_SPECIFIC);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
} else {
ret = _cal_record_set_int(alarm, _calendar_alarm.tick, (-1 * tick));
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
ret = _cal_record_set_int(alarm, _calendar_alarm.tick_unit, unit);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() is failed(%d)", ret);
}
}
}
static void __work_component_property_valarm_attach(char *value, calendar_record_h alarm, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == alarm);
int ret = _cal_record_set_str(alarm, _calendar_alarm.attach, value + 1);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
static void __work_component_property_valarm_description(char *value, calendar_record_h alarm, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == alarm);
int ret = _cal_record_set_str(alarm, _calendar_alarm.description, value + 1);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
static void __work_component_property_valarm_summary(char *value, calendar_record_h alarm, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == alarm, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == alarm);
int ret = _cal_record_set_str(alarm, _calendar_alarm.summary, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() Failed(%d)", ret);
}
static void __work_component_property_valarm_duration(char *value, calendar_record_h alarm, struct user_data *ud)
static char* __work_component_property_begin(char *cursor, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
- retvm_if (NULL == record, NULL, "Invalid parameter: record is NULL");
- retvm_if (NULL == ud, NULL, "Invalid parameter: user_data is NULL");
+ RETV_IF(NULL == cursor, NULL);
+ RETV_IF(NULL == record, NULL);
+ RETV_IF(NULL == ud, NULL);
if (0 != strncmp(cursor, ":VALARM", strlen(":VALARM"))) {
DBG("this is not valarm");
int ret = 0;
calendar_record_h alarm = NULL;
ret = calendar_record_create(_calendar_alarm._uri, &alarm);
- retvm_if (CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
cursor = __crlf(cursor); // crlf: BEGIN:VALARM
bool exit_loop = false;
ret = calendar_record_add_child_record(record, _calendar_todo.calendar_alarm, alarm);
break;
}
- retvm_if (CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_add_child_record() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_add_child_record() is failed(%d)", ret);
return cursor;
}
static char* __work_component_vevent(char *cursor, calendar_record_h record, struct user_data *ud)
{
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
- retvm_if (NULL == record, NULL, "Invalid parameter: record is NULL");
+ RETV_IF(NULL == cursor, NULL);
+ RETV_IF(NULL == record, NULL);
bool exit_loop = false;
while (cursor) {
static char* __work_component_vjournal(char *cursor, calendar_record_h record, struct user_data *ud)
{
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
+ RETV_IF(NULL == cursor, NULL);
DBG("Not supported vjournal");
static char* __work_component_vfreebusy(char *cursor, calendar_record_h record, struct user_data *ud)
{
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
+ RETV_IF(NULL == cursor, NULL);
DBG("Not supported vfreebusy");
static void __work_component_property_vtimezone_standard_dtstart(char *value, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
int ret = 0;
int y = 0, m = 0, d = 0;
int h = 0, n = 0, s = 0;
sscanf(value +1, VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSS, &y, &m, &d, &h, &n, &s);
ret = _cal_record_set_int(record, _calendar_timezone.standard_start_month, m);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_timezone.standard_start_hour, h);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
long long int t = _cal_time_convert_lli(value +1);
int nth = 0, wday = 0;
_cal_time_get_nth_wday(t, &nth, &wday);
ret = _cal_record_set_int(record, _calendar_timezone.standard_start_position_of_week, nth);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_timezone.standard_start_day, wday);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
}
static void __work_component_property_vtimezone_standard_tzoffsetfrom(char *value, calendar_record_h record, struct user_data *ud)
{
}
static void __work_component_property_vtimezone_standard_tzoffsetto(char *value, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
char c;
int h = 0, m = 0;
int ret = 0;
ret = _cal_record_set_int(record, _calendar_timezone.standard_bias, offset);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_timezone.tz_offset_from_gmt, offset);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
if (NULL == ud->timezone_tzid || '\0' == *ud->timezone_tzid) {
char buf[32] = {0};
}
static void __work_component_property_vtimezone_standard_tzname(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
int ret = _cal_record_set_str(record, _calendar_timezone.standard_name, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
}
static void __work_component_property_vtimezone_standard_rdate(char *value, calendar_record_h record, struct user_data *ud)
{
}
static char* __work_component_vtimezone_standard(char *cursor, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retvm_if (NULL == cursor || '\0' == *cursor, __crlf(cursor), "Invalid parameter: cursor is NULL");
- retvm_if (NULL == record, __crlf(cursor), "Invalid parameter: record is NULL");
+ RETV_IF(NULL == cursor, __crlf(cursor));
+ RETV_IF('\0' == *cursor, __crlf(cursor));
+ RETV_IF(NULL == record, __crlf(cursor));
cursor = __crlf(cursor);
bool exit_loop = false;
static void __work_component_property_vtimezone_daylight_dtstart(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
int ret = 0;
int y = 0, m = 0, d = 0;
int h = 0, n = 0, s = 0;
sscanf(value +1, VCAL_DATETIME_FORMAT_YYYYMMDDTHHMMSS, &y, &m, &d, &h, &n, &s);
ret = _cal_record_set_int(record, _calendar_timezone.day_light_start_month, m);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_timezone.day_light_start_hour, h);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
long long int t = _cal_time_convert_lli(value +1);
int nth = 0, wday = 0;
_cal_time_get_nth_wday(t, &nth, &wday);
ret = _cal_record_set_int(record, _calendar_timezone.day_light_start_position_of_week, nth);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
ret = _cal_record_set_int(record, _calendar_timezone.day_light_start_day, wday);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
}
static void __work_component_property_vtimezone_daylight_tzoffsetfrom(char *value, calendar_record_h record, struct user_data *ud)
{
}
static void __work_component_property_vtimezone_daylight_tzoffsetto(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
char c;
int h = 0, m = 0;
if ('-' == c) offset *= -1;
int ret = ret = _cal_record_set_int(record, _calendar_timezone.day_light_bias, offset);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
-DBG("offset(%d)", offset);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_int() Failed(%d)", ret);
}
static void __work_component_property_vtimezone_daylight_tzname(char *value, calendar_record_h record, struct user_data *ud)
{
- retm_if (NULL == value || '\0' == *value, "Invalid parameter: value is NULL");
- retm_if (NULL == record, "Invalid parameter: record is NULL");
+ RET_IF(NULL == value);
+ RET_IF('\0' == *value);
+ RET_IF(NULL == record);
int ret = _cal_record_set_str(record, _calendar_timezone.day_light_name, value);
- warn_if (CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_record_set_str() is failed(%d)", ret);
}
static void __work_component_property_vtimezone_daylight_rdate(char *value, calendar_record_h record, struct user_data *ud)
{
}
static char* __work_component_vtimezone_daylight(char *cursor, calendar_record_h record, struct user_data *ud)
{
- retvm_if (NULL == cursor || '\0' == *cursor, __crlf(cursor), "Invalid parameter: cursor is NULL");
- retvm_if (NULL == record, __crlf(cursor), "Invalid parameter: record is NULL");
+ RETV_IF(NULL == cursor, __crlf(cursor));
+ RETV_IF('\0' == *cursor, __crlf(cursor));
+ RETV_IF(NULL == record, __crlf(cursor));
cursor = __crlf(cursor);
bool exit_loop = false;
static char* __work_component_vtimezone(char *cursor, calendar_record_h record, struct user_data *ud)
{
- ENTER();
+ CAL_FN_CALL();
- retvm_if (NULL == cursor, NULL, "Invalid parameter: cursor is NULL");
- retvm_if (NULL == record, NULL, "Invalid parameter: record is NULL");
+ RETV_IF(NULL == cursor, NULL);
+ RETV_IF(NULL == record, NULL);
__init_component_property_vtimezone();
static char* __work_property_begin(char *cursor, calendar_record_h *out_record, struct user_data *ud)
{
- ENTER();
- retvm_if (NULL == cursor || '\0' == *cursor, NULL, "Invalid parameter: cursor is NULL");
- retvm_if (NULL == out_record, NULL, "Invalid parameter: out_record is NULL");
- retvm_if (NULL == ud, NULL, "Invalid parameter: ud is NULL");
+ CAL_FN_CALL();
+ RETV_IF(NULL == cursor, NULL);
+ RETV_IF('\0' == *cursor, NULL);
+ RETV_IF(NULL == out_record, NULL);
+ RETV_IF(NULL == ud, NULL);
int ret = 0;
int index = 0;
{
case VCAL_COMPONENT_VEVENT:
ret = calendar_record_create(_calendar_event._uri, &record);
- retvm_if (CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
ud->type = CALENDAR_BOOK_TYPE_EVENT;
cursor = __work_component_vevent(cursor, record, ud);
break;
case VCAL_COMPONENT_VTODO:
ret = calendar_record_create(_calendar_todo._uri, &record);
- retvm_if (CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
ud->type = CALENDAR_BOOK_TYPE_TODO;
cursor = __work_component_vevent(cursor, record, ud); // same as event
break;
case VCAL_COMPONENT_VTIMEZONE:
ret = calendar_record_create(_calendar_timezone._uri, &record);
- retvm_if (CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, NULL, "calendar_record_create() is failed(%d)", ret);
cursor = __work_component_vtimezone(cursor, record, ud);
break;
}
int _cal_vcalendar_parse_vcalendar_object(char *stream, calendar_list_h list, vcalendar_foreach_s *foreach_data)
{
- ENTER();
+ CAL_FN_CALL();
- retvm_if (NULL == stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: stream is NULL");
- retvm_if (NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: list is NULL");
+ RETV_IF(NULL == stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
__init_component();
__init_property();
__unfolding(stream);
struct user_data *ud = calloc(1, sizeof(struct user_data));
- retvm_if (NULL == ud, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() is failed");
+ RETVM_IF(NULL == ud, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() is failed");
ud->version = VCAL_VER_2; // default
calendar_record_h record = NULL;
view_uri_info = g_hash_table_lookup(cal_uri_property_hash, view_uri);
if( view_uri_info ) {
type = view_uri_info->type;
- //CAL_DBG("%s:%d",view_uri,type);
}
else
{
cal_filter_type_e filter_type = CAL_FILTER_COMPOSITE;
calendar_filter_operator_e op = CALENDAR_FILTER_OPERATOR_AND;
- retvm_if(filter==NULL, CALENDAR_ERROR_INVALID_PARAMETER, "filter is NULL");
+ RETVM_IF(filter==NULL, CALENDAR_ERROR_INVALID_PARAMETER, "filter is NULL");
filter->filter_type = CAL_FILTER_COMPOSITE;
}
if (filter_type == CAL_FILTER_COMPOSITE) {
cal_composite_filter_s* com_filter = NULL;
- com_filter = (cal_composite_filter_s*)calloc(1,sizeof(cal_composite_filter_s));
+ com_filter = calloc(1,sizeof(cal_composite_filter_s));
if (com_filter == NULL) {
ERR("malloc fail");
ret = CALENDAR_ERROR_OUT_OF_MEMORY;
}
else {
cal_attribute_filter_s* attr_filter = NULL;
- attr_filter = (cal_attribute_filter_s*)calloc(1,sizeof(cal_attribute_filter_s));
+ attr_filter = calloc(1,sizeof(cal_attribute_filter_s));
if (attr_filter == NULL) {
ERR("malloc fail");
ret = CALENDAR_ERROR_OUT_OF_MEMORY;
cal_record_s common = {0,};
cal_record_s *pcommon = NULL;
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == precord, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == precord, CALENDAR_ERROR_INVALID_PARAMETER);
if (_cal_ipc_unmarshal_record_common(ipc_data,&common) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_unmarshal fail");
}
ret = calendar_record_create(common.view_uri, precord);
- retvm_if(ret != CALENDAR_ERROR_NONE, ret, "record create fail");
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "record create fail");
pcommon = (cal_record_s*)(*precord);
pcommon->properties_max_count = common.properties_max_count;
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
if (_cal_ipc_marshal_record_common(temp,ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
}
cal_ipc_marshal_record_plugin_cb_s *plugin_cb = __cal_ipc_marshal_get_plugin_cb(temp->type);
-
- retvm_if(NULL == plugin_cb || NULL == plugin_cb->marshal_record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == plugin_cb->marshal_record, CALENDAR_ERROR_INVALID_PARAMETER);
ret = plugin_cb->marshal_record(record, ipc_data);
cal_record_s *temp = (cal_record_s*)(record);
- retvm_if(NULL == record || NULL == property_id ||
- NULL == id, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == property_id, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == id, CALENDAR_ERROR_INVALID_PARAMETER);
cal_ipc_marshal_record_plugin_cb_s *plugin_cb = __cal_ipc_marshal_get_plugin_cb(temp->type);
- retvm_if(NULL == plugin_cb || NULL == plugin_cb->get_primary_id, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == plugin_cb->get_primary_id, CALENDAR_ERROR_INVALID_PARAMETER);
ret = plugin_cb->get_primary_id(record, property_id,id);
int length = 0;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(ppbufchar==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ppbufchar, CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(ipc_data,&size);
if ( tmp == NULL) {
if(length == -1) {
ret = CALENDAR_ERROR_NONE;
- //CAL_DBG("string is null");
*ppbufchar = NULL;
return ret;
}
void *tmp = NULL;
unsigned int size = 0;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
void *tmp = NULL;
unsigned int size = 0;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
void *tmp = NULL;
unsigned int size = 0;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
ERR("pims_ipc_data_get fail");
void *tmp = NULL;
unsigned int size = 0;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
ERR("pims_ipc_data_get fail");
void *tmp = NULL;
unsigned int size = 0;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
ERR("pims_ipc_data_get fail");
unsigned int size = 0;
int ret = CALENDAR_ERROR_NONE;
- retv_if(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pout==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
tmp = pims_ipc_data_get(data,&size);
if ( tmp == NULL) {
ERR("pims_ipc_data_get fail");
}
else {
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.year));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.month));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.mday));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.hour));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.minute));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_unmarshal_int(data, &(pout->time.date.second));
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
}
return CALENDAR_ERROR_NONE;
unsigned int size = 0;
const char* str = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
tmp = pims_ipc_data_get(ipc_data,&size);
if ( tmp == NULL) {
ERR("pims_ipc_data_get fail");
{
unsigned char *tmp_properties_flags;
tmp_properties_flags = (unsigned char*)pims_ipc_data_get(ipc_data,&size);
- common->properties_flags = calloc(common->properties_max_count, sizeof(char));
+ common->properties_flags = calloc(common->properties_max_count, sizeof(char));
if (common->properties_flags == NULL) {
ERR("calloc fail");
return CALENDAR_ERROR_OUT_OF_MEMORY;
{
int ret = CALENDAR_ERROR_NONE;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if( bufchar != NULL) {
int length = strlen(bufchar);
int _cal_ipc_marshal_int(const int in, pims_ipc_data_h ipc_data)
{
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(int)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_ipc_marshal_uint(const unsigned int in, pims_ipc_data_h ipc_data)
{
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(unsigned int)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_ipc_marshal_lli(const long long int in, pims_ipc_data_h ipc_data)
{
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(long long int)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_ipc_marshal_long(const long in, pims_ipc_data_h ipc_data)
{
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(long)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_ipc_marshal_double(const double in, pims_ipc_data_h ipc_data)
{
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&in,sizeof(double)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
int _cal_ipc_marshal_caltime(const calendar_time_s in, pims_ipc_data_h ipc_data)
{
int ret = CALENDAR_ERROR_NONE;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&(in.type),sizeof(int)) != 0) {
return CALENDAR_ERROR_OUT_OF_MEMORY;
}
else {
ret = _cal_ipc_marshal_int(in.time.date.year,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_marshal_int(in.time.date.month,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_marshal_int(in.time.date.mday,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_marshal_int(in.time.date.hour,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_marshal_int(in.time.date.minute,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
ret = _cal_ipc_marshal_int(in.time.date.second,ipc_data);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
}
return CALENDAR_ERROR_NONE;
int _cal_ipc_marshal_record_common(const cal_record_s* common, pims_ipc_data_h ipc_data)
{
- retv_if(NULL == common, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == common, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
if (pims_ipc_data_put(ipc_data,(void*)&common->type,sizeof(int)) < 0)
return CALENDAR_ERROR_NO_DATA;
int count = 0, i = 0;
int ret = CALENDAR_ERROR_NONE;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
// view_uri
str = (char*)pims_ipc_data_get(ipc_data,&size);
int i = 0;
int length = 0;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
//view_uri
calendar_record_h record;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "list is NULL");
- retvm_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER, "ipc_data is NULL");
+ RETVM_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "list is NULL");
+ RETVM_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER, "ipc_data is NULL");
if (calendar_list_create(list) != CALENDAR_ERROR_NONE) {
ERR("calendar_list_create fail");
{
int count = 0, i = 0;
calendar_record_h record;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
// count
if (calendar_list_get_count(list, &count) != CALENDAR_ERROR_NONE) {
int count = 0;
calendar_record_h record;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ipc_data, CALENDAR_ERROR_INVALID_PARAMETER);
if (_cal_ipc_unmarshal_int(ipc_data,&(count)) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_unmarshal_int fail");
static int __cal_ipc_unmarshal_alarm(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_alarm_s* palarm = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
palarm = (cal_alarm_s*) record;
static int __cal_ipc_marshal_alarm(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_alarm_s* palarm = (cal_alarm_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(palarm==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(palarm==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
// read only or primary/secondary key
if (_cal_ipc_marshal_int((palarm->id),ipc_data) != CALENDAR_ERROR_NONE) {
static int __cal_ipc_unmarshal_attendee(const pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_attendee_s* pattendee = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
pattendee = (cal_attendee_s*) record;
{
cal_attendee_s* pattendee = (cal_attendee_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(pattendee==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(pattendee==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
// read only or primary/secondary key
if (_cal_ipc_marshal_int((pattendee->id),ipc_data) != CALENDAR_ERROR_NONE) {
static int __cal_ipc_unmarshal_calendar(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_calendar_s* pcalendar = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pcalendar = (cal_calendar_s*) record;
static int __cal_ipc_marshal_calendar(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_calendar_s* pcalendar = (cal_calendar_s*)record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pcalendar==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pcalendar==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pcalendar->index),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_event(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_event_s *pevent = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pevent = (cal_event_s*) record;
static int __cal_ipc_marshal_event(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_event_s* pevent = (cal_event_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pevent==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pevent==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pevent->index),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_extended(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_extended_s* pextended = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pextended = (cal_extended_s*) record;
static int __cal_ipc_marshal_extended(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_extended_s* pextended = (cal_extended_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pextended==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pextended==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pextended->id),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_instance_allday(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_instance_allday_s* pinstanceallday = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pinstanceallday = (cal_instance_allday_s*) record;
if (_cal_ipc_unmarshal_int(ipc_data,&pinstanceallday->event_id) != CALENDAR_ERROR_NONE) {
static int __cal_ipc_marshal_instance_allday(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_instance_allday_s* pinstanceallday = (cal_instance_allday_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pinstanceallday==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pinstanceallday==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pinstanceallday->event_id),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_instance_allday_extended(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_instance_allday_extended_s* pinstanceallday = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pinstanceallday = (cal_instance_allday_extended_s*) record;
static int __cal_ipc_marshal_instance_allday_extended(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_instance_allday_extended_s* pinstanceallday = (cal_instance_allday_extended_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pinstanceallday==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pinstanceallday==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pinstanceallday->event_id),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_instance_normal(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_instance_normal_s* pinstancenormal = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pinstancenormal = (cal_instance_normal_s*) record;
if (_cal_ipc_unmarshal_int(ipc_data,&pinstancenormal->event_id) != CALENDAR_ERROR_NONE) {
static int __cal_ipc_marshal_instance_normal(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_instance_normal_s* pinstancenormal = (cal_instance_normal_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pinstancenormal==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pinstancenormal==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pinstancenormal->event_id),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_instance_normal_extended(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_instance_normal_extended_s* pinstancenormal = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pinstancenormal = (cal_instance_normal_extended_s*) record;
static int __cal_ipc_marshal_instance_normal_extended(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_instance_normal_extended_s* pinstancenormal = (cal_instance_normal_extended_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pinstancenormal==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pinstancenormal==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pinstancenormal->event_id),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_search(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_search_s* psearch = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(record==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
psearch = (cal_search_s*) record;
static int __cal_ipc_marshal_search(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_search_s* psearch = (cal_search_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(psearch==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(psearch==NULL,CALENDAR_ERROR_INVALID_PARAMETER);
if (psearch->values) {
int count = g_slist_length(psearch->values);
static int __cal_ipc_unmarshal_timezone(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_timezone_s* ptimezone = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
ptimezone = (cal_timezone_s*) record;
if (_cal_ipc_unmarshal_int(ipc_data,&ptimezone->index) != CALENDAR_ERROR_NONE) {
static int __cal_ipc_marshal_timezone(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_timezone_s* ptimezone = (cal_timezone_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(ptimezone==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ptimezone==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((ptimezone->index),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_todo(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_todo_s* ptodo = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
ptodo = (cal_todo_s*) record;
static int __cal_ipc_marshal_todo(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_todo_s* ptodo = (cal_todo_s*)record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(ptodo==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ptodo==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((ptodo->index),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
static int __cal_ipc_unmarshal_updated_info(pims_ipc_data_h ipc_data, calendar_record_h record)
{
cal_updated_info_s* pupdatedinfo = NULL;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(record==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(record==NULL,CALENDAR_ERROR_NO_DATA);
pupdatedinfo = (cal_updated_info_s*) record;
static int __cal_ipc_marshal_updated_info(const calendar_record_h record, pims_ipc_data_h ipc_data)
{
cal_updated_info_s* pupdatedinfo = (cal_updated_info_s*) record;
- retv_if(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
- retv_if(pupdatedinfo==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(ipc_data==NULL,CALENDAR_ERROR_NO_DATA);
+ RETV_IF(pupdatedinfo==NULL,CALENDAR_ERROR_NO_DATA);
if (_cal_ipc_marshal_int((pupdatedinfo->type),ipc_data) != CALENDAR_ERROR_NONE) {
ERR("_cal_ipc_marshal fail");
return;
}
info->write_list = calloc(count +1, sizeof(int));
- retm_if(NULL == info->write_list, "calloc() Fail");
+ RETM_IF(NULL == info->write_list, "calloc() Fail");
info->write_list[0] = -1;
snprintf(query, sizeof(query),
static void __cal_access_control_disconnected_cb(pims_ipc_h ipc, void *user_data)
{
- ENTER();
+ CAL_FN_CALL();
calendar_permission_info_s *info = NULL;
_cal_mutex_lock(CAL_MUTEX_ACCESS_CONTROL);
API int calendar_connect(void)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
int ret = 0;
_cal_mutex_lock(CAL_MUTEX_CONNECTION);
API int calendar_disconnect(void)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
_cal_mutex_lock(CAL_MUTEX_CONNECTION);
if (1 == thread_connection) {
int ret = 0;
int is_deleted = 0;
- retvm_if(NULL == current_calendar_db_version || NULL == view_uri || NULL == record_list,
- CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == current_calendar_db_version, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_util_query_get_first_int_result(query_cur_version, NULL, &transaction_ver);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "_cal_db_util_query_get_first_int_result() failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_util_query_get_first_int_result() failed(%d)", ret);
char buf[64] = {0};
if (calendar_book_id > 0) {
SEC_DBG("query[%s]", query);
ret = calendar_list_create(record_list);
- retvm_if (ret != CALENDAR_ERROR_NONE, ret, "calendar_list_create() Failed");
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "calendar_list_create() Failed");
stmt = _cal_db_util_query_prepare(query);
if (NULL == stmt)
int transaction_ver = 0;
int ret;
- retvm_if(NULL == current_version, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == current_version, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_util_query_get_first_int_result(query, NULL, &transaction_ver);
if (CALENDAR_ERROR_NONE != ret)
{
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(((cal_record_s *)record)->type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->insert_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->insert_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if(CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed");
ret = plugin_cb->insert_record(record, id);
int ret = CALENDAR_ERROR_NONE;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->get_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->get_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = plugin_cb->get_record(id, out_record);
API int calendar_db_get_record( const char* view_uri, int id, calendar_record_h* out_record )
{
-
-
return _cal_db_get_record(view_uri, id, out_record);
}
cal_record_s *temp=NULL ;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
temp = (cal_record_s*)(record);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(temp->type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->update_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->update_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
+ RETVM_IF( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
ret = plugin_cb->update_record(record);
int ret = CALENDAR_ERROR_NONE;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->delete_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->delete_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
+ RETVM_IF( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
ret = plugin_cb->delete_record(id);
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
calendar_list_h list = NULL;
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->get_all_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->get_all_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = plugin_cb->get_all_records(offset,limit, &list);
if (CALENDAR_ERROR_NONE != ret)
cal_query_s *que = NULL;
calendar_list_h list = NULL;
- retvm_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
type = _cal_view_get_type(que->view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->get_records_with_query, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->get_records_with_query, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = plugin_cb->get_records_with_query(query,offset,limit, &list);
if (CALENDAR_ERROR_NONE != ret)
cal_db_util_error_e dbret = CAL_DB_OK;
int len = 0;
- retvm_if(calendar_book_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_id(%d) is Invalid", calendar_book_id);
+ RETVM_IF(calendar_book_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_id(%d) is Invalid", calendar_book_id);
ret = _cal_db_util_begin_trans();
if (CALENDAR_ERROR_NONE != ret)
}
dbret = _cal_db_util_query_exec(query);
- CAL_DBG("%s",query);
+ DBG("%s",query);
if (dbret != CAL_DB_OK)
{
ERR("DB failed");
return CALENDAR_ERROR_DB_FAILED;
}
}
- retvm_if(ret < 0, ret, "cals_query_exec() failed (%d)", ret);
+ RETVM_IF(ret < 0, ret, "cals_query_exec() failed (%d)", ret);
/* delete delete table */
snprintf(query, sizeof(query), "DELETE FROM %s "
calendar_book_id);
dbret = _cal_db_util_query_exec(query);
- CAL_DBG("%s",query);
+ DBG("%s",query);
if (dbret != CAL_DB_OK)
{
ERR("DB failed");
int ret = CALENDAR_ERROR_NONE;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->get_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->get_count, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = plugin_cb->get_count(out_count);
return ret;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
cal_query_s *que = NULL;
- retvm_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
type = _cal_view_get_type(que->view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->get_count_with_query, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->get_count_with_query, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = plugin_cb->get_count_with_query(query, out_count);
return ret;
int *_ids = NULL;
int _count = 0;
- retvm_if(NULL == list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETVM_IF(NULL == list, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
if ( ret != CALENDAR_ERROR_NONE)
API int calendar_db_insert_records_async(calendar_list_h list, calendar_db_insert_result_cb callback, void *user_data)
{
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
#ifdef CAL_NATIVE
if (callback != NULL)
calendar_list_h out_list = NULL;
ret = _cal_list_clone(list, &out_list);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
__insert_records_data_s *callback_data = NULL;
callback_data = calloc(1,sizeof(__insert_records_data_s));
int count = 0;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_util_begin_trans();
if ( ret != CALENDAR_ERROR_NONE)
API int calendar_db_update_records_async( calendar_list_h list, calendar_db_result_cb callback, void *user_data)
{
-
#ifdef CAL_NATIVE
if (callback != NULL)
{
int ret = CALENDAR_ERROR_NONE;
calendar_list_h out_list = NULL;
ret = _cal_list_clone(list, &out_list);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
__update_records_data_s *callback_data = NULL;
callback_data = calloc(1,sizeof(__update_records_data_s));
int count = 0;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_util_begin_trans();
if (ret != CALENDAR_ERROR_NONE)
API int calendar_db_delete_records(const char* view_uri, int record_id_array[], int count)
{
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
int ret = CALENDAR_ERROR_NONE;
cal_record_type_e type = CAL_RECORD_TYPE_INVALID;
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->delete_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->delete_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
+ RETVM_IF( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
ret = plugin_cb->delete_records(record_id_array,count);
API int calendar_db_delete_records_async(const char* view_uri, int ids[], int count, calendar_db_result_cb callback, void *user_data)
{
- retvm_if(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == ids, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ids, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
#ifdef CAL_NATIVE
if (callback != NULL)
{
type = _cal_view_get_type(view_uri);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->delete_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->delete_records, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
+ RETVM_IF( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
ret = plugin_cb->delete_records(ids,count);
int i = 0;
int *ids = NULL;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == count, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_vcalendar_parse_to_calendar(vcalendar_stream, &list);
- retvm_if(ret != CALENDAR_ERROR_NONE, ret, "parse fail");
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "parse fail");
ret = calendar_list_get_count(list, &list_count);
if (ret != CALENDAR_ERROR_NONE)
API int calendar_db_insert_vcalendars_async(const char* vcalendar_stream, calendar_db_insert_result_cb callback, void *user_data)
{
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
#ifdef CAL_NATIVE
int list_count = 0;
int i = 0;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
ret = calendar_vcalendar_parse_to_calendar(vcalendar_stream, &list);
- retvm_if(ret != CALENDAR_ERROR_NONE, ret, "parse fail");
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "parse fail");
ret = calendar_list_get_count(list, &list_count);
if (ret != CALENDAR_ERROR_NONE)
API int calendar_db_replace_vcalendars_async(const char* vcalendar_stream, int *record_id_array, int count, calendar_db_result_cb callback, void *user_data)
{
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == vcalendar_stream, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
#ifdef CAL_NATIVE
cal_record_s *temp=NULL ;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(record_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(record_id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d)", record_id);
temp = (cal_record_s*)(record);
cal_db_plugin_cb_s* plugin_cb = __cal_db_get_plugin(temp->type);
- retvm_if(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == plugin_cb->replace_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+ RETV_IF(NULL == plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(NULL == plugin_cb->replace_record, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
ret = _cal_db_util_begin_trans();
- retvm_if( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
+ RETVM_IF( CALENDAR_ERROR_NONE != ret,CALENDAR_ERROR_DB_FAILED, "Db failed" );
ret = plugin_cb->replace_record(record, record_id);
int i;
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == ids, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == ids, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
ret = _cal_db_util_begin_trans();
if ( ret != CALENDAR_ERROR_NONE)
{
int ret = CALENDAR_ERROR_NONE;
- retvm_if(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
- retvm_if(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == callback, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_id_array, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(count <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "count(%d)", count);
#ifdef CAL_NATIVE
calendar_list_h out_list = NULL;
ret = _cal_list_clone(record_list, &out_list);
- retv_if(ret!=CALENDAR_ERROR_NONE,ret);
+ RETV_IF(ret!=CALENDAR_ERROR_NONE,ret);
__replace_records_data_s *callback_data = NULL;
callback_data = calloc(1,sizeof(__replace_records_data_s));
API int calendar_db_get_last_change_version(int* last_version)
{
- retvm_if(NULL == last_version, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == last_version, CALENDAR_ERROR_INVALID_PARAMETER);
*last_version = _cal_db_util_get_transaction_ver();
return CALENDAR_ERROR_NONE;
}
int ret = 0;
int is_deleted = 0;
- retvm_if(NULL == view_uri || NULL == record_list || original_event_id <= 0,
- CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == view_uri, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record_list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(original_event_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_util_query_get_first_int_result(query_cur_version, NULL, &transaction_ver);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "_cal_db_util_query_get_first_int_result() failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_util_query_get_first_int_result() failed");
int schedule_type = 0;
int record_type = 0;
SEC_DBG("query[%s]", query);
ret = calendar_list_create(record_list);
- retvm_if (ret != CALENDAR_ERROR_NONE, ret, "calendar_list_create() Failed");
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "calendar_list_create() Failed");
stmt = _cal_db_util_query_prepare(query);
if (NULL == stmt)
cal_alarm_s *alarm = NULL;
alarm = (cal_alarm_s *)(record);
- retvm_if(NULL == alarm, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == alarm, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: cal_alarm_s is NULL");
if (alarm->remind_tick_unit == CALENDAR_ALARM_NONE) {
int count = 0;
calendar_record_h record = NULL;
calendar_list_h list = (calendar_list_h)list_s;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_list_get_count(list, &count);
if (0 == count)
calendar_list_first(list);
while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
ret = __cal_db_alarm_insert_record(record, event_id);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
calendar_list_next(list);
}
return CALENDAR_ERROR_NONE;
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter: list is NULL");
snprintf(query, sizeof(query),
CAL_TABLE_ALARM, parent);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
int index = 0;
const unsigned char *temp;
cal_attendee_s *attendee = NULL;
attendee = (cal_attendee_s *)(record);
- retvm_if(NULL == attendee, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == attendee, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: cal_alarm_s is NULL");
snprintf(query, sizeof(query),
calendar_record_h record = NULL;
calendar_list_h list = (calendar_list_h)list_s;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_list_get_count(list, &count);
if (0 == count)
calendar_list_first(list);
while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
ret = __cal_db_attendee_insert_record(record, parent_id);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
calendar_list_next(list);
}
return CALENDAR_ERROR_NONE;
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter: list is NULL");
snprintf(query, sizeof(query),
CAL_TABLE_ATTENDEE, parent_id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
int index;
const unsigned char *temp;
#ifdef CAL_IPC_SERVER
int calendar_db_delete_account(int account_id)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
int ret = CALENDAR_ERROR_NONE;
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
sqlite3_finalize(stmt);
if(calendar_list)
- CAL_DBG("calendar cnt=%d",g_list_length(calendar_list) );
+ DBG("calendar cnt=%d",g_list_length(calendar_list) );
ret = _cal_db_util_begin_trans();
if (CALENDAR_ERROR_NONE != ret)
long long int slli = 0;
long long int elli = 0;
- retv_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
if (event->start.type != event->end.type) {
ERR("start type(%d) is not same as end type(%d)", event->start.type, event->end.type);
GList* _cal_db_event_get_list_with_uid(char *uid, int parent_id)
{
- retvm_if (NULL == uid || '\0' == *uid, NULL, "Invalid parameter: uid is NULL");
+ RETV_IF(NULL == uid, NULL);
+ RETV_IF('\0' == *uid, NULL);
+
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
void _cal_db_event_update_child_origina_event_id(int child_id, int parent_id)
{
- ENTER();
+ CAL_FN_CALL();
char query[CAL_DB_SQL_MAX_LEN] = {0};
snprintf(query, sizeof(query), "UPDATE %s SET original_event_id=%d WHERE id=%d",
}
static void __get_tzid_and_range(char *p, char **out_tzid, int *out_range)
{
- retm_if (NULL == p || '\0' == *p, "Invalid parameter: p is NULL");
- retm_if (NULL == out_tzid, "Invalid parameter: tzid is NULL");
- retm_if (NULL == out_range, "Invalid parameter: range is NULL");
+ RET_IF(NULL == p);
+ RET_IF('\0' == *p);
+ RET_IF(NULL == out_tzid);
+ RET_IF(NULL == out_range);
char **s = NULL;
s = g_strsplit(p, ";", -1);
- retm_if (NULL == s, "g_strsplit() is failed");
+ RETM_IF(NULL == s, "g_strsplit() is failed");
int count = g_strv_length(s);
int i;
int ret = 0;
calendar_record_h record = NULL;
ret = _cal_db_get_record(_calendar_event._uri, child_id, &record);
- retm_if (CALENDAR_ERROR_NONE != ret, "_cal_db_get_record() is failed(%d)", ret);
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_get_record() is failed(%d)", ret);
if (true == is_prior) {
_cal_record_set_caltime(record, _calendar_event.start_time, event->start);
"ORDER BY dtstart_utime ASC LIMIT 1",
CAL_TABLE_NORMAL_INSTANCE, parent_id, caltime->time.utime);
stmt = _cal_db_util_query_prepare(query);
- retm_if (NULL == stmt, "_cal_db_util_query_prepare() is failed");
+ RETM_IF(NULL == stmt, "_cal_db_util_query_prepare() is failed");
while (CAL_DB_ROW == _cal_db_util_stmt_step(stmt)) {
dtstart->type = CALENDAR_TIME_UTIME;
caltime->time.date.year, caltime->time.date.month, caltime->time.date.mday,
caltime->time.date.hour, caltime->time.date.minute, caltime->time.date.second);
stmt = _cal_db_util_query_prepare(query);
- retm_if (NULL == stmt, "_cal_db_util_query_prepare() is failed");
+ RETM_IF(NULL == stmt, "_cal_db_util_query_prepare() is failed");
if (CAL_DB_ROW == _cal_db_util_stmt_step(stmt)) {
char *temp = NULL;
"ORDER BY dtstart_utime DESC LIMIT 1",
CAL_TABLE_NORMAL_INSTANCE, parent_id);
stmt = _cal_db_util_query_prepare(query);
- retm_if (NULL == stmt, "_cal_db_util_query_prepare() is failed");
+ RETM_IF(NULL == stmt, "_cal_db_util_query_prepare() is failed");
while (CAL_DB_ROW == _cal_db_util_stmt_step(stmt)) {
dtstart->type = CALENDAR_TIME_UTIME;
dtstart->time.utime = sqlite3_column_int64(stmt, 0);
"ORDER BY dtstart_datetime DESC LIMIT 1",
CAL_TABLE_ALLDAY_INSTANCE, parent_id);
stmt = _cal_db_util_query_prepare(query);
- retm_if (NULL == stmt, "_cal_db_util_query_prepare() is failed");
+ RETM_IF(NULL == stmt, "_cal_db_util_query_prepare() is failed");
if (CAL_DB_ROW == _cal_db_util_stmt_step(stmt)) {
char *temp = NULL;
*/
void _cal_db_event_apply_recurrence_id(int parent_id, cal_event_s *event, char *recurrence_id, int child_id)
{
- ENTER();
+ CAL_FN_CALL();
- retm_if (NULL == recurrence_id || '\0' == *recurrence_id, "Invalid parameter: recurrence_id is NULL");
+ RET_IF(NULL == recurrence_id);
+ RET_IF('\0' == *recurrence_id);
char **t = NULL;
t = g_strsplit(recurrence_id, ":", -1);
- retm_if (NULL == t, "g_strsplit() is failed");
+ RETM_IF(NULL == t, "g_strsplit() is failed");
if ('\0' == *t[0]) { // no param
g_strfreev(t);
snprintf(query, sizeof(query), "SELECT id FROM %s WHERE original_event_id=-1 AND id!=%d AND uid='%s'",
CAL_TABLE_SCHEDULE, child_id, uid);
stmt = _cal_db_util_query_prepare(query);
- retvm_if (NULL == stmt, -1, "_cal_db_util_query_prepare() is failed");
+ RETVM_IF(NULL == stmt, -1, "_cal_db_util_query_prepare() is failed");
if (CAL_DB_ROW == _cal_db_util_stmt_step(stmt)) {
parent_id = sqlite3_column_int64(stmt, 0);
}
int has_alarm = 0;
int timezone_id = 0;
- retv_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_event_check_value_validation(event);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_event_check_value_validation() failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_event_check_value_validation() failed");
// access control
if (_cal_access_control_have_write_permission(event->calendar_id) == false) {
DBG("calendar_book_id(%d)", calendar_book_id);
ret = _cal_db_get_record(_calendar_book._uri, calendar_book_id, &record_calendar);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_book_id is invalid");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_book_id is invalid");
calendar_record_destroy(record_calendar, true);
event->freq, is_allday);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED,
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED,
"_cal_db_util_query_prepare() Failed");
index = 1;
if (event->alarm_list->count) {
DBG("insert alarm");
ret = _cal_db_alarm_insert_records(event->alarm_list, event_id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() Failed(%d)", ret);
}
else {
DBG("No alarm");
if (0 < event->attendee_list->count) {
DBG("insert attendee");
ret = _cal_db_attendee_insert_records(event->attendee_list, event_id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() Failed(%d)", ret);
}
else {
DBG("No attendee");
if (original_event_id <= 0 && 0 < event->exception_list->count) {
DBG("insert exception");
ret = _cal_db_event_insert_records(event->exception_list, event_id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_event_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_event_insert_records() Failed(%d)", ret);
}
else {
DBG("No exception");
if (0 < event->extended_list->count) {
DBG("insert extended");
ret = _cal_db_extended_insert_records(event->extended_list, event_id, CALENDAR_RECORD_TYPE_EVENT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
}
else {
DBG("No extended");
calendar_record_h record = NULL;
calendar_list_h list = (calendar_list_h)list_s;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_list_get_count(list, &count);
if (0 == count)
calendar_list_first(list);
while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
ret = _cal_db_event_insert_record(record, original_event_id, NULL);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
calendar_list_next(list);
}
return CALENDAR_ERROR_NONE;
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: GList is NULL");
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query),
"SELECT * FROM %s "
record_type);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt,CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
+ RETVM_IF(NULL == stmt,CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
int count = 0;
const unsigned char *temp;
cal_extended_s* extended = (cal_extended_s*)(record);
cal_db_util_error_e dbret;
- retv_if(NULL == extended, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(record_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d)", record_id);
+ RETV_IF(NULL == extended, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(record_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d)", record_id);
snprintf(query, sizeof(query), "INSERT INTO %s(record_id, "
"record_type ,key ,value) "
calendar_record_h record = NULL;
calendar_list_h list = (calendar_list_h)list_s;
- retv_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_list_get_count(list, &count);
if (0 == count)
calendar_list_first(list);
while (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
ret = _cal_db_extended_insert_record(record, record_id, record_type, NULL);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_extended_insert_record() Failed(%d)", ret);
calendar_list_next(list);
}
return CALENDAR_ERROR_NONE;
#define sec2ms(s) (s * 1000.0)
#define lli2p(x) ((gpointer)((time_t)x))
-#define COLOR_RED "\033[0;31m"
-#define COLOR_GREEN "\033[0;32m"
-#define COLOR_END "\033[0;m"
-
/* input order
* UCAL_MONTH + UCAL_DAY_OF_MONTH
* UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
char **t = NULL;
t = g_strsplit_set(byint, " ,", -1);
- retvm_if(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");
+ RETVM_IF(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");
int length = g_strv_length(t);
int i;
static int __cal_db_instance_parse_bystr(char *bystr, char **by, int *len)
{
- retvm_if (NULL == bystr || '\0' == *bystr, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: byint is NULL");
+ RETV_IF(NULL == bystr, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF('\0' == *bystr, CALENDAR_ERROR_INVALID_PARAMETER);
char **t = NULL;
t = g_strsplit_set(bystr, " ,", -1);
- retvm_if(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");
+ RETVM_IF(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");
int length = g_strv_length(t);
int i;
static void __set_time_to_ucal(int calendar_system_type, UCalendar *ucal, calendar_time_s *t)
{
- retm_if(NULL == ucal, "Invalid parameter: ucal is NULL");
- retm_if(NULL == t, "Invalid parameter: calendar_time_s is NULL");
+ RET_IF(NULL == ucal);
+ RET_IF(NULL == t);
UErrorCode ec = U_ZERO_ERROR;
static int __get_exdate_list(UCalendar *ucal, cal_event_s *event, GList **l, int *count)
{
- retvm_if (NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "ucal is NULL");
- retvm_if (NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
if (event->exdate == NULL || '\0' == *(event->exdate)) {
return CALENDAR_ERROR_NONE;
char **t = NULL;
t = g_strsplit_set(event->exdate, " ,", -1);
- retvm_if (NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");;
+ RETVM_IF(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");;
DBG("[%s]", event->exdate);
int len = 0;
DBG("recurrence_id[%s]", recurrence_id);
t = g_strsplit_set(recurrence_id, " ,", -1);
- retvm_if (NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");;
+ RETVM_IF(NULL == t, CALENDAR_ERROR_OUT_OF_MEMORY, "g_strsplit_set() is failed");;
for (i = 0; t[i]; i++)
{
{
int d;
- if (!str || !*str) {
- ERR("Invalid argument: check mday[%s]", str);
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(!str, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(*str, CALENDAR_ERROR_INVALID_PARAMETER);
d = atoi(str);
- if (d < 1 || d > 31) {
- ERR("Invalid argument: check day(%d)", d);
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETVM_IF(d < 1 || d > 31, CALENDAR_ERROR_INVALID_PARAMETER, "day(%d)", d);
DBG("get mday[%s] and convert to int(%d)", str, d);
*mday = d;
*/
static int __convert_week_to_bits(const char *byday, int *byday_len)
{
- retvm_if(NULL == byday, -1, "Invalid parameter:byday is NULL");
+ RETV_IF(NULL == byday, -1);
+
const char *week_text[7] = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"};
int week = 0;
int i;
int len = 0;
- for (i = 0; i < 7; i++)
- {
- if (strstr(byday, week_text[i]))
- {
+ for (i = 0; i < 7; i++) {
+ if (strstr(byday, week_text[i])) {
week |= (0x01 << i);
len++;
}
static int __cal_db_instance_get_duration(UCalendar *ucal, calendar_time_s *st, calendar_time_s *et, long long int *duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == st || NULL == et, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: st or et is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == st, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == et, CALENDAR_ERROR_INVALID_PARAMETER);
long long int _duration = -1;
UErrorCode ec = U_ZERO_ERROR;
switch (st->type) {
case CALENDAR_TIME_UTIME:
- if (st->time.utime > et->time.utime)
- {
+ if (st->time.utime > et->time.utime) {
ERR("check time: start(%lld) > end(%lld)", st->time.utime, et->time.utime);
return CALENDAR_ERROR_INVALID_PARAMETER;
}
st->time.date.hour, st->time.date.minute, st->time.date.second, &ec);
_duration = ucal_getFieldDifference(ucal, ud, UCAL_SECOND, &ec);
- if (U_FAILURE(ec))
- {
+ if (U_FAILURE(ec)) {
ERR("ucal_getFieldDifference failed (%s)", u_errorName(ec));
return ec;
}
char buf_s[256] = {0};
char buf_e[256] = {0};
- retvm_if (NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
- switch (event->start.type)
- {
+ switch (event->start.type) {
case CALENDAR_TIME_UTIME:
lli_s = ms2sec(ucal_getMillis(ucal, &ec));
lli_e = lli_s + duration;
ret = _cal_db_instance_helper_insert_utime_instance(event->index, lli_s, lli_e);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "_cal_db_instance_normal_insert_record() failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_instance_normal_insert_record() failed(%d)", ret);
break;
case CALENDAR_TIME_LOCALTIME:
}
snprintf(buf_e, sizeof(buf_e), CAL_FORMAT_LOCAL_DATETIME, y, m, d, h, n, s);
ret = _cal_db_instance_helper_insert_localtime_instance(event->index, buf_s, buf_e);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "_cal_db_instance_allday_insert_record() failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_instance_allday_insert_record() failed(%d)", ret);
break;
}
__print_ucal(event->system_type, ucal, NULL, 1);
static int __convert_wday_to_int(const char *wday)
{
- retvm_if(NULL == wday, 0, "Invalid paramter: wday is NULL");
+ RETV_IF(NULL == wday, 0);
const char *week_text[7] = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"};
int i;
- for (i = 0; i < 7; i++)
- {
+ for (i = 0; i < 7; i++) {
if (strstr(wday, week_text[i])) {
return i + 1;
}
static int __get_until_from_range(cal_event_s *event, calendar_time_s *until)
{
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
- retvm_if(NULL == until, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: until is NULL");
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == until, CALENDAR_ERROR_INVALID_PARAMETER);
long long int range = 0;
- switch (event->range_type)
- {
+ switch (event->range_type) {
case CALENDAR_RANGE_COUNT:
DBG("range count");
break;
case CALENDAR_RANGE_UNTIL:
DBG("range until");
until->type = event->until.type;
- switch (until->type)
- {
+ switch (until->type) {
case CALENDAR_TIME_UTIME:
range = _cal_time_convert_itol(NULL, CAL_ENDLESS_LIMIT_YEAR,
- CAL_ENDLESS_LIMIT_MONTH, CAL_ENDLESS_LIMIT_MDAY,
- 0, 0, 0);
- if (event->until.time.utime > range)
- {
+ CAL_ENDLESS_LIMIT_MONTH, CAL_ENDLESS_LIMIT_MDAY, 0, 0, 0);
+ if (event->until.time.utime > range) {
DBG("until time(%lld) > max, so set max(%lld)", event->until.time.utime, range);
until->time.utime = range;
- }
- else
- {
+ } else {
until->time.utime = event->until.time.utime;
}
break;
case CALENDAR_RANGE_NONE:
DBG("range none");
until->type = event->until.type;
- switch (until->type)
- {
+ switch (until->type) {
case CALENDAR_TIME_UTIME:
until->time.utime = _cal_time_convert_itol(event->start_tzid,
CAL_ENDLESS_LIMIT_YEAR,
static bool __check_out_of_range(long long int current_utime, cal_event_s *event, long long int until_utime, int *count)
{
- retvm_if(NULL == event, true, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == event, true);
// check range
switch (event->range_type)
static int __get_dates_in_month(UCalendar *ucal, int week_bits, int bymonth, int *dates_len)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
-
UErrorCode ec = U_ZERO_ERROR;
int len = 0;
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+
int i;
for (i = 0; i < 7; i++) {
if (0 == (week_bits & (0x01 << i))) continue;
static int __cal_db_instance_publish_yearly_yday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
- retvm_if(NULL == event->byyearday || '\0' == event->byyearday[0],
- CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: no byyearday");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event->byyearday, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF('\0' == event->byyearday[0], CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
*/
static int __cal_db_instance_publish_yearly_weekno(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
- retvm_if(NULL == event->byweekno || '\0' == event->byweekno[0],
- CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: no byweekno");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event->byweekno || '\0' == event->byweekno[0], CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
ucal_setMillis(ucal, ms2sec(start_point), &ec); // set start point
int i;
- for (i = 0 ; i < byweekno_len; i++)
- {
+ for (i = 0 ; i < byweekno_len; i++) {
int j;
int week_count = 0;
- for (j = 0; j < 7; j++)
- {
+ for (j = 0; j < 7; j++) {
if (week_bits & (0x01 << j)) {
week_count++;
ucal_set(ucal, UCAL_WEEK_OF_YEAR, byweekno[i] + extra_weekno);
static int __cal_db_instance_publish_yearly_wday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_yearly_mday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_record_yearly(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- if (NULL == ucal)
- {
- ERR("Invalid parameter: ucal is NULL");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
- if (NULL == event)
- {
- ERR("Invalid parameter: event is NULL");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
if (event->byyearday && strlen(event->byyearday) > 0) {
__cal_db_instance_publish_yearly_yday(ucal, event, duration);
static int __cal_db_instance_publish_monthly_wday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_monthly_mday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_record_monthly(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
if (event->byday && strlen(event->byday) > 0) {
__cal_db_instance_publish_monthly_wday(ucal, event, duration);
static int __cal_db_instance_publish_weekly_wday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_record_weekly(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
__cal_db_instance_publish_weekly_wday(ucal, event, duration);
return CALENDAR_ERROR_NONE;
static int __cal_db_instance_publish_daily_mday(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
UErrorCode ec = U_ZERO_ERROR;
calendar_time_s until = {0};
static int __cal_db_instance_publish_record_daily(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
__cal_db_instance_publish_daily_mday(ucal, event, duration);
return CALENDAR_ERROR_NONE;
static int __cal_db_instance_publish_record_once(UCalendar *ucal, cal_event_s *event, long long int duration)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
calendar_time_s *st = &event->start;
__set_time_to_ucal(event->system_type, ucal, st);
static int __cal_db_instance_publish_record_details(UCalendar *ucal, cal_event_s *event)
{
- retvm_if(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter:ucal is NULL");
- retvm_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: event is NULL");
+ RETV_IF(NULL == ucal, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
long long int duration = -1;
int exception_freq = 0; // for exception
__cal_db_instance_get_duration(ucal, &event->start, &event->end, &duration);
- warn_if (duration < 0, "Invalid duration (%lld)", duration);
+ WARN_IF(duration < 0, "Invalid duration (%lld)", duration);
if (event->original_event_id > 0)
{
int _cal_db_instance_publish_record(calendar_record_h record)
{
- retvm_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: record is NULL");
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
cal_event_s *event = NULL;
event = (cal_event_s *)(record);
int _cal_db_instance_normal_insert_record(cal_instance_normal_s *normal, int* id)
{
char query[CAL_DB_SQL_MAX_LEN] = {0};
- retvm_if(NULL == normal, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: cal_instance_normal_s is NULL");
+ RETV_IF(NULL == normal, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query),
"INSERT INTO %s ("
int _cal_db_instance_allday_insert_record(cal_instance_allday_s *allday, int* id)
{
char query[CAL_DB_SQL_MAX_LEN] = {0};
- retvm_if(NULL == allday, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: cal_instance_allday_s is NULL");
+ RETV_IF(NULL == allday, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query),
"INSERT INTO %s ("
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
-
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0) {
snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text) {
int count = 0;
int ret;
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query), "SELECT count(*) FROM %s ", CAL_TABLE_ALARM);
ERR("_cal_db_util_query_get_first_int_result() failed");
return ret;
}
- CAL_DBG("%s=%d",query,count);
+ DBG("%s=%d",query,count);
*out_count = count;
return CALENDAR_ERROR_NONE;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("%s=%d",query_str,count);
+ DBG("%s=%d",query_str,count);
*out_count = count;
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER,
- "Invalid parameter: calendar_list_h is NULL");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
+
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_DB_FAILED,
- "calendar_list_create() failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (limit > 0) {
snprintf(limitquery, sizeof(limitquery), "LIMIT %d ", limit);
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text) {
char query[CAL_DB_SQL_MAX_LEN] = {0};
int count = 0;
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query), "SELECT count(*) FROM %s ", CAL_TABLE_ATTENDEE);
ERR("_cal_db_util_query_get_first_int_result() failed");
return ret;
}
- CAL_DBG("%s=%d",query,count);
+ DBG("%s=%d",query,count);
*out_count = count;
return CALENDAR_ERROR_NONE;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("%s=%d",query_str,count);
+ DBG("%s=%d",query_str,count);
*out_count = count;
static bool __cal_db_calendar_check_value_validation(cal_calendar_s* calendar)
{
- retvm_if (NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER, "calendar is NULL");
+ RETVM_IF(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER, "calendar is NULL");
switch (calendar->store_type) {
case CALENDAR_BOOK_TYPE_NONE:
char *client_label = NULL;
// !! error check
- retv_if(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
if (false == __cal_db_calendar_check_value_validation(calendar)) {
ERR("_cal_db_calendar_check_value_validation() is failed");
"AND (deleted = 0)",
CAL_TABLE_CALENDAR, id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
dbret = _cal_db_util_stmt_step(stmt);
if (dbret != CAL_DB_ROW) {
cal_calendar_s* calendar = (cal_calendar_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
if (false == __cal_db_calendar_check_value_validation(calendar)) {
ERR("_cal_db_calendar_check_value_validation() is failed");
calendar->index);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
if (calendar->name)
_cal_db_util_stmt_bind_text(stmt, 1, calendar->name);
cal_calendar_s* calendar = (cal_calendar_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == calendar, CALENDAR_ERROR_INVALID_PARAMETER);
if (false == __cal_db_calendar_check_value_validation(calendar)) {
ERR("_cal_db_calendar_check_value_validation() is failed");
id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
if (calendar->name)
_cal_db_util_stmt_bind_text(stmt, 1, calendar->name);
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
- if (offset > 0) {
+ if (offset > 0)
snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
- }
- if (limit > 0) {
+ if (limit > 0)
snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
- }
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT * FROM");
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text) {
id = calloc(1, sizeof(int)*count);
- retvm_if(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE) {
static int __cal_db_calendar_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count)
*out_count = count;
GSList *cursor = NULL;
ret = _cal_db_query_create_projection_update_set(record,&set,&bind_text);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
snprintf(query, sizeof(query), "UPDATE %s SET %s "
"WHERE id = %d",
static int __cal_db_event_insert_record(calendar_record_h record, int* id)
{
- retv_if(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(false == __cal_db_event_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(false == __cal_db_event_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
cal_event_s *event = (cal_event_s *)record;
return _cal_db_event_insert_record(record, event->original_event_id, id);
}
static int __is_dirty_in_time(calendar_record_h record)
{
cal_record_s *rec = (cal_record_s *)record;
- retvm_if (NULL == record, false, "Invalid parameter: record id NULL");
- retvm_if (NULL == rec->view_uri, false, "Invalid parameter: view_uri is NULL");
+ RETV_IF(NULL == record, false);
+ RETV_IF(NULL == rec->view_uri, false);
int count = 0;
const cal_property_info_s *info = _cal_view_get_property_info(rec->view_uri, &count);
- retvm_if (NULL == info, false, "_cal_view_get_property_info() is failed");
+ RETVM_IF(NULL == info, false, "_cal_view_get_property_info() is failed");
int i;
int is_dirty_in_time = DIRTY_IN_OTHER;
time_t __get_time_diff(char *old_tzid, calendar_time_s *old, char *new_tzid, calendar_time_s *new)
{
- retvm_if (NULL == old, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: old time is NULL");
- retvm_if (NULL == new, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: new time is NULL");
+ RETV_IF(NULL == old, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == new, CALENDAR_ERROR_INVALID_PARAMETER);
time_t diff = 0;
switch (old->type)
gchar **t = NULL;
t = g_strsplit_set(old_field, " ,", -1);
- retvm_if (NULL == t, CALENDAR_ERROR_DB_FAILED, "g_strsplit_set() is failed");
+ RETVM_IF(NULL == t, CALENDAR_ERROR_DB_FAILED, "g_strsplit_set() is failed");
int len_t = g_strv_length(t);
static int __update_exdate(cal_event_s *rec, time_t time_diff)
{
- retvm_if (NULL == rec, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: rec is NULL");
+ RETV_IF(NULL == rec, CALENDAR_ERROR_INVALID_PARAMETER);
+
if (NULL == rec->exdate || '\0' == *rec->exdate)
return CALENDAR_ERROR_NONE;
if (0 == time_diff)
int ret;
calendar_record_h db_record = NULL;
ret = calendar_db_get_record(_calendar_event._uri, rec->index, &db_record);
- retvm_if(ret != CALENDAR_ERROR_NONE, ret, "calendar_db_get_record fail(%d)", ret);
+ RETVM_IF(ret != CALENDAR_ERROR_NONE, ret, "calendar_db_get_record fail(%d)", ret);
// get time diff
char *db_tzid = NULL;
static int __update_recurrence_id(calendar_record_h exception, int old_type, int new_type, time_t time_diff)
{
- ENTER();
+ CAL_FN_CALL();
cal_event_s *rec = (cal_event_s *)exception;
- retvm_if (NULL == rec, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: rec is NULL");
+ RETV_IF(NULL == rec, CALENDAR_ERROR_INVALID_PARAMETER);
+
if (NULL == rec->recurrence_id) {
DBG("No recurrence_id");
return CALENDAR_ERROR_NONE;
int timezone_id = 0;
int input_ver = 0;
- retv_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(false == __cal_db_event_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(false == __cal_db_event_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
ret = _cal_db_event_check_value_validation(event);
event->index);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
int index = 1;
if (event->alarm_list && 0 < event->alarm_list->count) {
ret = _cal_db_alarm_insert_records(event->alarm_list, event->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
}
if (event->attendee_list && 0 < event->attendee_list->count) {
ret = _cal_db_attendee_insert_records(event->attendee_list, event->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
}
if (event->exception_list && 0 < event->exception_list->count) {
ret = __cal_db_event_exception_update(event->exception_list, event->index, event->calendar_id, is_dirty_in_time, time_diff, ct.type, event->start.type);
- warn_if(CALENDAR_ERROR_NONE != ret, "__cal_db_event_exception_update() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "__cal_db_event_exception_update() Failed(%d)", ret);
}
if (event->extended_list && 0 < event->extended_list->count) {
ret = _cal_db_extended_insert_records(event->extended_list, event->index, CALENDAR_RECORD_TYPE_EVENT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
}
_cal_db_util_notify(CAL_NOTI_TYPE_EVENT);
calendar_book_sync_event_type_e sync_event_type = CALENDAR_BOOK_SYNC_EVENT_FOR_ME;
DBG("delete record(id:%d)", id);
- retvm_if(id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: id < 0");
+ RETVM_IF(id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "id(%d) < 0", id);
// get calendar_id, created_ver, original_event_id, recurrence_id
ret = __cal_db_event_get_deleted_data(id, &calendar_book_id, &created_ver, &original_event_id, &recurrence_id);
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
{
_cal_db_append_string(&query_str, buf);
}
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// query
stmt = _cal_db_util_query_prepare(query_str);
id = calloc(1, sizeof(int)*count);
- retvm_if(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE)
static int __cal_db_event_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
if (bind_text)
int timezone_id = 0;
int input_ver = 0;
- retv_if(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == event, CALENDAR_ERROR_INVALID_PARAMETER);
event->index = id;
// access control
id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
int index = 1;
if (event->alarm_list && 0 < event->alarm_list->count) {
ret = _cal_db_alarm_insert_records(event->alarm_list, event->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
}
if (event->attendee_list && 0 < event->attendee_list->count) {
ret = _cal_db_attendee_insert_records(event->attendee_list, event->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
}
if (event->exception_list && 0 < event->exception_list->count) {
ret = _cal_db_event_insert_records(event->exception_list, id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_event_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_event_insert_records() failed(%x)", ret);
}
if (event->extended_list && 0 < event->extended_list->count) {
ret = _cal_db_extended_insert_records(event->extended_list, id, CALENDAR_RECORD_TYPE_EVENT);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
}
_cal_db_util_notify(CAL_NOTI_TYPE_EVENT);
calendar_record_h original_record = NULL;
ret = calendar_record_get_int(record,_calendar_event.id, &event_id);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
- CAL_DBG("id=%d",event_id);
+ DBG("id=%d",event_id);
ret = __cal_db_event_get_record(event_id, &original_record);
- retvm_if (CALENDAR_ERROR_NONE != ret, ret, "__cal_db_event_get_record() is failed(%d)", ret);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "__cal_db_event_get_record() is failed(%d)", ret);
cal_record_s *_record = NULL;
const cal_property_info_s* property_info = NULL;
continue;
}
- //CAL_DBG("%d",property_info[i].property_id);
+ //DBG("%d",property_info[i].property_id);
if (property_info[i].property_id == CAL_PROPERTY_EVENT_EXDATE)
{
int calendar_id = 0;
if (sync_event_type == CALENDAR_BOOK_SYNC_EVENT_FOR_EVERY_AND_REMAIN)
{
ret = __cal_db_event_exdate_insert_normal(event_id, original_exdate, record_exdate, NULL, NULL);
- warn_if (ret != CALENDAR_ERROR_NONE, "%s->%s",original_exdate,record_exdate);
+ WARN_IF(ret != CALENDAR_ERROR_NONE, "%s->%s",original_exdate,record_exdate);
} else {
int *exception_ids = NULL;
int exception_len = 0;
ret = __cal_db_event_exdate_insert_normal(event_id, original_exdate, record_exdate, &exception_ids, &exception_len);
- warn_if (ret != CALENDAR_ERROR_NONE, "%s->%s",original_exdate,record_exdate);
+ WARN_IF(ret != CALENDAR_ERROR_NONE, "%s->%s",original_exdate,record_exdate);
ret = __cal_db_event_delete_exception(exception_ids, exception_len);
- warn_if (ret != CALENDAR_ERROR_NONE, "__cal_db_event_delete_record() is failed");
+ WARN_IF(ret != CALENDAR_ERROR_NONE, "__cal_db_event_delete_record() is failed");
free(exception_ids);
}
ret = _cal_record_set_str(original_record, property_info[i].property_id, record_exdate);
char query[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter: list is NULL");
snprintf(query, sizeof(query),
original_id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() failed");
calendar_record_h record = NULL;
sqlite3_stmt *stmt = NULL;
GList *list = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter: GList is NULL");
snprintf(query, sizeof(query),
}
int *ids = calloc(len1, sizeof(int));
- retvm_if (NULL == ids, CALENDAR_ERROR_DB_FAILED, "calloc() is failed");
+ RETVM_IF(NULL == ids, CALENDAR_ERROR_DB_FAILED, "calloc() is failed");
int exception_count = 0;
for(i = 0; i < len1; i++)
static int __cal_db_extended_insert_record( calendar_record_h record, int* id )
{
cal_extended_s* extended = (cal_extended_s*)(record);
- retv_if(NULL == extended, CALENDAR_ERROR_INVALID_PARAMETER);
- retvm_if(extended->record_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d)", extended->record_id);
+ RETV_IF(NULL == extended, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETVM_IF(extended->record_id <= 0, CALENDAR_ERROR_INVALID_PARAMETER, "record_id(%d)", extended->record_id);
return _cal_db_extended_insert_record(record, extended->record_id, extended->record_type, id);
}
cal_extended_s* extended_info = (cal_extended_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == extended_info, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == extended_info, CALENDAR_ERROR_INVALID_PARAMETER);
if (extended_info->common.properties_flags != NULL)
{
extended_info->id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
if (extended_info->key)
_cal_db_util_stmt_bind_text(stmt, 1, extended_info->key);
cal_extended_s* extended_info = (cal_extended_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == extended_info, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == extended_info, CALENDAR_ERROR_INVALID_PARAMETER);
extended_info->id = id;
if (extended_info->common.properties_flags != NULL)
id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
if (extended_info->key)
_cal_db_util_stmt_bind_text(stmt, 1, extended_info->key);
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
-
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
{
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text)
id = calloc(1, sizeof(int)*count);
- retvm_if(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE)
int count = 0;
int ret;
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query), "SELECT count(*) FROM %s ", CAL_TABLE_EXTENDED);
ERR("_cal_db_util_query_get_first_int_result() failed");
return ret;
}
- CAL_DBG("%s=%d",query,count);
+ DBG("%s=%d",query,count);
*out_count = count;
return CALENDAR_ERROR_NONE;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("%s=%d",query_str,count);
+ DBG("%s=%d",query_str,count);
*out_count = count;
GSList *cursor = NULL;
ret = _cal_db_query_create_projection_update_set(record,&set,&bind_text);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
snprintf(query, sizeof(query), "UPDATE %s SET %s "
"WHERE id = %d",
char query[CAL_DB_SQL_MAX_LEN] = {0};
cal_db_util_error_e dbret = CAL_DB_OK;
- retvm_if(id < 0, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(id < 0, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: id(%d) < 0", id);
snprintf(query, sizeof(query),
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
- {
snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
- }
if (limit > 0)
- {
snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
- }
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT * FROM");
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text)
static int __cal_db_instance_allday_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
int ret = 0;
int count = 0;
ret = _cal_db_util_query_get_first_int_result(query_str, NULL, &count);
- if (CALENDAR_ERROR_NONE != ret)
- {
+ if (CALENDAR_ERROR_NONE != ret) {
ERR("_cal_db_util_query_get_first_int_result() failed");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
{
stmt = _cal_db_util_query_prepare(query_str);
if (NULL == stmt)
{
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
if (bind_text)
{
g_slist_free_full(bind_text, free);
static int __cal_db_instance_allday_extended_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
cal_db_util_error_e dbret = CAL_DB_OK;
char query[CAL_DB_SQL_MAX_LEN] = {0};
- retvm_if(id < 0, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(id < 0, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: id(%d) < 0", id);
snprintf(query, sizeof(query),
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
- {
snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
- }
if (limit > 0)
- {
snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
- }
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT * FROM");
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text)
static int __cal_db_instance_normal_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
if (bind_text)
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
- {
snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
- }
if (limit > 0)
- {
snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
- }
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT * FROM");
stmt = _cal_db_util_query_prepare(query_str);
if (NULL == stmt)
{
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
if (bind_text)
{
g_slist_free_full(bind_text, free);
static int __cal_db_instance_normal_extended_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
if (bind_text)
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text)
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
if (bind_text)
break;
}
ret = _cal_record_set_caltime(record,property,caltime_tmp);
- warn_if (CALENDAR_ERROR_NONE != ret, "Failed to _cal_record_set_caltime()");
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "Failed to _cal_record_set_caltime()");
}
else
{
cal_query_s *query_s = NULL;
cal_property_info_s *properties = NULL;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
query_s = (cal_query_s *)query;
properties = &(query_s->properties[0]);
calendar_record_h record_calendar = NULL;
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == timezone, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == timezone, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_record_get_int(record,
_calendar_timezone.calendar_book_id, &calendar_book_id);
DBG("calendar_book_id(%d)", calendar_book_id);
- ret = _cal_db_get_record(_calendar_book._uri,
- calendar_book_id, &record_calendar);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_book_id is invalid");
+ ret = _cal_db_get_record(_calendar_book._uri, calendar_book_id, &record_calendar);
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "_cal_db_get_record() Fail(%d)", ret);
calendar_record_destroy(record_calendar, true);
// start >>>>> check if we already have
timezone->calendar_id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
if (timezone->standard_name)
_cal_db_util_stmt_bind_text(stmt, 1, timezone->standard_name);
cal_timezone_s* timezone_info = (cal_timezone_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == timezone_info, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == timezone_info, CALENDAR_ERROR_INVALID_PARAMETER);
if (timezone_info->common.properties_flags != NULL)
{
timezone_info->index);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
if (timezone_info->standard_name)
_cal_db_util_stmt_bind_text(stmt, 1, timezone_info->standard_name);
cal_timezone_s* timezone_info = (cal_timezone_s*)(record);
cal_db_util_error_e dbret = CAL_DB_OK;
- retv_if(NULL == timezone_info, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == timezone_info, CALENDAR_ERROR_INVALID_PARAMETER);
timezone_info->index = id;
if (timezone_info->common.properties_flags != NULL)
id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "cal_q_cal_db_util_query_prepareuery_prepare() Failed");
if (timezone_info->standard_name)
_cal_db_util_stmt_bind_text(stmt, 1, timezone_info->standard_name);
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
-
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
{
id = calloc(1, sizeof(int)*count);
- retvm_if(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE)
int i;
int ret = 0;
- if (NULL == list)
- {
- ERR("Invalid argument: list is NULL");
- return CALENDAR_ERROR_INVALID_PARAMETER;
- }
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE)
int count = 0;
int ret;
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
snprintf(query, sizeof(query), "SELECT count(*) FROM %s where "
"calendar_id IN (select id from %s where deleted = 0)",
ERR("_cal_db_util_query_get_first_int_result() failed");
return ret;
}
- CAL_DBG("%s=%d",query,count);
+ DBG("%s=%d",query,count);
*out_count = count;
return CALENDAR_ERROR_NONE;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("%s=%d",query_str,count);
+ DBG("%s=%d",query_str,count);
*out_count = count;
GSList *cursor = NULL;
ret = _cal_db_query_create_projection_update_set(record,&set,&bind_text);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
snprintf(query, sizeof(query), "UPDATE %s SET %s "
"WHERE id = %d",
CAL_TABLE_TIMEZONE,set,
timezone->index);
- CAL_DBG("%s",query);
+ DBG("%s",query);
stmt = _cal_db_util_query_prepare(query);
if (NULL == stmt) {
ERR("_cal_db_util_query_prepare() Failed");
calendar_record_h record_calendar = NULL;
int has_alarm = 0;
- retv_if(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
- retv_if(false == __cal_db_todo_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(false == __cal_db_todo_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
// access control
if (_cal_access_control_have_write_permission(todo->calendar_id) == false)
ret = _cal_db_get_record(_calendar_book._uri,
calendar_book_id, &record_calendar);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_book_id is invalid");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "calendar_book_id is invalid");
calendar_record_destroy(record_calendar, true);
if (todo->alarm_list && 0 < todo->alarm_list->count) {
ret = _cal_db_alarm_insert_records(todo->alarm_list, index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
}
if (todo->attendee_list && 0 < todo->attendee_list->count) {
ret = _cal_db_attendee_insert_records(todo->attendee_list, index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
}
if (todo->extended_list && 0 < todo->extended_list->count) {
DBG("insert extended");
ret = _cal_db_extended_insert_records(todo->extended_list, index, CALENDAR_RECORD_TYPE_TODO);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%x)", ret);
}
else {
DBG("No extended");
cal_db_util_error_e dbret = CAL_DB_OK;
int has_alarm = 0;
- retv_if(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
// access control
if (_cal_access_control_have_write_permission(todo->calendar_id) == false)
todo->index);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
int count = 1;
if (todo->alarm_list && 0 < todo->alarm_list->count) {
ret = _cal_db_alarm_insert_records(todo->alarm_list, todo->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() Failed(%d)", ret);
}
if (todo->attendee_list && 0 < todo->attendee_list->count) {
ret = _cal_db_attendee_insert_records(todo->attendee_list, todo->index);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() Failed(%d)", ret);
}
if (todo->extended_list && 0 < todo->extended_list->count) {
DBG("insert extended");
ret = _cal_db_extended_insert_records(todo->extended_list, todo->index, CALENDAR_RECORD_TYPE_TODO);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
}
_cal_db_util_notify(CAL_NOTI_TYPE_TODO);
int created_ver = 0;
calendar_book_sync_event_type_e sync_event_type = CALENDAR_BOOK_SYNC_EVENT_FOR_ME;
- retvm_if(id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid argument: id < 0");
+ RETVM_IF(id < 0, CALENDAR_ERROR_INVALID_PARAMETER, "id(%d) < 0", id);
ret = __cal_db_todo_get_deleted_data(id, &calendar_book_id, &created_ver);
if (CALENDAR_ERROR_NONE != ret)
cal_db_util_error_e dbret = CAL_DB_OK;
int has_alarm = 0;
- retv_if(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == todo, CALENDAR_ERROR_INVALID_PARAMETER);
todo->index = id;
// access control
id);
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
int count = 1;
if (todo->alarm_list && 0 < todo->alarm_list->count) {
ret = _cal_db_alarm_insert_records(todo->alarm_list, id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_alarm_insert_records() failed(%x)", ret);
}
if (todo->attendee_list && 0 < todo->attendee_list->count) {
ret = _cal_db_attendee_insert_records(todo->attendee_list, id);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_attendee_insert_records() failed(%x)", ret);
}
if (todo->extended_list && 0 < todo->extended_list->count) {
DBG("insert extended");
ret = _cal_db_extended_insert_records(todo->extended_list, id, CALENDAR_RECORD_TYPE_TODO);
- warn_if(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
+ WARN_IF(CALENDAR_ERROR_NONE != ret, "_cal_db_extended_insert_records() Failed(%d)", ret);
}
_cal_db_util_notify(CAL_NOTI_TYPE_TODO);
char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
ret = calendar_list_create(out_list);
- retvm_if(CALENDAR_ERROR_NONE != ret, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
if (offset > 0)
{
ERR("_cal_db_util_query_prepare() Failed");
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_DBG("%s",query_str);
+ DBG("%s",query_str);
// bind text
if (bind_text)
id = calloc(1, sizeof(int)*count);
- retvm_if(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
+ RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc fail");
ret = calendar_list_first(list);
if (ret != CALENDAR_ERROR_NONE)
static int __cal_db_todo_get_count(int *out_count)
{
- retvm_if(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter");
+ RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
char *query_str = NULL;
_cal_db_append_string(&query_str, "SELECT count(*) FROM");
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
CAL_FREE(query_str);
*out_count = count;
CAL_FREE(query_str);
return ret;
}
- CAL_DBG("count(%d) str[%s]", count, query_str);
+ DBG("count(%d) str[%s]", count, query_str);
if (out_count) *out_count = count;
if (bind_text)
calendar_record_h original_record;
ret = calendar_record_get_int(record,_calendar_todo.id, &todo_id);
- retv_if(CALENDAR_ERROR_NONE != ret, ret);
+ RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
- CAL_DBG("id=%d",todo_id);
+ DBG("id=%d",todo_id);
- retv_if(false == __cal_db_todo_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(false == __cal_db_todo_check_calendar_book_type(record), CALENDAR_ERROR_INVALID_PARAMETER);
ret = __cal_db_todo_get_record(todo_id, &original_record);
}
else
{
- CAL_DBG("get_record fail");
+ DBG("get_record fail");
return ret;
}
cal_query_s *que = NULL;
int ret = CALENDAR_ERROR_NONE;
- retv_if(NULL == query || NULL == condition || NULL == bind_text, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == condition, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == bind_text, CALENDAR_ERROR_INVALID_PARAMETER);
que = (cal_query_s *)query;
cal_query_s *query_s = NULL;
cal_property_info_s *properties = NULL;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
query_s = (cal_query_s *)query;
properties = query_s->properties;
cal_query_s *query_s = NULL;
cal_property_info_s *properties = NULL;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
query_s = (cal_query_s *)query;
properties = query_s->properties;
int i = 0;
cal_query_s *query_s = NULL;
- retv_if(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == query, CALENDAR_ERROR_INVALID_PARAMETER);
query_s = (cal_query_s *)query;
if (NULL == query_s->projection || '\0' == *query_s->projection)
const char *field_name;
int ret = CALENDAR_ERROR_NONE;
- retv_if(record == NULL, -1);
+ RETV_IF(record == NULL, -1);
_record = (cal_record_s *)record;
if (_record->properties_max_count == 0 || _record->properties_flags == NULL)
{
- CAL_DBG("record don't have properties");
+ DBG("record don't have properties");
return CALENDAR_ERROR_INVALID_PARAMETER;
}
}
*set = strdup(out_set);
- CAL_DBG("set=%s",*set);
+ DBG("set=%s",*set);
return CALENDAR_ERROR_NONE;
}
const char *field_name;
int ret = CALENDAR_ERROR_NONE;
- retv_if(record == NULL, -1);
+ RETV_IF(record == NULL, -1);
_record = (cal_record_s *)record;
int ret;
char *cond = NULL;
- retv_if(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == filter, CALENDAR_ERROR_INVALID_PARAMETER);
switch (filter->filter_type)
{
field_name = __cal_db_query_get_property_field_name(com_filter->properties,
com_filter->property_count, filter->property_id);
- retvm_if(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property id(%d)", filter->property_id);
switch(filter->match)
field_name = __cal_db_query_get_property_field_name(com_filter->properties,
com_filter->property_count, filter->property_id);
- retvm_if(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property id(%d)", filter->property_id);
switch(filter->match)
field_name = __cal_db_query_get_property_field_name(com_filter->properties,
com_filter->property_count, filter->property_id);
- retvm_if(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property id(%d)", filter->property_id);
switch(filter->match)
field_name = __cal_db_query_get_property_field_name(com_filter->properties,
com_filter->property_count, filter->property_id);
- retvm_if(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property id(%d)", filter->property_id);
if (filter->value.caltime.type == CALENDAR_TIME_UTIME )
field_name = __cal_db_query_get_property_field_name(com_filter->properties,
com_filter->property_count, filter->property_id);
- retvm_if(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(NULL == field_name, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid parameter : property id(%d)", filter->property_id);
switch(filter->match)
void _cal_db_rrule_set_default(calendar_record_h record)
{
cal_event_s *event = NULL;
- retm_if(record == NULL, "Invalid argument: rrule is NULL");
+ RET_IF(record == NULL);
event = (cal_event_s *)record;
cal_rrule_s *_rrule;
cal_event_s *_event;
- retm_if(event == NULL, "Invalid argument: rrule is NULL");
+ RET_IF(event == NULL);
_event = (cal_event_s *)event;
if (_event->freq == CALENDAR_RECURRENCE_NONE) {
return;
}
_rrule = calloc(1, sizeof(cal_rrule_s));
- retm_if(_rrule == NULL, "Failed to calloc");
+ RETM_IF(_rrule == NULL, "Failed to calloc");
_rrule->freq = _event->freq;
{
cal_event_s *_event;
- retm_if(rrule == NULL, "Invalid argument: rrule is NULL");
- retm_if(event == NULL, "Invalid argument: rrule is NULL");
+ RET_IF(rrule == NULL);
+ RET_IF(event == NULL);
_event = (cal_event_s *)event;
{
cal_todo_s *_todo;
- retm_if(rrule == NULL, "Invalid argument: rrule is NULL");
- retm_if(todo == NULL, "Invalid argument: todo is NULL");
+ RET_IF(rrule == NULL);
+ RET_IF(todo == NULL);
_todo = (cal_todo_s *)todo;
cal_rrule_s *_rrule;
cal_todo_s *_todo;
- retm_if(todo == NULL, "Invalid argument: rrule is NULL");
+ RET_IF(todo == NULL);
_todo = (cal_todo_s *)todo;
_rrule = calloc(1, sizeof(cal_rrule_s));
- retm_if(_rrule == NULL, "Failed to calloc");
+ RETM_IF(_rrule == NULL, "Failed to calloc");
_rrule->freq = _todo->freq;
_rrule->range_type = _todo->range_type;
sqlite3_stmt *stmt = NULL;
cal_db_util_error_e dbret = CAL_DB_OK;
- retvm_if(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: rrule is NULL");
snprintf(query, sizeof(query),
}
_rrule = calloc(1, sizeof(cal_rrule_s));
- retvm_if(_rrule == NULL, CALENDAR_ERROR_OUT_OF_MEMORY,
+ RETVM_IF(_rrule == NULL, CALENDAR_ERROR_OUT_OF_MEMORY,
"Failed to calloc");
index = 0;
int _cal_db_rrule_insert_record(int id, cal_rrule_s *rrule)
{
- retvm_if(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
+ RETVM_IF(rrule == NULL, CALENDAR_ERROR_INVALID_PARAMETER,
"Invalid argument: rrule is NULL");
if (rrule->freq == CALENDAR_RECURRENCE_NONE) {
mkdir(DB_PATH, 755);
}
ret = db_util_open(CAL_DB_FILE, &calendar_db_handle, 0);
- retvm_if(SQLITE_OK != ret, CALENDAR_ERROR_DB_FAILED,
+ RETVM_IF(SQLITE_OK != ret, CALENDAR_ERROR_DB_FAILED,
"db_util_open() Failed(%d).", ret);
}
return CALENDAR_ERROR_NONE;
if (calendar_db_handle) {
ret = db_util_close(calendar_db_handle);
- warn_if(SQLITE_OK != ret, "db_util_close() Failed(%d)", ret);
+ WARN_IF(SQLITE_OK != ret, "db_util_close() Failed(%d)", ret);
calendar_db_handle = NULL;
- CAL_DBG("The database disconnected really.");
+ DBG("The database disconnected really.");
}
return CALENDAR_ERROR_NONE;
struct timeval from, now, diff;
bool retry = false;
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == calendar_db_handle, CALENDAR_ERROR_DB_FAILED, "Database is not opended");
+ RETVM_IF(NULL == calendar_db_handle, CALENDAR_ERROR_DB_FAILED, "Database is not opended");
gettimeofday(&from, NULL);
do
int ret;
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == calendar_db_handle, CALENDAR_ERROR_DB_FAILED, "Database is not opended");
+ RETVM_IF(NULL == calendar_db_handle, CALENDAR_ERROR_DB_FAILED, "Database is not opended");
stmt = _cal_db_util_query_prepare(query);
- retvm_if(NULL == stmt, CAL_DB_ERROR_FAIL, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CAL_DB_ERROR_FAIL, "_cal_db_util_query_prepare() Failed");
ret = _cal_db_util_stmt_step(stmt);
bool retry = false;
sqlite3_stmt *stmt = NULL;
- retvm_if(NULL == query, NULL, "Invalid query");
- retvm_if(NULL == calendar_db_handle, NULL, "Database is not opended");
- //CALS_DBG("prepare query : %s", query);
+ RETV_IF(NULL == query, NULL);
+ RETV_IF(NULL == calendar_db_handle, NULL);
gettimeofday(&from, NULL);
- do
- {
+ do {
ret = sqlite3_prepare_v2(calendar_db_handle, query, strlen(query), &stmt, NULL);
- if (SQLITE_BUSY == ret || SQLITE_LOCKED == ret)
- {
+ if (SQLITE_BUSY == ret || SQLITE_LOCKED == ret) {
gettimeofday(&now, NULL);
timersub(&now, &from, &diff);
retry = (diff.tv_sec < __CAL_QUERY_RETRY_TIME) ? true : false;
ret = _cal_db_util_query_exec("BEGIN IMMEDIATE TRANSACTION");
progress *= 2;
}
- retvm_if(CAL_DB_OK != ret, ret, "cal_query_exec() Failed(%d)", ret);
+ RETVM_IF(CAL_DB_OK != ret, ret, "cal_query_exec() Failed(%d)", ret);
transaction_cnt = 0;
const char *query = "SELECT ver FROM "CAL_TABLE_VERSION;
version_up = false;
}
transaction_cnt++;
- CAL_DBG("transaction_cnt : %d", transaction_cnt);
+ DBG("transaction_cnt : %d", transaction_cnt);
return CALENDAR_ERROR_NONE;
}
transaction_cnt--;
if (0 != transaction_cnt) {
- CAL_DBG("transaction_cnt : %d", transaction_cnt);
+ DBG("transaction_cnt : %d", transaction_cnt);
return CALENDAR_ERROR_NONE;
}
snprintf(query, sizeof(query), "UPDATE %s SET ver = %d",
CAL_TABLE_VERSION, transaction_ver);
ret = _cal_db_util_query_exec(query);
- warn_if(CAL_DB_OK != ret, "cal_query_exec(version up) Failed(%d).", ret);
+ WARN_IF(CAL_DB_OK != ret, "cal_query_exec(version up) Failed(%d).", ret);
}
INFO("start commit");
ERR("cal_query_exec() Failed(%d)", ret);
__cal_db_util_cancel_changes();
tmp_ret = _cal_db_util_query_exec("ROLLBACK TRANSACTION");
- warn_if(CAL_DB_OK != tmp_ret, "cal_query_exec(ROLLBACK) Failed(%d).", tmp_ret);
+ WARN_IF(CAL_DB_OK != tmp_ret, "cal_query_exec(ROLLBACK) Failed(%d).", tmp_ret);
return CALENDAR_ERROR_DB_FAILED;
}
if (event_change) __cal_db_util_notify_event_change();
if (todo_change) __cal_db_util_notify_todo_change();
if (calendar_change) __cal_db_util_notify_calendar_change();
- CAL_DBG("transaction_ver = %d",transaction_ver);
+ DBG("transaction_ver = %d",transaction_ver);
return CALENDAR_ERROR_NONE;
}
static bool __cal_server_account_delete_cb(const char* event_type, int account_id, void* user_data)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
if (strcmp(event_type, ACCOUNT_NOTI_NAME_DELETE) == 0)
{
int main(int argc, char *argv[])
{
- INFO(COLOR_GREEN"Server start"COLOR_END);
-
+ CAL_FN_CALL();
if (getuid() == 0)
{ // root
gid_t glist[] = {CAL_SECURITY_FILE_GROUP};
#define CAL_SEARCH_LOOP_MAX 4
-#define COLOR_CYAN "\033[0;36m"
-#define COLOR_END "\033[0;m"
-
struct _alarm_data_s
{
int event_id;
*/
static int __cal_server_alarm_get_alert_time(int alarm_id, time_t *tt_alert)
{
- retvm_if(NULL == tt_alert, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: tt_alert is NULL");
+ RETV_IF(NULL == tt_alert, CALENDAR_ERROR_INVALID_PARAMETER);
char query[CAL_DB_SQL_MAX_LEN] = {0};
snprintf(query, sizeof(query), "SELECT A.event_id, A.remind_tick_unit, A.remind_tick, "
sqlite3_stmt *stmt = NULL;
stmt = _cal_db_util_query_prepare(query);
- retvm_if (NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
+ RETVM_IF(NULL == stmt, CALENDAR_ERROR_DB_FAILED, "_cal_db_util_query_prepare() Failed");
int event_id = 0;
int unit = 0;
static int __cal_server_alarm_get_alert_list(time_t utime, GList **list)
{
- ENTER();
- retvm_if (NULL == list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: list is NULL");
+ CAL_FN_CALL();
+ RETV_IF(NULL == list, CALENDAR_ERROR_INVALID_PARAMETER);
tzset();
struct tm st_local = {0};
static int __cal_server_alarm_register(GList *alarm_list)
{
- ENTER();
- retvm_if (NULL == alarm_list, CALENDAR_ERROR_INVALID_PARAMETER, "Invalid parameter: alarm list is NULL");
+ CAL_FN_CALL();
+ RETV_IF(NULL == alarm_list, CALENDAR_ERROR_INVALID_PARAMETER);
int ret = CALENDAR_ERROR_NONE;
GList *l = g_list_first(alarm_list);
struct _alarm_data_s *ad = (struct _alarm_data_s *)l->data;
- retvm_if (NULL == ad, CALENDAR_ERROR_DB_FAILED, "No data");
+ RETVM_IF(NULL == ad, CALENDAR_ERROR_DB_FAILED, "No data");
// clear all alarm which set by mine.
ret = alarmmgr_enum_alarm_ids(__cal_server_alarm_clear_all_cb, NULL);
static bool __app_matched_cb(app_control_h app_control, const char *package, void *user_data)
{
- retvm_if (NULL == user_data, true, "Invalid parameter: user_data is NULL");
+ RETV_IF(NULL == user_data, true);
int ret = 0;
char *mime = NULL;
ret = app_control_get_mime(app_control, &mime);
- retvm_if(APP_CONTROL_ERROR_NONE != ret, true, "app_control_get_mime() is failed(%d)", ret);
+ RETVM_IF(APP_CONTROL_ERROR_NONE != ret, true, "app_control_get_mime() is failed(%d)", ret);
const char *reminder_mime = "application/x-tizen.calendar.reminder";
if (strncmp(mime, reminder_mime, strlen(reminder_mime))) { // not same
static void __cal_server_alarm_noti_with_control(GList *alarm_list)
{
- retm_if(NULL == alarm_list, "No alarm list");
+ RETM_IF(NULL == alarm_list, "No alarm list");
app_control_h app_control = NULL;
app_control_create(&app_control);
static void __cal_server_alarm_noti_with_callback(GList *alarm_list)
{
- retm_if(NULL == alarm_list, "No alarm list");
+ RETM_IF(NULL == alarm_list, "No alarm list");
GList *l = g_list_first(alarm_list);
while (l) {
static int _alert_cb(alarm_id_t alarm_id, void *data)
{
- ENTER();
+ CAL_FN_CALL();
GList *l = NULL;
DBG("alarm_id (%ld)", alarm_id);
__cal_server_alarm_noti_with_callback(l);
__cal_server_alarm_noti_with_control(l);
__cal_server_alarm_register_with_alarmmgr(tt_alert);
- LEAVE();
return 0;
}
////////////////////////////////////////////////////////////////////
static void __cal_server_alarm_timechange_cb(keynode_t *node, void *data)
{
- ENTER();
+ CAL_FN_CALL();
int t = 0;
int ret;
else
{
ret = vconf_get_int(VCONFKEY_SYSTEM_TIMECHANGE, &t);
- warn_if(0 < ret, "vconf_get_int() Failed");
+ WARN_IF(0 < ret, "vconf_get_int() Failed");
}
if (t < 0)
static void __changed_cb(const char* view_uri, void* data)
{
- ENTER();
+ CAL_FN_CALL();
__cal_server_alarm_register_with_alarmmgr(time(NULL));
}
int _cal_server_alarm(void)
{
- ENTER();
+ CAL_FN_CALL();
int ret;
__cal_server_alarm_set_timechange();
__cal_server_alarm_set_inotify(__changed_cb);
ret = alarmmgr_init("calendar-service");
- retvm_if(ret < 0, ret, "alarmmgr_init() failed");
+ RETVM_IF(ret < 0, ret, "alarmmgr_init() failed");
ret = alarmmgr_set_cb(_alert_cb, NULL);
- retvm_if(ret < 0, ret, "alarmmgr_set_cb() failed");
+ RETVM_IF(ret < 0, ret, "alarmmgr_set_cb() failed");
__cal_server_alarm_register_with_alarmmgr(time(NULL));
sqlite3_stmt *stmt = NULL;
int count = 0;
- CAL_FN_CALL;
+ CAL_FN_CALL();
if (data->calendar_id_list == NULL)
{
sqlite3_stmt *stmt = NULL;
int count = 0;
- CAL_FN_CALL;
+ CAL_FN_CALL();
ret = _cal_db_util_begin_trans();
if (CALENDAR_ERROR_NONE != ret)
id);
dbret = _cal_db_util_query_exec(query);
- CAL_DBG("%s",query);
+ DBG("%s",query);
if (CAL_DB_OK != dbret)
{
ERR("_cal_db_util_query_exec() failed (%d)", dbret);
return CALENDAR_ERROR_DB_FAILED;
}
- CAL_FN_CALL;
+ CAL_FN_CALL();
/* delete event table */
snprintf(query, sizeof(query), "DELETE FROM %s "
{
int ret = CALENDAR_ERROR_NONE;
- CAL_FN_CALL;
+ CAL_FN_CALL();
if(data == NULL)
{
{
__calendar_delete_data_s *callback_data = NULL;
int ret = CALENDAR_ERROR_NONE;
- CAL_FN_CALL;
+ CAL_FN_CALL();
while(1)
{
if (__cal_server_calendar_run(callback_data) == false)
{
callback_data = NULL;
- CAL_DBG("end");
+ DBG("end");
break;
}
}
}
g_mutex_lock(&__cal_server_calendar_delete_mutex);
- CAL_DBG("wait");
+ DBG("wait");
g_cond_wait(&__cal_server_calendar_delete_cond, &__cal_server_calendar_delete_mutex);
g_mutex_unlock(&__cal_server_calendar_delete_mutex);
}
void _cal_server_calendar_delete_start(void)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
if (__cal_server_calendar_delete_thread == NULL)
{
snprintf(buf, sizeof(buf), "%d", st.time.date.mday);
ret = calendar_record_create(_calendar_event._uri, &event);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "calendar_record_create() failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_record_create() failed");
ret = calendar_record_set_str(event, _calendar_event.summary, label);
if (CALENDAR_ERROR_NONE != ret) {
ERR("calendar_record_set_str() failed:summary");
calendar_filter_h filter = NULL;
ret = calendar_query_create(_calendar_event._uri, &query);
- retvm_if(CALENDAR_ERROR_NONE != ret, ret, "calendar_query_create() failed");
+ RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_query_create() failed");
ret = calendar_filter_create(_calendar_event._uri, &filter);
if (CALENDAR_ERROR_NONE != ret) {
ERR("calendar_filter_create() failed");
calendar_list_first(list);
*delete_count = 0;
- *delete_ids = (int*)calloc(count, sizeof(int));
+ *delete_ids = calloc(count, sizeof(int));
do {
if (calendar_list_get_current_record_p(list, &event) == CALENDAR_ERROR_NONE) {
if (event == NULL) {
int ret;
ret = contacts_db_add_changed_cb(_contacts_event._uri, __contacts_changed_cb, NULL);
- retvm_if(CONTACTS_ERROR_NONE != ret, ret, "contacts_db_add_changed_cb() failed");
+ RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "contacts_db_add_changed_cb() failed");
return CALENDAR_ERROR_NONE;
}
snprintf(buf, sizeof(buf), "%d", account_id);
ret = calendar_query_create(_calendar_event._uri, &query);
- retm_if(CALENDAR_ERROR_NONE != ret, "calendar_query_create() failed");
+ RETM_IF(CALENDAR_ERROR_NONE != ret, "calendar_query_create() failed");
ret = calendar_filter_create(_calendar_event._uri, &filter);
if (CALENDAR_ERROR_NONE != ret) {
ERR("calendar_filter_create() failed");
static gpointer __cal_server_contacts_sync_main(gpointer user_data)
{
int ret = CALENDAR_ERROR_NONE;
- CAL_FN_CALL;
+ CAL_FN_CALL();
while(1) {
ret = calendar_connect();
while(1) {
if (__cal_server_contacts_sync() == false) {
- CAL_DBG("end");
+ DBG("end");
break;
}
}
calendar_disconnect();
g_mutex_lock(&__cal_server_contacts_sync_mutex);
- CAL_DBG("wait");
+ DBG("wait");
g_cond_wait(&__cal_server_contacts_sync_cond, &__cal_server_contacts_sync_mutex);
g_mutex_unlock(&__cal_server_contacts_sync_mutex);
}
void _cal_server_contacts_sync_start(void)
{
- CAL_FN_CALL;
+ CAL_FN_CALL();
if (__cal_server_contacts_sync_thread == NULL) {
g_mutex_init(&__cal_server_contacts_sync_mutex);
void _cal_server_reminder_publish(char *p)
{
- retm_if (NULL == p, "Invalid parameter: p is NULL");
+ RET_IF(NULL == p);
__cal_server_reminder_publish_changes_with_data(p, strlen(p));
}
int _cal_server_update(void)
{
- ENTER();
+ CAL_FN_CALL();
int ret = CALENDAR_ERROR_NONE;
int old_version = 0;
db_util_close(__db);
__db = NULL;
- LEAVE();
return CALENDAR_ERROR_NONE;
}