Commit Graph

227 Commits

Author SHA1 Message Date
Daniel P. Berrange
bd12a6bd2f 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-15 02:01:08 +01:00
Daniel P. Berrange
161e37ea9f 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-15 02:01:08 +01:00
Daniel P. Berrange
d8dda8213b 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-15 02:01:08 +01:00
Marc-André Lureau
9ed80dd6cf build: remove 'win' directory
Let's use the only included file directly instead.
2012-03-15 02:01:08 +01:00
Christophe Fergeau
3f962fd861 messages.h: add smartcard bits 2012-03-15 02:01:08 +01:00
Marc-André Lureau
349f70808b 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-15 02:01:08 +01:00
Marc-André Lureau
004a011b20 Use SPICE_{BEGIN,END}_DECLS 2012-03-15 02:01:08 +01:00
Christophe Fergeau
1074c36af2 add const to arrays in marshalling functions 2012-03-15 02:01:07 +01:00
Christophe Fergeau
e22a9e9ebe 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-15 02:01:07 +01:00
Marc-André Lureau
4a076d7fbd ssl_verify: comment X509_NAME undef 2012-03-15 02:01:07 +01:00
Marc-André Lureau
4a8383728a 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-15 02:01:07 +01:00
Marc-André Lureau
93a7da6789 update gitignore 2012-03-14 20:26:33 +01:00
Marc-André Lureau
bfc8a43b48 common: remove unnecessary outdated c++ debug 2012-03-14 14:14:47 +01:00
Marc-André Lureau
bb4bf7b8e3 common: ring.h should include stddef for NULL usage 2012-03-14 14:12:48 +01:00
Marc-André Lureau
45c592a89c 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-05 18:19:07 +01:00
Christophe Fergeau
ce48976950 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-04 10:50:39 +02:00
Christophe Fergeau
5bcece537e 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-04 10:50:39 +02:00
Christophe Fergeau
ec250967e2 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-04 10:50:38 +02:00
Dan McGee
29a31db629 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-02-14 18:19:29 +02:00
Dan McGee
4b6d1d5347 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-02-14 10:44:49 +02:00
Dan McGee
14fae75639 Update .gitignore with a few more generated files
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-01-23 12:28:58 +02:00
Daniel P. Berrange
3e50b41dc2 Remove trailing whitespace from end of lines 2012-01-13 18:11:59 +02:00
Daniel P. Berrange
38ee339bd8 Add missing includes of config.h
Not all files were including config.h
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
199bf855c7 Remove unused backup file
The common/glc.c.save file appears to be a obsolete copy of
glc.c
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
3e6cd060a0 Remove trailing blank lines
Remove any blank lines at the end of all source files
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
4fa5b500b3 Fix up copyright decl to always use 'Copyright (C) Red Hat, Inc.'
A couple of files were missing '(C)' in the copyright header
2012-01-13 18:11:59 +02:00
Daniel P. Berrange
8bda19d39e Remove casts from void * with xrealloc() calls
The xrealloc() function returns void*, so the return value
never needs to be cast
2012-01-13 18:11:58 +02:00
Daniel P. Berrange
c64594fca3 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-01-13 18:11:58 +02:00
Daniel P. Berrange
942d9b7391 Death to all TABs
Source files should all use spaces instead of tabs for
indentation. Update the few files not already in
compliance
2012-01-13 18:11:58 +02:00
Alon Levy
57c43db3c5 common/ssl_verify: special case to WIN32 that isn't MINGW32 2012-01-13 17:42:23 +02:00
Alon Levy
314a849ae2 common/bitops: mingw32: reorder so __GNUC__ define is checked first 2012-01-13 17:42:23 +02:00
Alon Levy
a299c362dd common/backtrace: for mingw32 no pipe/wait_pid, just disable 2012-01-13 17:42:23 +02:00
Alon Levy
3ac2a50264 client/windows: fix several assigned but not used errors 2012-01-13 17:42:23 +02:00
Alon Levy
3fcf2f217e client/common: mingw32: workaround HAVE_STDLIB_H redefined in jconfig.h 2012-01-13 17:42:22 +02:00
Alon Levy
cd595ed034 server: add prefix argument to red_printf_debug
printed before function name. No central location for prefixes.
Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
2011-11-07 10:29:32 +02:00
Alon Levy
dceb04044b common/spice_common.h: red_printf_debug: fix wrong sign 2011-11-07 10:20:41 +02:00
Yonit Halperin
758313d74c server,proto: tell the clients to connect to the migration target before migraton starts
(1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect
    (to all the clients that support it)
(2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) from all the relevant clients,
    or a timeout, in order to complete client_migrate_info monitor command
(cherry picked from commit 5560c56ef05c74da5e0e0825dc1f134019593cad branch 0.8;
 Was modified to support the separation of main channel from reds, and multiple clients)

Conflicts:

	server/reds.c
2011-11-02 11:21:08 +02:00
Christophe Fergeau
10538a2222 server: fix function prototypes
Several functions in server/ were not specifying an argument list,
ie they were declared as void foo(); When compiling with
-Wstrict-prototypes, this leads to:
test_playback.c:93:5: erreur: function declaration isn’t a prototype
[-Werror=strict-prototypes]
2011-09-05 07:52:20 +02:00
Christophe Fergeau
5a197ca497 add C++ guards to backtrace.h
Without these, spice_backtrace() can't be used from the C++ client
code.
2011-09-01 03:58:01 +02:00
Christophe Fergeau
4004bb37bc fix memory leak in error path
Issue found by the Coverity scanner
2011-08-25 14:37:08 +02:00
Alon Levy
26623d0fab common: introduce red_printf_debug 2011-08-23 17:01:14 +03:00
Alon Levy
5e4008cc2a common/ring: RING_FOREACH_SAFE: use shorter version from qemu 2011-08-23 17:01:14 +03:00
Alon Levy
e732e8a27d common/backtrace.h: disable for WIN32
This also catches mingw32 which is probably fine, but at least it fixes
the build on visual studio.
2011-07-31 13:31:58 +03:00
Christophe Fergeau
4801005294 fix integer marshalling helpers on big endian
They were trying to convert the destination pointer to an integer before
trying to dereference it. The initial conversion was meant to be a cast
to a pointer of the right size, not to an integer.
2011-07-28 11:32:46 +02:00
Christophe Fergeau
00cb6ff678 fix typo in big endian code path
uint63_t should be uint64_t
2011-07-28 11:32:46 +02:00
Christophe Fergeau
ede372e967 fix make distcheck 2011-07-22 10:24:30 +02:00
Alon Levy
3aff246075 common: add backtrace via gstack or glibc backtrace
Add a backtrace printing function copied from xserver os/backtrace.c
that uses gstack, and if that isn't found then glibc's backtrace.
Used in ASSERT, tested on F15.
2011-07-19 20:33:25 +03:00
Marc-André Lureau
8365513b12 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
2011-06-22 12:12:26 +02:00
Arnon Gilboa
6e10ed279c 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.
2011-05-22 14:53:13 +03:00
Arnon Gilboa
0b1b126b1e 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.
2011-05-12 15:21:08 +03:00