The macro was misused and not doing static check.
Spice have other working static check macros to use.
The macro is used only by spice-common so removing it
does not cause issues to other depending projects.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
memmove already deal with any alignment so there's no
reason to have row byte pointer cast to uint32_t.
This also remove the confusing "dest" terminology used. The image
is aligned in place so the image bits are used for both destination
and source.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
For example, something like this:
uint8_t *p8;
uint32_t *p32 = (uint32_t *) p8;
generates a warning like this:
spice-channel.c:1350:10: error: cast from 'uint8_t *' (aka 'unsigned char *') to
'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to
4 [-Werror,-Wcast-align]
The warning indicates that we end up with a pointer to data that
should be 4-byte aligned, but its value may be misaligned. On x86,
this does not make much of a difference, except a relatively minor
performance penalty. However, on platforms such as older ARM, misaligned
accesses are emulated by the kernel, and support for them is optional.
So we may end up with a fault.
The intent of the fix here is to make it easy to identify and rework
places where actual mis-alignment occurs. Wherever casts raise the warning,
they are replaced with a macro:
- SPICE_ALIGNED_CAST(type, value) casts value to type, and indicates that
we believe the resulting pointer is aligned. If it is not, a runtime
warning will be issued. This check is disabled unless
--enable-alignment-checks is passed at configure time
- SPICE_UNALIGNED_CAST(type, value) casts value to type, and indicates that
we believe the resulting pointer is not always aligned.
Any code using SPICE_UNALIGNED_CAST may need to be revisited in order
to improve performance, e.g. by using memcpy.
There are normally no warnings for SPICE_UNALIGNED_CAST, but it is possible
to emit debug messages for mis-alignment in SPICE_UNALIGNED_CAST
by configuring with CFLAGS=-DSPICE_DEBUG_ALIGNMENT.
Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
According to https://developer.gnome.org/glib/stable/glib-running.html,
G_MESSAGES_DEBUG is a space-separated list of log domains for which
informational and debug messages should be printed
Note that the equivalent code in spice-util.c gets it right.
Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
As we moved toward GLib logging instead of having to convert
every time the log level from the old system to GLib use
directly GLib constants.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This was suggested by Christophe de Dinechin as an optimisation.
Most of the messages won't be processed for formatting.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Use INT_MAX for invalid value to remove a test in code.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
spice_log_level_to_glib never returns 0 so don't check
for this value.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
License reported for MIT was indeed a BSD 3-Clause license,
not a MIT one (https://opensource.org/licenses/BSD-3-Clause).
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
Some headers for spice are distributed using MIT licenses.
Allows to generate such headers if needed.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
The HTML file is not built by default.
This fixes make distcheck in spice-gtk.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
pixman_region32_copy assume that destination (first argument)
is initialized and can use a pointer inside based on different
conditions.
As intersection is not initialized this can cause different
memory problems.
This resulted in memory leak detection from address sanitizer.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
The latter is deprecated, so might be removed at some point in the
future. This also adds a compatibility wrapper for OpenSSL < 1.1.0.
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Client might want to choose a preferred video codec for streaming for
different reasons which having hardware decoder support being the most
interest one.
This message allows the client to send an array of video codecs in
order of preference.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
spice-common has no stable ABI/API.
Also these function caused linking problems as these functions
were defined multiple times.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
The spice_marshaller_add_ref() family of functions is confusing since it
sounds like you're incrementing a reference on the marshaller. What it
is actually doing is adding a data buffer to the marshaller by reference
rather than by value. Changing the function names to _add_by_ref() makes
this clearer.
The old functions are deprecated and are simply inline functions that
call the new functions.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Including CANVAS_SINGLE_INSTANCE that was bounded to CanvasBase user
data which was removed in previous commit
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Neither Spice nor spice-gtk are using this since the
following commit in Spice "server: remove OpenGL"
c5c176a5c7718177f23b07981556b5d460627498
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Building spice or spice-gtk from git requires python modules pyparsing
and six. Search for them in the both Python versions and set
the Python version accordingly.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Newer lz4 headers give deprecated warning using LZ4_compress_continue
instead of LZ_compress_fast_continue so detect this function
to allow usage and avoid the warning.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
LZ4 changed versioning scheme from r131 to v1.7.3 making our configure
fail with (1.7.3 < 129).
Switch from version checking to checking that the necessary function
is available.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Moving out a big switch statement that sole purpose is to retrieve the
surface (pixma_image_t)
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
The verify macro used currently has some problem
as it raise a warning in RHEL6.
As suggested in verify.h use verify_expr macro
to avoid the warning.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
The generated spice_protocol.html file and the Makefile were not
included in gitignore. This patch fixes it.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
The protocol file is not documented and people have to read code to
understand the specification.
This can lead to unexpected or not optimal results so it's better
to have it documented.
The m4/spice_manual.m4 came from spice server and is meant to be
reused.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
LZ4 data compression on spicevmc channel uses LZ4_compress_default()
API introduced in 129 release (see commit bellow)
[0] https://github.com/Cyan4973/lz4/commit/1b17bf2ab8cf66dd2b740e
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Reported-by: Fabio Fantoni <fantonifabio@tiscali.it>
Python 2.6 does not have a flags parameter.
This is needed for RHEL 6.8.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
As client_marshallers.h is included outisde of spice-common, we need to
specify the path for generated_marsharllers.h so that builds out of the
tree don't fail.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This commit adds autogeneration of a generated_client_marshallers.h
header, which is then included in client_marshallers.h
This allows to remove the SpiceMessageMarshallers struct from this file,
which has to match what the generated code expects.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Until now, the same header guard was used for all generated .h files.
Now the header guard name is based on the name of the file being
generated so that it's different for each .h file.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Includes specified on the command line are currently #included with <>
rather than "". However, they are usually spice-common headers, so it
makes more sense to include them using ""
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>