From 2da280b8a1748052b70b3f5a1ef0d8e932c33adc Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 4 Jul 2022 14:34:46 +0200 Subject: [PATCH] Fixed compilation warnings --- channels/ainput/server/ainput_main.c | 2 +- channels/cliprdr/server/cliprdr_main.c | 9 +++++---- client/X11/xf_graphics.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/channels/ainput/server/ainput_main.c b/channels/ainput/server/ainput_main.c index 654b6d5c3..67404aa47 100644 --- a/channels/ainput/server/ainput_main.c +++ b/channels/ainput/server/ainput_main.c @@ -214,7 +214,7 @@ static UINT ainput_server_recv_mouse_event(ainput_server* ainput, wStream* s) static HANDLE ainput_server_get_channel_handle(ainput_server* ainput) { - BYTE* buffer = NULL; + void* buffer = NULL; DWORD BytesReturned = 0; HANDLE ChannelEvent = NULL; diff --git a/channels/cliprdr/server/cliprdr_main.c b/channels/cliprdr/server/cliprdr_main.c index 5ce1ef9da..27634cf8b 100644 --- a/channels/cliprdr/server/cliprdr_main.c +++ b/channels/cliprdr/server/cliprdr_main.c @@ -617,12 +617,13 @@ static UINT cliprdr_server_receive_temporary_directory(CliprdrServerContext* con cliprdr = (CliprdrServerPrivate*)context->handle; WINPR_ASSERT(cliprdr); - if (!Stream_CheckAndLogRequiredLength(TAG, s, 260 * sizeof(WCHAR))) + if (!Stream_CheckAndLogRequiredLength(TAG, s, + ARRAYSIZE(cliprdr->temporaryDirectory) * sizeof(WCHAR))) return CHANNEL_RC_NO_MEMORY; wszTempDir = (WCHAR*)Stream_Pointer(s); - if (wszTempDir[259] != 0) + if (wszTempDir[ARRAYSIZE(cliprdr->temporaryDirectory) - 1] != 0) { WLog_ERR(TAG, "wszTempDir[259] was not 0"); return ERROR_INVALID_DATA; @@ -639,8 +640,8 @@ static UINT cliprdr_server_receive_temporary_directory(CliprdrServerContext* con length = strnlen(cliprdr->temporaryDirectory, ARRAYSIZE(cliprdr->temporaryDirectory)); - if (length >= 260) - length = 259; + if (length >= ARRAYSIZE(cliprdr->temporaryDirectory)) + length = ARRAYSIZE(cliprdr->temporaryDirectory) - 1; CopyMemory(tempDirectory.szTempDir, cliprdr->temporaryDirectory, length); tempDirectory.szTempDir[length] = '\0'; diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 89cf0a1d5..65b9600f2 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -452,7 +452,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer) #endif fail: - WLog_DBG(TAG, "%s: %ld", __func__, rc ? pointer : -1); + WLog_DBG(TAG, "%s: %p", __func__, rc ? pointer : NULL); return rc; }