From: Jihoon Kim Date: Fri, 27 Jan 2023 01:33:06 +0000 (+0900) Subject: Add more error logs X-Git-Tag: accepted/tizen/unified/20230206.093753~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=231eee1b849edbaf416e3601534965b1375c5573;p=platform%2Fcore%2Fuifw%2Fautofill.git Add more error logs Change-Id: Iddf8daa02257223574e7f0a6870e956fd260a140 Signed-off-by: Jihoon Kim --- diff --git a/client/autofill_fill_request.c b/client/autofill_fill_request.c index 0b5f179..4233598 100644 --- a/client/autofill_fill_request.c +++ b/client/autofill_fill_request.c @@ -46,6 +46,7 @@ EXPORT_API int autofill_fill_request(autofill_h ah, autofill_view_info_h vi) } if (!ah->rpc_h) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; } diff --git a/common/autofill_auth_info.c b/common/autofill_auth_info.c index 2649c20..f7aa0ba 100644 --- a/common/autofill_auth_info.c +++ b/common/autofill_auth_info.c @@ -41,12 +41,16 @@ struct autofill_auth_info_s { EXPORT_API int autofill_auth_info_create(autofill_auth_info_h *ai) { - if (!ai) + if (!ai) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } struct autofill_auth_info_s *vs = (autofill_auth_info_h)calloc(1, sizeof(struct autofill_auth_info_s)); - if (!vs) + if (!vs) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } *ai = (autofill_auth_info_h)vs; @@ -55,8 +59,10 @@ EXPORT_API int autofill_auth_info_create(autofill_auth_info_h *ai) EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h ai) { - if (!ai) + if (!ai) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->app_id) { free(ai->app_id); @@ -85,8 +91,10 @@ EXPORT_API int autofill_auth_info_destroy(autofill_auth_info_h ai) EXPORT_API int autofill_auth_info_set_autofill_data_present(autofill_auth_info_h ai, bool autofill_data_present) { - if (!ai) + if (!ai) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } ai->autofill_data_present = autofill_data_present; @@ -95,8 +103,10 @@ EXPORT_API int autofill_auth_info_set_autofill_data_present(autofill_auth_info_h EXPORT_API int autofill_auth_info_get_autofill_data_present(autofill_auth_info_h ai, bool *autofill_data_present) { - if (!ai || !autofill_data_present) + if (!ai || !autofill_data_present) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *autofill_data_present = ai->autofill_data_present; @@ -105,8 +115,10 @@ EXPORT_API int autofill_auth_info_get_autofill_data_present(autofill_auth_info_h EXPORT_API int autofill_auth_info_set_authentication_needed(autofill_auth_info_h ai, bool authentication_needed) { - if (!ai) + if (!ai) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } ai->authentication_needed = authentication_needed; @@ -115,8 +127,10 @@ EXPORT_API int autofill_auth_info_set_authentication_needed(autofill_auth_info_h EXPORT_API int autofill_auth_info_get_authentication_needed(autofill_auth_info_h ai, bool *authentication_needed) { - if (!ai || !authentication_needed) + if (!ai || !authentication_needed) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *authentication_needed = ai->authentication_needed; @@ -125,8 +139,10 @@ EXPORT_API int autofill_auth_info_get_authentication_needed(autofill_auth_info_h EXPORT_API int autofill_auth_info_set_service_name(autofill_auth_info_h ai, const char *service_name) { - if (!ai || !service_name) + if (!ai || !service_name) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->service_name) free(ai->service_name); @@ -138,11 +154,15 @@ EXPORT_API int autofill_auth_info_set_service_name(autofill_auth_info_h ai, cons EXPORT_API int autofill_auth_info_get_service_name(autofill_auth_info_h ai, char **service_name) { - if (!ai || !service_name) + if (!ai || !service_name) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!ai->service_name) + if (!ai->service_name) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *service_name = strdup(ai->service_name); @@ -151,8 +171,10 @@ EXPORT_API int autofill_auth_info_get_service_name(autofill_auth_info_h ai, char EXPORT_API int autofill_auth_info_set_service_message(autofill_auth_info_h ai, const char *service_message) { - if (!ai || !service_message) + if (!ai || !service_message) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->service_message) free(ai->service_message); @@ -164,11 +186,15 @@ EXPORT_API int autofill_auth_info_set_service_message(autofill_auth_info_h ai, c EXPORT_API int autofill_auth_info_get_service_message(autofill_auth_info_h ai, char **service_message) { - if (!ai || !service_message) + if (!ai || !service_message) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!ai->service_message) + if (!ai->service_message) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *service_message = strdup(ai->service_message); @@ -177,8 +203,10 @@ EXPORT_API int autofill_auth_info_get_service_message(autofill_auth_info_h ai, c EXPORT_API int autofill_auth_info_set_service_logo_image_path(autofill_auth_info_h ai, const char *service_logo_image_path) { - if (!ai || !service_logo_image_path) + if (!ai || !service_logo_image_path) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->service_logo_image_path) free(ai->service_logo_image_path); @@ -190,8 +218,10 @@ EXPORT_API int autofill_auth_info_set_service_logo_image_path(autofill_auth_info EXPORT_API int autofill_auth_info_get_service_logo_image_path(autofill_auth_info_h ai, char **service_logo_image_path) { - if (!ai || !service_logo_image_path) + if (!ai || !service_logo_image_path) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (!ai->service_logo_image_path) return AUTOFILL_ERROR_OPERATION_FAILED; @@ -203,8 +233,10 @@ EXPORT_API int autofill_auth_info_get_service_logo_image_path(autofill_auth_info EXPORT_API int autofill_auth_info_set_app_id(autofill_auth_info_h ai, const char *app_id) { - if (!ai || !app_id) + if (!ai || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->app_id) free(ai->app_id); @@ -216,11 +248,15 @@ EXPORT_API int autofill_auth_info_set_app_id(autofill_auth_info_h ai, const char EXPORT_API int autofill_auth_info_get_app_id(autofill_auth_info_h ai, char **app_id) { - if (!ai || !app_id) + if (!ai || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!ai->app_id) + if (!ai->app_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *app_id = strdup(ai->app_id); @@ -229,8 +265,10 @@ EXPORT_API int autofill_auth_info_get_app_id(autofill_auth_info_h ai, char **app EXPORT_API int autofill_auth_info_set_view_id(autofill_auth_info_h ai, const char *view_id) { - if (!ai || !view_id) + if (!ai || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ai->view_id) free(ai->view_id); @@ -242,11 +280,15 @@ EXPORT_API int autofill_auth_info_set_view_id(autofill_auth_info_h ai, const cha EXPORT_API int autofill_auth_info_get_view_id(autofill_auth_info_h ai, char **view_id) { - if (!ai || !view_id) + if (!ai || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!ai->view_id) + if (!ai->view_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *view_id = strdup(ai->view_id); diff --git a/common/autofill_error_info.c b/common/autofill_error_info.c index cc74991..273b9f3 100644 --- a/common/autofill_error_info.c +++ b/common/autofill_error_info.c @@ -35,8 +35,10 @@ struct autofill_error_info_s { EXPORT_API int autofill_error_info_create(autofill_error_info_h *ei) { - if (!ei) + if (!ei) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } struct autofill_error_info_s *eis = (autofill_error_info_h)calloc(1, sizeof(struct autofill_error_info_s)); if (!eis) @@ -49,8 +51,10 @@ EXPORT_API int autofill_error_info_create(autofill_error_info_h *ei) EXPORT_API int autofill_error_info_destroy(autofill_error_info_h ei) { - if (!ei) + if (!ei) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ei->app_id) { free(ei->app_id); @@ -64,8 +68,10 @@ EXPORT_API int autofill_error_info_destroy(autofill_error_info_h ei) EXPORT_API int autofill_error_info_set_error_code(autofill_error_info_h ei, autofill_error_e error_code) { - if (!ei) + if (!ei) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } ei->error_code = error_code; @@ -74,8 +80,10 @@ EXPORT_API int autofill_error_info_set_error_code(autofill_error_info_h ei, auto EXPORT_API int autofill_error_info_get_error_code(autofill_error_info_h ei, autofill_error_e *error_code) { - if (!ei || !error_code) + if (!ei || !error_code) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *error_code = ei->error_code; @@ -84,8 +92,10 @@ EXPORT_API int autofill_error_info_get_error_code(autofill_error_info_h ei, auto EXPORT_API int autofill_error_info_set_app_id(autofill_error_info_h ei, const char *app_id) { - if (!ei || !app_id) + if (!ei || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (ei->app_id) free(ei->app_id); @@ -97,11 +107,15 @@ EXPORT_API int autofill_error_info_set_app_id(autofill_error_info_h ei, const ch EXPORT_API int autofill_error_info_get_app_id(autofill_error_info_h ei, char **app_id) { - if (!ei || !app_id) + if (!ei || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!ei->app_id) + if (!ei->app_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *app_id = strdup(ei->app_id); diff --git a/common/autofill_fill_response.c b/common/autofill_fill_response.c index 34179b9..7ce0bd1 100644 --- a/common/autofill_fill_response.c +++ b/common/autofill_fill_response.c @@ -30,12 +30,16 @@ EXPORT_API int autofill_fill_response_create(autofill_fill_response_h *h) { - if (!h) + if (!h) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_fill_response_h ri = (autofill_fill_response_h)calloc(1, sizeof(struct autofill_fill_response_s)); - if (!ri) + if (!ri) { + LOGW("[ERROR] Out of memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } *h = (autofill_fill_response_h)ri; @@ -44,8 +48,10 @@ EXPORT_API int autofill_fill_response_create(autofill_fill_response_h *h) EXPORT_API int autofill_fill_response_destroy(autofill_fill_response_h h) { - if (!h) + if (!h) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (h->view_id) { free(h->view_id); @@ -64,8 +70,10 @@ EXPORT_API int autofill_fill_response_destroy(autofill_fill_response_h h) EXPORT_API int autofill_fill_response_set_app_id(autofill_fill_response_h h, const char *app_id) { - if (!h || !app_id) + if (!h || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (h->app_id) { free(h->app_id); @@ -78,11 +86,15 @@ EXPORT_API int autofill_fill_response_set_app_id(autofill_fill_response_h h, con EXPORT_API int autofill_fill_response_get_app_id(autofill_fill_response_h h, char **app_id) { - if (!h || !app_id) + if (!h || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!h->app_id) + if (!h->app_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *app_id = strdup(h->app_id); @@ -91,8 +103,10 @@ EXPORT_API int autofill_fill_response_get_app_id(autofill_fill_response_h h, cha EXPORT_API int autofill_fill_response_set_view_id(autofill_fill_response_h h, const char *view_id) { - if (!h || !view_id) + if (!h || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (h->view_id) { free(h->view_id); @@ -105,11 +119,15 @@ EXPORT_API int autofill_fill_response_set_view_id(autofill_fill_response_h h, co EXPORT_API int autofill_fill_response_get_view_id(autofill_fill_response_h h, char **view_id) { - if (!h || !view_id) + if (!h || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!h->view_id) + if (!h->view_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *view_id = strdup(h->view_id); @@ -118,8 +136,10 @@ EXPORT_API int autofill_fill_response_get_view_id(autofill_fill_response_h h, ch EXPORT_API int autofill_fill_response_add_group(autofill_fill_response_h h, autofill_fill_response_group_h it) { - if (!h || !it) + if (!h || !it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_fill_response_group_h clone; autofill_fill_response_group_clone(it, &clone); @@ -137,6 +157,7 @@ EXPORT_API int autofill_fill_response_foreach_group(autofill_fill_response_h h, autofill_fill_response_group_cb callback, void *user_data) { if (!h || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -154,8 +175,10 @@ EXPORT_API int autofill_fill_response_foreach_group(autofill_fill_response_h h, EXPORT_API int autofill_fill_response_get_group_count(autofill_fill_response_h h, int *count) { - if (!h || !count) + if (!h || !count) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *count = eina_list_count(h->autofill_fill_response_group_list); diff --git a/common/autofill_fill_response_group.c b/common/autofill_fill_response_group.c index 31b5fed..ba593f6 100644 --- a/common/autofill_fill_response_group.c +++ b/common/autofill_fill_response_group.c @@ -29,12 +29,16 @@ EXPORT_API int autofill_fill_response_group_create(autofill_fill_response_group_h *h) { - if (!h) + if (!h) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_fill_response_group_h ri = (autofill_fill_response_group_h)calloc(1, sizeof(struct autofill_fill_response_group_s)); - if (!ri) + if (!ri) { + LOGW("[ERROR] Out of memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } *h = (autofill_fill_response_group_h)ri; @@ -43,8 +47,10 @@ EXPORT_API int autofill_fill_response_group_create(autofill_fill_response_group_ EXPORT_API int autofill_fill_response_group_destroy(autofill_fill_response_group_h h) { - if (!h) + if (!h) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } // Release memory autofill fill response item list autofill_fill_response_item_h it_h; @@ -99,13 +105,15 @@ EXPORT_API int autofill_fill_response_group_clone(autofill_fill_response_group_h EXPORT_API int autofill_fill_response_group_add_item(autofill_fill_response_group_h h, autofill_fill_response_item_h it) { - if (!h || !it) + if (!h || !it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_fill_response_item_h clone; autofill_fill_response_item_clone(it, &clone); if (!clone) { - LOGW("Out of memory"); + LOGW("[ERROR] Out of memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; } @@ -118,6 +126,7 @@ EXPORT_API int autofill_fill_response_group_foreach_item(autofill_fill_response_ autofill_fill_response_item_cb callback, void *user_data) { if (!h || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -131,4 +140,4 @@ EXPORT_API int autofill_fill_response_group_foreach_item(autofill_fill_response_ } return AUTOFILL_ERROR_NONE; -} \ No newline at end of file +} diff --git a/common/autofill_fill_response_item.c b/common/autofill_fill_response_item.c index b9fa709..77da855 100644 --- a/common/autofill_fill_response_item.c +++ b/common/autofill_fill_response_item.c @@ -36,8 +36,10 @@ struct autofill_response_item_s { EXPORT_API int autofill_fill_response_item_create(autofill_fill_response_item_h *it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_fill_response_item_h ri = (autofill_fill_response_item_h)calloc(1, sizeof(struct autofill_response_item_s)); if (!ri) @@ -50,8 +52,10 @@ EXPORT_API int autofill_fill_response_item_create(autofill_fill_response_item_h EXPORT_API int autofill_fill_response_item_destroy(autofill_fill_response_item_h it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -84,8 +88,10 @@ EXPORT_API int autofill_fill_response_item_clone(autofill_fill_response_item_h i } ret = autofill_fill_response_item_create(&handle); - if (ret == AUTOFILL_ERROR_OUT_OF_MEMORY) + if (ret == AUTOFILL_ERROR_OUT_OF_MEMORY) { + LOGW("[ERROR] Out of memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } if (!handle) { LOGW("[ERROR] Failed to create autofill fill response item handle"); @@ -128,8 +134,10 @@ EXPORT_API int autofill_fill_response_item_clone(autofill_fill_response_item_h i EXPORT_API int autofill_fill_response_item_set_id(autofill_fill_response_item_h it, const char *id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -142,11 +150,15 @@ EXPORT_API int autofill_fill_response_item_set_id(autofill_fill_response_item_h EXPORT_API int autofill_fill_response_item_get_id(autofill_fill_response_item_h it, char **id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!it->id) + if (!it->id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *id = strdup(it->id); @@ -155,8 +167,10 @@ EXPORT_API int autofill_fill_response_item_get_id(autofill_fill_response_item_h EXPORT_API int autofill_fill_response_item_set_value(autofill_fill_response_item_h it, const char *value) { - if (!it || !value) + if (!it || !value) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->value) { free(it->value); @@ -169,11 +183,15 @@ EXPORT_API int autofill_fill_response_item_set_value(autofill_fill_response_item EXPORT_API int autofill_fill_response_item_get_value(autofill_fill_response_item_h it, char **value) { - if (!it || !value) + if (!it || !value) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!it->value) + if (!it->value) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *value = strdup(it->value); @@ -182,8 +200,10 @@ EXPORT_API int autofill_fill_response_item_get_value(autofill_fill_response_item EXPORT_API int autofill_fill_response_item_set_presentation_text(autofill_fill_response_item_h it, const char *presentation_text) { - if (!it || !presentation_text) + if (!it || !presentation_text) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->presentation_text) { free(it->presentation_text); @@ -196,11 +216,15 @@ EXPORT_API int autofill_fill_response_item_set_presentation_text(autofill_fill_r EXPORT_API int autofill_fill_response_item_get_presentation_text(autofill_fill_response_item_h it, char ** presentation_text) { - if (!it || !presentation_text) + if (!it || !presentation_text) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!it->presentation_text) + if (!it->presentation_text) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *presentation_text = strdup(it->presentation_text); @@ -209,8 +233,10 @@ EXPORT_API int autofill_fill_response_item_get_presentation_text(autofill_fill_r EXPORT_API int autofill_fill_response_item_set_autofill_hint(autofill_fill_response_item_h it, autofill_hint_e hint) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } it->autofill_hint = hint; @@ -219,8 +245,10 @@ EXPORT_API int autofill_fill_response_item_set_autofill_hint(autofill_fill_respo EXPORT_API int autofill_fill_response_item_get_autofill_hint(autofill_fill_response_item_h it, autofill_hint_e *hint) { - if (!it || !hint) + if (!it || !hint) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *hint = it->autofill_hint; diff --git a/common/autofill_item.c b/common/autofill_item.c index d79ccf3..5e2c568 100644 --- a/common/autofill_item.c +++ b/common/autofill_item.c @@ -37,12 +37,16 @@ struct autofill_item_s { EXPORT_API int autofill_item_create(autofill_item_h *it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } struct autofill_item_s *ai = (autofill_item_h)calloc(1, sizeof(struct autofill_item_s)); - if (!ai) + if (!ai) { + LOGW("[ERROR] Failed to allocate memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } ai->is_sensitive_data = false; @@ -53,8 +57,10 @@ EXPORT_API int autofill_item_create(autofill_item_h *it) EXPORT_API int autofill_item_destroy(autofill_item_h it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -128,8 +134,10 @@ EXPORT_API int autofill_item_clone(autofill_item_h h, autofill_item_h *clone) EXPORT_API int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint_e hint) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } it->autofill_hint = hint; @@ -138,8 +146,10 @@ EXPORT_API int autofill_item_set_autofill_hint(autofill_item_h it, autofill_hint EXPORT_API int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint_e *hint) { - if (!it || !hint) + if (!it || !hint) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *hint = it->autofill_hint; @@ -148,8 +158,10 @@ EXPORT_API int autofill_item_get_autofill_hint(autofill_item_h it, autofill_hint EXPORT_API int autofill_item_set_id(autofill_item_h it, const char *id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -162,10 +174,13 @@ EXPORT_API int autofill_item_set_id(autofill_item_h it, const char *id) EXPORT_API int autofill_item_get_id(autofill_item_h it, char **id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (!it->id) { + LOGW("[ERROR] Failed to get id"); return AUTOFILL_ERROR_OPERATION_FAILED; } @@ -176,8 +191,10 @@ EXPORT_API int autofill_item_get_id(autofill_item_h it, char **id) EXPORT_API int autofill_item_set_label(autofill_item_h it, const char *label) { - if (!it || !label) + if (!it || !label) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->label) { free(it->label); @@ -190,10 +207,13 @@ EXPORT_API int autofill_item_set_label(autofill_item_h it, const char *label) EXPORT_API int autofill_item_get_label(autofill_item_h it, char **label) { - if (!it || !label) + if (!it || !label) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (!it->label) { + LOGW("[ERROR] Failed to get label"); return AUTOFILL_ERROR_OPERATION_FAILED; } @@ -204,8 +224,10 @@ EXPORT_API int autofill_item_get_label(autofill_item_h it, char **label) EXPORT_API int autofill_item_set_sensitive_data(autofill_item_h it, bool sensitive) { - if (!it) + if (!it) { + LOGW("[ERROR] AUTOFILL_ERROR_INVALID_PARAMETER"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } it->is_sensitive_data = sensitive; @@ -248,6 +270,7 @@ EXPORT_API int autofill_item_get_value(autofill_item_h it, char **value) } if (!it->value) { + LOGW("[ERROR] Failed to get value"); return AUTOFILL_ERROR_OPERATION_FAILED; } diff --git a/common/autofill_save_item.c b/common/autofill_save_item.c index c335027..555954b 100644 --- a/common/autofill_save_item.c +++ b/common/autofill_save_item.c @@ -37,8 +37,10 @@ struct autofill_save_item_s { EXPORT_API int autofill_save_item_create(autofill_save_item_h *it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } struct autofill_save_item_s *ai = (autofill_save_item_h)calloc(1, sizeof(struct autofill_save_item_s)); if (!ai) @@ -53,8 +55,10 @@ EXPORT_API int autofill_save_item_create(autofill_save_item_h *it) EXPORT_API int autofill_save_item_destroy(autofill_save_item_h it) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -87,8 +91,10 @@ EXPORT_API int autofill_save_item_clone(autofill_save_item_h it, autofill_save_i } ret = autofill_save_item_create(&handle); - if (ret == AUTOFILL_ERROR_OUT_OF_MEMORY) + if (ret == AUTOFILL_ERROR_OUT_OF_MEMORY) { + LOGW("[ERROR] Failed to create autofill_save_item handle"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } if (!handle) { LOGW("[ERROR] Failed to create autofill_save_item handle"); @@ -132,8 +138,10 @@ EXPORT_API int autofill_save_item_clone(autofill_save_item_h it, autofill_save_i EXPORT_API int autofill_save_item_set_autofill_hint(autofill_save_item_h it, autofill_hint_e hints) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } it->autofill_hint = hints; @@ -142,8 +150,10 @@ EXPORT_API int autofill_save_item_set_autofill_hint(autofill_save_item_h it, aut EXPORT_API int autofill_save_item_get_autofill_hint(autofill_save_item_h it, autofill_hint_e *hints) { - if (!it || !hints) + if (!it || !hints) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } *hints = it->autofill_hint; @@ -152,8 +162,10 @@ EXPORT_API int autofill_save_item_get_autofill_hint(autofill_save_item_h it, aut EXPORT_API int autofill_save_item_set_id(autofill_save_item_h it, const char *id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->id) { free(it->id); @@ -166,10 +178,13 @@ EXPORT_API int autofill_save_item_set_id(autofill_save_item_h it, const char *id EXPORT_API int autofill_save_item_get_id(autofill_save_item_h it, char **id) { - if (!it || !id) + if (!it || !id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (!it->id) { + LOGW("[ERROR] Failed to get id"); return AUTOFILL_ERROR_OPERATION_FAILED; } @@ -180,8 +195,10 @@ EXPORT_API int autofill_save_item_get_id(autofill_save_item_h it, char **id) EXPORT_API int autofill_save_item_set_label(autofill_save_item_h it, const char *label) { - if (!it || !label) + if (!it || !label) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (it->label) { free(it->label); @@ -194,10 +211,13 @@ EXPORT_API int autofill_save_item_set_label(autofill_save_item_h it, const char EXPORT_API int autofill_save_item_get_label(autofill_save_item_h it, char **label) { - if (!it || !label) + if (!it || !label) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (!it->label) { + LOGW("[ERROR] Failed to get label"); return AUTOFILL_ERROR_OPERATION_FAILED; } @@ -208,8 +228,10 @@ EXPORT_API int autofill_save_item_get_label(autofill_save_item_h it, char **labe EXPORT_API int autofill_save_item_set_sensitive_data(autofill_save_item_h it, bool sensitive) { - if (!it) + if (!it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } it->is_sensitive_data = sensitive; @@ -252,6 +274,7 @@ EXPORT_API int autofill_save_item_get_value(autofill_save_item_h it, char **valu } if (!it->value) { + LOGW("[ERROR] Failed to get value"); return AUTOFILL_ERROR_OPERATION_FAILED; } diff --git a/common/autofill_save_view_info.c b/common/autofill_save_view_info.c index 2fadfee..bb42761 100644 --- a/common/autofill_save_view_info.c +++ b/common/autofill_save_view_info.c @@ -31,12 +31,16 @@ EXPORT_API int autofill_save_view_info_create(autofill_save_view_info_h *vi) { - if (!vi) + if (!vi) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } struct autofill_save_view_info_s *vs = (struct autofill_save_view_info_s *)calloc(1, sizeof(struct autofill_save_view_info_s)); - if (!vs) + if (!vs) { + LOGW("[ERROR] Out of memory"); return AUTOFILL_ERROR_OUT_OF_MEMORY; + } *vi = (autofill_save_view_info_h)vs; @@ -45,8 +49,10 @@ EXPORT_API int autofill_save_view_info_create(autofill_save_view_info_h *vi) EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi) { - if (!vi) + if (!vi) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->app_id) { free(vi->app_id); @@ -76,8 +82,10 @@ EXPORT_API int autofill_save_view_info_destroy(autofill_save_view_info_h vi) // Set app id EXPORT_API int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, const char *app_id) { - if (!vi || !app_id) + if (!vi || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->app_id) free(vi->app_id); @@ -89,11 +97,15 @@ EXPORT_API int autofill_save_view_info_set_app_id(autofill_save_view_info_h vi, EXPORT_API int autofill_save_view_info_get_app_id(autofill_save_view_info_h vi, char **app_id) { - if (!vi || !app_id) + if (!vi || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!vi->app_id) + if (!vi->app_id) { + LOGW("[ERROR] Operation failed"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *app_id = strdup(vi->app_id); @@ -102,8 +114,10 @@ EXPORT_API int autofill_save_view_info_get_app_id(autofill_save_view_info_h vi, EXPORT_API int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, const char *view_id) { - if (!vi || !view_id) + if (!vi || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->view_id) free(vi->view_id); @@ -115,11 +129,15 @@ EXPORT_API int autofill_save_view_info_set_view_id(autofill_save_view_info_h vi, EXPORT_API int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, char **view_id) { - if (!vi || !view_id) + if (!vi || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!vi->view_id) + if (!vi->view_id) { + LOGW("[ERROR] Failed to get view id"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *view_id = strdup(vi->view_id); @@ -128,8 +146,10 @@ EXPORT_API int autofill_save_view_info_get_view_id(autofill_save_view_info_h vi, EXPORT_API int autofill_save_view_info_set_view_title(autofill_save_view_info_h vi, const char *view_title) { - if (!vi || !view_title) + if (!vi || !view_title) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->view_title) free(vi->view_title); @@ -141,11 +161,15 @@ EXPORT_API int autofill_save_view_info_set_view_title(autofill_save_view_info_h EXPORT_API int autofill_save_view_info_get_view_title(autofill_save_view_info_h vi, char **view_title) { - if (!vi || !view_title) + if (!vi || !view_title) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!vi->view_title) + if (!vi->view_title) { + LOGW("[ERROR] Failed to get view title"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *view_title = strdup(vi->view_title); @@ -154,8 +178,10 @@ EXPORT_API int autofill_save_view_info_get_view_title(autofill_save_view_info_h EXPORT_API int autofill_save_view_info_add_item(autofill_save_view_info_h vi, autofill_save_item_h it) { - if (!vi || !it) + if (!vi || !it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_save_item_h clone = NULL; @@ -174,6 +200,7 @@ EXPORT_API int autofill_save_view_info_foreach_item(autofill_save_view_info_h vi autofill_save_item_cb callback, void *user_data) { if (!vi || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } diff --git a/common/autofill_view_info.c b/common/autofill_view_info.c index 9e5a461..c6bf3a2 100644 --- a/common/autofill_view_info.c +++ b/common/autofill_view_info.c @@ -78,8 +78,10 @@ EXPORT_API int autofill_view_info_destroy(autofill_view_info_h vi) EXPORT_API int autofill_view_info_set_app_id(autofill_view_info_h vi, const char *app_id) { - if (!vi || !app_id) + if (!vi || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->app_id) free(vi->app_id); @@ -91,11 +93,15 @@ EXPORT_API int autofill_view_info_set_app_id(autofill_view_info_h vi, const char EXPORT_API int autofill_view_info_get_app_id(autofill_view_info_h vi, char **app_id) { - if (!vi || !app_id) + if (!vi || !app_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!vi->app_id) + if (!vi->app_id) { + LOGW("[ERROR] Failed to get app id"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *app_id = strdup(vi->app_id); @@ -104,8 +110,10 @@ EXPORT_API int autofill_view_info_get_app_id(autofill_view_info_h vi, char **app EXPORT_API int autofill_view_info_set_view_id(autofill_view_info_h vi, const char *view_id) { - if (!vi || !view_id) + if (!vi || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } if (vi->view_id) free(vi->view_id); @@ -117,11 +125,15 @@ EXPORT_API int autofill_view_info_set_view_id(autofill_view_info_h vi, const cha EXPORT_API int autofill_view_info_get_view_id(autofill_view_info_h vi, char **view_id) { - if (!vi || !view_id) + if (!vi || !view_id) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } - if (!vi->view_id) + if (!vi->view_id) { + LOGW("[ERROR] Failed to get view id"); return AUTOFILL_ERROR_OPERATION_FAILED; + } *view_id = strdup(vi->view_id); @@ -130,8 +142,10 @@ EXPORT_API int autofill_view_info_get_view_id(autofill_view_info_h vi, char **vi EXPORT_API int autofill_view_info_add_item(autofill_view_info_h vi, autofill_item_h it) { - if (!vi || !it) + if (!vi || !it) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } autofill_item_h clone = NULL; @@ -150,6 +164,7 @@ EXPORT_API int autofill_view_info_foreach_item(autofill_view_info_h vi, autofill_item_cb callback, void *user_data) { if (!vi || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; }