Skip to content

Commit

Permalink
Merge pull request #7181 from klemensn/1.1-maint
Browse files Browse the repository at this point in the history
Fix msgpack runtime on big-endian OpenBSD/sparc64
  • Loading branch information
ThomasWaldmann committed Dec 4, 2022
2 parents 9e22b27 + 9d5631f commit 9ad9d4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/borg/algorithms/msgpack/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

12 changes: 6 additions & 6 deletions src/borg/algorithms/msgpack/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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) \
Expand All @@ -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)
Expand Down

0 comments on commit 9ad9d4b

Please sign in to comment.