From 202fe6cbb652e3296df1ee435debd926e60b6c8a Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 18 Feb 2024 10:40:33 +0100 Subject: [PATCH] change intern methods handler without cast --- src/kds_s2000w_handler.c | 12 ++++-------- src/kds_s2000w_handler_opts.c | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index 4eb6680..e4718af 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -25,10 +25,9 @@ typedef struct { scan_status current_scan_status; -void _get_current_metadata(void* handle) +void _get_current_metadata(handler* h) { debug_printf(ALL, "get_current_metadata"); - handler* h = (handler*) handle; resp = kds_s2000w_client_response_init(); kds_s2000w_client_get_metadata(h->sessionid, current_scan_status.current_image_number, resp); if (resp->code != 200) { @@ -110,10 +109,9 @@ void _get_current_metadata(void* handle) sleep(1); } -void _delete_current_image(void* handle) +void _delete_current_image(handler* h) { debug_printf(ALL, "delete_current_image"); - handler* h = (handler*) handle; resp = kds_s2000w_client_response_init(); kds_s2000w_client_delete_image(h->sessionid, current_scan_status.current_image_number, resp); kds_s2000w_client_response_free(resp); @@ -121,10 +119,9 @@ void _delete_current_image(void* handle) sleep(1); } -void _download_current_image(void* handle) +void _download_current_image(handler* h) { debug_printf(ALL, "download_current_image"); - handler* h = (handler*) handle; if (image.size > 0) { free(image.data); image.data = NULL; @@ -141,10 +138,9 @@ void _download_current_image(void* handle) sleep(1); } -void _get_current_scan_status(void* handle) +void _get_current_scan_status(handler* h) { debug_printf(ALL, "get_current_scan_status"); - handler* h = (handler*) handle; json_object* status_resp_obj = NULL; json_object* status_obj = NULL; json_object* status_value_obj = NULL; diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 2c71e58..6c056d6 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -35,9 +35,8 @@ void _write_int_value_to_json(json_object* value_object, void* value) json_object_set_int(value_object, *int_value_ptr); } -void _load_options(void* handle) +void _load_options(handler* h) { - handler* h = (handler*) handle; json_object_put(resp_config); resp_config = NULL; -- 2.39.5