summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-31test-quic: Fix -Wsign-compare warningEduardo Lima (Etrunko)1-1/+1
../tests/test-quic.c: In function ‘gdk_pixbuf_new_random’: ../tests/test-quic.c:205:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < gdk_pixbuf_get_byte_length(random_pixbuf); i++) { ^ Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-31quic: Remove some too strict asserts in hot pathsFrediano Ziglio2-7/+17
Some assert in the code are doing some paranoid test and in code paths quite hot. The encoding time is reduced by 30-50% while the decoding time is reduced by a 20-30%. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2018-05-28quic: Remove 'no-inline' hackFrediano Ziglio1-21/+2
The quic code goes through a function pointer in two places in order to try to prevent the compiler from inlining code. Doing performance measurements this trick does not work anymore and just make code less readable. This patch and message was based on a previous work of Christophe Fergeau. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2018-05-25quic: Add test case for compression/decompressionChristophe Fergeau4-0/+291
This only adds a basic test relying on gdk-pixbuf. The main limitation is that gdk-pixbuf does not handle 16bpp images, nor 32bpp/no alpha images. I should have picked something else instead ;) This allows at least to exercise the QUIC_IMAGE_TYPE_RGB24 and QUIC_IMAGE_TYPE_RGBA codepaths. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-25lz: Inline GET_{r,g,b} macrosFrediano Ziglio1-12/+1
With last changes are just used once and are straight forward. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: jonathon Jongsma <jjongsma@redhat.com>
2018-05-25lz: Optimise SAME_PIXEL for RGB16Frediano Ziglio1-4/+4
Do not extract all components and compare one by one, can be easily compared together. Performance measurements on a set of 16 bit images shown an improve of about 10%. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-05-24quic: Use channel->correlate_row in macrosChristophe Fergeau1-50/+48
This avoids the need for a local variable with the right name (which was decorrelate_drow in some cases in quic_tmpl.c...) Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Remove unused argument in uncompress_row{0, }Christophe Fergeau1-8/+6
'correlation_row' is always set to channel->colleration_row, and we already pass 'channel' as an argument. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Add macros to make quic_tmpl.c much closer to quic_rgb_tmpl.cChristophe Fergeau1-77/+107
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: s/decorrelate_drow/correlate_rowChristophe Fergeau1-27/+27
The naming is odd as this is just an alias for channel->correlate_row. This will also help in subsequent commits to make things more consistent with quic_rgb_tmpl.c Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Introduce CommonState *state variable in templatesChristophe Fergeau2-184/+200
Most functions in quic_tmpl.c/quic_rgb_tmpl.c have only superficial differences. One of them is using channel->state or encoder->rgb_state. This commit adds a local CommonState *state in all template methods which will be used instead of channel->state or encoder->rgb_state. This makes it easier to spot the common code between the 2 template files... Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Factor common codeChristophe Fergeau1-82/+34
We don't need 2 different implementations when the only difference is the CommonState which is being used. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Get rid of RLE #defineChristophe Fergeau3-33/+0
It's always set, no need to have conditional compilation based on it. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Get rid of RLE_STAT #defineChristophe Fergeau2-63/+2
It's always set, no need to have conditional compilation based on it. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Get rid of QUIC_RGB #defineChristophe Fergeau2-163/+0
It's always set, no need to have conditional compilation based on it. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Remove configurable PREDChristophe Fergeau3-74/+0
It's hardcoded at compile-time, and I don't think it was changed in years... Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24quic: Remove configurable RLE_PREDChristophe Fergeau3-97/+16
It's hardcoded at compile-time, and I don't think it was changed in years... Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-24Bump glib requirements to 2.38Eduardo Lima (Etrunko)1-1/+1
test-logging makes use of functions only available from this version ../tests/test-logging.c: In function ‘test_spice_abort_level’: ../tests/test-logging.c:50:5: error: ‘g_test_subprocess’ is deprecated: Not available before 2.38 [-Werror=deprecated-declarations] if (g_test_subprocess()) { ^~ In file included from /usr/include/glib-2.0/glib.h:82:0, from ../tests/test-logging.c:23: /usr/include/glib-2.0/glib/gtestutils.h:151:10: note: declared here gboolean g_test_subprocess (void); ^~~~~~~~~~~~~~~~~ Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-23Check for messages with duplicate values inside a channelFrediano Ziglio1-0/+8
Make sure there are not 2 messages with the same value in the same channel. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-05-23Check for messages with duplicate names inside a channelFrediano Ziglio1-0/+2
Make sure there are not 2 messages with the same name in the same channel. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-05-23codegen: Remove duplicate client and server code from ChannelType::resolveFrediano Ziglio1-39/+29
Code that handled client and server messages check was the same, just changed some variable names. Instead use a class to store same information and reuse the code. This allows easier extension of the 2 path of code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-05-21marshaller: Remove initial underscore from static functionFrediano Ziglio1-2/+2
This is the only function starting with an underscore, looks out of style. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-05-18Fix cast to spice_marshaller_item_free_func functionEduardo Lima (Etrunko)1-1/+6
Building with gcc 8.0.1 from Fedora 28 gives the following error: FAILED: common/common@@spice-common@sta/marshaller.c.o ../common/marshaller.c: In function 'spice_marshaller_reserve_space': ../common/marshaller.c:311:27: error: cast between incompatible function types from 'void (*)(void *)' to 'void (*)(uint8_t *, void *)' {aka 'void (*)(unsigned char *, void *)'} [-Werror=cast-function-type] item->free_data = (spice_marshaller_item_free_func)free; ^ cc1: all warnings being treated as errors Which can be easily fixed by creating a new function with the correct signature and calling free() from it. Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-17Fix field names for Smartcard protocol structuresEduardo Lima (Etrunko)1-3/+3
Rename struct VSCMsgReaderAdd field 'reader_name' to 'name', and struct VSCMsgATR field 'data' to 'atr' to match their definitions in file vscard_common.h. The error log follows: generated_server_demarshallers.c:1985:30: note: each undeclared identifier is reported only once for each function it appears in generated_server_demarshallers.c:1994:15: error: ‘VSCMsgReaderAdd {aka struct VSCMsgReaderAdd}’ has no member named ‘reader_name’ memcpy(out->reader_name, in, reader_name__nelements); ^~ Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17Fix demarshaller code generatorEduardo Lima (Etrunko)3-2/+9
Even though commit df4ec5c3186e796624e4bbf2dc4a269faf2823f6 commented out most of smartcard code which triggered this error, it still might happen if a new message is added with an array member. The reason is a missing declaration of mem_size, which is fixed simply by checking if the attribute 'nocopy' is present. The error log follows: generated_server_demarshallers.c: In function ‘parse_msgc_smartcard_reader_add’: generated_server_demarshallers.c:1985:30: error: ‘mem_size’ undeclared (first use in this function); did you mean ‘nw_size’? data = (uint8_t *)malloc(mem_size); ^~~~~~~~ nw_size This patch also updates test-marshallers so that this bug is triggered. The diff between generated demarshallers with the patch applied follows: --- tests/generated_test_demarshallers.c.old 2018-05-17 14:35:29.234056487 -0300 +++ tests/generated_test_demarshallers.c 2018-05-17 14:35:40.554031295 -0300 @@ -286,6 +286,7 @@ static uint8_t * parse_msg_main_ArrayMes uint8_t *start = message_start; uint8_t *data = NULL; uint64_t nw_size; + uint64_t mem_size; uint8_t *in, *end; uint64_t name__nw_size; uint64_t name__nelements; @@ -298,6 +299,7 @@ static uint8_t * parse_msg_main_ArrayMes } nw_size = 0 + name__nw_size; + mem_size = sizeof(SpiceMsgMainArrayMessage); /* Check if message fits in reported side */ if (nw_size > (uintptr_t) (message_end - start)) { Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17test-overflow: Remove a leak in the testFrediano Ziglio1-0/+1
This causes errors if Valgrind or sanitizer or similar memory leak checkers are used. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-05-17build: Remove FIXME_SERVER_SMARTCARD hackEduardo Lima (Etrunko)2-9/+0
This hack is now made obsolete by the previous commit. We can safely remove those defines and the code now builds fine for both spice server and spice-gtk. commit df4ec5c3186e796624e4bbf2dc4a269faf2823f6 Author: Frediano Ziglio <fziglio@redhat.com> Date: Fri May 11 16:59:46 2018 +0100 Fix generation of Smartcard channel Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17Fix generation of Smartcard channelFrediano Ziglio1-2/+10
The Smartcard channel definition has been always broken. Multiple client messages with the same ID are defined in the channel. This cause on server demarshaller to only have last message defined, while on the client marshaller code all message marshallers are defined but client uses only header message. Following the difference of the generated code. diff -rup old/generated_client_marshallers.c common/generated_client_marshallers.c --- old/generated_client_marshallers.c 2018-05-14 22:49:07.641778414 +0100 +++ common/generated_client_marshallers.c 2018-05-14 22:49:22.266329296 +0100 @@ -389,27 +389,6 @@ static void spice_marshall_msgc_tunnel_s } #ifdef USE_SMARTCARD -static void spice_marshall_msgc_smartcard_data(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - SpiceMsgcSmartcard *src; - *reader_name_out = NULL; - src = (SpiceMsgcSmartcard *)msg; - - /* header */ { - spice_marshaller_add_uint32(m, src->header.type); - spice_marshaller_add_uint32(m, src->header.reader_id); - spice_marshaller_add_uint32(m, src->header.length); - } - if (src->header.type == SPICE_VSC_MESSAGE_TYPE_ReaderAdd) { - /* Don't marshall @nomarshal reader_name */ - } else if (src->header.type == SPICE_VSC_MESSAGE_TYPE_ATR || src->header.type == SPICE_VSC_MESSAGE_TYPE_APDU) { - /* Remaining data must be appended manually */ - } else if (src->header.type == SPICE_VSC_MESSAGE_TYPE_Error) { - spice_marshaller_add_uint32(m, src->error.code); - } -} - static void spice_marshall_msgc_smartcard_header(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED VSCMsgHeader *msg) { SPICE_GNUC_UNUSED SpiceMarshaller *m2; @@ -421,25 +400,6 @@ static void spice_marshall_msgc_smartcar spice_marshaller_add_uint32(m, src->length); } -static void spice_marshall_msgc_smartcard_error(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED VSCMsgError *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; - VSCMsgError *src; - src = (VSCMsgError *)msg; - - spice_marshaller_add_uint32(m, src->code); -} - -static void spice_marshall_msgc_smartcard_atr(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED VSCMsgATR *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - -static void spice_marshall_msgc_smartcard_reader_add(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED VSCMsgReaderAdd *msg) -{ - SPICE_GNUC_UNUSED SpiceMarshaller *m2; -} - #endif /* USE_SMARTCARD */ static void spice_marshall_SpiceMsgCompressedData(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgCompressedData *msg) { @@ -496,20 +456,8 @@ SpiceMessageMarshallers * spice_message_ marshallers.msgc_record_mode = spice_marshall_msgc_record_mode; marshallers.msgc_record_start_mark = spice_marshall_msgc_record_start_mark; #ifdef USE_SMARTCARD - marshallers.msgc_smartcard_atr = spice_marshall_msgc_smartcard_atr; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_data = spice_marshall_msgc_smartcard_data; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_error = spice_marshall_msgc_smartcard_error; -#endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD marshallers.msgc_smartcard_header = spice_marshall_msgc_smartcard_header; #endif /* USE_SMARTCARD */ -#ifdef USE_SMARTCARD - marshallers.msgc_smartcard_reader_add = spice_marshall_msgc_smartcard_reader_add; -#endif /* USE_SMARTCARD */ marshallers.msgc_tunnel_service_add = spice_marshall_msgc_tunnel_service_add; marshallers.msgc_tunnel_service_remove = spice_marshall_msgc_tunnel_service_remove; marshallers.msgc_tunnel_socket_closed = spice_marshall_msgc_tunnel_socket_closed; diff -rup old/generated_client_marshallers.h common/generated_client_marshallers.h --- old/generated_client_marshallers.h 2018-05-14 22:49:07.641778414 +0100 +++ common/generated_client_marshallers.h 2018-05-14 22:49:22.739358627 +0100 @@ -61,11 +61,7 @@ typedef struct { void (*msgc_tunnel_socket_data)(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg); void (*msgc_tunnel_socket_token)(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg); #ifdef USE_SMARTCARD - void (*msgc_smartcard_data)(SpiceMarshaller *m, SpiceMsgcSmartcard *msg, SpiceMarshaller **reader_name_out); void (*msgc_smartcard_header)(SpiceMarshaller *m, VSCMsgHeader *msg); - void (*msgc_smartcard_error)(SpiceMarshaller *m, VSCMsgError *msg); - void (*msgc_smartcard_atr)(SpiceMarshaller *m, VSCMsgATR *msg); - void (*msgc_smartcard_reader_add)(SpiceMarshaller *m, VSCMsgReaderAdd *msg); #endif /* USE_SMARTCARD */ void (*msg_SpiceMsgCompressedData)(SpiceMarshaller *m, SpiceMsgCompressedData *msg); void (*msgc_port_event)(SpiceMarshaller *m, SpiceMsgcPortEvent *msg); Only in common/: generated_client_marshallers.lo diff -rup old/generated_server_demarshallers.c common/generated_server_demarshallers.c --- old/generated_server_demarshallers.c 2018-05-14 22:49:07.641778414 +0100 +++ common/generated_server_demarshallers.c 2018-05-14 22:49:23.498405695 +0100 @@ -1957,24 +1957,18 @@ static uint8_t * parse_TunnelChannel_msg #ifdef USE_SMARTCARD -static uint8_t * parse_msgc_smartcard_reader_add(uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message) +static uint8_t * parse_msgc_smartcard_header(uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message) { SPICE_GNUC_UNUSED uint8_t *pos; uint8_t *start = message_start; uint8_t *data = NULL; uint64_t nw_size; + uint64_t mem_size; uint8_t *in, *end; - uint64_t reader_name__nw_size; - uint64_t reader_name__nelements; - VSCMsgReaderAdd *out; + VSCMsgHeader *out; - { /* reader_name */ - reader_name__nelements = message_end - (start + 0); - - reader_name__nw_size = reader_name__nelements; - } - - nw_size = 0 + reader_name__nw_size; + nw_size = 12; + mem_size = sizeof(VSCMsgHeader); /* Check if message fits in reported side */ if (nw_size > (uintptr_t) (message_end - start)) { @@ -1986,13 +1980,14 @@ static uint8_t * parse_msgc_smartcard_re if (SPICE_UNLIKELY(data == NULL)) { goto error; } - end = data + sizeof(VSCMsgReaderAdd); + end = data + sizeof(VSCMsgHeader); in = start; - out = (VSCMsgReaderAdd *)data; + out = (VSCMsgHeader *)data; - memcpy(out->reader_name, in, reader_name__nelements); - in += reader_name__nelements; + out->type = consume_uint32(&in); + out->reader_id = consume_uint32(&in); + out->length = consume_uint32(&in); assert(in <= message_end); assert(end <= data + mem_size); @@ -2017,7 +2012,7 @@ static uint8_t * parse_SmartcardChannel_ parse_msgc_disconnecting }; static parse_msg_func_t funcs2[1] = { - parse_msgc_smartcard_reader_add + parse_msgc_smartcard_header }; if (message_type >= 1 && message_type < 7) { return funcs1[message_type-1](message_start, message_end, minor, size_out, free_message); Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-05-11Avoid integer overflow computing image sizesFrediano Ziglio2-12/+9
Use always 64, sizes can be 32x32. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-11Write a small test to test possible crashFrediano Ziglio2-0/+100
This small test prove a that current generated demarshaller code is not safe to integer overflows leading to buffer overflows. Actually from a quick look at the protocol it seems that client can't cause these overflows but server can quite easily at demonstrated by this test. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-11Fix integer overflows computing sizesFrediano Ziglio1-19/+19
Make code safe using both 32 and 64 bit machine. Consider that this code can be compiled for machines with 32 bit. There are some arrays length which are 32 bit. If size_t this can cause easily an overflow. For instance message_len sending SPICE_MSG_NOTIFY messages are 32 bit and code add a small constant (currently 24) before doing the test for size. Now passing (uint32_t) -20 as message_len would lead to a size of 4 after the addition. This overflow does not happen on 64 bit machine as the length is converted to size_t. There are also some array length where some item are bigger than 1 byte. For instance SPICE_MAIN_CHANNELS_LIST message have a number of channels and each channel is composed by 2 bytes. Now the code generated try to do length * 2 where length is still a 32 bit so if we put a value like 0x80000002u we get 4 as length. This will cause an overflow as code will allocate very few bytes but try to fill with a huge number of elements. This overflow happen in both 32 and 64 bit machine. To avoid all these possible overflows this patch use only 64 bit for nelements (number of elements), nw_size (network size) and mem_size (memory size needed) checking the sizes to avoid other overflows (like pointers conversions under 32 bit machines). Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-05-10lz: Move ENCODE_PIXEL for RGB24 and RGB32 to a common placeFrediano Ziglio1-2/+1
The macro for both depth is the same, reuse the definition. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-10protocol: Use a typedef to specify stream_id typeFrediano Ziglio1-6/+11
This change does not affect generated code but make source more readable. Also document in a single location the range of this type. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-10miLineArc(): initialize edge1, edge2Jonathon Jongsma1-1/+1
When compiling spice-common with meson/ninja under "release" mode, I get several compiler warnings about possibly-uninitialized members. For example: ../subprojects/spice-common/common/lines.c: In function ‘miLineArc’: ../subprojects/spice-common/common/lines.c:2167:17: error: ‘edge2.dx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] edge->e += edge->dx; \ ^~ ../subprojects/spice-common/common/lines.c:2426:24: note: ‘edge2.dx’ was declared here PolyEdgeRec edge1, edge2; ^~~~~ Initializing these structures to zero silences the warnings. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-09codegen: Removed unused get_type methodsFrediano Ziglio1-9/+0
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-05-09codegen: Add some commentsFrediano Ziglio1-1/+5
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-05-05messages: document limitation of id in StreamCreateVictor Toso1-1/+1
Note that the ID limitation always existed but now we have the limitation in the protocol itself with SPICE_MAX_NUM_STREAMS Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-17Remove extra self parameter from member functionJonathon Jongsma1-1/+1
When testing out some experimental protocol changes, I managed to trigger the following error: GEN generated_client_demarshallers.c Traceback (most recent call last): File "../../../spice-common/spice_codegen.py", line 267, in <module> demarshal.write_protocol_parser(writer, proto, True) File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1270, in write_protocol_parser parsers[channel.value] = (channel.channel_type, write_channel_parser(writer, channel.channel_type, is_server)) File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1163, in write_channel_parser func = write_msg_parser(helpers, ids[i].message_type) File "/home/jjongsma/work/spice/spice-common/python_modules/demarshal.py", line 1061, in write_msg_parser num_pointers = message.get_num_pointers() File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 855, in get_num_pointers count = count + m.get_num_pointers() File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 662, in get_num_pointers return self.member_type.get_num_pointers() File "/home/jjongsma/work/spice/spice-common/python_modules/ptypes.py", line 507, in get_num_pointers if self.is_constant_length(self): TypeError: is_constant_length() takes exactly 1 argument (2 given) Calling a member function will implicitly pass 'self' as the first argument, but we were also explicitly passing it as an argument (self.is_constant_length(self)). This resulted in the above error. Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-03-19Add --enable-extra-checks optionFrediano Ziglio3-0/+21
Allow to enable code to do additional or expensive checks. The option should be used by higher level libraries. By default the option is disabled. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-03-18protocol: Add some documentation for inval_all_pixmaps messageFrediano Ziglio1-0/+7
This message is not straight forward to grasp. Not clear by the name why we need to wait other channels messages before resetting the image cache. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-01-31canvas: Use SPICE_UNALIGNED_CAST to avoid -Wcast-align warningsFrediano Ziglio1-1/+1
This solves https://bugs.freedesktop.org/show_bug.cgi?id=104521. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2018-01-25canvas: Fix some semi transparent drawingFrediano Ziglio1-2/+10
This is reproducible using desktop icons on Windows XP. These drawing are sent for the icons on the desktop. To get an extends.x1 >= 32 you have to move an icon out of the screen on the left side. Set the icon size to 72 as the icon has to be out of the screen quite a lot. Disable the grid alignment on the desktop and move an icon out of the screen. Select and unselect the icon. Using "/ 32" the icon will have a white background instead of a transparent one. Using a "/ 8" the icon is rendered correctly. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2018-01-24canvas: Prevent some error compiling spice-gtkFrediano Ziglio1-3/+5
Due to different warning setting some GCC reports: In file included from ../spice-common/common/sw_canvas.c:27:0, from client_sw_canvas.c:20: ../spice-common/common/canvas_base.c: In function ‘canvas_get_lz’: ../spice-common/common/canvas_base.c:768:13: error: ‘palette’ may be used uninitialized in this function [-Werror=maybe-uninitialized] free(palette); ^~~~~~~~~~~~~ ../spice-common/common/canvas_base.c:764:9: error: variable ‘free_palette’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] int free_palette = FALSE; ^~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-01-23Fix build with LibreSSLPaweł Pękala1-1/+1
Some FreeBSD configurations can use LibreSSL instead of OpenSSL. The two libraries are really similar but need some minimal adjustment. Signed-off-by: Paweł Pękala <pawelbsd@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-01-18canvas: Remove unused include headerFrediano Ziglio2-7/+0
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-18canvas: Unify __surface_create_stride and surface_create_strideFrediano Ziglio1-9/+3
They are now just the same function with same parameters, just one calls the other. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-18canvas: Remove dc fields from CanvasBase and LzDecodeUsrDataFrediano Ziglio3-43/+1
Now always NULL. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-18canvas: Remove dc parameter from SwCanvas::put_imageFrediano Ziglio2-6/+0
Not used anymore. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-18canvas: Remove unused dc parameter from surface_createFrediano Ziglio3-41/+7
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-01-18canvas: Remove Windows bitmap allocationFrediano Ziglio1-105/+0
There's no reason to use a DIB section if we are going to use just the memory in it assigned to a pixman surface, use normal path and memory. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>