Commit Graph

812 Commits

Author SHA1 Message Date
Frediano Ziglio
5b6878e72c docs: Fix typos and grammar
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2018-11-21 17:27:54 +00:00
Frediano Ziglio
2060672e81 Create common header for demarshallers declarations
Code generated for demarshallers define and declare some types and
functions.
However these types and functions are also declared separately in other
headers (currently spice-common/client_demarshallers.h and
spice/server/demarshallers.h) resulting in potential ABI mismatch if the
different declarations do not match.
Using a common header shared between generated code and code using
these functions prevent potentially multiple different declarations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 13:31:16 +01:00
Frediano Ziglio
87493929b4 client_demarshallers: Remove SPICE protocol 1 declaration
spice_get_server_channel_parser1 function was removed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 10:58:38 +01:00
Frediano Ziglio
ddfb8807c6 codegen: Remove minor attribute
The idea in version 1 of the protocol was to extend it using the minor
version. However this was replaced by the usage of capabilities and the
minor attribute (which was not much used in version 1) was abandoned in
version 2.
This patch create a big difference in the code generated but only because
the minor version was passed between all possible functions as argument.
Note that exported functions retain the minor argument for compatibility
reasons.
The demarshaller code export directly spice_get_client_channel_parser or
spice_get_server_channel_parser functions which returns internal module
functions which parse message of specific channels.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 10:58:38 +01:00
Frediano Ziglio
8a68e67afa codegen: Remove fixedsize attribute
This attribute was used only in SPICE version 1.
The intention was use fixed size for switch type in the protocol.
However this does not bring any improvement, just increase network
bytes used.
Generated code does not change.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 10:58:38 +01:00
Frediano Ziglio
979717350d codegen: Remove bytes_count attribute
This attribute was used only in SPICE version 1.
Its usage was confusing, and was replaced by the simple usage of
array size.
Generated code does not change.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-10-15 10:58:38 +01:00
Christophe Fergeau
b9dca950fb Remove config.h from header files
This should only be included from c files.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-10-08 17:18:12 +02:00
Frediano Ziglio
7d16536672 proto: Remove support for SPICE version 1
SPICE version 2 was introduced more than 8 years ago.
RHEL 6 already removed support for version 1 in the server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-09-28 09:00:03 +01:00
Frediano Ziglio
90f95c2f8c quic: Prevent side effects calling C macros
In some architectures GLib macros to change endianness use the
argument multiple times causing possible side effects.

This happens for instance using Debian SID and MIPS.

This fixes https://gitlab.freedesktop.org/spice/spice-common/issues/1.

Reported-by: Laurent Bigonville <bigon@debian.org>
Tested-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-09-10 12:44:17 +02:00
Eduardo Lima (Etrunko)
6b93b3fce8 meson: Make use of compiler.get_supported_arguments()
This avoids adding an extra build flag which may not be supported by the
compiler.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-09-03 08:53:01 +01:00
Frediano Ziglio
bb15d4815a Fix flexible array buffer overflow
This is kind of a DoS, possibly flexible array in the protocol
causes the network size check to be ignored due to integer overflows.

The size of flexible array is computed as (message_end - position),
then this size is added to the number of bytes before the array and
this number is used to check if we overflow initial message.

An example is:

    message {
        uint32 dummy[2];
        uint8 data[] @end;
    } LenMessage;

which generated this (simplified remove useless code) code:

    { /* data */
        data__nelements = message_end - (start + 8);

        data__nw_size = data__nelements;
    }

    nw_size = 8 + data__nw_size;

    /* Check if message fits in reported side */
    if (nw_size > (uintptr_t) (message_end - start)) {
        return NULL;
    }

Following code:
- data__nelements == message_end - (start + 8)
- data__nw_size == data__nelements == message_end - (start + 8)
- nw_size == 8 + data__nw_size == 8 + message_end - (start + 8) ==
  8 + message_end - start - 8 == message_end -start
- the check for overflow is (nw_size > (message_end - start)) but
  nw_size == message_end - start so the check is doing
  ((message_end - start) > (message_end - start)) which is always false.

If message_end - start < 8 then data__nelements (number of element
on the array above) computation generate an integer underflow that
later create a buffer overflow.

Add a check to make sure that the array starts before the message ends
to avoid the overflow.

Difference is:
    diff -u save/generated_client_demarshallers1.c common/generated_client_demarshallers1.c
    --- save/generated_client_demarshallers1.c	2018-06-22 22:13:48.626793919 +0100
    +++ common/generated_client_demarshallers1.c	2018-06-22 22:14:03.408163291 +0100
    @@ -225,6 +225,9 @@
         uint64_t data__nelements;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 0) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 0);

             data__nw_size = data__nelements;
    @@ -243,6 +246,9 @@
         *free_message = nofree;
         return data;

    +   error:
    +    free(data);
    +    return NULL;
     }

     static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message)
    @@ -301,6 +307,9 @@
         SpiceMsgPing *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 12) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 12);

             data__nw_size = data__nelements;
    @@ -5226,6 +5235,9 @@
             uint64_t cursor_data__nw_size;
             uint64_t cursor_data__nelements;
             { /* data */
    +            if (SPICE_UNLIKELY((start2 + 22) > message_end)) {
    +                goto error;
    +            }
                 cursor_data__nelements = message_end - (start2 + 22);

                 cursor_data__nw_size = cursor_data__nelements;
    @@ -5305,6 +5317,9 @@
             uint64_t cursor_data__nw_size;
             uint64_t cursor_data__nelements;
             { /* data */
    +            if (SPICE_UNLIKELY((start2 + 22) > message_end)) {
    +                goto error;
    +            }
                 cursor_data__nelements = message_end - (start2 + 22);

                 cursor_data__nw_size = cursor_data__nelements;
    @@ -5540,6 +5555,9 @@
         SpiceMsgPlaybackPacket *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 4) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 4);

             data__nw_size = data__nelements;
    @@ -5594,6 +5612,9 @@
         SpiceMsgPlaybackMode *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 8) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 8);

             data__nw_size = data__nelements;
    diff -u save/generated_client_demarshallers.c common/generated_client_demarshallers.c
    --- save/generated_client_demarshallers.c	2018-06-22 22:13:48.626793919 +0100
    +++ common/generated_client_demarshallers.c	2018-06-22 22:14:03.004153195 +0100
    @@ -225,6 +225,9 @@
         uint64_t data__nelements;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 0) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 0);

             data__nw_size = data__nelements;
    @@ -243,6 +246,9 @@
         *free_message = nofree;
         return data;

    +   error:
    +    free(data);
    +    return NULL;
     }

     static uint8_t * parse_msg_set_ack(uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message)
    @@ -301,6 +307,9 @@
         SpiceMsgPing *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 12) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 12);

             data__nw_size = data__nelements;
    @@ -6574,6 +6583,9 @@
             }

             { /* data */
    +            if (SPICE_UNLIKELY((start2 + 2 + cursor_u__nw_size) > message_end)) {
    +                goto error;
    +            }
                 cursor_data__nelements = message_end - (start2 + 2 + cursor_u__nw_size);

                 cursor_data__nw_size = cursor_data__nelements;
    @@ -6670,6 +6682,9 @@
             }

             { /* data */
    +            if (SPICE_UNLIKELY((start2 + 2 + cursor_u__nw_size) > message_end)) {
    +                goto error;
    +            }
                 cursor_data__nelements = message_end - (start2 + 2 + cursor_u__nw_size);

                 cursor_data__nw_size = cursor_data__nelements;
    @@ -6907,6 +6922,9 @@
         SpiceMsgPlaybackPacket *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 4) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 4);

             data__nw_size = data__nelements;
    @@ -6961,6 +6979,9 @@
         SpiceMsgPlaybackMode *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 6) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 6);

             data__nw_size = data__nelements;
    @@ -7559,6 +7580,9 @@
         SpiceMsgTunnelSocketData *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 2) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 2);

             data__nw_size = data__nelements;
    @@ -7840,6 +7864,9 @@
         }

         { /* compressed_data */
    +        if (SPICE_UNLIKELY((start + 1 + u__nw_size) > message_end)) {
    +            goto error;
    +        }
             compressed_data__nelements = message_end - (start + 1 + u__nw_size);

             compressed_data__nw_size = compressed_data__nelements;
    diff -u save/generated_server_demarshallers.c common/generated_server_demarshallers.c
    --- save/generated_server_demarshallers.c	2018-06-22 22:13:48.627793944 +0100
    +++ common/generated_server_demarshallers.c	2018-06-22 22:14:05.231208847 +0100
    @@ -306,6 +306,9 @@
         uint64_t data__nelements;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 0) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 0);

             data__nw_size = data__nelements;
    @@ -324,6 +327,9 @@
         *free_message = nofree;
         return data;

    +   error:
    +    free(data);
    +    return NULL;
     }

     static uint8_t * parse_msgc_disconnecting(uint8_t *message_start, uint8_t *message_end, SPICE_GNUC_UNUSED int minor, size_t *size, message_destructor_t *free_message)
    @@ -1259,6 +1265,9 @@
         SpiceMsgcRecordPacket *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 4) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 4);

             data__nw_size = data__nelements;
    @@ -1313,6 +1322,9 @@
         SpiceMsgcRecordMode *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 6) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 6);

             data__nw_size = data__nelements;
    @@ -1841,6 +1853,9 @@
         SpiceMsgcTunnelSocketData *out;

         { /* data */
    +        if (SPICE_UNLIKELY((start + 2) > message_end)) {
    +            goto error;
    +        }
             data__nelements = message_end - (start + 2);

             data__nw_size = data__nelements;
    @@ -2057,6 +2072,9 @@
         }

         { /* compressed_data */
    +        if (SPICE_UNLIKELY((start + 1 + u__nw_size) > message_end)) {
    +            goto error;
    +        }
             compressed_data__nelements = message_end - (start + 1 + u__nw_size);

             compressed_data__nw_size = compressed_data__nelements;

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-08-16 15:02:24 +01:00
Frediano Ziglio
5dd0c2f70a ci: Fix Meson feature option
feature can be enabled, disabled or auto, not true/false

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-07-27 12:30:21 +01:00
Eduardo Lima (Etrunko)
d6c05fb046 Meson: Make use of 'feature' option type introduced in version 0.47
This built-in type is used instead of the tri-state string combo
(auto/true/false), simplifying the dependency checks.

http://mesonbuild.com/Build-options.html#features

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-27 10:31:53 +01:00
Eduardo Lima (Etrunko)
12af62316d Meson: Make use of dictionary type introduced in version 0.47
Easier to iterate and improves readability of the code by replacing the
use of nested lists.

http://mesonbuild.com/Reference-manual.html#dictionary-object

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-27 10:29:16 +01:00
Eduardo Lima (Etrunko)
25c00ef146 meson: Fix checking for python
When running with -Dpython-checks=false, the build fails. To fix this,
we move the python variable declaration outside of the get_option()
block as it will be used for calling the generators. Also removes the
unnecessary check for python3-devel.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-25 06:13:06 +01:00
Eduardo Lima (Etrunko)
e2fad781ec meson: Make options accessible through parent project
When building either spice-server or spice-gtk, spice-common should
inherit the command line options from the parent project. This is done
by adding the 'yield' keyword for the opus and celt051 options.

It is also required to add a smartcard option so that we can bypass the
checks if the user wants to.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-23 18:43:42 +01:00
Eduardo Lima (Etrunko)
9b2c989dd9 ci: Fix typo: celt501 -> celt051
Fixes the following warning message while running meson:

WARNING: Unknown command line options: "celt501"
This will become a hard error in a future Meson release.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-07-20 08:19:57 +01:00
Lukáš Hrázký
83e1229417 spice*.proto: Replace tabs with the appropriate number of spaces
Plus a few other indentation fixes.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-19 13:16:19 +02:00
Lukáš Hrázký
f82a6c5349 Rename SpiceHead::id to monitor_id
The id is called 'monitor_id' throughout the rest of the code, rename
for clarity and consistency.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-18 07:21:48 +01:00
Frediano Ziglio
f4a0fec5e9 tests: Join test-overflow and test-marshallers
test-overflow was doing a specific test on demarshalling code.
Joining the 2 tests also allows to remove the dependency from the main
protocol allowing to run the test independently from generation setting.
Using Meson when building either SPICE server or spice-gtk, we only
generate the specific marshallers/demarshallers for that given case.
With this commit the test is built in any case.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-07-12 05:50:50 +01:00
Frediano Ziglio
82c2e2315c canvas_base: Change spice_warning to g_warning
The 2 APIs are equivalent.
Some minor coherence changes:
- remove line terminator, already added;
- start message with lower case;
- LZ4, not Lz4.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-12 05:48:12 +01:00
Frediano Ziglio
e8314732a7 canvas_base: Check for overflows decoding LZ4
Check that we have enough data before reading.
This could lead to read buffer overflows being undetected.
This is not a security issue, read happens only in the client not causing
any information leakage, maximum can generate a crash or some garbage on
the screen.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-12 05:48:12 +01:00
Frediano Ziglio
f636ef42a0 quic: Remove duplicate file
Now that the 2 template files are the same (except for whitespace differences),
we can use a single file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
3618db77b5 quic: Unify rgb/non-rgb macro declarations
This commit adds a common block of macro declarations at the top of
quic_tmpl.c and quic_rgb_tmpl.c. This block is identical between the 2
files, and is one big step towards making the 2 files identical.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
79a6ca2a51 quic: Reorder macro declarations
This commit reorders the macro declarations at the beginning of
quic_tmpl.c and quic_rgb_tmpl.c so that they follow a similar order.
This does the same for the #undef at the end of both file.
This commit is only code movement, and should not add/remove anything
which was not there before. The next commit will unify the macro
declarations and #undef.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
291475318f quic: Introduce COPY_PIXEL macro
Define and reuse a COPY_PIXEL macro to copy a pixel.
This will help in making quic_tmpl.c and quic_rgb_tmpl.c identical.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
c0cc563e10 quic: Add DECLARE_*_VARIABLES macros
They will help unify quic_rgb_tmpl.c and quic_tmpl.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
8b21fc5ea1 quic: Move all golomb decoding macros in a single place
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:34:57 +01:00
Christophe Fergeau
0046ee5e81 quic: Wrap declaration/call of quic method in macros
This allows to pass an additional 'channel' argument when needed, and
should eventually let us unify quic_tmpl.c and quic_rgb_tmpl.c

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-10 10:34:57 +01:00
Frediano Ziglio
a2d32a1fdd quic: Add APPLY_ALL_COMP macro to iterate over channels
Use a APPLY_ALL_COMP macro to unify single/multiple channel processing.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
e3609f06a3 quic: Add CORRELATE*/DECORRELATE* macros
This will help to unify quic_tmpl.c and quic_rgb_tmpl.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
394b5d31c0 quic: Call directly encode_state_run from templates.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
7a535a6141 quic: Add missing #undef SET_a/GET_a
These macros were added to quic_tmpl.c in 815223861 but without the
corresponding #undef. This commit adds them for consistency.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
7a6980def8 quic: Make {UN, }COMPRESS_xx macros closer
Define COMPRESS_xx/UNCOMPRESS_xx macros in a more similar way between
quic_tmpl.c and quic_rgb_tmpl.c using channel suffixes. Instead of
having #define COMPRESS(channel) do_something(channel), we'll now have
 #define COMPRESS(channel) do_something(channel_##channel), and call it
with COMPRESS(a)

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
1ca7e2d765 quic: Add SAME_PIXEL macro
This helps making the code in quic_tmpl.c and quic_rgb_tmpl.c more
similar.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
499b10e494 quic: Rework PIXEL_A/PIXEL_B macros
This makes them identical to their counterparts in quic_rgb_tmpl.c

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
946d3dda22 quic: Add UPDATE_MODEL_COMP macro to iterate over channels
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 10:33:28 +01:00
Frediano Ziglio
6ea60433de meson: Remove -std=c99
This flag disable some compiler feature which is used by some system header
potentially introducing some limitations.
Autotools won't add any flag to limit compiler features to C99, instead it
currently only add flags to support C99 when needed.
For instance some Posix limitations changes (like _POSIX_OPEN_MAX).
As compiler feature for instance _Static_assert is not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-10 09:54:19 +01:00
Christophe Fergeau
9bf4c32288 build: Define GLIB_VERSION_MIN_REQUIRED/GLIB_VERSION_MAX_ALLOWED
This is defined for the meson build, but not the autotools build. This
commit makes them consistent.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 18:12:16 +02:00
Christophe Fergeau
204ff1ae2e pixman: Use g_error() rather than g_abort()
g_abort() was only added in glib 2.50, which causes meson build failures
since this defines GLIB_VERSION_MIN_REQUIRED/GLIB_VERSION_MAX_ALLOWED

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 18:11:54 +02:00
Christophe Fergeau
b4e07c31cf build: Remove spice_common.h
Most users of spice_common.h don't need it, or only need log.h. It only
has a few users outside of spice-common. It's not very well defined
which headers it should contain. This commit removes spice_common.h in
favour of direct inclusion of the needed headers.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:15 +01:00
Christophe Fergeau
8069bf498d common: Remove spice_abort()
There are only 2 users in spice-common, and none in spice-gtk/spice

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:13 +01:00
Christophe Fergeau
31d4622687 log: Remove SPICE_DISABLE_ABORT
spice-gtk was the last user, and stopped using it on Jun 14th 2017
in 040090ccba34 "build-sys: remove -DSPICE_DISABLE_ABORT"

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-06 06:46:05 +01:00
Frediano Ziglio
bb8d75bf31 canvas_base: Avoid misaligned access decoding LZ4 data
Make code faster on platforms not supporting unaligned access by
default.
SPICE_UNALIGNED_CAST is just silencing possible alignment warning and,
if enabled, produces some logs, however in this case we know that the
pointer can be misaligned.
Use packed structures to tell compiler to generate best code possible.
For more details see comment on commit 74e50b57ae ("Make the
compiler work out better way to write unaligned memory").

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-05 09:38:30 +01:00
Christophe Fergeau
6496437e80 meson: Remove '(default: xxx)' from option description
'meson configure' will show the current value of an option, specifying
the default value in the option description does not add much to that
output.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2018-07-05 10:37:35 +02:00
Frediano Ziglio
e98e08594c canvas_base: Fix minor indentation issues
This patch just changes some spaces fixing some possible misleading
indentation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-07-05 09:23:14 +01:00
Christophe Fergeau
3def5a8448 swcanvas: Remove canvas_create()
Nothing calls it in spice-gtk or spice-server

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-04 10:04:02 +02:00
Frediano Ziglio
cd932df7a2 quic: Call encode from golomb_coding
golomb_coding is always followed by a encode call.
Simplify code calling directly it, no reason to pass back output
using pointers.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-07-03 19:37:39 +01:00
Eduardo Lima (Etrunko)
75863fb69f test-region: Decrease loop count by a factor of 10
This test was timing out when running in gitlab-ci, so decreasing the
loop count in order to make it run faster. Example:

https://gitlab.freedesktop.org/etrunko/spice-common/-/jobs/6546

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03 11:43:24 -03:00
Eduardo Lima (Etrunko)
246f3a02b4 Update gitlab-ci to use meson
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03 11:30:55 -03:00