[ofono-binder] Fix compilation issues
src/binder_voicecall.c: In function 'binder_voicecall_list_find_call_with_id':
src/binder_voicecall.c:377:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (GSList* l = list; l; l = l->next) {
     ^
src/binder_voicecall.c: In function 'binder_voicecall_merge_call_lists':
src/binder_voicecall.c:403:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
     for (GSList* l = self->calls; l; l = l->next) {
     ^
src/binder_voicecall.c: In function 'binder_voicecall_call_state_changed_event':
src/binder_voicecall.c:1386:13: warning: unused variable 'ind_code' [-Wunused-variable]
     guint32 ind_code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
             ^
			
			
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 *  oFono - Open Source Telephony - binder based adaptation
 | 
					 *  oFono - Open Source Telephony - binder based adaptation
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
					 *  Copyright (C) 2024 Slava Monich <slava@monich.com>
 | 
				
			||||||
 *  Copyright (C) 2021-2022 Jolla Ltd.
 | 
					 *  Copyright (C) 2021-2022 Jolla Ltd.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *  This program is free software; you can redistribute it and/or modify
 | 
					 *  This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
@@ -369,16 +370,22 @@ binder_voicecall_info_ext_new(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
const BinderVoiceCallInfo*
 | 
					GSList*
 | 
				
			||||||
binder_voicecall_list_find_call_with_id(
 | 
					binder_voicecall_list_find_call_link_with_id(
 | 
				
			||||||
    GSList* list,
 | 
					    GSList* list,
 | 
				
			||||||
    guint call_id)
 | 
					    guint call_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    for (GSList* l = list; l; l = l->next) {
 | 
					    GSList* l;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * Normally, the list is either empty or very short, there's
 | 
				
			||||||
 | 
					     * nothing to optimize.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    for (l = list; l; l = l->next) {
 | 
				
			||||||
        const BinderVoiceCallInfo* call = l->data;
 | 
					        const BinderVoiceCallInfo* call = l->data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (call->oc.id == call_id) {
 | 
					        if (call->oc.id == call_id) {
 | 
				
			||||||
            return call;
 | 
					            return l;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
@@ -386,34 +393,30 @@ binder_voicecall_list_find_call_with_id(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
GSList*
 | 
					GSList*
 | 
				
			||||||
binder_voicecall_merge_call_lists(
 | 
					binder_voicecall_merge_ext_calls(
 | 
				
			||||||
    BinderVoiceCall* self,
 | 
					    BinderVoiceCall* self,
 | 
				
			||||||
    GSList* new_list,
 | 
					    GSList* list,
 | 
				
			||||||
    gboolean add_ext)
 | 
					    gboolean keep_ext)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    GSList* l;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Since IRadio and ext may have different lists of calls,
 | 
					     * Since IRadio and ext may have different lists of calls,
 | 
				
			||||||
     * attempt to merge the ongoing calls initiated by the other
 | 
					     * merge the ongoing calls initiated by the other component
 | 
				
			||||||
     * component before current calls list is going to
 | 
					     * before the current list of calls is going to be replaced
 | 
				
			||||||
     * be replaced by the new list.
 | 
					     * with the new list.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    if (!self->ext)
 | 
					    for (l = self->calls; l; l = l->next) {
 | 
				
			||||||
        return new_list;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (GSList* l = self->calls; l; l = l->next) {
 | 
					 | 
				
			||||||
        const BinderVoiceCallInfo* call = l->data;
 | 
					        const BinderVoiceCallInfo* call = l->data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!!call->ext == add_ext) {
 | 
					        if (!!call->ext == keep_ext &&
 | 
				
			||||||
            if (binder_voicecall_list_find_call_with_id(new_list, call->oc.id))
 | 
					            !binder_voicecall_list_find_call_link_with_id(list, call->oc.id)) {
 | 
				
			||||||
                continue;
 | 
					            list = g_slist_insert_sorted(list,
 | 
				
			||||||
 | 
					 | 
				
			||||||
            new_list = g_slist_insert_sorted(new_list,
 | 
					 | 
				
			||||||
                g_slice_dup(BinderVoiceCallInfo, call),
 | 
					                g_slice_dup(BinderVoiceCallInfo, call),
 | 
				
			||||||
                binder_voicecall_info_compare);
 | 
					                binder_voicecall_info_compare);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    return list;
 | 
				
			||||||
    return new_list;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
@@ -463,20 +466,7 @@ binder_voicecall_find_call_link_with_id(
 | 
				
			|||||||
    BinderVoiceCall* self,
 | 
					    BinderVoiceCall* self,
 | 
				
			||||||
    guint call_id)
 | 
					    guint call_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GSList* l;
 | 
					    return binder_voicecall_list_find_call_link_with_id(self->calls, call_id);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
     * Normally, the list is either empty or very short, there's
 | 
					 | 
				
			||||||
     * nothing to optimize.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    for (l = self->calls; l; l = l->next) {
 | 
					 | 
				
			||||||
        const BinderVoiceCallInfo* call = l->data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (call->oc.id == call_id) {
 | 
					 | 
				
			||||||
            return l;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
@@ -799,9 +789,8 @@ binder_voicecall_clcc_poll_cb(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Merge the ongoing ext calls since IRadio may not report them */
 | 
					    /* Merge the ongoing ext calls since IRadio may not report them */
 | 
				
			||||||
    list = binder_voicecall_merge_call_lists(self, list, TRUE /*add_ext*/);
 | 
					    binder_voicecall_set_calls(self,
 | 
				
			||||||
 | 
					        binder_voicecall_merge_ext_calls(self, list, TRUE));
 | 
				
			||||||
    binder_voicecall_set_calls(self, list);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
@@ -1380,16 +1369,10 @@ binder_voicecall_call_state_changed_event(
 | 
				
			|||||||
    RadioClient* client,
 | 
					    RadioClient* client,
 | 
				
			||||||
    RADIO_IND code,
 | 
					    RADIO_IND code,
 | 
				
			||||||
    const GBinderReader* args,
 | 
					    const GBinderReader* args,
 | 
				
			||||||
    gpointer user_data)
 | 
					    gpointer self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    BinderVoiceCall* self = user_data;
 | 
					 | 
				
			||||||
    guint32 ind_code = self->interface_aidl == RADIO_VOICE_INTERFACE ?
 | 
					 | 
				
			||||||
        RADIO_VOICE_IND_CALL_STATE_CHANGED : RADIO_IND_CALL_STATE_CHANGED;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    GASSERT(code == ind_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Just need to request the call list again */
 | 
					    /* Just need to request the call list again */
 | 
				
			||||||
    binder_voicecall_clcc_poll(self);
 | 
					    binder_voicecall_clcc_poll((BinderVoiceCall*) self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
@@ -2099,9 +2082,8 @@ binder_voicecall_ext_calls_changed(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Merge the IRadio calls back into the list */
 | 
					    /* Merge the IRadio calls back into the list */
 | 
				
			||||||
    list = binder_voicecall_merge_call_lists(self, list, FALSE /*add_ext*/);
 | 
					    binder_voicecall_set_calls(self,
 | 
				
			||||||
 | 
					        binder_voicecall_merge_ext_calls(self, list, FALSE));
 | 
				
			||||||
    binder_voicecall_set_calls(self, list);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user