Fixed return of rdp_client_transition_to_state

Use BOOL to just indicate success/failure and actually check return
of functions called.
This commit is contained in:
Armin Novak 2022-11-08 11:54:03 +01:00 committed by Martin Fleisz
parent 71c3f8e4bb
commit 8210ee77db
3 changed files with 11 additions and 10 deletions

View File

@ -630,8 +630,8 @@ BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
} while (0);
}
return rdp_client_transition_to_state(
rdp, CONNECTION_STATE_CAPABILITIES_EXCHANGE_DEMAND_ACTIVE) == 0;
return rdp_client_transition_to_state(rdp,
CONNECTION_STATE_CAPABILITIES_EXCHANGE_DEMAND_ACTIVE);
}
BOOL rdp_send_deactivate_all(rdpRdp* rdp)

View File

@ -1223,13 +1223,13 @@ int rdp_client_connect_finalize(rdpRdp* rdp)
return 0;
}
int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
BOOL rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
{
int status = 0;
const char* name = rdp_state_string(state);
WLog_DBG(TAG, "%s %s --> %s", __FUNCTION__, rdp_get_state_string(rdp), name);
rdp_set_state(rdp, state);
if (!rdp_set_state(rdp, state))
return FALSE;
switch (state)
{
@ -1239,12 +1239,13 @@ int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
case CONNECTION_STATE_FINALIZATION_PERSISTENT_KEY_LIST:
case CONNECTION_STATE_FINALIZATION_FONT_LIST:
update_reset_state(rdp->update);
rdp_finalize_reset_flags(rdp, FALSE);
if (!rdp_finalize_reset_flags(rdp, FALSE))
return FALSE;
break;
case CONNECTION_STATE_ACTIVE:
{
ActivatedEventArgs activatedEvent;
ActivatedEventArgs activatedEvent = { 0 };
rdpContext* context = rdp->context;
EventArgsInit(&activatedEvent, "libfreerdp");
activatedEvent.firstActivation =
@ -1259,7 +1260,7 @@ int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
}
{
ConnectionStateChangeEventArgs stateEvent;
ConnectionStateChangeEventArgs stateEvent = { 0 };
rdpContext* context = rdp->context;
EventArgsInit(&stateEvent, "libfreerdp");
stateEvent.state = rdp_get_state(rdp);
@ -1267,7 +1268,7 @@ int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
PubSub_OnConnectionStateChange(rdp->pubSub, context, &stateEvent);
}
return status;
return TRUE;
}
BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s)

View File

@ -47,7 +47,7 @@ FREERDP_LOCAL BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL int rdp_client_connect_license(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL int rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL int rdp_client_connect_confirm_active(rdpRdp* rdp, wStream* s);
FREERDP_LOCAL int rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state);
FREERDP_LOCAL BOOL rdp_client_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state);
FREERDP_LOCAL CONNECTION_STATE rdp_get_state(const rdpRdp* rdp);
FREERDP_LOCAL const char* rdp_state_string(CONNECTION_STATE state);