Fixed stream API for Stream_Copy.
authorArmin Novak <armin.novak@thincast.com>
Tue, 1 Mar 2016 10:39:21 +0000 (11:39 +0100)
committerArmin Novak <armin.novak@thincast.com>
Tue, 1 Mar 2016 11:57:48 +0000 (12:57 +0100)
channels/drdynvc/client/drdynvc_main.c
channels/tsmf/client/tsmf_ifman.c
libfreerdp/core/fastpath.c
libfreerdp/core/message.c
winpr/include/winpr/stream.h

index 29111fd..676dfb9 100644 (file)
@@ -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");
index b4a84df..4c9da74 100644 (file)
@@ -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)
index 79fa00d..411d0e9 100644 (file)
@@ -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;
index 76e0a69..a56d1b5 100644 (file)
@@ -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,
index 50f1aa9..7571a13 100644 (file)
@@ -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);