guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [01/26] incubator-guacamole-server git commit: GUACAMOLE-25: Implement buffer attachment in Stream_New() and Stream_Free() compatibility functions.
Date Thu, 02 Jun 2016 18:45:08 GMT
Repository: incubator-guacamole-server
Updated Branches:
  refs/heads/master ec93a2989 -> 995b6d669


GUACAMOLE-25: Implement buffer attachment in Stream_New() and Stream_Free() compatibility
functions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/f1d4393e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/f1d4393e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/f1d4393e

Branch: refs/heads/master
Commit: f1d4393eb8cedeec0214c497c73a528806ae2118
Parents: 1393358
Author: Michael Jumper <mjumper@apache.org>
Authored: Mon May 9 22:18:49 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Wed May 25 13:50:28 2016 -0700

----------------------------------------------------------------------
 src/protocols/rdp/compat/winpr-stream.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/f1d4393e/src/protocols/rdp/compat/winpr-stream.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/compat/winpr-stream.c b/src/protocols/rdp/compat/winpr-stream.c
index 528177d..8be4546 100644
--- a/src/protocols/rdp/compat/winpr-stream.c
+++ b/src/protocols/rdp/compat/winpr-stream.c
@@ -22,17 +22,26 @@
 #include "winpr-stream.h"
 #include "winpr-wtypes.h"
 
-/*
- * NOTE: Because the old API did not support local allocation of the buffer
- *       for each stream, these compatibility implementations ignore
- *       the parameters of Stream_New() and Stream_Free() that provide them.
- */
-
 wStream* Stream_New(BYTE* buffer, size_t size) {
-    return stream_new(size);
+
+    /* If no buffer is provided, allocate a new stream of the given size */
+    if (buffer == NULL)
+       return stream_new(size);
+
+    /* Otherwise allocate an empty stream and assign the given buffer */
+    wStream* stream = stream_new(0);
+    stream_attach(stream, buffer, size);
+    return stream;
+
 }
 
 void Stream_Free(wStream* s, BOOL bFreeBuffer) {
+
+    /* Disassociate buffer if it will be freed externally */
+    if (!bFreeBuffer)
+        stream_detach(s);
+
     stream_free(s);
+
 }
 


Mime
View raw message