Commit Graph

316 Commits

Author SHA1 Message Date
Marc-André Lureau
fb24e4e28b build-sys: split client marshallers in seperate lib 2012-03-25 18:38:09 +02:00
Marc-André Lureau
c1e4e1be63 build-sys: make it a seperately buildable spice-common library
- autotoolize
- fix headers inclusion
- generate gitignores
- workaround serverSMARTCARD support with dirty hack...
2012-03-22 20:21:05 +01:00
Marc-André Lureau
feaee86076 spice.proto: fix demarshaller crash with name message
It turned out the demarshaller wasn't allocating enough space to
memcpy the name. In order to take into account the size of a variable
array, it needs to be marked with the @end tag so that the
"extra_size" is added to the allocated memory.

It would be nice if the demarshaller would somehow fail if this wasn't
set explicitly, or do the right thing by default.

@end the name so that demarshaller
2012-03-21 13:24:17 +01:00
Marc-André Lureau
bc4f5db323 codegen: ifdef/endif function declaration too
Compile out part that we are not supporting.  In the future, we might
want to declare a fake type and an empty function to keep API
compatibility
2012-03-21 13:24:17 +01:00
Marc-André Lureau
b6afcd632e codegen: include headers locally 2012-03-21 13:24:17 +01:00
Marc-André Lureau
2d4e0d2000 codegen: struct marshallers are not current function helper
This solves the issue of struct_marshallers being included within the
current ifdef/endif body, although they are independant functions.
2012-03-21 13:24:16 +01:00
Christophe Fergeau
3df7798413 use new @ifdef directive for smartcard messages
We don't want to conditionally compile the smartcard messages
depending on whether USE_SMARTCARD is set or not, we can now use
the @ifdef attribute for that.
2012-03-20 15:31:30 +01:00
Christophe Fergeau
7f86151f18 add smartcard bits to spice.proto 2012-03-20 15:31:30 +01:00
Hans de Goede
69aecfc1bc spice_codegen: Always write a channels entry for an ifdef-ed channel
Before this patch, if a channel is defined conditionally in spice.proto
(because it depends on external headers like the smartcard channel),
spice_codegen would write an entry to the channels array in
spice_get_*_channel_parser which would only take up a place in the array
if the ifdef condition is true, thus moving up all other intializers
one place when it is not true. This was causing issues (crashes) when building
spice-gtk with the combination of usbredir support enabled and smartcard
support disabled.

This patch fixes this by adding #else { NULL, 0 }, to the generated code.

Thanks to coolper chen <lixin.chen@saicocch.com> for reporting this!

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-20 15:31:30 +01:00
Christophe Fergeau
a7cc3c6a56 handle @ifdef on messages and channels 2012-03-20 15:31:30 +01:00
Christophe Fergeau
7307fccb71 allow attributes on channel elements in .proto files
We want to be able to add an @ifdef annotation to optional messages
For example, we want to compile in the smartcard messages only if
libcacard is available
2012-03-20 15:31:30 +01:00
Christophe Fergeau
eb01d2fc46 add ifdef/endif methods to spice code generator
These methods will be needed to be able to make some fields optional
in spice.proto
2012-03-20 15:31:30 +01:00
Christophe Fergeau
51cf6fce72 fix copy & paste error in ptypes.py 2012-03-20 15:31:30 +01:00
Marc-André Lureau
f7af6264ea Add SPICE_ATTR_NORETURN and use it for a few functions 2012-03-20 15:30:24 +01:00
Marc-André Lureau
a1df67b3c5 Fix build with SPICE_DISABLE_ABORT 2012-03-20 15:30:24 +01:00
Marc-André Lureau
13fb823795 Remove need for SPICE_CANVAS_INTERNAL
Why is this useful?
2012-03-20 15:30:24 +01:00
Marc-André Lureau
61c30fcdcf fix void* arithmetic
marshaller.c:528:50: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
2012-03-20 15:30:24 +01:00
Marc-André Lureau
f87bb23ad2 build: replace INCLUDES with AM_CPPFLAGS
Fix warning `INCLUDES' is the old name for `AM_CPPFLAGS' (or `*_CPPFLAGS')
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
fbb6b9984a Add missing includes & make some functions static
A number of functions were used without prior declaration. In
some cases this was due to missing include files. In other cases
the functions should have just been static.

Ideally this would allow -Wmissing-declarations to be enabled, but
the files generated by spice_codegen.py will still trip up on this.
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
985ec9d6ec Add printf format annotations to all '...' functions
To allow the compile to detect incorrect printf formats, any
var-args function should have a format annotation

* common/macros.h: Helper to define ATTR_PRINTF for code
  which can't depend on glib
* common/canvas_base.c, common/lz.h, common/macros.h: Annotate
  some var-args methods
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
9f7d6175e7 Fix some integer range checks which always evaluate false
There are some integer range checks which always evaluate false
due to use of unsigned integer types. One of these would prevent
detection of encoding errors from celt. The others are simply
no-ops.

* common/pixman_utils.c: SpiceROP is an enum & thus unsigned
2012-03-20 15:30:23 +01:00
Daniel P. Berrange
3bc7d096b6 Avoid warnings about empty conditional statement bodies
Add extra {} braces around if/else statements which only
call SPICE_DEBUG to avoid:

../common/ssl_verify.c: In function 'verify_pubkey':
../common/ssl_verify.c:87:50: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_hostname':
../common/ssl_verify.c:254:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_subject':
../common/ssl_verify.c:381:41: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
2012-03-20 15:30:23 +01:00
Marc-André Lureau
0a96fe9364 build: remove 'win' directory
Let's use the only included file directly instead.
2012-03-20 15:30:23 +01:00
Christophe Fergeau
4feaffad8e messages.h: add smartcard bits 2012-03-20 15:30:23 +01:00
Marc-André Lureau
508547c100 Add client_marshallers.h client_demarshallers.h from spice-gtk
spice-gtk uses a more up to date version of client/marshallers.h and client/demarshallers.h
2012-03-20 15:30:23 +01:00
Marc-André Lureau
c4482c7ff2 Use SPICE_{BEGIN,END}_DECLS 2012-03-20 15:30:23 +01:00
Christophe Fergeau
e800e51d4e add const to arrays in marshalling functions 2012-03-20 15:30:23 +01:00
Christophe Fergeau
c968e76f96 ssl_verify: include <string.h>
ssl_verify.c is using memcmp which comes from string.h, this was
breaking compilation with -Werror -Wall on Mac OS X
2012-03-20 15:30:23 +01:00
Marc-André Lureau
3e4b2571a2 ssl_verify: comment X509_NAME undef 2012-03-20 15:30:23 +01:00
Marc-André Lureau
c1403ee6bf Use a log handler to modify abort() behaviour
Be more library friendly, by not aborting in library errors.

spice_common now includes a proper log handler that will abort by
default when reaching a warning.

SPICE_ABORT_LEVEL can be changed to modify run-time abort level.

SPICE_DEBUG_LEVEL can be changed to be more verbose. By default, only
log level more importants than WARNING.

Only memory-related functions are allowed to abort(), since they are
not recoverable errors in the library.
2012-03-20 15:30:23 +01:00
Marc-André Lureau
bb133148d8 update gitignore 2012-03-20 15:30:23 +01:00
Marc-André Lureau
cf705650d4 common: remove unnecessary outdated c++ debug 2012-03-20 15:30:23 +01:00
Marc-André Lureau
124f767b94 common: ring.h should include stddef for NULL usage 2012-03-20 15:30:05 +01:00
Marc-André Lureau
1a9f61dd17 Send name & uuid to capable clients
Add spice_server_set_name() and spice_server_set_uuid() that allows
the client to identify a Spice server (useful to associate settings
with a particular server)

The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent
to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
2012-03-20 15:25:56 +01:00
Marc-André Lureau
71faf12d81 demarshal: fixed-size array are missing __nelements
A message with a fixed-size array, such as uint8 uuid[16] will
generate an invalid code, missing the __nelements variable. Make sure
that variable is defined.
2012-03-20 15:25:56 +01:00
Christophe Fergeau
5d02123499 mingw: workaround weird openssl build failure
If X509_NAME isn't undefined before including x509v3.h, very
weird compilation error occurs. It seems to be caused by duplicate
definitions for this symbols coming from wincrypto.h
2012-03-20 15:25:56 +01:00
Christophe Fergeau
ea9e91cd8d mingw: don't try to redefine alloca
mingw already has a #define alloca __builtin_alloca so trying to
redefine it triggers a warning.
2012-03-20 15:25:56 +01:00
Christophe Fergeau
a107b62a74 mingw: use uintptr_t when converting a pointer to an int
win64 uses 32 bit long, so we cannot use a long to hold a 64 bit
pointer. Thankfully, there's a [u]intptr_t type available exactly
for these uses.
2012-03-20 15:25:56 +01:00
Dan McGee
a14a8c83e0 Remove extra '\n' from red_printf() calls
red_printf() takes care of adding a newline to all messages; remove the
extra newline from all messages and macros that were doubling them up.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:56 +01:00
Dan McGee
df2dcb496e Add casts for compatibility purposes
Some non-Linux platforms return a (caddr_t *) result for the return
value of mmap(), which is very unfortunate. Add a (void *) cast to
explicitly avoid the warning when compiling with -Werror.

For the IO vector related stuff, signed vs. unsigned comes into play so
adding a (void *) cast here is technically correct for all platforms.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:55 +01:00
Dan McGee
e571bd02c9 Update .gitignore with a few more generated files
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
95f2f77839 Remove trailing whitespace from end of lines 2012-03-20 15:25:55 +01:00
Daniel P. Berrange
14ca077df3 Add missing includes of config.h
Not all files were including config.h
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
4930ef7239 Remove unused backup file
The common/glc.c.save file appears to be a obsolete copy of
glc.c
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
f83432a685 Remove trailing blank lines
Remove any blank lines at the end of all source files
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
457892cb9f Fix up copyright decl to always use 'Copyright (C) Red Hat, Inc.'
A couple of files were missing '(C)' in the copyright header
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
6142b84cd4 Remove casts from void * with xrealloc() calls
The xrealloc() function returns void*, so the return value
never needs to be cast
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
4a9f7971fc Remove useless if() before free()
The free() function allows NULL to be passed in, so any
code which puts a if() before free() is wasting time
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
bcdf929c79 Death to all TABs
Source files should all use spaces instead of tabs for
indentation. Update the few files not already in
compliance
2012-03-20 15:25:55 +01:00
Alon Levy
a2e0db03a9 common/ssl_verify: special case to WIN32 that isn't MINGW32 2012-03-20 15:25:55 +01:00