Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37754382
en ru br
ALT Linux repos
S:0.15.2-alt1

Group :: Graphical desktop/Other
RPM: SPICE

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: 0007-tests-Remove-some-compiler-warnings.patch
Download


From 62dd7e47e9eed118d012758c4a7297ffa9978868 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <freddy77@gmail.com>
Date: Tue, 4 May 2021 18:11:40 +0100
Subject: [PATCH] tests: Remove some compiler warnings
Remove warnings like:
In file included from /usr/include/glib-2.0/glib.h:86,
                 from ../server/tests/test-glib-compat.h:21,
                 from ../server/tests/test-channel.cpp:25:
In function 'void send_ack_sync(int, uint32_t)',
    inlined from 'void channel_loop()' at ../server/tests/test-channel.cpp:250:18:
../server/sys-socket.h:28:43: error: 'ssize_t write(int, const void*, size_t)' reading 10 bytes from a region of size 2 [-Werror=stringop-overread]
   28 | #define socket_write(sock, buf, len) write(sock, buf, len)
/usr/include/glib-2.0/glib/gtestutils.h:50:61: note: in definition of macro 'g_assert_cmpint'
   50 |                                              gint64 __n1 = (n1), __n2 = (n2); \
      |                                                             ^~
../server/tests/test-channel.cpp:132:21: note: in expansion of macro 'socket_write'
  132 |     g_assert_cmpint(socket_write(socket, &msg.type, 10), ==, 10);
      |                     ^~~~~~~~~~~~
../server/tests/test-channel.cpp: In function 'void channel_loop()':
../server/tests/test-channel.cpp:123:18: note: source object 'send_ack_sync(int, uint32_t)::<unnamed struct>::type' of size 2
  123 |         uint16_t type;
      |                  ^~~~
In file included from ../server/tests/test-channel.cpp:22:
/usr/include/unistd.h:367:16: note: in a call to function 'ssize_t write(int, const void*, size_t)' declared with attribute 'access (read_only, 2, 3)'
  367 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~
cc1plus: all warnings being treated as errors
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 server/tests/test-channel.cpp   | 2 +-
 server/tests/test-smartcard.cpp | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/server/tests/test-channel.cpp b/server/tests/test-channel.cpp
index 036f499..ffd0ec0 100644
--- a/server/tests/test-channel.cpp
+++ b/server/tests/test-channel.cpp
@@ -129,7 +129,7 @@ static void send_ack_sync(int socket, uint32_t generation)
     msg.len = GUINT32_TO_LE(sizeof(generation));
     msg.generation = GUINT32_TO_LE(generation);
 
-    g_assert_cmpint(socket_write(socket, &msg.type, 10), ==, 10);
+    g_assert_cmpint(socket_write(socket, reinterpret_cast<uint8_t *>(&msg) + 2, 10), ==, 10);
 }
 
 static SpiceTimer *waked_up_timer;
diff --git a/server/tests/test-smartcard.cpp b/server/tests/test-smartcard.cpp
index 8c127e2..f76f602 100644
--- a/server/tests/test-smartcard.cpp
+++ b/server/tests/test-smartcard.cpp
@@ -108,7 +108,7 @@ static void send_ack_sync(int socket, uint32_t generation)
     msg.len = GUINT32_TO_LE(sizeof(generation));
     msg.generation = GUINT32_TO_LE(generation);
 
-    g_assert_cmpint(socket_write(socket, &msg.type, 10), ==, 10);
+    g_assert_cmpint(socket_write(socket, reinterpret_cast<uint8_t *>(&msg) + 2, 10), ==, 10);
 }
 
 static void send_data(int socket, uint32_t type, uint32_t reader_id)
@@ -128,7 +128,8 @@ static void send_data(int socket, uint32_t type, uint32_t reader_id)
     msg.vheader.length = GUINT32_TO_LE(6);
     strcpy(msg.data, "hello");
 
-    g_assert_cmpint(socket_write(socket, &msg.type, sizeof(msg)-4), ==, sizeof(msg)-4);
+    g_assert_cmpint(socket_write(socket, reinterpret_cast<uint8_t *>(&msg) + 2,
+                                 sizeof(msg) - 4), ==, sizeof(msg) - 4);
 }
 
 static void check_data(VmcEmu *vmc_emu)
--
libgit2 1.3.0
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin