summaryrefslogtreecommitdiffstats
path: root/server/display-channel.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-16 20:36:51 +0200
committerFrediano Ziglio <fziglio@redhat.com>2015-11-13 13:43:35 +0000
commit105fad7e87f27374619314c9875120d252a38abb (patch)
tree8575537acbb9797c2acb2481d79737d574c3b53f /server/display-channel.h
parent08230ee1715ff07bb0bdc8e6661b53a6752854d5 (diff)
downloadspice-105fad7e87f27374619314c9875120d252a38abb.tar.gz
spice-105fad7e87f27374619314c9875120d252a38abb.tar.xz
spice-105fad7e87f27374619314c9875120d252a38abb.zip
worker: don't use weird RedCompressedBuf nbytes shifting
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Diffstat (limited to 'server/display-channel.h')
-rw-r--r--server/display-channel.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/display-channel.h b/server/display-channel.h
index 1403b33f..c3dcc29d 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -75,7 +75,14 @@ typedef struct DisplayChannel DisplayChannel;
#define RED_COMPRESS_BUF_SIZE (1024 * 64)
typedef struct RedCompressBuf RedCompressBuf;
struct RedCompressBuf {
- uint32_t buf[RED_COMPRESS_BUF_SIZE / 4];
+ /* This buffer provide space for compression algorithms.
+ * Some algorithms access the buffer as an array of 32 bit words
+ * so is defined to make sure is always aligned that way.
+ */
+ union {
+ uint8_t bytes[RED_COMPRESS_BUF_SIZE];
+ uint32_t words[RED_COMPRESS_BUF_SIZE / 4];
+ } buf;
RedCompressBuf *next;
RedCompressBuf *send_next;
};