[Spice-commits] 4 commits - build-aux/git-version-gen server/glz-encoder-dict.h server/jpeg-encoder.h server/lz4-encoder.h server/stat-file.h server/stream-channel.cpp server/tests server/zlib-encoder.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 18 09:15:28 UTC 2021


 build-aux/git-version-gen        |   51 +++++++++++++++++++--------------------
 server/glz-encoder-dict.h        |    1 
 server/jpeg-encoder.h            |    1 
 server/lz4-encoder.h             |    1 
 server/stat-file.h               |    1 
 server/stream-channel.cpp        |    5 +++
 server/tests/test-display-base.h |    2 -
 server/zlib-encoder.h            |    1 
 8 files changed, 36 insertions(+), 27 deletions(-)

New commits:
commit c5412b071a971dd7a93f5b0d01aa801efc31490f
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Sun May 9 06:33:43 2021 +0100

    stream-channel: Fix compiler warning
    
    This removes:
    
    In function ‘stream_channel_get_supported_codecs’,
        inlined from ‘on_connect’ at ../server/stream-channel.cpp:364:60:
    ../server/stream-channel.cpp:326:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
      326 |             out_codecs[num++] = codec;
          |                               ^
    ../server/stream-channel.cpp: In member function ‘on_connect’:
    /usr/include/spice-1/spice/stream-device.h:209:13: note: destination object ‘codecs’ of size 0
      209 |     uint8_t codecs[0];
          |             ^
    
    Reported by by Tomasz Kłoczko in
    https://gitlab.freedesktop.org/spice/spice/-/issues/44
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/server/stream-channel.cpp b/server/stream-channel.cpp
index c3e09ca0..4d531eba 100644
--- a/server/stream-channel.cpp
+++ b/server/stream-channel.cpp
@@ -351,6 +351,9 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
         StreamMsgStartStop base;
         uint8_t codecs_buffer[MAX_SUPPORTED_CODECS];
     } start_msg;
+    static_assert(offsetof(StreamMsgStartStop, codecs) ==
+                  offsetof(decltype(start_msg), codecs_buffer),
+                  "Wrong assumption");
     StreamMsgStartStop *const start = &start_msg.base;
 
     spice_return_if_fail(stream != nullptr);
@@ -361,7 +364,7 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
     }
 
     // request new stream
-    start->num_codecs = stream_channel_get_supported_codecs(this, start->codecs);
+    start->num_codecs = stream_channel_get_supported_codecs(this, start_msg.codecs_buffer);
     // send in any case, even if list is not changed
     // notify device about changes
     request_new_stream(start);
commit 0b86b6808a06c482ea2bdef9f24be42e0dcb74ae
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Tue May 11 05:14:16 2021 +0100

    tests: Fix -Wodr warning compiling tests with LTO enabled
    
    Avoid the compiler to see 2 different defines of the same
    structure.
    Reported by Tomasz Kłoczko in
    https://gitlab.freedesktop.org/spice/spice/-/issues/44
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/server/tests/test-display-base.h b/server/tests/test-display-base.h
index 4e865093..a5e1f1b2 100644
--- a/server/tests/test-display-base.h
+++ b/server/tests/test-display-base.h
@@ -18,7 +18,7 @@
 #ifndef __TEST_DISPLAY_BASE_H__
 #define __TEST_DISPLAY_BASE_H__
 
-#include <spice.h>
+#include "spice-wrapped.h"
 #include "basic-event-loop.h"
 
 SPICE_BEGIN_DECLS
commit cb9bd1b09e1dcab2c58e0fd5c49e965edaec7c07
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Sun May 9 09:43:32 2021 +0100

    Make headers independent
    
    Make sure all headers can be compiled alone.
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/server/glz-encoder-dict.h b/server/glz-encoder-dict.h
index 329a50c6..b5a76361 100644
--- a/server/glz-encoder-dict.h
+++ b/server/glz-encoder-dict.h
@@ -19,6 +19,7 @@
 #define GLZ_ENCODER_DICT_H_
 
 #include <stdint.h>
+#include <spice/macros.h>
 
 /*
     Interface for maintaining lz dictionary that is shared among several encoders.
diff --git a/server/jpeg-encoder.h b/server/jpeg-encoder.h
index 4d1a5ee9..9a3325f2 100644
--- a/server/jpeg-encoder.h
+++ b/server/jpeg-encoder.h
@@ -32,6 +32,7 @@
 #define JPEG_ENCODER_H_
 
 #include <spice/types.h>
+#include <spice/macros.h>
 
 SPICE_BEGIN_DECLS
 
diff --git a/server/lz4-encoder.h b/server/lz4-encoder.h
index d7ec6dc6..ed119a1f 100644
--- a/server/lz4-encoder.h
+++ b/server/lz4-encoder.h
@@ -32,6 +32,7 @@
 #define LZ4_ENCODER_H_
 
 #include <spice/types.h>
+#include <spice/macros.h>
 
 SPICE_BEGIN_DECLS
 
diff --git a/server/stat-file.h b/server/stat-file.h
index 709e41c1..d6e763fc 100644
--- a/server/stat-file.h
+++ b/server/stat-file.h
@@ -20,6 +20,7 @@
 #define STAT_FILE_H_
 
 #include <stdint.h>
+#include <spice/macros.h>
 
 SPICE_BEGIN_DECLS
 
diff --git a/server/zlib-encoder.h b/server/zlib-encoder.h
index dd4384fa..11a6a666 100644
--- a/server/zlib-encoder.h
+++ b/server/zlib-encoder.h
@@ -32,6 +32,7 @@
 #define ZLIB_ENCODER_H_
 
 #include <inttypes.h>
+#include <spice/macros.h>
 
 SPICE_BEGIN_DECLS
 
commit e2f6f1c7aa75249b4292fdcd24ba6075baa82e0d
Author: Frediano Ziglio <freddy77 at gmail.com>
Date:   Wed Apr 21 08:46:38 2021 +0100

    build: Update git-version-gen
    
    Pick up new version from https://github.com/coreutils/gnulib.
    
    Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>

diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 34682473..da525aa5 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,8 +1,8 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2012-12-31.23; # UTC
+scriptversion=2019-10-13.15; # UTC
 
-# Copyright (C) 2007-2013 Free Software Foundation, Inc.
+# Copyright (C) 2007-2021 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@ scriptversion=2012-12-31.23; # UTC
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
+# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/.
 # It may be run two ways:
 # - from a git repository in which the "git describe" command below
 #   produces useful output (thus requiring at least one signed tag)
@@ -72,12 +72,13 @@ scriptversion=2012-12-31.23; # UTC
 
 me=$0
 
+year=`expr "$scriptversion" : '\([^-]*\)'`
 version="git-version-gen $scriptversion
 
-Copyright 2011 Free Software Foundation, Inc.
-There is NO warranty.  You may redistribute this software
-under the terms of the GNU General Public License.
-For more information about these matters, see the files named COPYING."
+Copyright (C) ${year} Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
 
 usage="\
 Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
@@ -85,8 +86,9 @@ Print a version string.
 
 Options:
 
-   --prefix           prefix of git tags (default 'v')
-   --fallback         fallback version to use if \"git --version\" fails
+   --prefix PREFIX    prefix of git tags (default 'v')
+   --fallback VERSION
+                      fallback version to use if \"git --version\" fails
 
    --help             display this help and exit
    --version          output version information and exit
@@ -100,8 +102,8 @@ while test $# -gt 0; do
   case $1 in
     --help) echo "$usage"; exit 0;;
     --version) echo "$version"; exit 0;;
-    --prefix) shift; prefix="$1";;
-    --fallback) shift; fallback="$1";;
+    --prefix) shift; prefix=${1?};;
+    --fallback) shift; fallback=${1?};;
     -*)
       echo "$0: Unknown option '$1'." >&2
       echo "$0: Try '--help' for more information." >&2
@@ -140,11 +142,9 @@ then
     v=`cat $tarball_version_file` || v=
     case $v in
         *$nl*) v= ;; # reject multi-line output
-        [0-9]*) ;;
-        *) v= ;;
     esac
     test "x$v" = x \
-        && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
+        && echo "$0: WARNING: $tarball_version_file is damaged" 1>&2
 fi
 
 if test "x$v" != x
@@ -166,9 +166,10 @@ then
     # tag or the previous older version that did not?
     #   Newer: v6.10-77-g0f8faeb
     #   Older: v6.10-g0f8faeb
-    case $v in
-        *-*-*) : git describe is okay three part flavor ;;
-        *-*)
+    vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v
+    case $vprefix in
+        *-*) : git describe is probably okay three part flavor ;;
+        *)
             : git describe is older two part flavor
             # Recreate the number of commits and rewrite such that the
             # result is the same as if we were using the newer version
@@ -183,9 +184,9 @@ then
             ;;
     esac
 
-    # Change the first '-' to a '.', so version-comparing tools work properly.
-    # Remove the "g" in git describe's output string, to save a byte.
-    v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
+    # Change the penultimate "-" to ".", for version-comparing tools.
+    # Remove the "g" to save a byte.
+    v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`;
     v_from_git=1
 elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
     v=UNKNOWN
@@ -199,7 +200,7 @@ v=`echo "$v" |sed "s/^$prefix//"`
 # string we're using came from git.  I.e., skip the test if it's "UNKNOWN"
 # or if it came from .tarball-version.
 if test "x$v_from_git" != x; then
-  # Don't declare a version "dirty" merely because a time stamp has changed.
+  # Don't declare a version "dirty" merely because a timestamp has changed.
   git update-index --refresh > /dev/null 2>&1
 
   dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
@@ -214,12 +215,12 @@ if test "x$v_from_git" != x; then
 fi
 
 # Omit the trailing newline, so that m4_esyscmd can use the result directly.
-echo "$v" | tr -d "$nl"
+printf %s "$v"
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:


More information about the Spice-commits mailing list