Commit Graph

244 Commits

Author SHA1 Message Date
Christophe Fergeau
da4768ae2b don't #include config.h in generated header files
7e30572ab adds a #include <config.h> to the beginning of generated
files. It also does this for generated headers and enums files,
which is not wanted, especially if it's an installed file. This
commit only adds this include for the non-header non-enum case
(hopefully, enums are only generated for use in a .h file).
2012-03-20 15:25:53 +01:00
Christophe Fergeau
e0a8d6625c add check for pyparsing
Check both in configure.ac (after checking if we need to rebuild
the marshalling files) and in the python script using pyparsing
(for people modifying .proto files in tarballs)
2012-03-20 15:25:53 +01:00
Marc-André Lureau
85a49d512a sndworker: add AudioVolume/AudioMute messages
These messages allow the guest to send the audio device volume to the
client. It uses an arbitrary scale of 16bits, which works good enough
for now.

Save VolumeState in {Playback,Record}State, so that we can send the
current volume on channel connection.

Note about future improvements:
- add exact dB support
- add client to guest volume change

Updated since v2:
- bumped record and playback interface minor version to allow
  conditional compilation
Updated since v1:
- sync record volume on connection too
2012-03-20 15:25:53 +01:00
Marc-André Lureau
5ae49c0d5b python: remove c-ism trailing ; 2012-03-20 15:25:53 +01:00
Marc-André Lureau
7f9e2cb1f7 codegen: typedef the protocol enums
Commit 9d5ef9beeca722b2ceff7d15aaa3aaaaf07ecfbf in spice-protocol
introduced a typedef manually in the generated enums.h header.

This patch adds them automatically to all enums during enums.h generation.
2012-03-20 15:25:53 +01:00
Arnon Gilboa
f492c12364 common: add WIN64 ifdef for spice_bit_find_msb (fix broken windows x64 build)
inline __asm is not supported in x64, so use the naive implementation
until x64 asm implemented.
2012-03-20 15:25:53 +01:00
Arnon Gilboa
88f7e2b32d common: use INLINE instead of inline
needed for spice/common files used by the client, server & qxl driver.
in windows _inline works for both c/c++, while inline is c++ only.
compiling the client with mixed c/c++ code required this define.
2012-03-20 15:25:53 +01:00
Arnon Gilboa
4cb26e06f7 common: fix ssl_verify windows build errors 2012-03-20 15:25:53 +01:00
Marc-André Lureau
5de42c768d common: add ssl_verify.c common code
Code adapter from RedPeer::ssl_verify_callback() and used by
spice-gtk.

Since v1:
 - fixed Makefile.am
 - added config.h include
 - autoconf alloca added in patch series
 - moved int escape inside for loop
 - added a failed case when missing assignment
 - replaced strlen () by -1
 - skip spaces after comma
 - c++ guards

I didn't use bool, because openSSL uses int, and it is more future
proof for error reporting.
2012-03-20 15:25:53 +01:00
Marc-André Lureau
a472bdff0d common: add ring_get_length() for debugging purposes
Please notice it has a "static" modifier, like the rest of the inlined
functions in ring.h, so it won't warn if it isn't used.
2012-03-20 15:25:52 +01:00
Marc-André Lureau
3349946ab2 common: mem.h add alloca definition
We don't support the autoconf ALLOCA/C_ALLOC fallback. If one day,
someone cares for a weird platform, he can fix it.
2012-03-20 15:25:52 +01:00
Marc-André Lureau
55e936b9fd common: spice_memdup could accept NULL
(this patch is not to solve a crash fix, but to align with glib API)
2012-03-20 15:25:52 +01:00
Marc-André Lureau
f0ce9c8433 common: add windows.h where required, make gdi_handlers static
This patch has not been verified with VS/brew. It should be safe
hopefully. Compilation is fine with mingw32/spice-gtk.
2012-03-20 15:25:52 +01:00
Christophe Fergeau
c04b58bf7a 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.
2012-03-20 15:25:52 +01:00
Christophe Fergeau
62ef19f8c7 use standard do { } while (0) for spice_common.h macros 2012-03-20 15:25:52 +01:00
Christophe Fergeau
09453dcd43 move WARN and WARN_ONCE to spice_common.h 2012-03-20 15:25:52 +01:00
Christophe Fergeau
56f2e9648e common: use PANIC from spice_common.h 2012-03-20 15:25:52 +01:00
Christophe Fergeau
50fc5bc747 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.
2012-03-20 15:25:52 +01:00
Christophe Fergeau
29e175bb06 common: don't duplicate find_msb implementation 2012-03-20 15:25:52 +01:00
Christophe Fergeau
8db40f4ae7 add missing static 2012-03-20 15:25:52 +01:00
Christophe Fergeau
90f32ab823 add comment to beginning of autogenerated files 2012-03-20 15:25:52 +01:00
Christophe Fergeau
61b344d774 add config.h to autogenerated files too
Modify the python (de)marshaller generator to add #include
<config.h> at the beginning of the C files it generates
2012-03-20 15:25:52 +01:00
Christophe Fergeau
08326f733a add #include <config.h> to all source files
When using config.h, it must be the very first include in all source
files since it contains #define that may change the compilation process
(eg libc structure layout changes when it's used to enable large file
support on 32 bit x86 archs). This commit adds it at the beginning
of all .c and .cpp files
2012-03-20 15:25:52 +01:00
Christophe Fergeau
d88b144f1b autotools: correctly build canvas-related code
spice client and spice server shares code from
common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is
shared, the server code wants a canvas compiled with
SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas
compiled with SW_CANVAS_CACHE.

The initial autotools refactoring didn't take that into account,
this is now fixed by this commit. After this commit, the canvas
files from common/ are no longer compiled as part of the
libspice-common.la convenience library. Instead, there are "proxy"
canvas source files in client/ and server/ which #include the
appropriate C files after defining the relevant #define for the
binary that is being built.

To prevent misuse of the canvas c files and headers in common/,
SPICE_CANVAS_INTERNAL must be set when including the canvas headers
from common/ or when building the c files from common/ otherwise
the build will error out.
2012-03-20 15:25:51 +01:00
Christophe Fergeau
4fafa210df autotools: refactor the whole build machinery
spice Makefile.am setup is a bit confusing, with source file
names being listed several times in different Makefile.am
(generally, once in EXTRA_DIST and another time in another
Makefile.am in _SOURCES). The client binaries are built
by client/x11/Makefile.am, which means recursing into client,
then into x11 to finally build spicec. This Makefile.am is
also referencing files from common/ and client/, which is
a bit unusual with autotools.

This patch attempts to simplify the build process to get
something more usual from an autotools point of view.
The source from common/ are compiled into a libtool convenience
library, which the server and the client links against which avoids
referencing source files from common/ when building the server and
the client. The client is built in client/Makefile.am and directly
builds files from x11/ windows/ and gui/ if needed (without
recursing in these subdirectories).

This makes the build simpler to understand, and also makes it
possible to list source files once, which avoids potential
make distcheck breakage when adding new files.

There is a regression in this patch with respect to
sw_canvas/gl_canvas/gdi_canvas. They should be built with
different preprocessor #defines resulting in different behaviour
of the canvas for the client and the server. However, this is not
currently the case, both the client and the server will use the same
code for now (which probably means one of them is broken). This will
be fixed in a subsequent commit.

make distcheck passes, but compilation on windows using the
autotools build system hasn't been tested, which means it's likely
to be broken. It shouldn't be too hard ot fix it though, just let
me know of any issues with this.
2012-03-20 15:25:51 +01:00
Christophe Fergeau
eda7b8938a common: don't try to redefine PANIC if it already exists
canvas_base.c tries to define PANIC, but it might already be set
if eg client/debug.h has been included before. All the other
macros in this file are guarded by #ifndef, this commit adds
the missing #ifndef to PANIC. Note that this is just a bandaid,
ideally common/ would contain a logging frameword, and these
macros would only be defined once instead of being defined in
several places.
2012-03-20 15:25:51 +01:00
Christophe Fergeau
57b6e08160 use foo(void) instead of foo() in prototypes
In C, the latter isn't a prototype for a function with no arg,
but declares a function with an undefined number of args.
2012-03-20 15:25:51 +01:00
Christophe Fergeau
c1530facf4 common: add missing header guards to gl_canvas.h 2012-03-20 15:25:51 +01:00
Christophe Fergeau
c15c5050af common: add extern "C" guards to headers
Since some spice C++ code is using code from common/, the C
functions need to be marked as such for the C++ compiler, otherwise
we'll get linkage issues.
2012-03-20 15:25:51 +01:00
Alon Levy
5b0b6d2f84 spice.proto: Fill.rop_descriptor type s/uint16/ropd (10x atiti) 2012-03-20 15:25:51 +01:00
Christophe Fergeau
116965471d draw: remove SPICE_ADDRESS
This commit removes the typedef for SPICE_ADDRESS which was no
longer used. This is the last thing that was missing to close
fdo bug #28984
2012-03-20 15:25:51 +01:00
Christophe Fergeau
a0acff58c6 common/pixman: remove dead assignments
They were detected using clang-static-analyzer. Don't initialize
the variable to a value to override it with a different value
a few lines after.
2012-03-20 15:25:51 +01:00
Christophe Fergeau
ecce34db52 common/gl: remove unused variable
clang static analyzer warned that 'len' was computed but never
used in glc_vertex2d. glc_stroke_line_dash has side effects so
we have to call it, but we don't need to save its return value
since it's not used.
2012-03-20 15:25:51 +01:00
Alon Levy
63703e4349 python_modules/codegen.py: fix indent error in an unused function 2012-03-20 15:25:51 +01:00
Alon Levy
bd84cda1fe ring: add RING_FOREACH{,_SAFE,_REVERSED} 2012-03-20 15:25:51 +01:00
Alon Levy
2890d418ee server/common: introduce common/spice_common.h
move all the ASSERT/PANIC/PANIC_ON/red_error/red_printf* macros
to a common file to be used with ring.h that is going to be used externally
(by spice-gtk).
2012-03-20 15:25:51 +01:00
Marc-André Lureau
99a225c87a common: add SpiceBuffer - based on qemu-vnc Buffer
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2012-03-20 15:25:51 +01:00
Uri Lublin
7c98f5c946 spice-client migration: fix minor for old migration support.
For not too old spice-migration, minor is 1.
For older (ancient) spice-migration, minor is 0.

Affects only VM migration while a spice client is connected.
2012-03-20 15:25:51 +01:00
Alon Levy
01580185e9 demarshaller/marshaller fix gcc 4.6.0
python_modules/demarshal.py and marshal.py fixes for gcc 4.6.0
warning about set but unused variables. The fixes disable creating
of variables mem_size when they are not used (demarshall) and
declaring a src variable when the message doesn't use it (marshal).

You need to touch *.proto after applying this (should add a Makefile
dependency).
2012-03-20 15:25:50 +01:00
Alon Levy
67ace54dbc codegen: avoid creating out if not used (fix gcc 4.6.0 warning) 2012-03-20 15:25:50 +01:00
Alon Levy
248c08768d common/sw_canvas: remove unused error val
This is the only unused var change I'll want to revisit eventually,
I'm submitting anyway since it doesn't change current behavior. I'm
talking about ignoring the return value from canvas creation. Adding
a print is possible but I didn't test (may be too verbose, also
preferable to be a debug print if so, and we don't have that option
in the code atm - probably an environment variable will do, or adding
some spice_server_set_logging_level api, maybe even
spice_server_set_logging_fd?)
2012-03-20 15:25:50 +01:00
Alon Levy
b48fee5d7c common/canvas_base.c: remove unused variables 2012-03-20 15:25:50 +01:00
Alon Levy
9db2743262 common, canvas_get_jpeg_alpha: let top_down be any value
Allow top_down flag to have any value, only ASSERT it is positive
when needs to be positive and zero otherwise. Allows older server
bug of sending 4 instead of 1 in top down flag to not affect newer
clients (previous patch fixes server).
2012-03-20 15:25:50 +01:00
Alon Levy
a99c9149b6 mingw32 build: python_modules/marshal: use unsigned for for_loop index variable 2012-03-20 15:25:50 +01:00
Alon Levy
c309d923aa mingw32 build: various fixes 2012-03-20 15:25:50 +01:00
Alon Levy
f5bfbff82f mingw32 build: fix two functions 2012-03-20 15:25:50 +01:00
Alon Levy
f4f40a3a30 mingw32 build: fix signed/unsigned warnings as errors 2012-03-20 15:25:50 +01:00
Gerd Hoffmann
2e2dbb5479 mingw32 build: fix build errors
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-20 15:25:50 +01:00
Alon Levy
8bea72b751 smartcard: add to spice.proto 2012-03-20 15:25:50 +01:00
Alon Levy
00a7b6ff3b spice codegen: fix copy-o, no such variable value 2012-03-20 15:25:50 +01:00