From 4b1aeab2af7467046cd9e411da899ce770bcd780 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Sat, 14 Nov 2009 02:22:06 +0100 Subject: Copy ints by memcpy to avoid segfaults on sparc --- src/net/ea/messagein.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/net/ea/messagein.cpp') diff --git a/src/net/ea/messagein.cpp b/src/net/ea/messagein.cpp index 0b1ab70a..1cca786a 100644 --- a/src/net/ea/messagein.cpp +++ b/src/net/ea/messagein.cpp @@ -43,7 +43,9 @@ int MessageIn::readInt16() if (mPos + 2 <= mLength) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - value = SDL_Swap16(*(Sint16*)(mData + mPos)); + Sint16 swap; + memcpy(&swap, mData + mPos, sizeof(Sint16)); + value = SDL_Swap16(swap); #else value = (*(Sint16*)(mData + mPos)); #endif @@ -58,7 +60,9 @@ int MessageIn::readInt32() if (mPos + 4 <= mLength) { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - value = SDL_Swap32(*(Sint32*)(mData + mPos)); + Sint32 swap; + memcpy(&swap, mData + mPos, sizeof(Sint32)); + value = SDL_Swap32(swap); #else value = (*(Sint32*)(mData + mPos)); #endif -- cgit v1.2.3-70-g09d2