summaryrefslogtreecommitdiff
path: root/src/net/ea/messageout.cpp
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2009-11-14 02:22:06 +0100
committerJared Adams <jaxad0127@gmail.com>2009-11-13 19:18:03 -0700
commit4b1aeab2af7467046cd9e411da899ce770bcd780 (patch)
treeed1bc577edf259ea67f782ff97fe70dfde17e7d8 /src/net/ea/messageout.cpp
parent546e7e29628454e18aa8af27882545b302550a03 (diff)
downloadmana-4b1aeab2af7467046cd9e411da899ce770bcd780.tar.gz
mana-4b1aeab2af7467046cd9e411da899ce770bcd780.tar.bz2
mana-4b1aeab2af7467046cd9e411da899ce770bcd780.tar.xz
mana-4b1aeab2af7467046cd9e411da899ce770bcd780.zip
Copy ints by memcpy to avoid segfaults on sparc
Diffstat (limited to 'src/net/ea/messageout.cpp')
-rw-r--r--src/net/ea/messageout.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net/ea/messageout.cpp b/src/net/ea/messageout.cpp
index f75dcf7e..9493ee80 100644
--- a/src/net/ea/messageout.cpp
+++ b/src/net/ea/messageout.cpp
@@ -48,7 +48,8 @@ void MessageOut::writeInt16(Sint16 value)
{
expand(2);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- (*(Sint16 *)(mData + mPos)) = SDL_Swap16(value);
+ Sint16 swap=SDL_Swap16(value);
+ memcpy(mData + mPos, &swap, sizeof(Sint16));
#else
(*(Sint16 *)(mData + mPos)) = value;
#endif
@@ -59,7 +60,8 @@ void MessageOut::writeInt32(Sint32 value)
{
expand(4);
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- (*(Sint32 *)(mData + mPos)) = SDL_Swap32(value);
+ Sint32 swap=SDL_Swap32(value);
+ memcpy(mData + mPos, &swap, sizeof(Sint32));
#else
(*(Sint32 *)(mData + mPos)) = value;
#endif