[Spice-commits] 2 commits - server/spicevmc.c

Eduardo Lima etrunko at kemper.freedesktop.org
Thu Jun 16 11:30:37 UTC 2016


 server/spicevmc.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 77c062f0c0e5723c86990155f2cc6d1b4914fc75
Author: Eduardo Lima (Etrunko) <etrunko at redhat.com>
Date:   Wed Jun 15 14:40:21 2016 -0300

    Fix set but not used variable warning
    
    Introduced by commit 903c91cd3013c763abd3f2292f8fbd911a0c83f0, this
    variable is used only for LZ4 code. Move the declaration to the proper
    block of code.
    
    Build log:
    
    spicevmc.c: In function 'handle_compressed_msg':
    spicevmc.c:346:14: error: variable 'decompressed' set but not used [-Werror=unused-but-set-variable]
         uint8_t *decompressed;
                       ^
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index e949827..0eda776 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -345,7 +345,6 @@ static int handle_compressed_msg(SpiceVmcState *state, RedChannelClient *rcc,
 {
     /* NOTE: *decompressed is free by the char-device */
     int decompressed_size;
-    uint8_t *decompressed;
     RedCharDeviceWriteBuffer *write_buf;
 
     write_buf = red_char_device_write_buffer_get(state->chardev, rcc->client,
@@ -353,16 +352,17 @@ static int handle_compressed_msg(SpiceVmcState *state, RedChannelClient *rcc,
     if (!write_buf) {
         return FALSE;
     }
-    decompressed = write_buf->buf;
 
     switch (compressed_data_msg->type) {
 #ifdef USE_LZ4
-    case SPICE_DATA_COMPRESSION_TYPE_LZ4:
+    case SPICE_DATA_COMPRESSION_TYPE_LZ4: {
+        uint8_t *decompressed = write_buf->buf;
         decompressed_size = LZ4_decompress_safe ((char *)compressed_data_msg->compressed_data,
                                                  (char *)decompressed,
                                                  compressed_data_msg->compressed_size,
                                                  compressed_data_msg->uncompressed_size);
         break;
+    }
 #endif
     default:
         spice_warning("Invalid Compression Type");
commit 33b45af275be240a91a4cf76f6d55617f64e18cf
Author: Eduardo Lima (Etrunko) <etrunko at redhat.com>
Date:   Wed Jun 15 14:37:25 2016 -0300

    Fix build for systems without LZ4 dependency installed
    
    This was introduced by commit 903c91cd3013c763abd3f2292f8fbd911a0c83f0.
    To fix it, we simply protect the try_compress_lz4 function with proper
    ifdef guards.
    
    Build log:
    
    spicevmc.c: In function 'try_compress_lz4':
    spicevmc.c:143:5: error: implicit declaration of function 'LZ4_compress_default' [-Werror=implicit-function-declaration]
         compressed_data_count = LZ4_compress_default((char*)&msg_item->buf,
         ^
    spicevmc.c:143:5: error: nested extern declaration of 'LZ4_compress_default' [-Werror=nested-externs]
    
    spicevmc.c: At top level:
    spicevmc.c:124:24: error: 'try_compress_lz4' defined but not used [-Werror=unused-function]
     static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
                            ^
    
    Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index 908ad5f..e949827 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -121,6 +121,7 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
  *  - NULL upon failure.
  *  - a new pipe item with the compressed data in it upon success
  */
+#ifdef USE_LZ4
 static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
 {
     RedVmcPipeItem *msg_item_compressed;
@@ -157,6 +158,7 @@ static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeI
     free(msg_item_compressed);
     return NULL;
 }
+#endif
 
 static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
                                                        void *opaque)


More information about the Spice-commits mailing list