From c413645fff5380c4f84ef6f7304c1347a2bbad68 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 28 Oct 2024 03:02:56 +0200 Subject: [PATCH] [ofono-binder] Fix compilation errors src/binder_plugin.c: In function 'binder_logger_dump_update_slot': src/binder_plugin.c:471:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { ^ src/binder_plugin.c:471:5: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code src/binder_plugin.c: In function 'binder_logger_trace_update_slot': src/binder_plugin.c:489:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { ^ src/binder_plugin.c: In function 'binder_plugin_is_slot_client_connected': src/binder_plugin.c:533:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { ^ src/binder_plugin.c: In function 'binder_plugin_slot_shutdown': src/binder_plugin.c:608:13: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { ^ src/binder_plugin.c: In function 'binder_plugin_slot_enabled_changed': src/binder_plugin.c:787:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { ^ make: *** [Makefile:204: build/release/binder_plugin.o] Error 1 --- src/binder_plugin.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/binder_plugin.c b/src/binder_plugin.c index c7076bc..2cf65b4 100644 --- a/src/binder_plugin.c +++ b/src/binder_plugin.c @@ -468,7 +468,9 @@ void binder_logger_dump_update_slot( BinderSlot* slot) { - for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { + RADIO_AIDL_INTERFACE i; + + for (i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { if (binder_logger_dump.flags & OFONO_DEBUG_FLAG_PRINT) { if (!slot->log_dump[i] && slot->instance[i]) { slot->log_dump[i] = binder_logger_new_radio_dump(slot->instance[i], @@ -486,7 +488,9 @@ void binder_logger_trace_update_slot( BinderSlot* slot) { - for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { + RADIO_AIDL_INTERFACE i; + + for (i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { if (binder_logger_trace.flags & OFONO_DEBUG_FLAG_PRINT) { if (!slot->log_trace[i] && slot->instance[i]) { slot->log_trace[i] = binder_logger_new_radio_trace(slot->instance[i], @@ -530,7 +534,9 @@ gboolean binder_plugin_is_slot_client_connected( BinderSlot* slot) { - for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { + RADIO_AIDL_INTERFACE i; + + for (i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { if (slot->client[i]) return TRUE; } return FALSE; @@ -600,12 +606,14 @@ binder_plugin_slot_shutdown( } if (binder_plugin_is_slot_client_connected(slot)) { + RADIO_AIDL_INTERFACE i; + radio_request_drop(slot->caps_check_req); radio_request_drop(slot->imei_req); slot->caps_check_req = NULL; slot->imei_req = NULL; - for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { + for (i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { if (!slot->client[i]) continue; @@ -783,8 +791,9 @@ binder_plugin_slot_enabled_changed( void* user_data) { BinderSlot* slot = user_data; + RADIO_AIDL_INTERFACE i; - for (RADIO_AIDL_INTERFACE i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { + for (i = 0; i < RADIO_AIDL_INTERFACE_COUNT; i++) { if (!slot->instance[i]) continue; if (ofono_slot->enabled) {