summaryrefslogtreecommitdiffstats
path: root/src/AFC.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-11-17 00:17:22 +0100
committerGravatar Matt Colyer2009-11-30 21:01:32 -0800
commit12a44afce569c2cdf31018c259745e09b13bffc3 (patch)
tree4b203632fb8191e963ae96d0548a8c21355601c3 /src/AFC.h
parenta386752ce0f4ab8dd364b50e9a60c2155827ba66 (diff)
downloadlibimobiledevice-12a44afce569c2cdf31018c259745e09b13bffc3.tar.gz
libimobiledevice-12a44afce569c2cdf31018c259745e09b13bffc3.tar.bz2
added endian safety to AFC
This should make libiphone compatible with big endian machines. [#85 state:resolved] Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/AFC.h')
-rw-r--r--src/AFC.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/AFC.h b/src/AFC.h
index 6b4a0aa..5db865f 100644
--- a/src/AFC.h
+++ b/src/AFC.h
@@ -36,6 +36,18 @@ typedef struct {
uint64_t entire_length, this_length, packet_num, operation;
} AFCPacket;
+#define AFCPacket_to_LE(x) \
+ (x)->entire_length = GUINT64_TO_LE((x)->entire_length); \
+ (x)->this_length = GUINT64_TO_LE((x)->this_length); \
+ (x)->packet_num = GUINT64_TO_LE((x)->packet_num); \
+ (x)->operation = GUINT64_TO_LE((x)->operation);
+
+#define AFCPacket_from_LE(x) \
+ (x)->entire_length = GUINT64_FROM_LE((x)->entire_length); \
+ (x)->this_length = GUINT64_FROM_LE((x)->this_length); \
+ (x)->packet_num = GUINT64_FROM_LE((x)->packet_num); \
+ (x)->operation = GUINT64_FROM_LE((x)->operation);
+
typedef struct {
uint64_t filehandle, size;
} AFCFilePacket;