From: Anthony Liguori <aliguori@us.ibm.com>
To: Tim Hardeck <thardeck@suse.de>, qemu-devel@nongnu.org
Cc: stefanha@gmail.com, github@martintribe.org, alevy@redhat.com,
kraxel@redhat.com, corentin.chary@gmail.com
Subject: Re: [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function
Date: Mon, 07 Jan 2013 13:38:06 -0600 [thread overview]
Message-ID: <87vcb8u6ld.fsf@codemonkey.ws> (raw)
In-Reply-To: <1357133386-7643-2-git-send-email-thardeck@suse.de>
Tim Hardeck <thardeck@suse.de> writes:
> Following Anthony Liguori's Websocket implementation I have added the
> buffer_advance function to VNC and replaced all related buffer memmove
> operations with it.
>
> Signed-off-by: Tim Hardeck <thardeck@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Regards,
Anthony Liguori
> ---
> ui/vnc.c | 13 +++++++++----
> ui/vnc.h | 1 +
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 8912b78..ddf01f1 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -510,6 +510,13 @@ void buffer_append(Buffer *buffer, const void *data, size_t len)
> buffer->offset += len;
> }
>
> +void buffer_advance(Buffer *buf, size_t len)
> +{
> + memmove(buf->buffer, buf->buffer + len,
> + (buf->offset - len));
> + buf->offset -= len;
> +}
> +
> static void vnc_desktop_resize(VncState *vs)
> {
> DisplayState *ds = vs->ds;
> @@ -1166,8 +1173,7 @@ static long vnc_client_write_plain(VncState *vs)
> if (!ret)
> return 0;
>
> - memmove(vs->output.buffer, vs->output.buffer + ret, (vs->output.offset - ret));
> - vs->output.offset -= ret;
> + buffer_advance(&vs->output, ret);
>
> if (vs->output.offset == 0) {
> qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
> @@ -1313,8 +1319,7 @@ void vnc_client_read(void *opaque)
> }
>
> if (!ret) {
> - memmove(vs->input.buffer, vs->input.buffer + len, (vs->input.offset - len));
> - vs->input.offset -= len;
> + buffer_advance(&vs->input, len);
> } else {
> vs->read_handler_expect = ret;
> }
> diff --git a/ui/vnc.h b/ui/vnc.h
> index 8b40f09..5059cbe 100644
> --- a/ui/vnc.h
> +++ b/ui/vnc.h
> @@ -510,6 +510,7 @@ void buffer_reserve(Buffer *buffer, size_t len);
> void buffer_reset(Buffer *buffer);
> void buffer_free(Buffer *buffer);
> void buffer_append(Buffer *buffer, const void *data, size_t len);
> +void buffer_advance(Buffer *buf, size_t len);
>
>
> /* Misc helpers */
> --
> 1.7.10.4
next prev parent reply other threads:[~2013-01-07 19:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-02 13:29 [Qemu-devel] [PATCH 0/3 v5] vnc: added initial websocket protocol support Tim Hardeck
2013-01-02 13:29 ` [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function Tim Hardeck
2013-01-07 19:38 ` Anthony Liguori [this message]
2013-01-02 13:29 ` [Qemu-devel] [PATCH 2/3] vnc: added initial websocket protocol support Tim Hardeck
2013-01-04 20:20 ` Blue Swirl
2013-01-05 18:02 ` Tim Hardeck
2013-01-07 19:52 ` Anthony Liguori
2013-01-07 23:57 ` Tim Hardeck
2013-01-08 0:38 ` Anthony Liguori
2013-01-11 14:12 ` Tim Hardeck
2013-01-02 13:29 ` [Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals Tim Hardeck
-- strict thread matches above, loose matches on Subject: below --
2013-01-21 10:04 [Qemu-devel] [PATCH 0/3 v7] vnc: added initial websocket protocol support Tim Hardeck
2013-01-21 10:04 ` [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function Tim Hardeck
2013-01-08 10:27 [Qemu-devel] [PATCH 0/3 v6] vnc: added initial websocket protocol support Tim Hardeck
2013-01-08 10:27 ` [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function Tim Hardeck
2012-12-07 14:56 [Qemu-devel] [PATCH 0/3 v4] vnc: added initial websocket protocol support Tim Hardeck
2012-12-07 14:56 ` [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function Tim Hardeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vcb8u6ld.fsf@codemonkey.ws \
--to=aliguori@us.ibm.com \
--cc=alevy@redhat.com \
--cc=corentin.chary@gmail.com \
--cc=github@martintribe.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=thardeck@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).