summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Duncan Ogilvie2024-11-28 15:16:54 +0100
committerGravatar Duncan Ogilvie2024-11-28 15:16:54 +0100
commit8f24c4876a32b4f19e459bedd1fdbbc54cb0daa9 (patch)
tree4316563019acbd85e277422afe5b687959f2e940 /src/plist.c
parent3a1404c2e87daff1eb45c3f21182b7ede7a7a82b (diff)
downloadlibplist-8f24c4876a32b4f19e459bedd1fdbbc54cb0daa9.tar.gz
libplist-8f24c4876a32b4f19e459bedd1fdbbc54cb0daa9.tar.bz2
Switch from detecting little endian (common) to detecting big endian (rare)
This prevents a bug class where we bswap things when __LITTLE_ENDIAN__ is not defined. Almost all modern systems are little endian, so detecting __BIG_ENDIAN__ is a better strategy.
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plist.c b/src/plist.c
index 79448db..0d4e077 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -82,26 +82,26 @@ static int plist_debug = 0;
82#endif 82#endif
83 83
84#ifndef le16toh 84#ifndef le16toh
85#ifdef __LITTLE_ENDIAN__ 85#ifdef __BIG_ENDIAN__
86#define le16toh(x) (x)
87#else
88#define le16toh(x) bswap16(x) 86#define le16toh(x) bswap16(x)
87#else
88#define le16toh(x) (x)
89#endif 89#endif
90#endif 90#endif
91 91
92#ifndef le32toh 92#ifndef le32toh
93#ifdef __LITTLE_ENDIAN__ 93#ifdef __BIG_ENDIAN__
94#define le32toh(x) (x)
95#else
96#define le32toh(x) bswap32(x) 94#define le32toh(x) bswap32(x)
95#else
96#define le32toh(x) (x)
97#endif 97#endif
98#endif 98#endif
99 99
100#ifndef le64toh 100#ifndef le64toh
101#ifdef __LITTLE_ENDIAN__ 101#ifdef __BIG_ENDIAN__
102#define le64toh(x) (x)
103#else
104#define le64toh(x) bswap64(x) 102#define le64toh(x) bswap64(x)
103#else
104#define le64toh(x) (x)
105#endif 105#endif
106#endif 106#endif
107 107