summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2021-05-07 19:42:38 +0100
committerFrediano Ziglio <freddy77@gmail.com>2021-05-07 19:42:38 +0100
commitbb0831cc105de856a4a6f15191f133e73b37d361 (patch)
treedf19dd6ff0cbaa04cbcd273df08616f5e8adb5c4
parentfcfe9104bd62a5a1debfebf9ce25e96715662ab4 (diff)
canvas_base: Fix missing ntohl for Win32 platform
Win32 requires winsock2.h to be included in order to use ntohl. To avoid the include use GUINT32_FROM_BE instead, already available. This problem was reported by Biswapriyo Nath whom also tested the solution for Win32. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
-rw-r--r--common/canvas_base.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 175a8a2..906fb83 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -25,9 +25,6 @@
#include <math.h>
#ifdef USE_LZ4
-#ifndef WIN32
-#include <arpa/inet.h>
-#endif
#include <lz4.h>
#endif
#include <spice/macros.h>
@@ -49,7 +46,7 @@ typedef struct SPICE_ATTR_PACKED {
} uint32_unaligned_t;
#include <spice/end-packed.h>
-#define read_uint32_be(ptr) ntohl(((uint32_unaligned_t *)(ptr))->v)
+#define READ_UINT32_BE(ptr) GUINT32_FROM_BE(((uint32_unaligned_t *)(ptr))->v)
#define ROUND(_x) ((int)floor((_x) + 0.5))
@@ -585,7 +582,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image)
goto format_error;
}
// Read next compressed block
- enc_size = read_uint32_be(data);
+ enc_size = READ_UINT32_BE(data);
data += 4;
/* check overflow. This check is a bit different to avoid
* possible overflows. From previous check data_end - data cannot overflow.