Selaa lähdekoodia

Merge pull request #7181 from klemensn/1.1-maint

Fix msgpack runtime on big-endian OpenBSD/sparc64
TW 2 vuotta sitten
vanhempi
sitoutus
9ad9d4b96a
2 muutettua tiedostoa jossa 11 lisäystä ja 7 poistoa
  1. 5 1
      src/borg/algorithms/msgpack/_version.py
  2. 6 6
      src/borg/algorithms/msgpack/sysdep.h

+ 5 - 1
src/borg/algorithms/msgpack/_version.py

@@ -2,5 +2,9 @@
 # Changes:
 # +borg1: drop support for old buffer protocol to be compatible with py310
 #         (backport of commit 9ae43709e42092c7f6a4e990d696d9005fa1623d)
-version = (0, 5, 6, '+borg1')
+# +borg2: Usef __BYTE_ORDER__ instead of __BYTE_ORDER (#513)
+#         (backport of commit 9d45926a596028e39ec59dd909a56eb5e9e8fee7)
+#         Fix build error caused by ntohs, ntohl (#514)
+#         (backport of commit edca770071fc702e0b4c33f87fb0fa3682b486b4)
+version = (0, 5, 6, '+borg2')
 

+ 6 - 6
src/borg/algorithms/msgpack/sysdep.h

@@ -61,14 +61,14 @@ typedef unsigned int _msgpack_atomic_counter_t;
 #endif
 #endif
 
-#else
-#include <arpa/inet.h>  /* __BYTE_ORDER */
+#else /* _WIN32 */
+#include <arpa/inet.h> /* ntohs, ntohl */
 #endif
 
 #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define __LITTLE_ENDIAN__
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define __BIG_ENDIAN__
 #elif _WIN32
 #define __LITTLE_ENDIAN__
@@ -95,7 +95,7 @@ typedef unsigned int _msgpack_atomic_counter_t;
 #ifdef _WIN32
 #  if defined(ntohl)
 #    define _msgpack_be32(x) ntohl(x)
-#  elif defined(_byteswap_ulong) || (defined(_MSC_VER) && _MSC_VER >= 1400)
+#  elif defined(_byteswap_ulong) || defined(_MSC_VER)
 #    define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
 #  else
 #    define _msgpack_be32(x) \
@@ -108,7 +108,7 @@ typedef unsigned int _msgpack_atomic_counter_t;
 #  define _msgpack_be32(x) ntohl(x)
 #endif
 
-#if defined(_byteswap_uint64) || (defined(_MSC_VER) && _MSC_VER >= 1400)
+#if defined(_byteswap_uint64) || defined(_MSC_VER)
 #  define _msgpack_be64(x) (_byteswap_uint64(x))
 #elif defined(bswap_64)
 #  define _msgpack_be64(x) bswap_64(x)