[Spice-commits] 12 commits - client/jpeg_decoder.cpp client/red_channel.cpp client/windows client/x11 common/bitops.h common/canvas_base.c common/canvas_utils.c common/glc.c common/gl_utils.h common/Makefile.am common/ogl_ctx.c common/pixman_utils.c common/quic.c common/quic_family_tmpl.c common/region.c common/rop3.c common/spice_common.h configure.ac server/main_channel.c server/mjpeg_encoder.c server/red_channel.c server/red_dispatcher.c server/reds.c server/reds_gl_canvas.c server/reds_sw_canvas.c server/red_worker.c server/red_worker.h
Christophe Fergau
teuf at kemper.freedesktop.org
Tue May 3 05:48:23 PDT 2011
client/jpeg_decoder.cpp | 2
client/red_channel.cpp | 2
client/windows/redc.vcproj | 8 +--
client/x11/platform_utils.h | 6 --
common/Makefile.am | 1
common/bitops.h | 89 ++++++++++++++++++++++++++++++++++++++++++++
common/canvas_base.c | 14 ------
common/canvas_utils.c | 8 ---
common/gl_utils.h | 58 +---------------------------
common/glc.c | 13 ------
common/ogl_ctx.c | 7 ---
common/pixman_utils.c | 15 -------
common/quic.c | 14 ------
common/quic_family_tmpl.c | 4 -
common/region.c | 5 --
common/rop3.c | 16 +------
common/spice_common.h | 32 ++++++---------
configure.ac | 12 -----
server/main_channel.c | 7 +++
server/mjpeg_encoder.c | 6 +-
server/red_channel.c | 10 ++--
server/red_dispatcher.c | 5 +-
server/red_worker.c | 14 +++---
server/red_worker.h | 6 +-
server/reds.c | 18 ++++----
server/reds_gl_canvas.c | 2
server/reds_sw_canvas.c | 2
27 files changed, 166 insertions(+), 210 deletions(-)
New commits:
commit 68c6014ff0a384cde8fb158456804525e9ac653d
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 16:43:48 2011 +0200
move get_time_stamp to main_channel.c
There is only one user of get_time_stamp from spice_common.h so
it's not really useful to keep it there.
diff --git a/common/spice_common.h b/common/spice_common.h
index d324ca1..bc74486 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -63,11 +63,4 @@
} \
} while (0)
-static inline uint64_t get_time_stamp(void)
-{
- struct timespec time_space;
- clock_gettime(CLOCK_MONOTONIC, &time_space);
- return time_space.tv_sec * 1000 * 1000 * 1000 + time_space.tv_nsec;
-}
-
#endif
diff --git a/server/main_channel.c b/server/main_channel.c
index e0fa1e4..1a6a89c 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -489,6 +489,13 @@ void main_channel_push_notify(Channel *channel, uint8_t *mess, const int mess_le
red_channel_pipe_add_push(&main_chan->base, &item->base);
}
+static uint64_t get_time_stamp(void)
+{
+ struct timespec time_space;
+ clock_gettime(CLOCK_MONOTONIC, &time_space);
+ return time_space.tv_sec * 1000 * 1000 * 1000 + time_space.tv_nsec;
+}
+
static void main_channel_marshall_notify(SpiceMarshaller *m, NotifyPipeItem *item)
{
SpiceMsgNotify notify;
commit 54f028a01d691c4b13c46a77c2ad33b03419f8b1
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 16:41:28 2011 +0200
use standard do { } while (0) for spice_common.h macros
diff --git a/common/spice_common.h b/common/spice_common.h
index ed28689..d324ca1 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -28,40 +28,40 @@
abort(); \
}
-#define PANIC(format, ...) { \
+#define PANIC(format, ...) do { \
printf("%s: panic: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
- abort(); \
-}
+ abort(); \
+} while (0)
-#define PANIC_ON(x) if ((x)) { \
+#define PANIC_ON(x) if ((x)) { \
printf("%s: panic %s\n", __FUNCTION__, #x); \
abort(); \
}
-#define red_error(format, ...) { \
+#define red_error(format, ...) do { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
abort(); \
-}
-
+} while (0)
#define red_printf(format, ...) \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ )
-#define red_printf_once(format, ...) { \
+#define red_printf_once(format, ...) do { \
static int do_print = TRUE; \
if (do_print) { \
do_print = FALSE; \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
-}
+} while (0)
+
#define WARN(format, ...) red_printf("warning: "format"\n", ##__VA_ARGS__ );
#define WARN_ONCE red_printf_once
-#define red_printf_some(every, format, ...) { \
+#define red_printf_some(every, format, ...) do { \
static int count = 0; \
if (count++ % (every) == 0) { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
-}
+} while (0)
static inline uint64_t get_time_stamp(void)
{
commit 2a611d9955546dc52be37651e6f7b6f7f03c7aa4
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 16:39:29 2011 +0200
move WARN and WARN_ONCE to spice_common.h
diff --git a/common/glc.c b/common/glc.c
index 0396fc9..1c81dd8 100644
--- a/common/glc.c
+++ b/common/glc.c
@@ -39,14 +39,7 @@
#include "mem.h"
#include "glc.h"
#include "gl_utils.h"
-
-#define WARN_ONCE(x) { \
- static int warn = TRUE; \
- if (warn) { \
- printf x; \
- warn = FALSE; \
- } \
-}
+#include "spice_common.h"
#define TESS_VERTEX_ALLOC_BUNCH 20
@@ -1015,7 +1008,7 @@ void _glc_fill_mask(GLCCtx glc, int x_dest, int y_dest, int width, int height, i
ASSERT(ctx && bitmap);
start_draw(ctx);
if (ctx->pat) {
- WARN_ONCE(("%s: unimplemented fill mask with pattern\n", __FUNCTION__));
+ WARN_ONCE("%s: unimplemented fill mask with pattern\n", __FUNCTION__);
}
fill_mask(ctx, x_dest, y_dest, width, height, stride, bitmap);
}
diff --git a/common/ogl_ctx.c b/common/ogl_ctx.c
index 76a3551..0917f42 100644
--- a/common/ogl_ctx.c
+++ b/common/ogl_ctx.c
@@ -25,6 +25,7 @@
#include <GL/glx.h>
#include "ogl_ctx.h"
+#include "spice_common.h"
enum {
OGLCTX_TYPE_PBUF,
diff --git a/common/rop3.c b/common/rop3.c
index 1ce2cd2..af872c1 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -24,10 +24,6 @@
#include "rop3.h"
#include "spice_common.h"
-#ifndef WARN
-#define WARN(x) printf("warning: %s\n", x)
-#endif
-
typedef void (*rop3_with_pattern_handler_t)(pixman_image_t *d, pixman_image_t *s,
SpicePoint *src_pos, pixman_image_t *p,
SpicePoint *pat_pos);
@@ -51,13 +47,13 @@ static void default_rop3_with_pattern_handler(pixman_image_t *d, pixman_image_t
SpicePoint *src_pos, pixman_image_t *p,
SpicePoint *pat_pos)
{
- WARN("not implemented 0x%x");
+ WARN("not implemented");
}
static void default_rop3_withe_color_handler(pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
uint32_t rgb)
{
- WARN("not implemented 0x%x");
+ WARN("not implemented");
}
static void default_rop3_test_handler()
diff --git a/common/spice_common.h b/common/spice_common.h
index 430c8af..ed28689 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -53,6 +53,8 @@
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
}
+#define WARN(format, ...) red_printf("warning: "format"\n", ##__VA_ARGS__ );
+#define WARN_ONCE red_printf_once
#define red_printf_some(every, format, ...) { \
static int count = 0; \
commit edfe2683583d7a849661cc08dc1964a5c925dff2
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 16:23:38 2011 +0200
common: use PANIC from spice_common.h
diff --git a/common/canvas_base.c b/common/canvas_base.c
index a8db367..d11c8ec 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -54,13 +54,6 @@
#define WARN(x) printf("warning: %s\n", x)
#endif
-#ifndef PANIC
-#define PANIC(str) { \
- printf("%s: panic: %s", __FUNCTION__, str); \
- abort(); \
-}
-#endif
-
#ifndef DBG
#define DBG(level, format, ...) printf("%s: debug: " format "\n", __FUNCTION__, ## __VA_ARGS__);
#endif
diff --git a/common/ogl_ctx.c b/common/ogl_ctx.c
index 072a0c0..76a3551 100644
--- a/common/ogl_ctx.c
+++ b/common/ogl_ctx.c
@@ -26,12 +26,6 @@
#include "ogl_ctx.h"
-
-#define PANIC(str) { \
- printf("%s: panic: %s", __FUNCTION__, str); \
- abort(); \
-}
-
enum {
OGLCTX_TYPE_PBUF,
OGLCTX_TYPE_PIXMAP,
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index 99a3005..9f3f1de 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -28,13 +28,6 @@
#include <stdio.h>
#include "mem.h"
-#ifndef PANIC
-#define PANIC(str) { \
- printf("%s: panic: %s", __FUNCTION__, str); \
- abort(); \
-}
-#endif
-
#define SOLID_RASTER_OP(_name, _size, _type, _equation) \
static void \
solid_rop_ ## _name ## _ ## _size (_type *ptr, int len, _type src) \
commit 48db4c2181d4918b0e2727d0bbe864b9e8019d85
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 16:17:14 2011 +0200
common,server: use ASSERT from spice_common.h
spice_common.h provides an ASSERT macro, no need to duplicate it
in many places. For now client/debug.h keeps its own copy since
debug.h and spice_common.h have clashes on other macros which are
trickier to unify.
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 272c7e8..a8db367 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -50,13 +50,6 @@
}
#endif
-#ifndef ASSERT
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- abort(); \
-}
-#endif
-
#ifndef WARN
#define WARN(x) printf("warning: %s\n", x)
#endif
diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 1b81d54..d861800 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -33,14 +33,6 @@
extern int gdi_handlers;
#endif
-#ifndef ASSERT
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- abort(); \
-}
-#endif
-
-
#ifndef CANVAS_ERROR
#define CANVAS_ERROR(format, ...) { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__); \
diff --git a/common/glc.c b/common/glc.c
index d90e383..0396fc9 100644
--- a/common/glc.c
+++ b/common/glc.c
@@ -40,8 +40,6 @@
#include "glc.h"
#include "gl_utils.h"
-#define ASSERT(x) if (!(x)) {printf("%s: assert failed %s\n", __FUNCTION__, #x); abort();}
-
#define WARN_ONCE(x) { \
static int warn = TRUE; \
if (warn) { \
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index e876fe6..99a3005 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -20,6 +20,7 @@
#endif
#include "pixman_utils.h"
+#include "spice_common.h"
#include <spice/macros.h>
#include <stdlib.h>
@@ -27,13 +28,6 @@
#include <stdio.h>
#include "mem.h"
-#ifndef ASSERT
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- abort(); \
-}
-#endif
-
#ifndef PANIC
#define PANIC(str) { \
printf("%s: panic: %s", __FUNCTION__, str); \
diff --git a/common/region.c b/common/region.c
index 0e1613c..10a6e62 100644
--- a/common/region.c
+++ b/common/region.c
@@ -28,11 +28,6 @@
#include "rect.h"
#include "mem.h"
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- abort(); \
-}
-
/* true iff two Boxes overlap */
#define EXTENTCHECK(r1, r2) \
(!( ((r1)->x2 <= (r2)->x1) || \
diff --git a/common/rop3.c b/common/rop3.c
index 53e8a6d..1ce2cd2 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -22,13 +22,7 @@
#include <stdio.h>
#include "rop3.h"
-
-#ifndef ASSERT
-#define ASSERT(x) if (!(x)) { \
- printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \
- abort(); \
-}
-#endif
+#include "spice_common.h"
#ifndef WARN
#define WARN(x) printf("warning: %s\n", x)
diff --git a/common/spice_common.h b/common/spice_common.h
index 75ebda7..430c8af 100644
--- a/common/spice_common.h
+++ b/common/spice_common.h
@@ -19,6 +19,7 @@
#define H_SPICE_COMMON
#include <stdio.h>
+#include <stdint.h>
#include <time.h>
#include <stdlib.h>
diff --git a/server/reds_gl_canvas.c b/server/reds_gl_canvas.c
index bf5244f..deec440 100644
--- a/server/reds_gl_canvas.c
+++ b/server/reds_gl_canvas.c
@@ -18,6 +18,8 @@
#include <config.h>
#endif
+#include "spice_common.h"
+
#include "reds_gl_canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
diff --git a/server/reds_sw_canvas.c b/server/reds_sw_canvas.c
index 6df63e6..43e086d 100644
--- a/server/reds_sw_canvas.c
+++ b/server/reds_sw_canvas.c
@@ -18,6 +18,8 @@
#include <config.h>
#endif
+#include "spice_common.h"
+
#include "reds_sw_canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
commit f88dc6eecb56222688275893e2a891d8ec23d1d6
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 13:31:48 2011 +0200
server: use gcc builtin for atomic get/set bit
diff --git a/server/red_worker.h b/server/red_worker.h
index ae2eaee..b4e2ed2 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -23,12 +23,14 @@
static inline void set_bit(int index, uint32_t *addr)
{
- __asm__ __volatile__ ("lock btsl %1, %0": : "m" (*addr), "r" (index));
+ uint32_t mask = 1 << index;
+ __sync_or_and_fetch(addr, mask);
}
static inline void clear_bit(int index, uint32_t *addr)
{
- __asm__ __volatile__ ("lock btrl %1, %0": : "m" (*addr), "r" (index));
+ uint32_t mask = ~(1 << index);
+ __sync_and_and_fetch(addr, mask);
}
static inline int test_bit(int index, uint32_t val)
commit 1caee1f21691e954c96fa31ba7c9baf97d896784
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 13:31:34 2011 +0200
client: remove unused mb() macro
diff --git a/client/x11/platform_utils.h b/client/x11/platform_utils.h
index 3423b2a..d574e21 100644
--- a/client/x11/platform_utils.h
+++ b/client/x11/platform_utils.h
@@ -24,12 +24,6 @@
#include <netinet/tcp.h>
#include <netdb.h>
-#ifdef __i386__
-#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
-#else
-#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory")
-#endif
-
typedef int SOCKET;
#define INVALID_SOCKET -1
commit 172edf298fa75fd85ed70751c81ec297e7ed0324
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 12:55:21 2011 +0200
common: don't duplicate find_msb implementation
diff --git a/common/Makefile.am b/common/Makefile.am
index 501a6e1..dff9574 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -6,6 +6,7 @@ NULL =
noinst_LTLIBRARIES = libspice-common.la
libspice_common_la_SOURCES = \
+ bitops.h \
canvas_utils.c \
canvas_utils.h \
draw.h \
diff --git a/common/bitops.h b/common/bitops.h
new file mode 100644
index 0000000..666d82d
--- /dev/null
+++ b/common/bitops.h
@@ -0,0 +1,89 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef BITOPS_H
+#define BITOPS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WIN32
+static inline int spice_bit_find_msb(uint32_t val)
+{
+ uint32_t r;
+ __asm {
+ bsr eax, val
+ jnz found
+ mov eax, -1
+
+found:
+ mov r, eax
+ }
+ return r + 1;
+}
+
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+static inline int spice_bit_find_msb(unsigned int val)
+{
+ int ret;
+
+ asm ("bsrl %1,%0\n\t"
+ "jnz 1f\n\t"
+ "movl $-1,%0\n"
+ "1:"
+ : "=r"(ret) : "r"(val));
+ return ret + 1;
+}
+
+#else
+static inline int spice_bit_find_msb(unsigned int val)
+{
+ signed char index = 31;
+
+ if(val == 0) {
+ return 0;
+ }
+
+ do {
+ if(val & 0x80000000) {
+ break;
+ }
+ val <<= 1;
+ } while(--index >= 0);
+
+ return index+1;
+}
+
+#endif
+
+static inline int spice_bit_next_pow2(unsigned int val)
+{
+ if ((val & (val - 1)) == 0) {
+ return val;
+ }
+ return 1 << spice_bit_find_msb(val);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/gl_utils.h b/common/gl_utils.h
index 175f131..c30be16 100644
--- a/common/gl_utils.h
+++ b/common/gl_utils.h
@@ -49,62 +49,10 @@ extern "C" {
#define GLC_ERROR_TEST_FINISH ;
#endif
-#ifdef WIN32
-static inline int find_msb(uint32_t val)
-{
- uint32_t r;
- __asm {
- bsr eax, val
- jnz found
- mov eax, -1
+#include "bitops.h"
-found:
- mov r, eax
- }
- return r + 1;
-}
-
-#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-static inline int find_msb(unsigned int val)
-{
- int ret;
-
- asm ("bsrl %1,%0\n\t"
- "jnz 1f\n\t"
- "movl $-1,%0\n"
- "1:"
- : "=r"(ret) : "r"(val));
- return ret + 1;
-}
-
-#else
-static inline int find_msb(unsigned int val)
-{
- signed char index = 31;
-
- if(val == 0) {
- return 0;
- }
-
- do {
- if(val & 0x80000000) {
- break;
- }
- val <<= 1;
- } while(--index >= 0);
-
- return index+1;
-}
-
-#endif
-
-static inline int gl_get_to_power_two(unsigned int val)
-{
- if ((val & (val - 1)) == 0) {
- return val;
- }
- return 1 << find_msb(val);
-}
+#define find_msb spice_bit_find_msb
+#define gl_get_to_power_two spice_bit_next_pow2
#ifdef __cplusplus
}
diff --git a/common/quic.c b/common/quic.c
index 8f8d726..5a41399 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -25,6 +25,7 @@
#include "quic.h"
#include <spice/macros.h>
+#include "bitops.h"
//#define DEBUG
@@ -707,17 +708,6 @@ static int decode_channel_run(Encoder *encoder, Channel *channel)
#else
-static INLINE int find_msb(int x)
-{
- int r;
-
- __asm__("bsrl %1,%0\n\t"
- "jnz 1f\n\t"
- "movl $-1,%0\n"
- "1:" : "=r" (r) : "rm" (x));
- return r + 1;
-}
-
static INLINE void encode_run(Encoder *encoder, unsigned int len)
{
int odd = len & 1U;
@@ -725,7 +715,7 @@ static INLINE void encode_run(Encoder *encoder, unsigned int len)
len &= ~1U;
- while ((msb = find_msb(len))) {
+ while ((msb = spice_bit_find_msb(len))) {
len &= ~(1 << (msb - 1));
ASSERT(encoder->usr, msb < 32);
encode(encoder, (1 << (msb)) - 1, msb);
commit cdba4ead6764f8728ffcd2f4e67008185025a235
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 11:49:26 2011 +0200
remove void * arithmetic
With -Wpointer-arith, gcc complains about void pointer arithmetic.
This is not a big deal with gcc, but could be with other compilers,
so it's better to cast to char */uint8_t * before doing the
arithmetic on such pointers.
diff --git a/server/red_worker.c b/server/red_worker.c
index 7fc1b96..b8d6a96 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8460,7 +8460,7 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
surface->context.stride = stride;
surface->context.line_0 = line_0;
if (!data_is_valid) {
- memset(line_0 + (int32_t)(stride * (height - 1)), 0, height*abs(stride));
+ memset((char *)line_0 + (int32_t)(stride * (height - 1)), 0, height*abs(stride));
}
surface->create.info = NULL;
surface->destroy.info = NULL;
diff --git a/server/reds.c b/server/reds.c
index 5927a69..5fa50c1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1766,7 +1766,7 @@ static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nby
return -1;
}
-static ssize_t reds_stream_sasl_read(RedsStream *s, void *buf, size_t nbyte)
+static ssize_t reds_stream_sasl_read(RedsStream *s, uint8_t *buf, size_t nbyte)
{
uint8_t encoded[4096];
const char *decoded;
commit e17767e8927e724687b1529e9bc8ddbc927dbc8f
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 11:48:53 2011 +0200
add missing static
diff --git a/client/jpeg_decoder.cpp b/client/jpeg_decoder.cpp
index 74cb758..4bc4f18 100644
--- a/client/jpeg_decoder.cpp
+++ b/client/jpeg_decoder.cpp
@@ -48,7 +48,7 @@ static void op_decode(SpiceJpegDecoder *decoder,
extern "C" {
- void jpeg_decoder_init_source(j_decompress_ptr cinfo)
+ static void jpeg_decoder_init_source(j_decompress_ptr cinfo)
{
}
diff --git a/client/red_channel.cpp b/client/red_channel.cpp
index bcd7051..d8dcc42 100644
--- a/client/red_channel.cpp
+++ b/client/red_channel.cpp
@@ -45,7 +45,7 @@ RedChannelBase::~RedChannelBase()
{
}
-const char *spice_link_error_string(int err)
+static const char *spice_link_error_string(int err)
{
switch (err) {
case SPICE_LINK_ERR_OK: return "no error";
diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c
index 7a32f2d..fbefe89 100644
--- a/common/quic_family_tmpl.c
+++ b/common/quic_family_tmpl.c
@@ -56,8 +56,8 @@ static void FNAME(golomb_coding)(const BYTE n, const unsigned int l, unsigned in
}
}
-unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned int bits,
- unsigned int * const codewordlen)
+static unsigned int FNAME(golomb_decoding)(const unsigned int l, const unsigned int bits,
+ unsigned int * const codewordlen)
{
if (bits > VNAME(family).notGRprefixmask[l]) { /*GR*/
const unsigned int zeroprefix = cnt_l_zeroes(bits); /* leading zeroes in codeword */
diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
index bae7bd2..30f15ef 100644
--- a/server/mjpeg_encoder.c
+++ b/server/mjpeg_encoder.c
@@ -74,16 +74,16 @@ size_t mjpeg_encoder_get_frame_stride(MJpegEncoder *encoder)
return encoder->stride;
}
-void init_destination(j_compress_ptr cinfo)
+static void init_destination(j_compress_ptr cinfo)
{
}
-boolean empty_output_buffer(j_compress_ptr cinfo)
+static boolean empty_output_buffer(j_compress_ptr cinfo)
{
return FALSE;
}
-void term_destination(j_compress_ptr cinfo)
+static void term_destination(j_compress_ptr cinfo)
{
}
diff --git a/server/red_channel.c b/server/red_channel.c
index 9012b0d..a700d20 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -201,7 +201,7 @@ static void red_peer_handle_outgoing(RedsStream *stream, OutgoingHandler *handle
}
}
-void red_channel_on_output(void *opaque, int n)
+static void red_channel_on_output(void *opaque, int n)
{
RedChannel *channel = opaque;
@@ -401,11 +401,11 @@ error:
return NULL;
}
-void do_nothing_disconnect(RedChannel *red_channel)
+static void do_nothing_disconnect(RedChannel *red_channel)
{
}
-int do_nothing_handle_message(RedChannel *red_channel, SpiceDataHeader *header, uint8_t *msg)
+static int do_nothing_handle_message(RedChannel *red_channel, SpiceDataHeader *header, uint8_t *msg)
{
return TRUE;
}
@@ -475,14 +475,14 @@ void red_channel_init_outgoing_messages_window(RedChannel *channel)
red_channel_push(channel);
}
-void red_channel_handle_migrate_flush_mark(RedChannel *channel)
+static void red_channel_handle_migrate_flush_mark(RedChannel *channel)
{
if (channel->handle_migrate_flush_mark) {
channel->handle_migrate_flush_mark(channel);
}
}
-void red_channel_handle_migrate_data(RedChannel *channel, uint32_t size, void *message)
+static void red_channel_handle_migrate_data(RedChannel *channel, uint32_t size, void *message)
{
if (!channel->handle_migrate_data) {
return;
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 19d6e8d..56446ab 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -388,8 +388,9 @@ static void qxl_worker_stop(QXLWorker *qxl_worker)
ASSERT(message == RED_WORKER_MESSAGE_READY);
}
-void qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
- struct QXLCommandExt *ext, uint32_t count)
+static void qxl_worker_loadvm_commands(QXLWorker *qxl_worker,
+ struct QXLCommandExt *ext,
+ uint32_t count)
{
RedDispatcher *dispatcher = (RedDispatcher *)qxl_worker;
RedWorkerMessage message = RED_WORKER_MESSAGE_LOADVM_COMMANDS;
diff --git a/server/red_worker.c b/server/red_worker.c
index a9452fb..7fc1b96 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1043,7 +1043,7 @@ static inline void validate_surface(RedWorker *worker, uint32_t surface_id)
PANIC_ON(!worker->surfaces[surface_id].context.canvas);
}
-char *draw_type_to_str(uint8_t type)
+static char *draw_type_to_str(uint8_t type)
{
switch (type) {
case QXL_DRAW_FILL:
@@ -4131,7 +4131,7 @@ static CursorItem *get_cursor_item(RedWorker *worker, RedCursorCmd *cmd, uint32_
return cursor_item;
}
-void qxl_process_cursor(RedWorker *worker, RedCursorCmd *cursor_cmd, uint32_t group_id)
+static void qxl_process_cursor(RedWorker *worker, RedCursorCmd *cursor_cmd, uint32_t group_id)
{
CursorItem *item = get_cursor_item(worker, cursor_cmd, group_id);
int cursor_show = FALSE;
@@ -8975,7 +8975,7 @@ static int display_channel_handle_message(RedChannel *channel, uint32_t size, ui
}
}
-int common_channel_config_socket(RedChannel *channel)
+static int common_channel_config_socket(RedChannel *channel)
{
int flags;
int delay_val;
@@ -9005,16 +9005,16 @@ static void free_common_channel_from_listener(EventListener *ctx)
free(common);
}
-void worker_watch_update_mask(SpiceWatch *watch, int event_mask)
+static void worker_watch_update_mask(SpiceWatch *watch, int event_mask)
{
}
-SpiceWatch *worker_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+static SpiceWatch *worker_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
{
return NULL; // apparently allowed?
}
-void worker_watch_remove(SpiceWatch *watch)
+static void worker_watch_remove(SpiceWatch *watch)
{
}
diff --git a/server/reds.c b/server/reds.c
index 99a3176..5927a69 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -388,7 +388,7 @@ static void reds_link_free(RedLinkInfo *link)
#ifdef RED_STATISTICS
-void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
+static void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
{
SpiceStatNode *node = &reds->stat->nodes[ref];
uint32_t pos = INVALID_STAT_REF;
@@ -457,7 +457,7 @@ StatNodeRef stat_add_node(StatNodeRef parent, const char *name, int visible)
return ref;
}
-void stat_remove(SpiceStatNode *node)
+static void stat_remove(SpiceStatNode *node)
{
pthread_mutex_lock(&reds->stat_lock);
node->flags &= ~SPICE_STAT_NODE_FLAG_ENABLED;
@@ -583,7 +583,7 @@ static void reds_reset_vdp()
state->write_filter.discard_all = TRUE;
}
-int reds_main_channel_connected()
+static int reds_main_channel_connected(void)
{
return !!reds->main_channel;
}
@@ -746,7 +746,7 @@ static void reds_push_tokens()
reds->agent_state.num_tokens = 0;
}
-static int write_to_vdi_port();
+static int write_to_vdi_port(void);
static void vdi_port_write_timer_start()
{
@@ -805,7 +805,7 @@ static int write_to_vdi_port()
static int read_from_vdi_port(void);
-void vdi_read_buf_release(uint8_t *data, void *opaque)
+static void vdi_read_buf_release(uint8_t *data, void *opaque)
{
VDIReadBuf *buf = (VDIReadBuf *)opaque;
@@ -1390,7 +1390,7 @@ static void reds_channel_set_common_caps(Channel *channel, int cap, int active)
}
}
-void reds_channel_init_auth_caps(Channel *channel)
+static void reds_channel_init_auth_caps(Channel *channel)
{
if (sasl_enabled) {
reds_channel_set_common_caps(channel, SPICE_COMMON_CAP_AUTH_SASL, TRUE);
@@ -1721,7 +1721,7 @@ static int sync_write_u32(RedsStream *s, uint32_t n)
return sync_write(s, &n, sizeof(uint32_t));
}
-ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nbyte)
+static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t nbyte)
{
ssize_t ret;
@@ -3100,7 +3100,7 @@ static void reds_mig_finished(int completed)
}
}
-void reds_mig_switch(void)
+static void reds_mig_switch(void)
{
main_channel_push_migrate_switch(reds->main_channel);
}
commit 12b9654bf41a83427777b0400f95b918ba21ce74
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 11:05:35 2011 +0200
configure.ac: remove setting default C(XX)FLAGS
automake/autoconf already set them for us to -g -O2 if there are
no flags defined.
diff --git a/configure.ac b/configure.ac
index ac1d5e7..430bf83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,9 +13,7 @@ AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
AM_MAINTAINER_MODE
-AS_IF([test "$CFLAGS" = ""], [], [_cflags_is_set=yes])
AC_PROG_CC
-AS_IF([test "$CXXFLAGS" = ""], [], [_cxxflags_is_set=yes])
AC_PROG_CXX
AC_PROG_INSTALL
AC_CANONICAL_HOST
@@ -277,16 +275,6 @@ AC_ARG_ENABLE(static-linkage,
AS_IF([test x"$enable_static_linkage" != "xno"],
[SPICEC_STATIC_LINKAGE_BSTATIC=["-Wl,-Bstatic"]])
-
-AS_IF([test "$_cflags_is_set" = "yes"], [], [
- CFLAGS="-g -O2"
-])
-
-
-AS_IF([test "$_cxxflags_is_set" = "yes"], [], [
- CXXFLAGS="-g -O2"
-])
-
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(
commit 4a989d6c7a6ef846a40b583ffd7be81e11200d2f
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 22 11:01:29 2011 +0200
win32: remove obsolete preprocessor #defines
SW_CANVAS_NO_CHUNKS isn't used anywhere but in this file.
SW_CANVAS_CACHE is now defined directly in the files where it's
needed so we no longer need it in the .vcproj file.
diff --git a/client/windows/redc.vcproj b/client/windows/redc.vcproj
index 70eb170..87d018c 100644
--- a/client/windows/redc.vcproj
+++ b/client/windows/redc.vcproj
@@ -50,7 +50,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..;$(SPICE_PROTOCOL_DIR);..\..\common;..\..\common\win;"..\..\common\win\my_getopt-1.5";"$(SPICE_LIBS)\include";"$(SPICE_LIBS)\include\pixman-1";"$(SPICE_LIBS)\include\CEGUI-0.6.2";"$(SPICE_LIBS)\include\CxImage""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;SW_CANVAS_CACHE;RED_DEBUG;SW_CANVAS_NO_CHUNKS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RED_DEBUG;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -138,7 +138,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..;$(SPICE_PROTOCOL_DIR);..\..\common;..\..\common\win;"..\..\common\win\my_getopt-1.5";"$(SPICE_LIBS)\include";"$(SPICE_LIBS)\include\pixman-1";"$(SPICE_LIBS)\include\CEGUI-0.6.2";"$(SPICE_LIBS)\include\CxImage""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;SW_CANVAS_CACHE;RED_DEBUG;SW_CANVAS_NO_CHUNKS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;RED_DEBUG;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -221,7 +221,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..;$(SPICE_PROTOCOL_DIR);..\..\common;..\..\common\win;"..\..\common\win\my_getopt-1.5";"$(SPICE_LIBS)\include";"$(SPICE_LIBS)\include\pixman-1";"$(SPICE_LIBS)\include\CEGUI-0.6.2";"$(SPICE_LIBS)\include\CxImage""
- PreprocessorDefinitions="WIN32;_WINDOWS;SW_CANVAS_CACHE;SW_CANVAS_NO_CHUNKS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
@@ -304,7 +304,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..;$(SPICE_PROTOCOL_DIR);..\..\common;..\..\common\win;"..\..\common\win\my_getopt-1.5";"$(SPICE_LIBS)\include";"$(SPICE_LIBS)\include\pixman-1";"$(SPICE_LIBS)\include\CEGUI-0.6.2";"$(SPICE_LIBS)\include\CxImage""
- PreprocessorDefinitions="WIN32;_WINDOWS;SW_CANVAS_CACHE;SW_CANVAS_NO_CHUNKS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_WIN32_WINNT=0x0500;USE_GUI;USE_GLZ;PTW32_STATIC_LIB;CEGUI_STATIC"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
More information about the Spice-commits
mailing list