From 4ec241a697217c5f14f80f361a055d5ae1a967f9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Oct 2018 16:05:35 +0900 Subject: [PATCH] Rename handle variable name in sample code Change-Id: I1fc7d930d60ab1e41e03eb16fba08259ccb01397 Signed-off-by: Jihoon Kim --- service/service_main.c | 106 ++++++++++++++++++++++++----------------------- test/ecore_imf_example.c | 50 +++++++++++----------- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/service/service_main.c b/service/service_main.c index 416075b..5ce3a55 100644 --- a/service/service_main.c +++ b/service/service_main.c @@ -61,7 +61,7 @@ static bool __view_info_item_cb(autofill_item_h items, void *user_data) return true; } -static bool __save_item_cb(autofill_save_item_h items, void *user_data) +static bool __save_item_cb(autofill_save_item_h it_h, void *user_data) { char *id = NULL; char *label = NULL; @@ -69,45 +69,45 @@ static bool __save_item_cb(autofill_save_item_h items, void *user_data) autofill_hint_e autofill_hint; bool sensitive_data; - autofill_save_item_get_id(items, &id); + autofill_save_item_get_id(it_h, &id); if (id) { LOGD("id : %s", id); free(id); } - autofill_save_item_get_label(items, &label); + autofill_save_item_get_label(it_h, &label); if (label) { LOGD("label : %s", label); free(label); } - autofill_save_item_get_value(items, &value); + autofill_save_item_get_value(it_h, &value); if (value) { LOGD("value : %s", value); free(value); } - autofill_save_item_get_autofill_hint(items, &autofill_hint); + autofill_save_item_get_autofill_hint(it_h, &autofill_hint); LOGD("autofill hint : %d", autofill_hint); - autofill_save_item_get_sensitive_data(items, &sensitive_data); + autofill_save_item_get_sensitive_data(it_h, &sensitive_data); LOGD("sensitive data : %d", sensitive_data); return true; } -static void _auth_info_request_cb(autofill_view_info_h vi, void *user_data) +static void _auth_info_request_cb(autofill_view_info_h vi_h, void *user_data) { LOGD(""); char *view_id = NULL; char *app_id = NULL; - autofill_view_info_get_app_id(vi, &app_id); - autofill_view_info_get_view_id(vi, &view_id); + autofill_view_info_get_app_id(vi_h, &app_id); + autofill_view_info_get_view_id(vi_h, &view_id); LOGD("app_id : %s, view id : %s", app_id, view_id); - autofill_view_info_foreach_items(vi, __view_info_item_cb, NULL); + autofill_view_info_foreach_items(vi_h, __view_info_item_cb, NULL); if (view_id) free(view_id); @@ -132,19 +132,19 @@ static void _auth_info_request_cb(autofill_view_info_h vi, void *user_data) autofill_auth_info_destroy(auth_info); } -static void _fill_request_cb(autofill_view_info_h vi, void *user_data) +static void _fill_request_cb(autofill_view_info_h vi_h, void *user_data) { char *app_id = NULL; char *view_id = NULL; - autofill_view_info_get_app_id(vi, &app_id); - autofill_view_info_get_view_id(vi, &view_id); + autofill_view_info_get_app_id(vi_h, &app_id); + autofill_view_info_get_view_id(vi_h, &view_id); LOGD("app id : %s, view id : %s", app_id, view_id); - autofill_fill_response_h fill_response; - autofill_fill_response_create(&fill_response); - autofill_fill_response_set_app_id(fill_response, app_id); - autofill_fill_response_set_view_id(fill_response, view_id); + autofill_fill_response_h fill_response_h; + autofill_fill_response_create(&fill_response_h); + autofill_fill_response_set_app_id(fill_response_h, app_id); + autofill_fill_response_set_view_id(fill_response_h, view_id); if (app_id) free(app_id); @@ -153,31 +153,34 @@ static void _fill_request_cb(autofill_view_info_h vi, void *user_data) free(view_id); autofill_fill_response_group_h res_group_h[2]; - autofill_fill_response_item_h ritem_h[2]; + autofill_fill_response_item_h res_it_h[2]; /* group 1 */ autofill_fill_response_group_create(&res_group_h[0]); /* item 1 */ - autofill_fill_response_item_create(&ritem_h[0]); - autofill_fill_response_item_set_id(ritem_h[0], "id"); - autofill_fill_response_item_set_presentation_text(ritem_h[0], "Input ID"); - autofill_fill_response_item_set_value(ritem_h[0], "tester1"); + autofill_fill_response_item_create(&res_it_h[0]); + autofill_fill_response_item_set_id(res_it_h[0], "id"); + autofill_fill_response_item_set_presentation_text(res_it_h[0], "Input ID"); + autofill_fill_response_item_set_value(res_it_h[0], "tester1"); - autofill_fill_response_group_add_item(res_group_h[0], ritem_h[0]); + /* Add item 1 in group 1 */ + autofill_fill_response_group_add_item(res_group_h[0], res_it_h[0]); /* item 2 */ - autofill_fill_response_item_create(&ritem_h[1]); - autofill_fill_response_item_set_id(ritem_h[1], "password"); - autofill_fill_response_item_set_presentation_text(ritem_h[1], "Input Password"); - autofill_fill_response_item_set_value(ritem_h[1], "testerpw1"); + autofill_fill_response_item_create(&res_it_h[1]); + autofill_fill_response_item_set_id(res_it_h[1], "password"); + autofill_fill_response_item_set_presentation_text(res_it_h[1], "Input Password"); + autofill_fill_response_item_set_value(res_it_h[1], "testerpw1"); - autofill_fill_response_group_add_item(res_group_h[0], ritem_h[1]); + /* Add item 2 in group 1 */ + autofill_fill_response_group_add_item(res_group_h[0], res_it_h[1]); - autofill_fill_response_item_destroy(ritem_h[0]); - autofill_fill_response_item_destroy(ritem_h[1]); + autofill_fill_response_item_destroy(res_it_h[0]); + autofill_fill_response_item_destroy(res_it_h[1]); - autofill_fill_response_add_group(fill_response, res_group_h[0]); + /* Add group 1 in fill response */ + autofill_fill_response_add_group(fill_response_h, res_group_h[0]); autofill_fill_response_group_destroy(res_group_h[0]); @@ -185,41 +188,43 @@ static void _fill_request_cb(autofill_view_info_h vi, void *user_data) autofill_fill_response_group_create(&res_group_h[1]); /* item 1 */ - autofill_fill_response_item_create(&ritem_h[0]); - autofill_fill_response_item_set_id(ritem_h[0], "id"); - autofill_fill_response_item_set_presentation_text(ritem_h[0], "Input ID"); - autofill_fill_response_item_set_value(ritem_h[0], "tester2"); + autofill_fill_response_item_create(&res_it_h[0]); + autofill_fill_response_item_set_id(res_it_h[0], "id"); + autofill_fill_response_item_set_presentation_text(res_it_h[0], "Input ID"); + autofill_fill_response_item_set_value(res_it_h[0], "tester2"); - autofill_fill_response_group_add_item(res_group_h[0], ritem_h[0]); + /* Add item 1 in group 2 */ + autofill_fill_response_group_add_item(res_group_h[0], res_it_h[0]); /* item 2 */ - autofill_fill_response_item_create(&ritem_h[1]); - autofill_fill_response_item_set_id(ritem_h[1], "password"); - autofill_fill_response_item_set_presentation_text(ritem_h[1], "Input Password"); - autofill_fill_response_item_set_value(ritem_h[1], "testerpw2"); + autofill_fill_response_item_create(&res_it_h[1]); + autofill_fill_response_item_set_id(res_it_h[1], "password"); + autofill_fill_response_item_set_presentation_text(res_it_h[1], "Input Password"); + autofill_fill_response_item_set_value(res_it_h[1], "testerpw2"); - autofill_fill_response_group_add_item(res_group_h[0], ritem_h[1]); + /* Add item 2 in group 2 */ + autofill_fill_response_group_add_item(res_group_h[0], res_it_h[1]); - autofill_fill_response_item_destroy(ritem_h[0]); - autofill_fill_response_item_destroy(ritem_h[1]); + autofill_fill_response_item_destroy(res_it_h[0]); + autofill_fill_response_item_destroy(res_it_h[1]); - autofill_fill_response_add_group(fill_response, res_group_h[1]); + autofill_fill_response_add_group(fill_response_h, res_group_h[1]); autofill_fill_response_group_destroy(res_group_h[1]); /* Send fill response */ - autofill_service_send_fill_response(fill_response); + autofill_service_send_fill_response(fill_response_h); - autofill_fill_response_destroy(fill_response); + autofill_fill_response_destroy(fill_response_h); } -static void _commit_cb(autofill_save_view_info_h vi, void *user_data) +static void _commit_cb(autofill_save_view_info_h vi_h, void *user_data) { - char *view_id; - autofill_save_view_info_get_view_id(vi, &view_id); + char *view_id = NULL; + autofill_save_view_info_get_view_id(vi_h, &view_id); LOGD("view id : %s", view_id); - autofill_save_view_info_foreach_items(vi, __save_item_cb, NULL); + autofill_save_view_info_foreach_items(vi_h, __save_item_cb, NULL); if (view_id) free(view_id); @@ -302,4 +307,3 @@ int main(int argc, char *argv[]) return service_app_main(argc, argv, &event_callback, ad); } - diff --git a/test/ecore_imf_example.c b/test/ecore_imf_example.c index 14ae53f..75e78b7 100644 --- a/test/ecore_imf_example.c +++ b/test/ecore_imf_example.c @@ -43,7 +43,7 @@ struct _Entry static Entry en1, en2; -static autofill_view_info_h autofill_view_info = NULL; +static autofill_view_info_h g_vi_h = NULL; static void _imf_cursor_info_set(Entry *en); @@ -189,7 +189,7 @@ _autofill_fill_response_cb(autofill_fill_response_h fill_response, void *data) } static void -_autofill_auth_info_cb(autofill_auth_info_h auth_info, void *data) +_autofill_auth_info_cb(autofill_auth_info_h auth_info_h, void *data) { bool exist_autofill_data; bool need_authentication; @@ -197,12 +197,12 @@ _autofill_auth_info_cb(autofill_auth_info_h auth_info, void *data) char *service_message = NULL; char *service_logo_image_path = NULL; - autofill_auth_info_get_exist_autofill_data(auth_info, &exist_autofill_data); - autofill_auth_info_get_need_authentication(auth_info, &need_authentication); + autofill_auth_info_get_exist_autofill_data(auth_info_h, &exist_autofill_data); + autofill_auth_info_get_need_authentication(auth_info_h, &need_authentication); - autofill_auth_info_get_service_name(auth_info, &service_name); - autofill_auth_info_get_service_message(auth_info, &service_message); - autofill_auth_info_get_service_logo_image_path(auth_info, &service_logo_image_path); + autofill_auth_info_get_service_name(auth_info_h, &service_name); + autofill_auth_info_get_service_message(auth_info_h, &service_message); + autofill_auth_info_get_service_logo_image_path(auth_info_h, &service_logo_image_path); LOGD("exist : %d, need_auth : %d, service name : %s, logo path : %s, message : '%s'", exist_autofill_data, need_authentication, service_name, service_logo_image_path, service_message); @@ -227,7 +227,7 @@ _autofill_auth_info_cb(autofill_auth_info_h auth_info, void *data) LOGD("Send fill request"); autofill_fill_response_set_callback(_autofill_fill_response_cb, NULL); - int ret = autofill_fill_request(autofill_view_info); + int ret = autofill_fill_request(g_vi_h); if (ret == AUTOFILL_ERROR_NONE) LOGD("Succeeded to request fill"); else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) @@ -241,7 +241,7 @@ _request_autofill_auth_info() { int ret; autofill_auth_info_set_callback(_autofill_auth_info_cb, NULL); - ret = autofill_auth_info_request(autofill_view_info); + ret = autofill_auth_info_request(g_vi_h); if (ret == AUTOFILL_ERROR_NONE) LOGD("Succeeded to request auth info"); else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) @@ -256,23 +256,23 @@ _save_autofill_info() int ret; char *app_id; app_get_id(&app_id); - autofill_save_view_info_h autofill_save_view_info = NULL; + autofill_save_view_info_h svi_h = NULL; autofill_save_item_set_value(en1.si_h, "save data 1"); autofill_save_item_set_value(en2.si_h, "save data 2"); // create autofill view info - autofill_save_view_info_create(&autofill_save_view_info); - autofill_save_view_info_set_app_id(autofill_save_view_info, app_id); - autofill_save_view_info_set_view_id(autofill_save_view_info, "login"); + autofill_save_view_info_create(&svi_h); + autofill_save_view_info_set_app_id(svi_h, app_id); + autofill_save_view_info_set_view_id(svi_h, "login"); - autofill_save_view_info_add_item(autofill_save_view_info, en1.si_h); - autofill_save_view_info_add_item(autofill_save_view_info, en2.si_h); + autofill_save_view_info_add_item(svi_h, en1.si_h); + autofill_save_view_info_add_item(svi_h, en2.si_h); if (app_id) free(app_id); - ret = autofill_commit(autofill_save_view_info); + ret = autofill_commit(svi_h); if (ret == AUTOFILL_ERROR_NONE) LOGD("Succeeded to request auth info"); else if (ret == AUTOFILL_ERROR_PERMISSION_DENIED) @@ -280,7 +280,7 @@ _save_autofill_info() else LOGW("Failed to request auth info. error : %d", ret); - autofill_save_view_info_destroy(autofill_save_view_info); + autofill_save_view_info_destroy(svi_h); } static void @@ -891,11 +891,11 @@ main(void) app_get_id(&app_id); // create autofill view info - autofill_view_info_create(&autofill_view_info); - autofill_view_info_set_app_id(autofill_view_info, app_id); - autofill_view_info_set_view_id(autofill_view_info, "login"); - autofill_view_info_add_item(autofill_view_info, en1.ai_h); - autofill_view_info_add_item(autofill_view_info, en2.ai_h); + autofill_view_info_create(&g_vi_h); + autofill_view_info_set_app_id(g_vi_h, app_id); + autofill_view_info_set_view_id(g_vi_h, "login"); + autofill_view_info_add_item(g_vi_h, en1.ai_h); + autofill_view_info_add_item(g_vi_h, en2.ai_h); if (app_id) free(app_id); @@ -908,9 +908,9 @@ main(void) delete_input_field(&en1); // delete input field 1 delete_input_field(&en2); // delete input field 2 - if (autofill_view_info) { - autofill_view_info_destroy(autofill_view_info); - autofill_view_info = NULL; + if (g_vi_h) { + autofill_view_info_destroy(g_vi_h); + g_vi_h = NULL; } evas_event_callback_del_full(evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL); -- 2.7.4