summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangyoon Jang <jeremy.jang@samsung.com>2019-10-23 11:48:56 (GMT)
committerSangyoon Jang <jeremy.jang@samsung.com>2019-10-23 12:28:34 (GMT)
commitee8b95c843692db9662b47ef5f843e6a6cd98bc8 (patch)
tree9e74bf32565273fd3ac1e85eaede2120cf425ab3
parent7f72eb9bc0d1690c3908bd70d47f55e63ab6cede (diff)
downloadalarm-manager-ee8b95c843692db9662b47ef5f843e6a6cd98bc8.zip
alarm-manager-ee8b95c843692db9662b47ef5f843e6a6cd98bc8.tar.gz
alarm-manager-ee8b95c843692db9662b47ef5f843e6a6cd98bc8.tar.bz2
Fix to return error code properly when dbus call failedrefs/changes/38/216338/3
Change-Id: I87e2185e992705013149ba9b42224fad7da05098 Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
-rw-r--r--lib/alarm-lib-dbus.c100
1 files changed, 80 insertions, 20 deletions
diff --git a/lib/alarm-lib-dbus.c b/lib/alarm-lib-dbus.c
index 9633b68..c89d653 100644
--- a/lib/alarm-lib-dbus.c
+++ b/lib/alarm-lib-dbus.c
@@ -102,8 +102,11 @@ bool _send_alarm_create_noti(alarm_context_t context, alarm_info_t *alarm_info,
return_code = __dbus_call_sync(context.proxy, "alarm_create_noti",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(ii)", alarm_id, &return_code);
@@ -160,8 +163,11 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
return_code = __dbus_call_sync(context.proxy, "alarm_create_appsvc",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(ii)", alarm_id, &return_code);
@@ -219,8 +225,11 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
return_code = __dbus_call_sync(context.proxy, "alarm_create",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(ii)", alarm_id, &return_code);
@@ -260,8 +269,11 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r
return_code = __dbus_call_sync(context.proxy, "alarm_create_periodic",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(ii)", alarm_id, &return_code);
@@ -292,8 +304,11 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
return_code = __dbus_call_sync(context.proxy, "alarm_get_appsvc_info",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(si)", &b_data, &return_code);
@@ -330,8 +345,11 @@ notification_h _send_alarm_get_noti_info(alarm_context_t context, alarm_id_t ala
return_code = __dbus_call_sync(context.proxy, "alarm_get_noti_info",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(si)", &noti_data, &return_code);
@@ -375,8 +393,11 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *
return_code = __dbus_call_sync(context.proxy, "alarm_set_rtc_time",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -405,8 +426,11 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error
return_code = __dbus_call_sync(context.proxy, "alarm_delete",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -432,8 +456,11 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code)
return_code = __dbus_call_sync(context.proxy, "alarm_delete_all",
NULL, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -466,8 +493,11 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
return_code = __dbus_call_sync(context.proxy, "alarm_get_list_of_ids",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(@aiii)", &arr, num_of_ids, &return_code);
g_variant_get(arr, "ai", &iter_temp);
@@ -498,8 +528,11 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
return_code = __dbus_call_sync(context.proxy, "alarm_get_number_of_ids",
NULL, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(ii)", num_of_ids, &return_code);
@@ -530,8 +563,11 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
return_code = __dbus_call_sync(context.proxy, "alarm_get_info",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(iiiiiiiiiiiixi)",
&alarm_info->start.year,
@@ -577,8 +613,11 @@ bool _send_alarm_get_next_duetime(alarm_context_t context, alarm_id_t alarm_id,
return_code = __dbus_call_sync(context.proxy, "alarm_get_next_duetime",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(xi)", &_duetime, &return_code);
@@ -606,8 +645,11 @@ bool _send_alarm_get_all_info(alarm_context_t context, char **db_path, int *erro
return_code = __dbus_call_sync(context.proxy, "alarm_get_all_info",
NULL, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(si)", &_db_path, &return_code);
@@ -637,8 +679,11 @@ bool _send_alarm_set_time(alarm_context_t context, time_t new_time, int *error_c
return_code = __dbus_call_sync(context.proxy, "alarm_set_time",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -716,8 +761,11 @@ bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, struct
return_code = __dbus_call_sync(context.proxy, "alarm_set_time_with_propagation_delay",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -796,8 +844,11 @@ bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *er
return_code = __dbus_call_sync(context.proxy, "alarm_set_timezone",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -826,8 +877,11 @@ bool _send_alarm_set_global(alarm_context_t context, const alarm_id_t alarm_id,
return_code = __dbus_call_sync(context.proxy, "alarm_set_global",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);
@@ -856,8 +910,11 @@ bool _send_alarm_get_global(alarm_context_t context, const alarm_id_t alarm_id,
return_code = __dbus_call_sync(context.proxy, "alarm_get_global",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(bi)", global, &return_code);
@@ -902,8 +959,11 @@ bool _send_alarm_update(alarm_context_t context, alarm_id_t alarm_id,
return_code = __dbus_call_sync(context.proxy, "alarm_update",
param, &reply);
- if (return_code != ALARMMGR_RESULT_SUCCESS)
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code)
+ *error_code = return_code;
return false;
+ }
g_variant_get(reply, "(i)", &return_code);