From e7814d58554d5859b59221b3f6af00fbddaa9c8d Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 1 Mar 2016 11:39:21 +0100 Subject: [PATCH] Fixed stream API for Stream_Copy. --- channels/drdynvc/client/drdynvc_main.c | 4 ++-- channels/tsmf/client/tsmf_ifman.c | 2 +- libfreerdp/core/fastpath.c | 12 ++++++------ libfreerdp/core/message.c | 2 +- winpr/include/winpr/stream.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 29111fde8..676dfb960 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -958,8 +958,8 @@ static UINT drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int c Stream_Write_UINT8(data_out, 0x10 | cbChId); Stream_SetPosition(s, 1); - Stream_Copy(data_out, s, pos - 1); - + Stream_Copy(s, data_out, pos - 1); + if (channel_status == CHANNEL_RC_OK) { WLog_DBG(TAG, "channel created"); diff --git a/channels/tsmf/client/tsmf_ifman.c b/channels/tsmf/client/tsmf_ifman.c index b4a84dfdb..4c9da7421 100644 --- a/channels/tsmf/client/tsmf_ifman.c +++ b/channels/tsmf/client/tsmf_ifman.c @@ -79,7 +79,7 @@ UINT tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman) if (!Stream_EnsureRemainingCapacity(ifman->output, ifman->input_size + 4)) return ERROR_OUTOFMEMORY; pos = Stream_GetPosition(ifman->output); - Stream_Copy(ifman->output, ifman->input, ifman->input_size); + Stream_Copy(ifman->input, ifman->output, ifman->input_size); Stream_SetPosition(ifman->output, pos); if (Stream_GetRemainingLength(ifman->output) < 4) diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index 79fa00d6e..411d0e960 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -45,7 +45,7 @@ * Fast-Path packet format is defined in [MS-RDPBCGR] 2.2.9.1.2, which revises * server output packets from the first byte with the goal of improving * bandwidth. - * + * * Slow-Path packet always starts with TPKT header, which has the first * byte 0x03, while Fast-Path packet starts with 2 zero bits in the first * two less significant bits of the first byte. @@ -282,7 +282,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s if (!fastpath_recv_update_synchronize(fastpath, s)) WLog_ERR(TAG, "fastpath_recv_update_synchronize failure but we continue"); else - IFCALL(update->Synchronize, context); + IFCALL(update->Synchronize, context); break; case FASTPATH_UPDATETYPE_SURFCMDS: @@ -463,7 +463,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) Stream_SetPosition(fastpath->updateData, 0); - Stream_Copy(fastpath->updateData, cs, size); + Stream_Copy(cs, fastpath->updateData, size); } else if (fragmentation == FASTPATH_FRAGMENT_NEXT) { @@ -491,7 +491,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) goto out_fail; } - Stream_Copy(fastpath->updateData, cs, size); + Stream_Copy(cs, fastpath->updateData, size); } else if (fragmentation == FASTPATH_FRAGMENT_LAST) { @@ -519,7 +519,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) goto out_fail; } - Stream_Copy(fastpath->updateData, cs, size); + Stream_Copy(cs, fastpath->updateData, size); Stream_SealLength(fastpath->updateData); Stream_SetPosition(fastpath->updateData, 0); @@ -546,7 +546,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) out_fail: if (cs != s) { - Stream_Release(cs); + Stream_Release(cs); } return -1; diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index 76e0a69a9..a56d1b58d 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -192,7 +192,7 @@ static BOOL update_message_SurfaceCommand(rdpContext* context, wStream* s) if (!wParam) return FALSE; - Stream_Copy(wParam, s, Stream_GetRemainingLength(s)); + Stream_Copy(s, wParam, Stream_GetRemainingLength(s)); Stream_SetPosition(wParam, 0); return MessageQueue_Post(context->update->queue, (void*) context, diff --git a/winpr/include/winpr/stream.h b/winpr/include/winpr/stream.h index 50f1aa904..7571a1380 100644 --- a/winpr/include/winpr/stream.h +++ b/winpr/include/winpr/stream.h @@ -240,7 +240,7 @@ static INLINE void Stream_Fill(wStream* _s, int _v, size_t _n) Stream_Seek(_s, _n); } -static INLINE void Stream_Copy(wStream* _dst, wStream* _src, size_t _n) +static INLINE void Stream_Copy(wStream* _src, wStream* _dst, size_t _n) { memcpy(_dst->pointer, _src->pointer, _n); Stream_Seek(_dst, _n);