From c159b2e9c8c55348d96439b8ac9aa9ea0946a889 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 12:43:29 +0200 Subject: [PATCH 01/12] Fixed missing check before calling memcpy --- winpr/include/winpr/stream.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/winpr/include/winpr/stream.h b/winpr/include/winpr/stream.h index 4a0005948..0ec18a23f 100644 --- a/winpr/include/winpr/stream.h +++ b/winpr/include/winpr/stream.h @@ -216,8 +216,11 @@ static INLINE void Stream_Write_UINT64(wStream* _s, UINT64 _v) } static INLINE void Stream_Write(wStream* _s, const void* _b, size_t _n) { - memcpy(_s->pointer, (_b), (_n)); - Stream_Seek(_s, _n); + if (_n > 0) + { + memcpy(_s->pointer, (_b), (_n)); + Stream_Seek(_s, _n); + } } #define Stream_Seek_UINT8(_s) Stream_Seek(_s, 1) @@ -342,7 +345,7 @@ static INLINE BOOL Stream_Read_UTF16_String(wStream* s, WCHAR* dst, size_t lengt if (Stream_GetRemainingLength(s) / sizeof(WCHAR) < length) return FALSE; - for (x=0; x Date: Thu, 23 Aug 2018 12:45:36 +0200 Subject: [PATCH 02/12] Fixed dead initialization. --- client/X11/xf_keyboard.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 7e7c297af..d41e70e1a 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -447,7 +447,6 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym) { XF_MODIFIER_KEYS mod = { 0 }; xk_keyboard_get_modifier_keys(xfc, &mod); - rdpContext* ctx = &xfc->context; // remember state of RightCtrl to ungrab keyboard if next action is release of RightCtrl // do not return anything such that the key could be used by client if ungrab is not the goal @@ -500,6 +499,8 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym) if (!xfc->remote_app && xfc->settings->MultiTouchGestures) { + rdpContext* ctx = &xfc->context; + if (mod.Ctrl && mod.Alt) { int pdx = 0; @@ -596,6 +597,7 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym) { xf_toggle_control(xfc); } + xfc->mouse_active = FALSE; XUngrabKeyboard(xfc->display, CurrentTime); } From bff49a9bd0371656470b572ba2aa8d10e4e537f0 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:04:42 +0200 Subject: [PATCH 03/12] Fixed invalid argument warnings. --- libfreerdp/codec/h264.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libfreerdp/codec/h264.c b/libfreerdp/codec/h264.c index 322c640e3..7fb8d81c0 100644 --- a/libfreerdp/codec/h264.c +++ b/libfreerdp/codec/h264.c @@ -180,6 +180,7 @@ INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize return -1001; status = h264->subsystem->Decompress(h264, pSrcData, SrcSize); + if (status == 0) return 1; @@ -216,7 +217,10 @@ INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, &roi) != PRIMITIVES_SUCCESS) return -1; - return h264->subsystem->Compress(h264, h264->pYUVData, h264->iStride, ppDstData, pDstSize); + { + const BYTE* pYUVData[3] = {h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2]}; + return h264->subsystem->Compress(h264, pYUVData, h264->iStride, ppDstData, pDstSize); + } } INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, @@ -264,16 +268,22 @@ INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, return -1; } - if (h264->subsystem->Compress(h264, h264->pYUV444Data, h264->iStride, &coded, &codedSize) < 0) - return -1; + { + const BYTE* pYUV444Data[3] = {h264->pYUV444Data[0], h264->pYUV444Data[1], h264->pYUV444Data[2]}; + + if (h264->subsystem->Compress(h264, pYUV444Data, h264->iStride, &coded, &codedSize) < 0) + return -1; + } memcpy(h264->lumaData, coded, codedSize); *ppDstData = h264->lumaData; *pDstSize = codedSize; + { + const BYTE* pYUVData[3] = {h264->pYUVData[0], h264->pYUVData[1], h264->pYUVData[2]}; - if (h264->subsystem->Compress(h264, h264->pYUVData, h264->iStride, &coded, &codedSize) < 0) - return -1; - + if (h264->subsystem->Compress(h264, pYUVData, h264->iStride, &coded, &codedSize) < 0) + return -1; + } *ppAuxDstData = coded; *pAuxDstSize = codedSize; *op = 0; From d90e5da86592ae7546763301c600982190fbb331 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:05:12 +0200 Subject: [PATCH 04/12] Fixed unused label warning. --- channels/rdpsnd/server/rdpsnd_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index 9b5339510..caebacab5 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -522,7 +522,6 @@ static UINT rdpsnd_server_send_wave2_pdu(RdpsndServerContext* context, } } -out: Stream_SetPosition(s, 0); context->priv->out_pending_frames = 0; return error; From 8d473af4fbf7f737f7531873984a14d208700ca2 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:05:44 +0200 Subject: [PATCH 05/12] Fixed missing type cast. --- libfreerdp/codec/dsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfreerdp/codec/dsp.c b/libfreerdp/codec/dsp.c index 0f0817f82..5dac569d0 100644 --- a/libfreerdp/codec/dsp.c +++ b/libfreerdp/codec/dsp.c @@ -426,7 +426,7 @@ static BOOL freerdp_dsp_encode_faac(FREERDP_DSP_CONTEXT* context, if (!Stream_EnsureRemainingCapacity(out, context->faacMaxOutputBytes)) return FALSE; - outSamples = Stream_Buffer(context->buffer); + outSamples = (int32_t*)Stream_Buffer(context->buffer); for (x = 0; x < nrSamples * context->format.nChannels; x++) outSamples[x] = inSamples[x]; From 59819818f3bdd50594d8d7b5c3a2e83dc1812f10 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:06:15 +0200 Subject: [PATCH 06/12] Fixed freerdp_load_dynamic_addin path --- libfreerdp/common/addin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libfreerdp/common/addin.c b/libfreerdp/common/addin.c index 15df05f2b..916e7f8d0 100644 --- a/libfreerdp/common/addin.c +++ b/libfreerdp/common/addin.c @@ -188,7 +188,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, if (!pszRelativeFilePath) goto fail; - sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszRelativeFilePath); + sprintf_s(pszRelativeFilePath, relPathLen, "%s", pszPath); NativePathCchAppendA(pszRelativeFilePath, relPathLen, pszAddinFile); } else @@ -245,7 +245,7 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, if (pszName && pszSubsystem && pszType) { const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen( - pszType) + strlen(pszExtension); + pszType) + strlen(pszExtension); pszFileName = (LPSTR) malloc(cchFileName); if (!pszFileName) @@ -256,7 +256,8 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, } else if (pszName && pszSubsystem) { - const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen(pszExtension); + const size_t cchFileName = cchBaseFileName + strlen(pszName) + strlen(pszSubsystem) + strlen( + pszExtension); pszFileName = (LPSTR) malloc(cchFileName); if (!pszFileName) From a3819f65e851dcc99f72d28b4572e995687ead12 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:06:34 +0200 Subject: [PATCH 07/12] Fixed unused variable warnings. --- libfreerdp/core/message.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index d054f5fd0..3f3852c2a 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -1491,7 +1491,6 @@ static BOOL update_message_PointerCached(rdpContext* context, /* Message Queue */ static BOOL update_message_free_update_class(wMessage* msg, int type) { - int status = 0; rdpContext* context; if (!msg) @@ -2038,8 +2037,6 @@ static BOOL update_message_free_altsec_update_class(wMessage* msg, int type) static BOOL update_message_process_altsec_update_class(rdpUpdateProxy* proxy, wMessage* msg, int type) { - int status = 0; - if (!proxy || !msg) return FALSE; From dab842cfb527eb242bfa8502302245ccf9212eea Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:08:31 +0200 Subject: [PATCH 08/12] Fixed missing type casts. --- libfreerdp/crypto/tls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 5af8e4e72..4b25b7fda 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -1172,23 +1172,23 @@ static BOOL is_accepted(rdpTls* tls, const BYTE* pem, size_t length) return FALSE; } -static BOOL accept_cert(rdpTls* tls, const BYTE* pem, size_t length) +static BOOL accept_cert(rdpTls* tls, BYTE* pem, UINT32 length) { rdpSettings* settings = tls->settings; if (tls->isGatewayTransport) { - settings->GatewayAcceptedCert = pem; + settings->GatewayAcceptedCert = (char*)pem; settings->GatewayAcceptedCertLength = length; } else if (is_redirected(tls)) { - settings->RedirectionAcceptedCert = pem; + settings->RedirectionAcceptedCert = (char*)pem; settings->RedirectionAcceptedCertLength = length; } else { - settings->AcceptedCert = pem; + settings->AcceptedCert = (char*)pem; settings->AcceptedCertLength = length; } From d7d556789108d27ae6846fc1a115a611d498075d Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:08:52 +0200 Subject: [PATCH 09/12] Fixed missing const. --- winpr/libwinpr/file/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winpr/libwinpr/file/generic.c b/winpr/libwinpr/file/generic.c index c9ac2a662..695984342 100644 --- a/winpr/libwinpr/file/generic.c +++ b/winpr/libwinpr/file/generic.c @@ -936,7 +936,7 @@ HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData) { if (isDir) { - char* name = strrchr(lpFileName, '/'); + const char* name = strrchr(lpFileName, '/'); if (!name) name = lpFileName; From 6d3beabd54065ad8e59ca4646e2b51af326d8fdb Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:15:46 +0200 Subject: [PATCH 10/12] Removed unused variables in tests. --- .../codec/test/TestFreeRDPCodecPlanar.c | 73 +------------------ libfreerdp/gdi/test/TestGdiBitBlt.c | 13 ---- libfreerdp/gdi/test/TestGdiLine.c | 42 ----------- .../primitives/test/TestPrimitivesAlphaComp.c | 55 ++++++-------- .../primitives/test/TestPrimitivesSet.c | 65 ++++++++++------- 5 files changed, 62 insertions(+), 186 deletions(-) diff --git a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c index 1bea9f04c..7b583fc02 100644 --- a/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c +++ b/libfreerdp/codec/test/TestFreeRDPCodecPlanar.c @@ -2795,77 +2795,6 @@ static const BYTE TEST_RLE_UNCOMPRESSED_BITMAP_16BPP[2048] = "\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42" "\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\x08\x42\xFF\xFF"; -/** - * [MS-RDPEGDI] Test Bitmap 32x32 (RLE Encoded, not RDP6) - */ - -static const BYTE TEST_RLE_COMPRESSED_BITMAP[220] = - "\x85\xFF\xFF\x99\xD6\x99\xD6\x99\xD6\x99\xD6\x06\x8B\x99\xD6\x99" - "\xD6\x99\xD6\x10\x84\x08\x42\x08\x42\x10\x84\x99\xD6\x99\xD6\x99" - "\xD6\x99\xD6\x06\x84\x99\xD6\x99\xD6\x99\xD6\xFF\xFF\x16\x69\x99" - "\xD6\x06\x69\x99\xD6\x04\xCC\x89\x52\x03\x6E\xFF\xFF\x02\x6E\x08" - "\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18\xC6\x01\x81\x08\x42\xCE" - "\x66\x29\x02\xCD\x89\x52\x03\x88\x10\x84\x99\xD6\x99\xD6\x99\xD6" - "\x00\x00\x00\x00\x00\x00\x00\x00\xD8\x99\xD6\x03\xF8\x01\x00\x00" - "\x00\x00\xF0\x66\x99\xD6\x05\x6A\x99\xD6\x00\xC4\xCC\x89\x52\x03" - "\x6E\xFF\xFF\x02\x6E\x08\x42\x01\x70\x08\x42\x71\xFF\xFF\xCE\x18" - "\xC6\x01\x81\x08\x42\xCE\x66\x29\x02\xCD\x89\x52\x03\x00\x04\xD6" - "\x99\xD6\xC3\x80\x61\x00\xA5\x80\x40\xEC\x52\x00\x5A\x00\x2D\x00" - "\x24\x00\x12\x00\x24\x00\x12\x00\x5A\x00\x2D\x00\xA5\x80\x52\x00" - "\xC3\x80\x61\x00\x00\x00\x00\x00\xCC\x89\x52\x03\x6E\xFF\xFF\x02" - "\xCB\x18\xC6\x84\x08\x42\x08\x42\x08\x42\xFF\xFF"; - -static const BYTE TEST_RLE_SCANLINE_UNCOMPRESSED[12] = - "AAAABBCCCCCD"; - -/** - * [MS-RDPEGDI] 3.1.9.2.1 Encoding Run-Length Sequences - */ - -/* Scanline Absolute Values */ - -static const BYTE TEST_RDP6_SCANLINES_ABSOLUTE[3][6] = -{ - { 255, 255, 255, 255, 254, 253 }, - { 254, 192, 132, 96, 75, 25 }, - { 253, 140, 62, 14, 135, 193 } -}; - -/* Scanline Delta Values */ -static const int TEST_RDP6_SCANLINES_DELTA[3][6] = -{ - { 255, 255, 255, 255, 254, 253 }, - { -1, -63, -123, -159, -179, -228 }, - { -1, -52, -70, -82, 60, 168 } -}; - -/* Scanline Delta Values (1-byte two's complement) */ - -static const BYTE TEST_RDP6_SCANLINES_DELTA_2C[3][6] = -{ - { -1, -1, -1, -1, -2, -3 }, - { -1, -63, -123, 97, 77, 28 }, - { -1, -52, -70, -82, 60, -88 } -}; - -/* Scanline Delta Values (1-byte two's complement, encoded) */ - -static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED[3][6] = -{ - { -1, -1, -1, -1, -2, -3 }, - { -1, 125, 11, -62, -102, 56 }, - { 1, 103, -117, -93, 120, -81 } -}; - -/* Scanline Delta Values (1-byte two's complement, encoded, unsigned) */ - -static const BYTE TEST_RDP6_SCANLINES_DELTA_2C_ENCODED_UNSIGNED[3][6] = -{ - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFD }, - { 0x01, 0x7D, 0xF5, 0xC2, 0x9A, 0x38 }, - { 0x01, 0x67, 0x8B, 0xA3, 0x78, 0xAF } -}; - static const UINT32 colorFormatList[] = { PIXEL_FORMAT_RGB15, @@ -3020,7 +2949,7 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, UINT32 compressedSize; const UINT32 fill = j; const UINT32 color = FreeRDPGetColor(srcFormat, (fill >> 8) & 0xF, (fill >> 4) & 0xF, - (fill) & 0xF, 0xFF); + (fill) & 0xF, 0xFF); const UINT32 width = i; const UINT32 height = i; BOOL failed = TRUE; diff --git a/libfreerdp/gdi/test/TestGdiBitBlt.c b/libfreerdp/gdi/test/TestGdiBitBlt.c index dc0530a8b..c04a68cfa 100644 --- a/libfreerdp/gdi/test/TestGdiBitBlt.c +++ b/libfreerdp/gdi/test/TestGdiBitBlt.c @@ -56,19 +56,6 @@ static const BYTE bmp_DST[256] = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00" }; -/* pattern bitmap (8x8) */ -static const BYTE bmp_PAT[64] = -{ - "\xFF\xFF\x00\x00\xFF\xFF\x00\x00" - "\xFF\xFF\x00\x00\xFF\xFF\x00\x00" - "\x00\x00\xFF\xFF\x00\x00\xFF\xFF" - "\x00\x00\xFF\xFF\x00\x00\xFF\xFF" - "\xFF\xFF\x00\x00\xFF\xFF\x00\x00" - "\xFF\xFF\x00\x00\xFF\xFF\x00\x00" - "\x00\x00\xFF\xFF\x00\x00\xFF\xFF" - "\x00\x00\xFF\xFF\x00\x00\xFF\xFF" -}; - /* SRCCOPY (0x00CC0020) */ static const BYTE bmp_SRCCOPY[256] = { diff --git a/libfreerdp/gdi/test/TestGdiLine.c b/libfreerdp/gdi/test/TestGdiLine.c index f5d1f3d9b..fc494c266 100644 --- a/libfreerdp/gdi/test/TestGdiLine.c +++ b/libfreerdp/gdi/test/TestGdiLine.c @@ -572,48 +572,6 @@ static const BYTE line_to_R2_WHITE[256] = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" }; -/* PolylineTo() Test Data */ - -static const BYTE polyline_to_case_1[256] = -{ - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF" - "\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF" - "\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static const BYTE polyline_to_case_2[256] = -{ - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\xFF\xFF" - "\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" -}; - #define LINTETO_NUMBER 11 struct ropMap { diff --git a/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c b/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c index 92fe2c9a8..16a72f3b0 100644 --- a/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c +++ b/libfreerdp/primitives/test/TestPrimitivesAlphaComp.c @@ -19,11 +19,6 @@ #include "prim_test.h" -static const int ALPHA_PRETEST_ITERATIONS = 5000000; -static const float TEST_TIME = 5.0; - -static const int block_size[] = { 4, 64, 256 }; -#define NUM_BLOCK_SIZES (sizeof(block_size)/sizeof(int)) #define MAX_BLOCK_SIZE 256 #define SIZE_SQUARED (MAX_BLOCK_SIZE*MAX_BLOCK_SIZE) @@ -36,7 +31,6 @@ static const int block_size[] = { 4, 64, 256 }; static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_, UINT32 _y_) { const BYTE* addr = _addr_ + _x_ * sizeof(UINT32) + _y_ * _bytes_; - return (const UINT32*)addr; } @@ -51,8 +45,8 @@ static inline const UINT32* PIXEL(const BYTE* _addr_, UINT32 _bytes_, UINT32 _x_ /* ------------------------------------------------------------------------- */ static UINT32 alpha_add( - UINT32 c1, - UINT32 c2) + UINT32 c1, + UINT32 c2) { UINT32 a1 = ALF(c1); UINT32 r1 = RED(c1); @@ -71,8 +65,8 @@ static UINT32 alpha_add( /* ------------------------------------------------------------------------- */ static UINT32 colordist( - UINT32 c1, - UINT32 c2) + UINT32 c1, + UINT32 c2) { int d, maxd = 0; d = ABS((INT32)(ALF(c1) - ALF(c2))); @@ -96,11 +90,12 @@ static UINT32 colordist( /* ------------------------------------------------------------------------- */ static BOOL check(const BYTE* pSrc1, UINT32 src1Step, - const BYTE* pSrc2, UINT32 src2Step, - BYTE* pDst, UINT32 dstStep, - UINT32 width, UINT32 height) + const BYTE* pSrc2, UINT32 src2Step, + BYTE* pDst, UINT32 dstStep, + UINT32 width, UINT32 height) { UINT32 x, y; + for (y = 0; y < height; ++y) { for (x = 0; x < width; ++x) @@ -130,41 +125,39 @@ static BOOL test_alphaComp_func(void) BYTE ALIGN(dst1[DST_WIDTH * DST_HEIGHT * 4]); UINT32* ptr; UINT32 i; - winpr_RAND((BYTE*)src1, sizeof(src1)); - /* Special-case the first two values */ src1[0] &= 0x00FFFFFFU; src1[1] |= 0xFF000000U; winpr_RAND((BYTE*)src2, sizeof(src2)); - /* Set the second operand to fully-opaque. */ ptr = (UINT32*)src2; for (i = 0; i < sizeof(src2) / 4; ++i) *ptr++ |= 0xFF000000U; memset(dst1, 0, sizeof(dst1)); - status = generic->alphaComp_argb(src1, 4 * SRC1_WIDTH, - src2, 4 * SRC2_WIDTH, - dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT); + src2, 4 * SRC2_WIDTH, + dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT); + if (status != PRIMITIVES_SUCCESS) return FALSE; if (!check(src1, 4 * SRC1_WIDTH, - src2, 4 * SRC2_WIDTH, - dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) + src2, 4 * SRC2_WIDTH, + dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) return FALSE; status = optimized->alphaComp_argb((const BYTE*) src1, 4 * SRC1_WIDTH, - (const BYTE*) src2, 4 * SRC2_WIDTH, - (BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT); + (const BYTE*) src2, 4 * SRC2_WIDTH, + (BYTE*) dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT); + if (status != PRIMITIVES_SUCCESS) return FALSE; if (!check(src1, 4 * SRC1_WIDTH, - src2, 4 * SRC2_WIDTH, - dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) + src2, 4 * SRC2_WIDTH, + dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) return FALSE; return TRUE; @@ -184,7 +177,6 @@ static int test_alphaComp_speed(void) src1[0] &= 0x00FFFFFFU; src1[1] |= 0xFF000000U; winpr_RAND((BYTE*)src2, sizeof(src2)); - /* Set the second operand to fully-opaque. */ ptr = (UINT32*)src2; @@ -193,11 +185,11 @@ static int test_alphaComp_speed(void) memset(dst1, 0, sizeof(dst1)); if (!speed_test("add16s", "aligned", g_Iterations, - (speed_test_fkt)generic->alphaComp_argb, - (speed_test_fkt)optimized->alphaComp_argb, - src1, 4 * SRC1_WIDTH, - src2, 4 * SRC2_WIDTH, - dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) + (speed_test_fkt)generic->alphaComp_argb, + (speed_test_fkt)optimized->alphaComp_argb, + src1, 4 * SRC1_WIDTH, + src2, 4 * SRC2_WIDTH, + dst1, 4 * DST_WIDTH, TEST_WIDTH, TEST_HEIGHT)) return FALSE; return TRUE; @@ -206,6 +198,7 @@ static int test_alphaComp_speed(void) int TestPrimitivesAlphaComp(int argc, char* argv[]) { prim_test_setup(FALSE); + if (!test_alphaComp_func()) return -1; diff --git a/libfreerdp/primitives/test/TestPrimitivesSet.c b/libfreerdp/primitives/test/TestPrimitivesSet.c index ab903da5b..913bf802d 100644 --- a/libfreerdp/primitives/test/TestPrimitivesSet.c +++ b/libfreerdp/primitives/test/TestPrimitivesSet.c @@ -19,23 +19,17 @@ #include #include "prim_test.h" -static const int MEMSET8_PRETEST_ITERATIONS = 100000000; -static const int MEMSET32_PRETEST_ITERATIONS = 40000000; -static const float TEST_TIME = 1.0; - -static const int set_sizes[] = { 1, 4, 16, 32, 64, 256, 1024, 4096 }; -#define NUM_SET_SIZES (sizeof(set_sizes)/sizeof(int)) - /* ------------------------------------------------------------------------- */ static BOOL check8(const BYTE* src, UINT32 length, UINT32 offset, BYTE value) { UINT32 i; + for (i = 0; i < length; ++i) { if (src[offset + i] != value) { printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%02"PRIx8"\n", - offset, length, i + offset, src[i + offset]); + offset, length, i + offset, src[i + offset]); return FALSE; } } @@ -52,11 +46,12 @@ static BOOL test_set8u_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 3, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = generic->set_8u(0xa5, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -68,11 +63,12 @@ static BOOL test_set8u_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 3, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = optimized->set_8u(0xa5, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -91,13 +87,14 @@ static BOOL test_set8u_speed(void) BYTE value; UINT32 x; - for (x=0; x<16; x++) + for (x = 0; x < 16; x++) { winpr_RAND(&value, sizeof(value)); + if (!speed_test("set_8u", "", g_Iterations, - (speed_test_fkt)generic->set_8u, - (speed_test_fkt)optimized->set_8u, - value, dest + x, x)) + (speed_test_fkt)generic->set_8u, + (speed_test_fkt)optimized->set_8u, + value, dest + x, x)) return FALSE; } @@ -107,12 +104,13 @@ static BOOL test_set8u_speed(void) static BOOL check32s(const INT32* src, UINT32 length, UINT32 offset, INT32 value) { UINT32 i; + for (i = 0; i < length; ++i) { if (src[offset + i] != value) { printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n", - offset, length, i + offset, src[i + offset]); + offset, length, i + offset, src[i + offset]); return FALSE; } } @@ -131,11 +129,12 @@ static BOOL test_set32s_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 0, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = generic->set_32s(value, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -147,11 +146,12 @@ static BOOL test_set32s_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 0, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = optimized->set_32s(value, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -166,12 +166,13 @@ static BOOL test_set32s_func(void) static BOOL check32u(const UINT32* src, UINT32 length, UINT32 offset, UINT32 value) { UINT32 i; + for (i = 0; i < length; ++i) { if (src[offset + i] != value) { printf("SET8U FAILED: off=%"PRIu32" len=%"PRIu32" dest[%"PRIu32"]=0x%08"PRIx32"\n", - offset, length, i + offset, src[i + offset]); + offset, length, i + offset, src[i + offset]); return FALSE; } } @@ -190,11 +191,12 @@ static BOOL test_set32u_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 0, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = generic->set_32u(value, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -206,11 +208,12 @@ static BOOL test_set32u_func(void) for (off = 0; off < 16; ++off) { UINT32 len; - memset(dest, 0, sizeof(dest)); + for (len = 1; len < 48 - off; ++len) { status = optimized->set_32u(value, dest + off, len); + if (status != PRIMITIVES_SUCCESS) return FALSE; @@ -229,13 +232,14 @@ static BOOL test_set32u_speed(void) BYTE value; UINT32 x; - for (x=0; x<16; x++) + for (x = 0; x < 16; x++) { winpr_RAND(&value, sizeof(value)); + if (!speed_test("set_32u", "", g_Iterations, - (speed_test_fkt)generic->set_32u, - (speed_test_fkt)optimized->set_32u, - value, dest + x, x)) + (speed_test_fkt)generic->set_32u, + (speed_test_fkt)optimized->set_32u, + value, dest + x, x)) return FALSE; } @@ -249,13 +253,14 @@ static BOOL test_set32s_speed(void) BYTE value; UINT32 x; - for (x=0; x<16; x++) + for (x = 0; x < 16; x++) { winpr_RAND(&value, sizeof(value)); + if (!speed_test("set_32s", "", g_Iterations, - (speed_test_fkt)generic->set_32s, - (speed_test_fkt)optimized->set_32s, - value, dest + x, x)) + (speed_test_fkt)generic->set_32s, + (speed_test_fkt)optimized->set_32s, + value, dest + x, x)) return FALSE; } @@ -268,8 +273,10 @@ int TestPrimitivesSet(int argc, char* argv[]) if (!test_set8u_func()) return -1; + if (!test_set32s_func()) return -1; + if (!test_set32u_func()) return -1; @@ -277,8 +284,10 @@ int TestPrimitivesSet(int argc, char* argv[]) { if (!test_set8u_speed()) return -1; + if (!test_set32s_speed()) return -1; + if (!test_set32u_speed()) return -1; } From 33be80cb413dd8694b1cb1c5fbc3ed1d078cd9bd Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:16:13 +0200 Subject: [PATCH 11/12] Removed unused variables. --- libfreerdp/core/gateway/rpc.c | 16 ---------------- libfreerdp/core/gateway/rts.c | 19 ------------------- 2 files changed, 35 deletions(-) diff --git a/libfreerdp/core/gateway/rpc.c b/libfreerdp/core/gateway/rpc.c index 38978171f..6b770ff9d 100644 --- a/libfreerdp/core/gateway/rpc.c +++ b/libfreerdp/core/gateway/rpc.c @@ -49,11 +49,6 @@ #define TAG FREERDP_TAG("core.gateway.rpc") -/* Security Verification Trailer Signature */ - -static const rpc_sec_verification_trailer RPC_SEC_VERIFICATION_TRAILER = -{ { 0x8a, 0xe3, 0x13, 0x71, 0x02, 0xf4, 0x36, 0x71 } }; - static const char* PTYPE_STRINGS[] = { "PTYPE_REQUEST", @@ -80,17 +75,6 @@ static const char* PTYPE_STRINGS[] = "" }; -static const RPC_SECURITY_PROVIDER_INFO RPC_SECURITY_PROVIDER_INFO_TABLE[] = -{ - { RPC_C_AUTHN_NONE, TRUE, -1 }, - { RPC_C_AUTHN_GSS_NEGOTIATE, TRUE, -1 }, - { RPC_C_AUTHN_WINNT, FALSE, 3 }, - { RPC_C_AUTHN_GSS_SCHANNEL, TRUE, -1 }, - { RPC_C_AUTHN_GSS_KERBEROS, TRUE, -1 }, - { RPC_C_AUTHN_DEFAULT, -1, -1 }, - { 0, -1, -1 } -}; - /** * [MS-RPCH]: Remote Procedure Call over HTTP Protocol Specification: * http://msdn.microsoft.com/en-us/library/cc243950/ diff --git a/libfreerdp/core/gateway/rts.c b/libfreerdp/core/gateway/rts.c index 07d2324c0..bcf7c5bdb 100644 --- a/libfreerdp/core/gateway/rts.c +++ b/libfreerdp/core/gateway/rts.c @@ -34,25 +34,6 @@ #define TAG FREERDP_TAG("core.gateway.rts") -static const char* const RTS_CMD_STRINGS[] = -{ - "ReceiveWindowSize", - "FlowControlAck", - "ConnectionTimeout", - "Cookie", - "ChannelLifetime", - "ClientKeepalive", - "Version", - "Empty", - "Padding", - "NegativeANCE", - "ANCE", - "ClientAddress", - "AssociationGroupId", - "Destination", - "PingTrafficSentNotify" -}; - /** * RTS PDU Header * From 5b0b18ae71bbe7a3007dea909f9554ba975315b8 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 23 Aug 2018 13:25:46 +0200 Subject: [PATCH 12/12] Device name now const. --- include/freerdp/channels/rdpdr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freerdp/channels/rdpdr.h b/include/freerdp/channels/rdpdr.h index 6e99a4e32..b64ca26c4 100644 --- a/include/freerdp/channels/rdpdr.h +++ b/include/freerdp/channels/rdpdr.h @@ -325,7 +325,7 @@ struct _DEVICE UINT32 id; UINT32 type; - char* name; + const char* name; wStream* data; pcIRPRequest IRPRequest;