summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2015-09-15Fix linearization of several marshallers with one itemJavier Celaya1-1/+1
The linearization optimization that avoids copying only one item must check that there are no further marshallers in the chain. Just to be clear, we are trying to marshall a message like this: message { uint32 data_size; uint64 *data[data_size] @marshall; } SomeData; Where the data field points to an array in dynamic memory. Marshalling and demarshalling functions look good. The marshalling function creates a submarshaller for the data field and links it to the root marshaller. But when it comes to sending the data through the wire, only the data_size field gets sent. We have observed that, in spice_marshaller_linearize, execution enters into the optimization that avoids copying the data when the root marshaller only has one item, but it ignores the following marshallers in the list. Checking if there are more marshallers fixes the problem.
2015-08-14common: Fix typo in commentFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-11Use installed spice-protocol for code generationChristophe Fergeau1-29/+23
Now that spice-protocol ships the needed .proto files as well as the corresponding python scripts, spice-common can use these in order to generate the C code for the SPICE (de)marshallers.
2015-07-02ppc: Fix quic magic endianessLukas Venhoda1-1/+2
Runtime conversion from a string to uint32 is storing the magic with the same endianness on both LE and BE machines. This requires aditional byte swap when sending magic between LE/BE machines. Changing quic magic to a constant will ensure, that it will be always stored in native endianness, and the second byte swap won't be needed.
2015-07-02ppc: Fix lz magic endianessLukas Venhoda2-4/+3
Commit d39dfbfe changes lz magic to be always treated as LE when encoded. Runtime conversion from a string to uint32 is storing the magic with the same endianness on both LE and BE machines. This requires aditional byte swap when sending magic between LE/BE machines. Changing lz magic to a constant will ensure, that it will be always stored in native endianness, and the second byte swap won't be needed. This commit reverts d39dfbfe changes in lz.c while keeping the rest. They will be needed in future commit for quic.c
2015-07-02ppc: Fix quic decode endianessLukas Venhoda1-3/+5
Converts all decoded words in quic from little endian to local machine endianness.
2015-06-22Proto: Add preferred compression message and constants.Javier Celaya2-0/+5
When accessing a virtual desktop from different devices, some may have different image compression requirements, e.g. slow devices may prefer the faster LZ4 over GLZ. This message instructs the server to switch the image compression algorithm. This patch also promotes the SPICE_IMAGE_COMPRESS_* constants so that they are available from both the server and the client.
2015-04-10ppc: Fix lz magic endiannessErlon Cruz1-1/+3
Signed-off-by: Erlon R. Cruz <erlon.cruz@br.flextronics.com> Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@gmail.com> Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@fit-tecnologia.org.br>
2015-03-26ssl_verify: Move wincrypt.h related #ifdef closer to the includeChristophe Fergeau1-4/+4
Both wincrypt.h and openssl try to define X509_NAME. The wincrypt.h one is not useful for us, so we currently #undef it if this was set. However, it's done very late, right before including x509v3.h which defines the X509_NAME type. Any header included in between may try to #include x509v3.h so it's better to undefine X509_NAME right after including wincrypt.h.
2015-03-26Get rid of SW_CANVAS_IMAGE_CACHEChristophe Fergeau6-42/+14
Every time it's used, it's in constructs similar to: #ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache #elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif This can be rewritten as: , SpiceImageCache *bits_cache #ifdef SW_CANVAS_CACHE , SpicePaletteCache *palette_cache #endif allowing to get rid of SW_CANVAS_IMAGE_CACHE.
2015-03-26Remove another redundant (SW_CANVAS_CACHE) || (SW_CANVAS_IMAGE_CACHE) #ifdefChristophe Fergeau1-2/+0
2015-02-25Fix typo in pixman_image_get_stride() functionFabiano Fidêncio1-1/+1
pixman_image_surface_get_stride -> pixman_image_get_stride
2015-02-03LZ4: Do not include arpa/inet.h in Windows buildsJavier Celaya1-0/+2
2015-02-03LZ4: Add support for 24bit pixman surfacesJavier Celaya2-0/+11
2015-02-03LZ4: Fix the row alignment when it is not on a 32bit boundaryJavier Celaya1-2/+20
Fix the row alignment for 16/24 bpp images when it is not in a 32bit boundary. This is needed for 16bpp images when the width is an odd number, and for the future support of 24bpp images.
2015-02-03LZ4: Decode the image format from the streamJavier Celaya1-1/+19
2015-02-03LZ4: Adjust reading the top_down flagJavier Celaya1-4/+4
Adjust the way the top_down flag is read to the corresponding change in the wire protocol.
2015-02-03LZ4: Fix output buffer sizeJavier Celaya1-2/+4
2015-01-23Remove redundant #if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE)Christophe Fergeau1-37/+1
SW_CANVAS_CACHE is always defined when building spice-gtk, SW_CANVAS_IMAGE_CACHE is always defined when building spice-server, and they are the only 2 users of spice-common. Moreover, build when none of these is defined is broken.
2015-01-23Remove unused 'invers' arg from canvas_get_*Christophe Fergeau1-67/+11
All canvas_get_{quic,jpeg,lz4,jpeg_alpha,lz} methods have an 'invers' argument, but are always called with that argument being 0, so we can drop it from the argument list, and remove the code triggerring when it's true.
2015-01-06common: fix build with mingwVictor Toso1-1/+1
2014-12-09build-sys: Move pixman check to m4 macroChristophe Fergeau1-1/+0
2014-12-09build-sys: Move opengl check to m4 macroChristophe Fergeau1-1/+0
2014-12-09build-sys: Move opus check to m4 macroChristophe Fergeau1-2/+1
2014-12-09build-sys: Move celt check to m4 macroChristophe Fergeau1-3/+1
2014-12-09build-sys: Move smartcard check to m4 macroChristophe Fergeau1-1/+2
2014-12-09build-sys: Small cleanup of AM_CPPFLAGSChristophe Fergeau1-3/+0
Commit 4fafa210 added WARN_CFLAGS, VISIBILITY_HIDDEN_CFLAGS and -std=gnu99 to AM_CFLAGS in common/Makefile.am, but these are not needed. WARN_CFLAGS and VISIBILITY_HIDDEN_CFLAGS are not defined anywhere in spice-common, and spice-common compiles fine without -std=gnu99 on my f21 box.
2014-12-04Remove unused header fileChristophe Fergeau3-44/+0
Nothing uses the definition it contains (I've tested spice-gtk and spice)
2014-12-02Add LZ4 image compression support.Javier Celaya2-1/+73
- Add a new LZ4 image type to spice.proto. - Add canvas_get_lz4() to common_canvas_base, to get a pixmap from an lz4 image. - Add an enable-lz4 switch to the configure script, disabled by default.
2014-11-24glc: Fix "warning: unused variable 'recreate'"Christophe Fergeau1-1/+1
2014-11-10gdi: fix path segments drawing天外银龙1-1/+1
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=64698
2014-10-23common: Fix -Wunused-variableVictor Toso1-0/+6
Fix a few warnings from unused variables when compiling spice-common without OPUS or celt051.
2014-09-18common: Fix -Wmissing-field-initializersFabiano Fidêncio1-1/+1
2014-09-18common: Fix -Wsign-compareFabiano Fidêncio1-2/+2
2014-09-18common: Fix -Wunused-parameterFabiano Fidêncio8-22/+46
2014-09-18common: Remove dead codeFabiano Fidêncio1-9/+0
2014-07-23quic_family_tmpl: Fix "FORWARD_NULL" caught by coverityFabiano Fidêncio1-0/+2
Ensure the received bucket is non NULL
2014-07-23quic: Fix "UNINIT" caught by coverityFabiano Fidêncio1-7/+5
In case of the model evolution mode has a obsolete or non-valid value, just return, avoiding then the usage of non initalized variables.
2014-07-14quic: Fix melcstate "OVERRUN" caught by coverityFabiano Fidêncio1-4/+4
Check for MELCSTATES - 1 to get inside the branch, otherwise (...)->rgb_state.melcstate may be up to MELCSTATES after the pre-incrementing, which would result in an access to a position that is out bounds of the array size MELCSTATES.
2014-05-07Mark sw_canvas.[ch] as automake source filesChristophe Fergeau1-2/+10
These 2 files are not build as part of spice-common build system, but modules using spice-common will build them with the appropriate options. We need to let automake know that these are source files so that it can properly track these files dependencies. Without this change, when eg spice-gtk switches to use 'subdir-objects' to build sw_canvas.c as recommended by automake 1.14, the build will fail because $(top_srcdir)/spice-common/common/.deps/sw_canvas.Plo will not have been generated.
2014-04-16Use #include "common/..." in (de)marshallersChristophe Fergeau1-7/+8
Now that they are created in $builddir, their includes will need to refer to files in $srcdir, which can be different. It's cleaner to add -I $(top_srcdir)/spice-common/ to modules using spice-common rather than having -I $(top_srcdir)/spice-common/common which would could create header collisions.
2014-04-16Fix generation of marshallers in VPATH buildsChristophe Fergeau1-9/+9
The rules to generate the .c/.h (de)marshalling files have targets based in $builddir, but the CLIENT_MARSHALLERS/SERVER_MARSHALLERS list refer to files in $srcdir. When using a $srcdir != $builddir, these $srcdir files will not exist, and it will not be possible to generate them, which causes the build to fail. When using $srcdir == $builddir from git or from tarballs, this will not make a difference. When building from git, if $srcdir and $builddir are the same, then the files will be found regardless of if we look for them in $srcdir or $builddir as they are the same. In tarballs, the files will be shipped with the tarball and thus available in $srcdir. As $builddir is the same as $srcdir, the files will already exist and not be regenerated. The only change of behaviour will be when using a tarball and doing a $srcdir != $builddir build. In this case, the files will need to be regenerated, so the tools needed for that must be installed on the machine doing the build.
2014-01-20quic: Fix test which is always trueChristophe Fergeau1-1/+1
find_model_params() is first doing *nbuckets = 0; and it then checks nbuckets for NULL. This is redundant as the dereferencing would cause a segfault if nbuckets was NULL, so the if (nbuckets) test can't be false. As Uri pointed out, the "/* bucket start */" comment on the same line probably implies that the test was meant to be 'if (*nbuckets)' I've ran a few test and I did not observe issues because of it...
2014-01-07ssl: Don't use uninitialized variable in verify_subject()Christophe Fergeau2-12/+9
If verify_subject() is called with a SpiceOpenSSLVerify struct containing a non-NULL 'in_subject' member, it would try to use the local 'in_entries' variable without having initialized it first. This could happen if verify_subject() was called multiple time with the same SpiceOpenSSLVerify context, which probably isn't occurring the way we are using it. However, since verify_subject() is the only method which needs in_subject, we don't need to have it stored in SpiceOpenSSLVerify, and we can recreate it as needed locally in that method, which avoids that issue.
2014-01-07mi: Fix shadow warningsChristophe Fergeau1-4/+0
Based off a xserver commit from Yaakov Selkowitz: http://cgit.freedesktop.org/xorg/xserver/commit/mi/mispans.c?id=f02e27e4fcc34413b2051e5a01edc92172fa8612
2014-01-07mi: fix memory leak in miFillUniqueSpanGroupChristophe Fergeau1-0/+2
This is based off the corresponding xserver commit from Tiago Vignatti: http://cgit.freedesktop.org/xorg/xserver/commit/mi/mispans.c?id=7ae46b69ba3f05f46529131e6a864904967cde3a Since xrealloc is #defined to spice_realloc which aborts on failure, this block is dead code, but I prefer to stay as close as possible to the upstream xserver code this is based on.
2014-01-07mi: Avoid stack smash when drawing dashed linesChristophe Fergeau1-3/+3
Based off Peter Harris's xserver commit http://cgit.freedesktop.org/xorg/xserver/commit/mi/miwideline.c?id=20c2a3bcb11b5baf564e2c73a477ba23f5ae2b10
2014-01-07quic: Add missing break; in switch/caseChristophe Fergeau1-0/+2
Unhandled values call an error callback, and then fall through the default: case, which will call again the error callback. This commit adds some break; after these cases to avoid this.
2014-01-07backtrace: Don't attempt to call seteuid(0)Christophe Fergeau1-1/+0
We are mostly likely not running as root, so this call will fail. As we are supposed to check its return value as it's declared with warn_unused_result, the current way of using it is wrong, so this commit just removes the call.
2014-01-07Remove unused variableChristophe Fergeau1-2/+0
It was assigned a value, but then the value was never used.