From cfef4a7f658b391bb77227579d326f59e6a3c58a Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 7 Oct 2019 20:18:47 +0900 Subject: [PATCH] Change order of return value in autofill manager APIs Change-Id: Ibb6cee4edf4acecd97eeb6cf6ee1d22acb63e982 Signed-off-by: Jihoon Kim --- manager/autofill_manager.c | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/manager/autofill_manager.c b/manager/autofill_manager.c index 9baadc8..4842630 100644 --- a/manager/autofill_manager.c +++ b/manager/autofill_manager.c @@ -74,11 +74,6 @@ EXPORT_API int autofill_manager_create(autofill_manager_h *amh) LOGI("autofill manager initialize"); - if (!amh) { - LOGW("[ERROR] Invalid paramater"); - return AUTOFILL_ERROR_INVALID_PARAMETER; - } - if (!check_privilege(AUTOFILL_MANAGER_PRIVILEGE)) { LOGW("[ERROR] Permission denied"); return AUTOFILL_ERROR_PERMISSION_DENIED; @@ -87,6 +82,11 @@ EXPORT_API int autofill_manager_create(autofill_manager_h *amh) LOGD("Succeed to check privilege"); } + if (!amh) { + LOGW("[ERROR] Invalid paramater"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + struct autofill_manager_s *ams = (autofill_manager_h)calloc(1, sizeof(struct autofill_manager_s)); if (!ams) return AUTOFILL_ERROR_OUT_OF_MEMORY; @@ -113,13 +113,6 @@ EXPORT_API int autofill_manager_destroy(autofill_manager_h amh) { LOGI("autofill manager deinitialize"); - if (!amh) { - LOGW("[ERROR] Invalid paramater"); - return AUTOFILL_ERROR_INVALID_PARAMETER; - } - - amh->connection_callback = NULL; - if (!check_privilege(AUTOFILL_MANAGER_PRIVILEGE)) { LOGW("[ERROR] Permission denied"); return AUTOFILL_ERROR_PERMISSION_DENIED; @@ -128,6 +121,13 @@ EXPORT_API int autofill_manager_destroy(autofill_manager_h amh) LOGD("Succeed to check privilege"); } + if (!amh) { + LOGW("[ERROR] Invalid paramater"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + + amh->connection_callback = NULL; + if (amh->rpc_h) { rpc_port_proxy_AutofillManagerPort_destroy(amh->rpc_h); amh->rpc_h = NULL; @@ -144,16 +144,16 @@ EXPORT_API int autofill_manager_connect(autofill_manager_h amh, autofill_manager int ret; - if (!amh || !callback) { - LOGW("[ERROR] parameter is NULL\n"); - return AUTOFILL_ERROR_INVALID_PARAMETER; - } - if (!check_privilege(AUTOFILL_MANAGER_PRIVILEGE)) { LOGW("[ERROR] Permission denied"); return AUTOFILL_ERROR_PERMISSION_DENIED; } + if (!amh || !callback) { + LOGW("[ERROR] parameter is NULL\n"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + if (!amh->rpc_h) { LOGW("[ERROR] rpc handle is NULL"); return AUTOFILL_ERROR_OPERATION_FAILED; @@ -181,16 +181,16 @@ EXPORT_API int autofill_manager_set_autofill_service(autofill_manager_h amh, con { LOGI("autofill manager set autofill service. app id : %s", app_id); - if (!amh || !app_id) { - LOGW("[ERROR] parameter is NULL"); - return AUTOFILL_ERROR_INVALID_PARAMETER; - } - if (!check_privilege(AUTOFILL_MANAGER_PRIVILEGE)) { LOGW("[ERROR] Permission denied"); return AUTOFILL_ERROR_PERMISSION_DENIED; } + if (!amh || !app_id) { + LOGW("[ERROR] parameter is NULL"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + if (!amh->rpc_h) { LOGW("[ERROR] rpc handle is NULL"); return AUTOFILL_ERROR_OPERATION_FAILED; @@ -208,16 +208,16 @@ EXPORT_API int autofill_manager_get_autofill_service(autofill_manager_h amh, cha { LOGI("autofill manager get autofill service"); - if (!amh || !service_app_id) { - LOGW("[ERROR] parameter is NULL"); - return AUTOFILL_ERROR_INVALID_PARAMETER; - } - if (!check_privilege(AUTOFILL_MANAGER_PRIVILEGE)) { LOGW("[ERROR] Permission denied"); return AUTOFILL_ERROR_PERMISSION_DENIED; } + if (!amh || !service_app_id) { + LOGW("[ERROR] parameter is NULL"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + if (!amh->rpc_h) { LOGW("[ERROR] Not initialized"); return AUTOFILL_ERROR_OPERATION_FAILED; -- 2.7.4