summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net/ea/messagein.cpp8
-rw-r--r--src/net/ea/messageout.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/net/ea/messagein.cpp b/src/net/ea/messagein.cpp
index 1cca786a..12da6bfb 100644
--- a/src/net/ea/messagein.cpp
+++ b/src/net/ea/messagein.cpp
@@ -39,7 +39,7 @@ MessageIn::MessageIn(const char *data, unsigned int length):
int MessageIn::readInt16()
{
- int value = -1;
+ Sint16 value = -1;
if (mPos + 2 <= mLength)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -47,7 +47,7 @@ int MessageIn::readInt16()
memcpy(&swap, mData + mPos, sizeof(Sint16));
value = SDL_Swap16(swap);
#else
- value = (*(Sint16*)(mData + mPos));
+ memcpy(&value, mData + mPos, sizeof(Sint16));
#endif
}
mPos += 2;
@@ -56,7 +56,7 @@ int MessageIn::readInt16()
int MessageIn::readInt32()
{
- int value = -1;
+ Sint32 value = -1;
if (mPos + 4 <= mLength)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -64,7 +64,7 @@ int MessageIn::readInt32()
memcpy(&swap, mData + mPos, sizeof(Sint32));
value = SDL_Swap32(swap);
#else
- value = (*(Sint32*)(mData + mPos));
+ memcpy(&value, mData + mPos, sizeof(Sint32));
#endif
}
mPos += 4;
diff --git a/src/net/ea/messageout.cpp b/src/net/ea/messageout.cpp
index 9493ee80..81fa917a 100644
--- a/src/net/ea/messageout.cpp
+++ b/src/net/ea/messageout.cpp
@@ -51,7 +51,7 @@ void MessageOut::writeInt16(Sint16 value)
Sint16 swap=SDL_Swap16(value);
memcpy(mData + mPos, &swap, sizeof(Sint16));
#else
- (*(Sint16 *)(mData + mPos)) = value;
+ memcpy(mData + mPos, &value, sizeof(Sint16));
#endif
mPos += 2;
}
@@ -63,7 +63,7 @@ void MessageOut::writeInt32(Sint32 value)
Sint32 swap=SDL_Swap32(value);
memcpy(mData + mPos, &swap, sizeof(Sint32));
#else
- (*(Sint32 *)(mData + mPos)) = value;
+ memcpy(mData + mPos, &value, sizeof(Sint32));
#endif
mPos += 4;
}