Skip to content

Commit 2ccfc48

Browse files
committed
Fix OpenBSD build of the updated kaitai runtime
1 parent 1886f6a commit 2ccfc48

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

common/kaitai/kaitaistream.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define __BYTE_ORDER BYTE_ORDER
1313
#define __BIG_ENDIAN BIG_ENDIAN
1414
#define __LITTLE_ENDIAN LITTLE_ENDIAN
15+
// UEFITool: add MinGW
1516
#elif defined(_MSC_VER) || defined(__MINGW32__)
1617
#include <stdlib.h>
1718
#define __LITTLE_ENDIAN 1234
@@ -32,7 +33,13 @@
3233
#else
3334
// At this point it's either Linux or BSD. Both have "sys/param.h", so it's safe to include
3435
#include <sys/param.h> // `BSD` macro // IWYU pragma: keep
35-
#if defined(BSD)
36+
// UEFITool: add special case of OpenBSD
37+
#if defined(__OpenBSD__)
38+
#include <endian.h>
39+
#define bswap_16(x) swap16(x)
40+
#define bswap_32(x) swap32(x)
41+
#define bswap_64(x) swap64(x)
42+
#elif defined(BSD)
3643
// Supposed to work on FreeBSD: https://man.freebsd.org/cgi/man.cgi?query=bswap16&manpath=FreeBSD+14.0-RELEASE
3744
// Supposed to work on NetBSD: https://man.netbsd.org/NetBSD-10.0/bswap16.3
3845
#include <sys/endian.h>

0 commit comments

Comments
 (0)