From f73ad4ab05aaf35cd720dffbdc47c28d35d609e1 Mon Sep 17 00:00:00 2001 From: irungentoo_trip Date: Fri, 24 Oct 2014 18:04:27 -0700 Subject: Portability saving fixes for big endian systems. Saves should now be portable from big endian to little endian systems though I need someone to actually test it to be sure I didn't mess up. --- toxcore/Messenger.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'toxcore/Messenger.c') diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 4841cbd9..eaf87179 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -2648,10 +2648,9 @@ uint32_t messenger_size(const Messenger *m) static uint8_t *z_state_save_subheader(uint8_t *data, uint32_t len, uint16_t type) { - memcpy(data, &len, sizeof(uint32_t)); + host_to_lendian32(data, len); data += sizeof(uint32_t); - uint32_t temp = (MESSENGER_STATE_COOKIE_TYPE << 16) | type; - memcpy(data, &temp, sizeof(uint32_t)); + host_to_lendian32(data, (host_tolendian16(MESSENGER_STATE_COOKIE_TYPE) << 16) | host_tolendian16(type)); data += sizeof(uint32_t); return data; } -- cgit v1.2.3