Merge pull request #10245 from akallabeth/warnings-fixed

[warnings] fix various compiler warnings
This commit is contained in:
akallabeth 2024-06-04 13:56:52 +02:00 committed by GitHub
commit b17b07885a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 38 additions and 43 deletions

View File

@ -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)))

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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));

View File

@ -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))

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -30,8 +30,8 @@
typedef struct
{
const char* Iana;
const char* Abbrev;
char* Iana;
char* Abbrev;
} TimeZoneInanaAbbrevMapEntry;
const static char* zonepath = "/usr/share/zoneinfo";