|
|
9ae3a8 |
From 4c2f805375c0dc66cdd2a30b29c03021833e02ca Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 8 Feb 2018 17:50:19 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 05/27] buffer: add buffer_move_empty
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20180208175041.5634-6-berrange@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78934
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 05/27] buffer: add buffer_move_empty
|
|
|
9ae3a8 |
Bugzilla: 1527405
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Peter Lieven <pl@kamp.de>
|
|
|
9ae3a8 |
Reviewed-by: Daniel Berrange <berrange@redhat.com>
|
|
|
9ae3a8 |
Message-id: 1446203414-4013-4-git-send-email-kraxel@redhat.com
|
|
|
9ae3a8 |
(cherry picked from commit 4d1eb5fdb141c9100eb82e1dc7d4547fb1decd8b)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
include/qemu/buffer.h
|
|
|
9ae3a8 |
util/buffer.c - APIs are still in vnc.{c,h}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
ui/vnc.c | 15 +++++++++++++++
|
|
|
9ae3a8 |
ui/vnc.h | 1 +
|
|
|
9ae3a8 |
2 files changed, 16 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/ui/vnc.c b/ui/vnc.c
|
|
|
9ae3a8 |
index 9047862..b520f58 100644
|
|
|
9ae3a8 |
--- a/ui/vnc.c
|
|
|
9ae3a8 |
+++ b/ui/vnc.c
|
|
|
9ae3a8 |
@@ -516,6 +516,21 @@ void buffer_advance(Buffer *buf, size_t len)
|
|
|
9ae3a8 |
buf->offset -= len;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+void buffer_move_empty(Buffer *to, Buffer *from)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ assert(to->offset == 0);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ g_free(to->buffer);
|
|
|
9ae3a8 |
+ to->offset = from->offset;
|
|
|
9ae3a8 |
+ to->capacity = from->capacity;
|
|
|
9ae3a8 |
+ to->buffer = from->buffer;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ from->offset = 0;
|
|
|
9ae3a8 |
+ from->capacity = 0;
|
|
|
9ae3a8 |
+ from->buffer = NULL;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static void vnc_desktop_resize(VncState *vs)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
if (vs->csock == -1 || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {
|
|
|
9ae3a8 |
diff --git a/ui/vnc.h b/ui/vnc.h
|
|
|
9ae3a8 |
index d1badbb..c300660 100644
|
|
|
9ae3a8 |
--- a/ui/vnc.h
|
|
|
9ae3a8 |
+++ b/ui/vnc.h
|
|
|
9ae3a8 |
@@ -548,6 +548,7 @@ void buffer_free(Buffer *buffer);
|
|
|
9ae3a8 |
void buffer_append(Buffer *buffer, const void *data, size_t len);
|
|
|
9ae3a8 |
void buffer_advance(Buffer *buf, size_t len);
|
|
|
9ae3a8 |
uint8_t *buffer_end(Buffer *buffer);
|
|
|
9ae3a8 |
+void buffer_move_empty(Buffer *to, Buffer *from);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Misc helpers */
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|