summaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-02 15:58:47 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-02 15:58:47 +0000
commit8906428682bf2e4f60ea7d5fa98f75fde9194106 (patch)
tree039c44a7f30797652934a7ca1b2447619e848331 /vnc.c
parentfb437313284d74bc89060b8de5b9899bd9d1d3c3 (diff)
Move buffer functions up (Alexander Graf)
We will need to use buffer functions in code that will end up being below the current buffer functions. In order to not introduce any function stub defines, let's just move them up. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6497 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/vnc.c b/vnc.c
index be6f2e8e7..b1e08a5f1 100644
--- a/vnc.c
+++ b/vnc.c
@@ -263,6 +263,39 @@ static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
vnc_write_s32(vs, encoding);
}
+static void buffer_reserve(Buffer *buffer, size_t len)
+{
+ if ((buffer->capacity - buffer->offset) < len) {
+ buffer->capacity += (len + 1024);
+ buffer->buffer = qemu_realloc(buffer->buffer, buffer->capacity);
+ if (buffer->buffer == NULL) {
+ fprintf(stderr, "vnc: out of memory\n");
+ exit(1);
+ }
+ }
+}
+
+static int buffer_empty(Buffer *buffer)
+{
+ return buffer->offset == 0;
+}
+
+static uint8_t *buffer_end(Buffer *buffer)
+{
+ return buffer->buffer + buffer->offset;
+}
+
+static void buffer_reset(Buffer *buffer)
+{
+ buffer->offset = 0;
+}
+
+static void buffer_append(Buffer *buffer, const void *data, size_t len)
+{
+ memcpy(buffer->buffer + buffer->offset, data, len);
+ buffer->offset += len;
+}
+
static void vnc_dpy_resize(DisplayState *ds)
{
int size_changed;
@@ -598,39 +631,6 @@ static int vnc_listen_poll(void *opaque)
return 0;
}
-static void buffer_reserve(Buffer *buffer, size_t len)
-{
- if ((buffer->capacity - buffer->offset) < len) {
- buffer->capacity += (len + 1024);
- buffer->buffer = qemu_realloc(buffer->buffer, buffer->capacity);
- if (buffer->buffer == NULL) {
- fprintf(stderr, "vnc: out of memory\n");
- exit(1);
- }
- }
-}
-
-static int buffer_empty(Buffer *buffer)
-{
- return buffer->offset == 0;
-}
-
-static uint8_t *buffer_end(Buffer *buffer)
-{
- return buffer->buffer + buffer->offset;
-}
-
-static void buffer_reset(Buffer *buffer)
-{
- buffer->offset = 0;
-}
-
-static void buffer_append(Buffer *buffer, const void *data, size_t len)
-{
- memcpy(buffer->buffer + buffer->offset, data, len);
- buffer->offset += len;
-}
-
/* audio */
static void audio_capture_notify(void *opaque, audcnotification_e cmd)
{