summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-03-10 01:24:33 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-03-10 11:22:33 +0300
commitd414f8a9824262212ab5a0416da816f6377179ea (patch)
tree5022ddd6ff7d8656cffddbab5fcf8510514224a0
parent26cf4e69882ff7de2c2b7b5d40eefcf8744024f0 (diff)
downloadmariadb-git-d414f8a9824262212ab5a0416da816f6377179ea.tar.gz
Fix compile error on windows: htobe{16,32,64} are not defined
Use the same solution as we used for MyRocks.
-rw-r--r--storage/xpand/xpand_connection.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/storage/xpand/xpand_connection.cc b/storage/xpand/xpand_connection.cc
index fc7bf000661..7bbec588d2c 100644
--- a/storage/xpand/xpand_connection.cc
+++ b/storage/xpand/xpand_connection.cc
@@ -14,6 +14,27 @@ Copyright (c) 2019, 2020, MariaDB Corporation.
#include "tztime.h"
#include "errmsg.h"
+#ifdef _WIN32
+#include <stdlib.h>
+#define htobe64 _byteswap_uint64
+#define be64toh _byteswap_uint64
+#define htobe32 _byteswap_ulong
+#define be32toh _byteswap_ulong
+#define htobe16 _byteswap_ushort
+#define be16toh _byteswap_ushort
+#endif
+
+#if defined(__APPLE__)
+#include <libkern/OSByteOrder.h>
+#define htobe64(x) OSSwapHostToBigInt64(x)
+#define be64toh(x) OSSwapBigToHostInt64(x)
+#define htobe32(x) OSSwapHostToBigInt32(x)
+#define be32toh(x) OSSwapBigToHostInt32(x)
+#define htobe16(x) OSSwapHostToBigInt16(x)
+#define be16toh(x) OSSwapBigToHostInt16(x)
+#endif
+
+
extern int xpand_connect_timeout;
extern int xpand_read_timeout;
extern int xpand_write_timeout;