diff --git a/channels/remdesk/client/remdesk_main.c b/channels/remdesk/client/remdesk_main.c index 269e9a8ae..46222983e 100644 --- a/channels/remdesk/client/remdesk_main.c +++ b/channels/remdesk/client/remdesk_main.c @@ -351,9 +351,7 @@ static UINT remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk) size_t cbExpertBlobW = 0; WCHAR* expertBlobW = NULL; size_t cbRaConnectionStringW = 0; - WCHAR* raConnectionStringW = NULL; - REMDESK_CTL_AUTHENTICATE_PDU pdu = { 0 }; - rdpSettings* settings = NULL; + REMDESK_CTL_HEADER ctlHeader = { 0 }; WINPR_ASSERT(remdesk); @@ -363,29 +361,30 @@ static UINT remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk) return error; } - pdu.expertBlob = remdesk->ExpertBlob; + const char* expertBlob = remdesk->ExpertBlob; WINPR_ASSERT(remdesk->rdpcontext); - settings = remdesk->rdpcontext->settings; + rdpSettings* settings = remdesk->rdpcontext->settings; WINPR_ASSERT(settings); - pdu.raConnectionString = + const char* raConnectionString = freerdp_settings_get_string(settings, FreeRDP_RemoteAssistanceRCTicket); - raConnectionStringW = ConvertUtf8ToWCharAlloc(pdu.raConnectionString, &cbRaConnectionStringW); + WCHAR* raConnectionStringW = + ConvertUtf8ToWCharAlloc(raConnectionString, &cbRaConnectionStringW); if (!raConnectionStringW || (cbRaConnectionStringW > UINT32_MAX / sizeof(WCHAR))) goto out; cbRaConnectionStringW = cbRaConnectionStringW * sizeof(WCHAR); - expertBlobW = ConvertUtf8ToWCharAlloc(pdu.expertBlob, &cbExpertBlobW); + expertBlobW = ConvertUtf8ToWCharAlloc(expertBlob, &cbExpertBlobW); if (!expertBlobW || (cbExpertBlobW > UINT32_MAX / sizeof(WCHAR))) goto out; cbExpertBlobW = cbExpertBlobW * sizeof(WCHAR); - remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_AUTHENTICATE, + remdesk_prepare_ctl_header(&(ctlHeader), REMDESK_CTL_AUTHENTICATE, cbRaConnectionStringW + cbExpertBlobW); - s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.ch.DataLength); + s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + ctlHeader.ch.DataLength); if (!s) { @@ -394,9 +393,9 @@ static UINT remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk) goto out; } - remdesk_write_ctl_header(s, &(pdu.ctlHeader)); - Stream_Write(s, (BYTE*)raConnectionStringW, cbRaConnectionStringW); - Stream_Write(s, (BYTE*)expertBlobW, cbExpertBlobW); + remdesk_write_ctl_header(s, &(ctlHeader)); + Stream_Write(s, raConnectionStringW, cbRaConnectionStringW); + Stream_Write(s, expertBlobW, cbExpertBlobW); Stream_SealLength(s); if ((error = remdesk_virtual_channel_write(remdesk, s))) @@ -418,28 +417,24 @@ static UINT remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk) { UINT error = 0; size_t length = 0; - wStream* s = NULL; - size_t cbRaConnectionStringW = 0; - WCHAR* raConnectionStringW = NULL; - REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu = { 0 }; - rdpSettings* settings = NULL; WINPR_ASSERT(remdesk); WINPR_ASSERT(remdesk->rdpcontext); - settings = remdesk->rdpcontext->settings; + rdpSettings* settings = remdesk->rdpcontext->settings; WINPR_ASSERT(settings); - pdu.raConnectionString = + const char* raConnectionString = freerdp_settings_get_string(settings, FreeRDP_RemoteAssistanceRCTicket); - raConnectionStringW = ConvertUtf8ToWCharAlloc(pdu.raConnectionString, &length); + WCHAR* raConnectionStringW = ConvertUtf8ToWCharAlloc(raConnectionString, &length); + size_t cbRaConnectionStringW = length * sizeof(WCHAR); if (!raConnectionStringW) return ERROR_INTERNAL_ERROR; - cbRaConnectionStringW = length * sizeof(WCHAR); - remdesk_prepare_ctl_header(&(pdu.ctlHeader), REMDESK_CTL_REMOTE_CONTROL_DESKTOP, + REMDESK_CTL_HEADER ctlHeader = { 0 }; + remdesk_prepare_ctl_header(&ctlHeader, REMDESK_CTL_REMOTE_CONTROL_DESKTOP, cbRaConnectionStringW); - s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + pdu.ctlHeader.ch.DataLength); + wStream* s = Stream_New(NULL, REMDESK_CHANNEL_CTL_SIZE + ctlHeader.ch.DataLength); if (!s) { @@ -448,8 +443,8 @@ static UINT remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* remdesk) goto out; } - remdesk_write_ctl_header(s, &(pdu.ctlHeader)); - Stream_Write(s, (BYTE*)raConnectionStringW, cbRaConnectionStringW); + remdesk_write_ctl_header(s, &ctlHeader); + Stream_Write(s, raConnectionStringW, cbRaConnectionStringW); Stream_SealLength(s); if ((error = remdesk_virtual_channel_write(remdesk, s))) diff --git a/channels/tsmf/client/alsa/tsmf_alsa.c b/channels/tsmf/client/alsa/tsmf_alsa.c index fcf30aa13..fdcd5b95f 100644 --- a/channels/tsmf/client/alsa/tsmf_alsa.c +++ b/channels/tsmf/client/alsa/tsmf_alsa.c @@ -224,7 +224,7 @@ static void tsmf_alsa_free(ITSMFAudioDevice* audio) free(alsa); } -FREERDP_ENTRY_POINT(ITSMFAudioDevice* alsa_freerdp_tsmf_client_audio_subsystem_entry(void)) +FREERDP_ENTRY_POINT(ITSMFAudioDevice* alsa_freerdp_tsmf_client_audio_subsystem_entry(void*)) { TSMFAlsaAudioDevice* alsa = calloc(1, sizeof(TSMFAlsaAudioDevice)); if (!alsa) diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c index eb45a8e06..7bb067a9b 100644 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c @@ -675,7 +675,7 @@ static BOOL CALLBACK InitializeAvCodecs(PINIT_ONCE once, PVOID param, PVOID* con return TRUE; } -FREERDP_ENTRY_POINT(ITSMFDecoder* ffmpeg_freerdp_tsmf_client_decoder_subsystem_entry(void)) +FREERDP_ENTRY_POINT(ITSMFDecoder* ffmpeg_freerdp_tsmf_client_decoder_subsystem_entry(void*)) { TSMFFFmpegDecoder* decoder = NULL; InitOnceExecuteOnce(&g_Initialized, InitializeAvCodecs, NULL, NULL); diff --git a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c index 90878765b..33b9e0f1d 100644 --- a/channels/tsmf/client/gstreamer/tsmf_gstreamer.c +++ b/channels/tsmf/client/gstreamer/tsmf_gstreamer.c @@ -1003,7 +1003,7 @@ static BOOL tsmf_gstreamer_sync(ITSMFDecoder* decoder, void (*cb)(void*), void* return TRUE; } -FREERDP_ENTRY_POINT(ITSMFDecoder* gstreamer_freerdp_tsmf_client_decoder_subsystem_entry(void)) +FREERDP_ENTRY_POINT(ITSMFDecoder* gstreamer_freerdp_tsmf_client_decoder_subsystem_entry(void*)) { TSMFGstreamerDecoder* decoder; diff --git a/channels/tsmf/client/oss/tsmf_oss.c b/channels/tsmf/client/oss/tsmf_oss.c index 666b41935..f5f2d5818 100644 --- a/channels/tsmf/client/oss/tsmf_oss.c +++ b/channels/tsmf/client/oss/tsmf_oss.c @@ -231,7 +231,7 @@ static void tsmf_oss_free(ITSMFAudioDevice* audio) free(oss); } -FREERDP_ENTRY_POINT(ITSMFAudioDevice* oss_freerdp_tsmf_client_audio_subsystem_entry(void)) +FREERDP_ENTRY_POINT(ITSMFAudioDevice* oss_freerdp_tsmf_client_audio_subsystem_entry(void*)) { TSMFOssAudioDevice* oss = calloc(1, sizeof(TSMFOssAudioDevice)); if (!oss) diff --git a/channels/tsmf/client/pulse/tsmf_pulse.c b/channels/tsmf/client/pulse/tsmf_pulse.c index 6d3cb1ca2..b807b4f9d 100644 --- a/channels/tsmf/client/pulse/tsmf_pulse.c +++ b/channels/tsmf/client/pulse/tsmf_pulse.c @@ -396,7 +396,7 @@ static void tsmf_pulse_free(ITSMFAudioDevice* audio) free(pulse); } -FREERDP_ENTRY_POINT(ITSMFAudioDevice* pulse_freerdp_tsmf_client_audio_subsystem_entry(void)) +FREERDP_ENTRY_POINT(ITSMFAudioDevice* pulse_freerdp_tsmf_client_audio_subsystem_entry(void*)) { TSMFPulseAudioDevice* pulse = NULL; pulse = (TSMFPulseAudioDevice*)calloc(1, sizeof(TSMFPulseAudioDevice)); diff --git a/channels/tsmf/client/tsmf_ifman.c b/channels/tsmf/client/tsmf_ifman.c index 223050571..054367c42 100644 --- a/channels/tsmf/client/tsmf_ifman.c +++ b/channels/tsmf/client/tsmf_ifman.c @@ -485,7 +485,6 @@ UINT tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman) RDP_RECT* rects = NULL; int num_rects = 0; UINT error = CHANNEL_RC_OK; - int i = 0; size_t pos = 0; if (!Stream_CheckAndLogRequiredLength(TAG, ifman->input, GUID_SIZE + 32)) diff --git a/libfreerdp/codec/h264.h b/libfreerdp/codec/h264.h index 89f8683a7..abd0aeb84 100644 --- a/libfreerdp/codec/h264.h +++ b/libfreerdp/codec/h264.h @@ -30,8 +30,8 @@ extern "C" { #endif - typedef BOOL (*pfnH264SubsystemInit)(H264_CONTEXT* WINPR_RESTRICT h264); - typedef void (*pfnH264SubsystemUninit)(H264_CONTEXT* WINPR_RESTRICT h264); + typedef BOOL (*pfnH264SubsystemInit)(H264_CONTEXT* h264); + typedef void (*pfnH264SubsystemUninit)(H264_CONTEXT* h264); typedef int (*pfnH264SubsystemDecompress)(H264_CONTEXT* WINPR_RESTRICT h264, const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize); diff --git a/libfreerdp/codec/h264_ffmpeg.c b/libfreerdp/codec/h264_ffmpeg.c index 29592f44c..dd856e957 100644 --- a/libfreerdp/codec/h264_ffmpeg.c +++ b/libfreerdp/codec/h264_ffmpeg.c @@ -457,7 +457,7 @@ fail: return rc; } -static void libavcodec_uninit(H264_CONTEXT* WINPR_RESTRICT h264) +static void libavcodec_uninit(H264_CONTEXT* h264) { WINPR_ASSERT(h264); @@ -580,7 +580,7 @@ static enum AVPixelFormat libavcodec_get_format(struct AVCodecContext* ctx, } #endif -static BOOL libavcodec_init(H264_CONTEXT* WINPR_RESTRICT h264) +static BOOL libavcodec_init(H264_CONTEXT* h264) { H264_CONTEXT_LIBAVCODEC* sys = NULL; diff --git a/libfreerdp/codec/h264_openh264.c b/libfreerdp/codec/h264_openh264.c index 57c798761..92e4aaf1e 100644 --- a/libfreerdp/codec/h264_openh264.c +++ b/libfreerdp/codec/h264_openh264.c @@ -388,7 +388,7 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264, return 1; } -static void openh264_uninit(H264_CONTEXT* WINPR_RESTRICT h264) +static void openh264_uninit(H264_CONTEXT* h264) { H264_CONTEXT_OPENH264* sysContexts = NULL; @@ -487,7 +487,7 @@ static BOOL openh264_load_functionpointers(H264_CONTEXT* h264, const char* name) } #endif -static BOOL openh264_init(H264_CONTEXT* WINPR_RESTRICT h264) +static BOOL openh264_init(H264_CONTEXT* h264) { #if defined(WITH_OPENH264_LOADING) BOOL success = FALSE; diff --git a/uwac/libuwac/uwac-display.c b/uwac/libuwac/uwac-display.c index 1b26e2192..91b2d6261 100644 --- a/uwac/libuwac/uwac-display.c +++ b/uwac/libuwac/uwac-display.c @@ -402,7 +402,7 @@ UwacDisplay* UwacOpenDisplay(const char* name, UwacReturnCode* err) if (ret->display == NULL) { - fprintf(stderr, "failed to connect to Wayland display %s: %m\n", name); + fprintf(stderr, "failed to connect to Wayland display %s: %s\n", name, strerror(errno)); *err = UWAC_ERROR_UNABLE_TO_CONNECT; goto out_free; } diff --git a/winpr/libwinpr/file/generic.c b/winpr/libwinpr/file/generic.c index e7bc0cfa5..b914354ed 100644 --- a/winpr/libwinpr/file/generic.c +++ b/winpr/libwinpr/file/generic.c @@ -885,7 +885,8 @@ static WIN32_FILE_SEARCH* file_search_new(const char* name, size_t namelen, cons WIN32_FILE_SEARCH* pFileSearch = (WIN32_FILE_SEARCH*)calloc(1, sizeof(WIN32_FILE_SEARCH)); if (!pFileSearch) return NULL; - strncpy(pFileSearch->magic, file_search_magic, sizeof(pFileSearch->magic) - 1); + WINPR_ASSERT(sizeof(file_search_magic) == sizeof(pFileSearch->magic)); + strncpy(pFileSearch->magic, file_search_magic, sizeof(pFileSearch->magic)); pFileSearch->lpPath = strndup(name, namelen); pFileSearch->lpPattern = strndup(pattern, patternlen); @@ -939,7 +940,7 @@ static BOOL is_valid_file_search_handle(HANDLE handle) return FALSE; if (pFileSearch == INVALID_HANDLE_VALUE) return FALSE; - if (strcmp(file_search_magic, pFileSearch->magic) != 0) + if (strncmp(file_search_magic, pFileSearch->magic, sizeof(file_search_magic)) != 0) return FALSE; return TRUE; } diff --git a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c index 370e5b4cc..e17968211 100644 --- a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c +++ b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c @@ -30,8 +30,8 @@ typedef struct { - const char* Iana; - const char* Abbrev; + char* Iana; + char* Abbrev; } TimeZoneInanaAbbrevMapEntry; const static char* zonepath = "/usr/share/zoneinfo";