[warnings] fix -Wswitch-default

This commit is contained in:
akallabeth 2024-10-30 19:56:36 +01:00
parent 63121583eb
commit dcf5a8e28c
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
52 changed files with 164 additions and 5 deletions

View File

@ -967,6 +967,8 @@ static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam,
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && cliprdr && cliprdr->context->rdpcontext)
@ -1086,7 +1088,8 @@ static VOID VCAPITYPE cliprdr_virtual_channel_init_event_ex(LPVOID lpUserParam,
WLog_ERR(TAG,
"cliprdr_virtual_channel_event_terminated failed with error %" PRIu32 "!",
error);
break;
default:
break;
}

View File

@ -509,6 +509,8 @@ static UINT dvcman_channel_close(DVCMAN_CHANNEL* channel, BOOL perRequest, BOOL
break;
case DVC_CHANNEL_CLOSED:
break;
default:
break;
}
return error;
@ -1543,6 +1545,8 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && drdynvc && drdynvc->rdpcontext)

View File

@ -1026,6 +1026,8 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam,
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && encomsp && encomsp->rdpcontext)

View File

@ -356,6 +356,8 @@ static UINT location_server_context_poll_int(LocationServerContext* context)
case LOCATION_OPENED:
error = location_process_message(location);
break;
default:
break;
}
return error;
@ -423,6 +425,8 @@ static DWORD WINAPI location_server_thread_func(LPVOID arg)
break;
}
break;
default:
break;
}
}

View File

@ -554,6 +554,8 @@ static VOID VCAPITYPE rail_virtual_channel_open_event_ex(LPVOID lpUserParam, DWO
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && rail && rail->rdpcontext)

View File

@ -249,6 +249,8 @@ static void VCAPITYPE VirtualChannelOpenEventEx(LPVOID lpUserParam, DWORD openHa
(void)SetEvent(plugin->writeComplete);
free(pData);
break;
default:
break;
}
}
@ -312,6 +314,8 @@ static VOID VCAPITYPE VirtualChannelInitEventEx(LPVOID lpUserParam, LPVOID pInit
case CHANNEL_EVENT_TERMINATED:
channel_terminated(plugin);
break;
default:
break;
}
}

View File

@ -2029,6 +2029,8 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DW
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && rdpdr && rdpdr->rdpcontext)

View File

@ -348,6 +348,8 @@ static UINT enumerator_server_context_poll_int(CamDevEnumServerContext* context)
case ENUMERATOR_OPENED:
error = enumerator_process_message(enumerator);
break;
default:
break;
}
return error;
@ -415,6 +417,8 @@ static DWORD WINAPI enumerator_server_thread_func(LPVOID arg)
break;
}
break;
default:
break;
}
}

View File

@ -501,6 +501,8 @@ static UINT device_server_context_poll_int(CameraDeviceServerContext* context)
case CAMERA_DEVICE_OPENED:
error = device_process_message(device);
break;
default:
break;
}
return error;
@ -568,6 +570,8 @@ static DWORD WINAPI device_server_thread_func(LPVOID arg)
break;
}
break;
default:
break;
}
}

View File

@ -305,6 +305,8 @@ static UINT mouse_cursor_server_context_poll_int(MouseCursorServerContext* conte
case MOUSE_CURSOR_OPENED:
error = mouse_cursor_process_message(mouse_cursor);
break;
default:
break;
}
return error;
@ -372,6 +374,8 @@ static DWORD WINAPI mouse_cursor_server_thread_func(LPVOID arg)
break;
}
break;
default:
break;
}
}

View File

@ -83,6 +83,8 @@ static int rdpsnd_oss_get_format(const AUDIO_FORMAT* format)
case 16:
return AFMT_S16_LE;
default:
break;
}
break;

View File

@ -1225,6 +1225,8 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, D
case CHANNEL_EVENT_USER:
break;
default:
break;
}
if (error && rdpsnd && rdpsnd->rdpcontext)

View File

@ -107,7 +107,8 @@ static UINT32 GetLastErrorToIoStatus(SERIAL_DEVICE* serial)
case ERROR_TIMEOUT:
return STATUS_TIMEOUT;
/* no default */
default:
break;
}
WLog_Print(serial->log, WLOG_DEBUG, "unexpected last-error: 0x%08" PRIX32 "", GetLastError());

View File

@ -455,6 +455,8 @@ static UINT smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* h
case SCARD_IOCTL_GETTRANSMITCOUNT:
asyncIrp = TRUE;
break;
default:
break;
}
pContext = smartcard_call_get_context(smartcard->callctx, element->operation.hContext);

View File

@ -225,6 +225,8 @@ static UINT telemetry_server_context_poll_int(TelemetryServerContext* context)
case TELEMETRY_OPENED:
error = telemetry_process_message(telemetry);
break;
default:
break;
}
return error;
@ -292,6 +294,8 @@ static DWORD WINAPI telemetry_server_thread_func(LPVOID arg)
break;
}
break;
default:
break;
}
}

View File

@ -357,6 +357,8 @@ static UINT tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
This message is not supported in this channel. */
processed = TRUE;
break;
default:
break;
}
if (!processed)

View File

@ -684,6 +684,8 @@ static BOOL tsmf_sample_playback(TSMF_SAMPLE* sample)
case TSMF_MAJOR_TYPE_AUDIO:
ret = tsmf_sample_playback_audio(sample) && tsmf_sample_queue_ack(sample);
break;
default:
break;
}
}
else
@ -712,6 +714,8 @@ static BOOL tsmf_sample_playback(TSMF_SAMPLE* sample)
{
break;
}
default:
break;
}
sample->ack_time = ack_anticipation_time;

View File

@ -669,6 +669,8 @@ static UINT urb_control_transfer(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK* callb
case URB_CONTROL_TRANSFER_NONEXTERNAL:
break;
default:
break;
}
/** SetupPacket 8 bytes */
@ -1178,6 +1180,8 @@ static UINT urb_os_feature_descriptor_request(IUDEVICE* pdev, GENERIC_CHANNEL_CA
case USBD_TRANSFER_DIRECTION_IN:
break;
default:
break;
}
WLog_Print(urbdrc->log, WLOG_DEBUG,
@ -1529,6 +1533,8 @@ static UINT urb_control_feature_request(IUDEVICE* pdev, GENERIC_CHANNEL_CALLBACK
case USBD_TRANSFER_DIRECTION_IN:
bmRequestType |= 0x80;
break;
default:
break;
}
switch (command)

View File

@ -1149,6 +1149,8 @@ static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow, con
case LMS_TERMINATING:
/* Already sent RDP end move to server. Allow events to pass. */
break;
default:
break;
}
return FALSE;

View File

@ -1010,6 +1010,8 @@ static UINT xf_rail_server_local_move_size(RailClientContext* context,
y = localMoveSize->posY;
/* FIXME: local keyboard moves not working */
return CHANNEL_RC_OK;
default:
break;
}
if (localMoveSize->isMoveSizeStart)

View File

@ -1254,6 +1254,8 @@ void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
XMapWindow(xfc->display, appWindow->handle);
break;
default:
break;
}
/* Save the current rail state of this window */

View File

@ -1254,6 +1254,8 @@ static UINT cliprdr_file_context_server_file_contents_response(
(const char*)file_contents_response->requestedData,
file_contents_response->cbRequested);
break;
default:
break;
}
HashTable_Remove(file_context->request_table,

View File

@ -234,6 +234,8 @@ static int test_image_fill_quarter(BYTE* pDstData, int nDstStep, int nWidth, int
width = nWidth / 2;
height = nHeight / 2;
break;
default:
return -1;
}
test_image_fill(pDstData, nDstStep, x, y, width, height, 0xFF000000);
@ -866,6 +868,8 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
clippingRect.right = g_Width;
clippingRect.bottom = g_Height / 2;
break;
default:
return -1;
}
for (UINT16 index = 0; index < region->numTiles; index++)

View File

@ -86,6 +86,8 @@ BOOL freerdp_settings_clone_keys(rdpSettings* dst, const rdpSettings* src)
return FALSE;
}
break;
default:
return FALSE;
}
}
return TRUE;
@ -234,6 +236,8 @@ BOOL freerdp_settings_print_diff(wLog* log, DWORD level, const rdpSettings* sett
}
}
break;
default:
break;
}
}
return rc;
@ -312,6 +316,8 @@ void freerdp_settings_dump(wLog* log, DWORD level, const rdpSettings* settings)
WLog_Print(log, level, "%s [POINTER]: '%p'", cur->str, sval);
}
break;
default:
break;
}
}
}
@ -333,6 +339,8 @@ void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup)
(void)freerdp_settings_set_pointer_len(dst, (FreeRDP_Settings_Keys_Pointer)cur->id,
NULL, 0);
break;
default:
break;
}
}
}

View File

@ -413,6 +413,8 @@ int credssp_auth_authenticate(rdpCredsspAuth* auth)
case AUTH_STATE_FINAL:
WLog_ERR(TAG, "context in invalid state!");
return -1;
default:
break;
}
/* input buffer will be null on first call,

View File

@ -507,6 +507,8 @@ wMessageQueue* freerdp_get_message_queue(freerdp* instance, DWORD id)
queue = input->queue;
}
break;
default:
break;
}
return queue;
@ -542,6 +544,8 @@ int freerdp_message_queue_process_message(freerdp* instance, DWORD id, wMessage*
case FREERDP_INPUT_MESSAGE_QUEUE:
status = input_message_queue_process_message(context->input, message);
break;
default:
break;
}
return status;
@ -566,6 +570,8 @@ int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id)
case FREERDP_INPUT_MESSAGE_QUEUE:
status = input_message_queue_process_pending_messages(context->input);
break;
default:
break;
}
return status;

View File

@ -266,6 +266,8 @@ static int rpc_client_recv_pdu_int(rdpRpc* rpc, RPC_PDU* pdu)
case VIRTUAL_CONNECTION_STATE_FINAL:
break;
default:
break;
}
}
else if (rpc->State < RPC_CLIENT_STATE_CONTEXT_NEGOTIATED)
@ -314,6 +316,9 @@ static int rpc_client_recv_pdu_int(rdpRpc* rpc, RPC_PDU* pdu)
WLog_ERR(TAG, "tsg_proxy_begin failure");
return -1;
}
break;
default:
break;
}
status = 1;

View File

@ -347,6 +347,8 @@ static UINT32 rpc_map_status_code_to_win32_error_code(UINT32 code)
case nca_s_fault_no_client_stub:
return nca_s_fault_no_client_stub;
default:
break;
}
return code;

View File

@ -2585,6 +2585,8 @@ BOOL tsg_recv_pdu(rdpTsg* tsg, const RPC_PDU* pdu)
case TSG_STATE_FINAL:
break;
default:
break;
}
return rc;

View File

@ -571,6 +571,9 @@ int websocket_read(BIO* bio, BYTE* pBuffer, size_t size, websocket_context* enco
pBuffer += status;
size -= status;
}
break;
default:
break;
}
}
/* should be unreachable */

View File

@ -842,6 +842,8 @@ int nego_recv(rdpTransport* transport, wStream* s, void* extra)
if (!nego_process_negotiation_failure(nego, s))
return -1;
break;
default:
return -1;
}
}
else if (li == 6)

View File

@ -3237,7 +3237,8 @@ BOOL update_write_switch_surface_order(wStream* s, const SWITCH_SURFACE_ORDER* s
if (!Stream_EnsureRemainingCapacity(s, inf))
return FALSE;
Stream_Write_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */
WINPR_ASSERT(switch_surface->bitmapId <= UINT16_MAX);
Stream_Write_UINT16(s, (UINT16)switch_surface->bitmapId); /* bitmapId (2 bytes) */
return TRUE;
}
static BOOL

View File

@ -1363,6 +1363,8 @@ static const char* os_major_type_to_string(UINT16 osMajorType)
return "Android platform";
case OSMAJORTYPE_CHROME_OS:
return "Chrome OS platform";
default:
break;
}
return "Unknown platform";
@ -1408,6 +1410,8 @@ static const char* os_minor_type_to_string(UINT16 osMinorType)
return "Pseudo X Server";
case OSMINORTYPE_WINDOWS_RT:
return "Windows RT";
default:
break;
}
return "Unknown version";

View File

@ -1034,6 +1034,8 @@ rdpSettings* freerdp_settings_new(DWORD flags)
case 9:
cache.cacheMaximumCellSize = 256;
break;
default:
goto out_fail;
}
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_GlyphCache, x, &cache))

View File

@ -378,6 +378,8 @@ static INLINE char* base64_encode_ex(const BYTE* WINPR_RESTRICT alphabet,
if (pad)
*p++ = '=';
break;
default:
break;
}
if (crLf && length % 3)

View File

@ -164,6 +164,8 @@ static int bio_rdp_tls_write(BIO* bio, const char* buf, int size)
case SSL_ERROR_SSL:
BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
break;
default:
break;
}
}
@ -187,6 +189,7 @@ static int bio_rdp_tls_read(BIO* bio, char* buf, int size)
if (status <= 0)
{
switch (error)
{
case SSL_ERROR_NONE:
@ -227,6 +230,8 @@ static int bio_rdp_tls_read(BIO* bio, char* buf, int size)
case SSL_ERROR_SYSCALL:
BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
break;
default:
break;
}
}
@ -1047,6 +1052,8 @@ int freerdp_tls_connect(rdpTls* tls, BIO* underlying)
case TLS_HANDSHAKE_ERROR:
case TLS_HANDSHAKE_VERIFY_ERROR:
return -1;
default:
return -1;
}
return pollAndHandshake(tls);

View File

@ -1006,6 +1006,8 @@ static BOOL gdi_surface_frame_marker(rdpContext* context,
surfaceFrameMarker->frameId);
}
break;
default:
break;
}

View File

@ -89,6 +89,8 @@ const char* rdpgfx_get_codec_id_string(UINT16 codecId)
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
return "RDPGFX_CODECID_CAPROGRESSIVE_V2";
default:
break;
}
return "RDPGFX_CODECID_UNKNOWN";

View File

@ -118,6 +118,8 @@ static LONG smartcard_ndr_read(wStream* s, BYTE** data, size_t min, size_t eleme
case NDR_PTR_FIXED:
required = min;
break;
default:
return STATUS_INVALID_PARAMETER;
}
if (!Stream_CheckAndLogRequiredLength(TAG, s, required))
@ -153,6 +155,8 @@ static LONG smartcard_ndr_read(wStream* s, BYTE** data, size_t min, size_t eleme
case NDR_PTR_FIXED:
len = (UINT32)min;
break;
default:
return STATUS_INVALID_PARAMETER;
}
if (min > len)
@ -223,6 +227,8 @@ static LONG smartcard_ndr_write(wStream* s, const BYTE* data, UINT32 size, UINT3
case NDR_PTR_FIXED:
required = 0;
break;
default:
return SCARD_E_INVALID_PARAMETER;
}
if (!Stream_EnsureRemainingCapacity(s, required + dataLen + 4))
@ -240,6 +246,8 @@ static LONG smartcard_ndr_write(wStream* s, const BYTE* data, UINT32 size, UINT3
break;
case NDR_PTR_FIXED:
break;
default:
return SCARD_E_INVALID_PARAMETER;
}
if (data)

View File

@ -140,6 +140,8 @@ PfChannelResult channelTracker_update(ChannelStateTracker* tracker, const BYTE*
case CHANNEL_TRACKER_DROP:
result = PF_CHANNEL_RESULT_DROP;
break;
default:
break;
}
if (lastPacket)

View File

@ -454,6 +454,7 @@ static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 chann
case PF_CHANNEL_RESULT_DROP:
return TRUE;
case PF_CHANNEL_RESULT_ERROR:
default:
return FALSE;
}

View File

@ -661,6 +661,8 @@ static BOOL s_CommDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID
}
break;
}
default:
break;
}
CommLog_Print(

View File

@ -242,6 +242,8 @@ static CK_RV object_load_attributes(NCryptP11ProviderHandle* provider, CK_SESSIO
"] even after buffer allocation",
CK_RV_error_string(rv), rv);
break;
default:
break;
}
return rv;
}

View File

@ -139,6 +139,8 @@ static BOOL PipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
case EWOULDBLOCK:
SetLastError(ERROR_NO_DATA);
break;
default:
break;
}
}

View File

@ -822,6 +822,8 @@ static SECURITY_STATUS SEC_ENTRY negotiate_InitializeSecurityContextW(
else
context->state = NEGOTIATE_STATE_FINAL;
break;
default:
break;
}
WLog_DBG(TAG, "Negotiated mechanism: %s", negotiate_mech_name(context->mech->oid));

View File

@ -67,6 +67,8 @@ static char* openssl_get_ssl_error_string(int ssl_error)
case SSL_ERROR_SSL:
return "SSL_ERROR_SSL";
default:
break;
}
return "SSL_ERROR_UNKNOWN";

View File

@ -453,6 +453,8 @@ const char* GetSecurityStatusString(SECURITY_STATUS status)
case SEC_I_NO_RENEGOTIATION:
return "SEC_I_NO_RENEGOTIATION";
default:
break;
}
return NtStatus2Tag((DWORD)status);
@ -477,6 +479,8 @@ BOOL IsSecurityStatusError(SECURITY_STATUS status)
case SEC_I_NO_RENEGOTIATION:
error = FALSE;
break;
default:
break;
}
return error;

View File

@ -1075,6 +1075,8 @@ static void sspi_ContextBufferFree(void* contextBuffer)
case QuerySecurityPackageInfoIndex:
FreeContextBuffer_QuerySecurityPackageInfo(contextBuffer);
break;
default:
break;
}
}
}

View File

@ -1164,6 +1164,8 @@ BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature)
if (c & C_BIT_PCLMULQDQ)
ret = TRUE;
break;
default:
break;
}
}

View File

@ -560,6 +560,8 @@ static size_t WinPrAsn1EncIntegerLike(WinPrAsn1Encoder* enc, WinPrAsn1_tag b,
Stream_Write_UINT8(s, 4);
Stream_Write_INT32_BE(s, value);
break;
default:
break;
}
return 1 + len;
}
@ -596,16 +598,18 @@ static size_t WinPrAsn1EncContextualIntegerLike(WinPrAsn1Encoder* enc, WinPrAsn1
{
case 2:
Stream_Write_UINT8(s, 1);
Stream_Write_INT8(s, value);
Stream_Write_INT8(s, (INT8)value);
break;
case 3:
Stream_Write_UINT8(s, 2);
Stream_Write_INT16_BE(s, value);
Stream_Write_INT16_BE(s, (INT16)value);
break;
case 5:
Stream_Write_UINT8(s, 4);
Stream_Write_INT32_BE(s, value);
break;
default:
return 0;
}
return outLen;
}

View File

@ -495,6 +495,8 @@ void WSASetLastError(int iError)
case WSAEREMOTE:
errno = EREMOTE;
break;
default:
break;
}
}
@ -693,6 +695,8 @@ int WSAGetLastError(void)
iError = WSAECONNRESET;
break;
#endif
default:
break;
}
/**
@ -1216,6 +1220,8 @@ int _shutdown(SOCKET s, int how)
case SD_BOTH:
s_how = SHUT_RDWR;
break;
default:
break;
}
if (s_how < 0)

View File

@ -672,6 +672,8 @@ const CHAR* WTSSessionStateToString(WTS_CONNECTSTATE_CLASS state)
return "WTSDown";
case WTSInit:
return "WTSInit";
default:
break;
}
return "INVALID_STATE";
}