summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorDuane Bailey <nayryeliab@gmail.com>2005-09-22 23:28:58 +0000
committerDuane Bailey <nayryeliab@gmail.com>2005-09-22 23:28:58 +0000
commit6e383d8867081d3ec6b57b4d2f171a4382e83195 (patch)
tree3c658e7e8068f7f0a13c8434dd1fac0e47b43ab1 /src/net
parent59796855784a34e35d09c5cb3750dd5a9b421c10 (diff)
downloadmana-6e383d8867081d3ec6b57b4d2f171a4382e83195.tar.gz
mana-6e383d8867081d3ec6b57b4d2f171a4382e83195.tar.bz2
mana-6e383d8867081d3ec6b57b4d2f171a4382e83195.tar.xz
mana-6e383d8867081d3ec6b57b4d2f171a4382e83195.zip
removed win2mac support
Diffstat (limited to 'src/net')
-rw-r--r--src/net/messagein.cpp8
-rw-r--r--src/net/messageout.cpp8
-rw-r--r--src/net/network.cpp5
-rw-r--r--src/net/win2mac.cpp19
-rw-r--r--src/net/win2mac.h12
5 files changed, 7 insertions, 45 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index c599a453..e3f8c28e 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -25,9 +25,7 @@
#include <cassert>
#include <SDL.h>
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#include "win2mac.h"
-#endif
+#include <SDL_endian.h>
#define MAKEWORD(low,high) \
((unsigned short)(((unsigned char)(low)) | \
@@ -56,7 +54,7 @@ MessageIn::readShort()
assert(mPos + 2 <= mLength);
mPos += 2;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- return DR_SwapTwoBytes(*(short*)(mData + (mPos - 2)));
+ return SDL_Swap16(*(short*)(mData + (mPos - 2)));
#else
return (*(short*)(mData + (mPos - 2)));
#endif
@@ -68,7 +66,7 @@ MessageIn::readLong()
assert(mPos + 4 <= mLength);
mPos += 4;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- return DR_SwapFourBytes(*(long*)(mData + (mPos - 4)));
+ return SDL_Swap32(*(long*)(mData + (mPos - 4)));
#else
return (*(long*)(mData + (mPos - 4)));
#endif
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 77819b63..d627d151 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -25,9 +25,7 @@
#include <string>
#include <SDL.h>
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#include "win2mac.h"
-#endif
+#include <SDL_endian.h>
#include "network.h"
#include "packet.h"
@@ -71,7 +69,7 @@ void MessageOut::writeShort(short value)
{
expand(mPos + sizeof(short));
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- (*(short *)(mData + mPos)) = DR_SwapTwoBytes(value);
+ (*(short *)(mData + mPos)) = SDL_Swap16(value);
#else
(*(short *)(mData + mPos)) = value;
#endif
@@ -83,7 +81,7 @@ void MessageOut::writeLong(long value)
{
expand(mPos + sizeof(long));
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- (*(long *)(mData + mPos)) = DR_SwapFourBytes(value);
+ (*(long *)(mData + mPos)) = SDL_Swap16(value);
#else
(*(long *)(mData + mPos)) = value;
#endif
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 7a3ecc09..d5a6579b 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -30,9 +30,6 @@
#include "messagein.h"
#include "../log.h"
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#include "win2mac.h"
-#endif
/** Warning: buffers and other variables are shared,
so there can be only one connection active at a time */
@@ -248,7 +245,7 @@ void flush()
unsigned short readWord(int pos)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- return DR_SwapTwoBytes((*(unsigned short*)(in+(pos))));
+ return SDL_Swap16((*(unsigned short*)(in+(pos))));
#else
return (*(unsigned short *)(in+(pos)));
#endif
diff --git a/src/net/win2mac.cpp b/src/net/win2mac.cpp
deleted file mode 100644
index 020b808b..00000000
--- a/src/net/win2mac.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "win2mac.h"
-
-UInt32 DR_SwapFourBytes(UInt32 dw)
-{
- UInt32 tmp;
- tmp = (dw & 0x000000FF);
- tmp = ((dw & 0x0000FF00) >> 0x08) | (tmp << 0x08);
- tmp = ((dw & 0x00FF0000) >> 0x10) | (tmp << 0x08);
- tmp = ((dw & 0xFF000000) >> 0x18) | (tmp << 0x08);
- return (tmp);
-}
-
-UInt16 DR_SwapTwoBytes(UInt16 w)
-{
- UInt16 tmp;
- tmp = (w & 0x00FF);
- tmp = ((w & 0xFF00) >> 0x08) | (tmp << 0x08);
- return(tmp);
-}
diff --git a/src/net/win2mac.h b/src/net/win2mac.h
deleted file mode 100644
index d0a99dad..00000000
--- a/src/net/win2mac.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _TMW_WIN2MAC_
-#define _TMW_WIN2MAC_
-
-#include <stdio.h>
-
-#define UInt16 unsigned short int
-#define UInt32 unsigned long int
-
-UInt32 DR_SwapFourBytes(UInt32 dw);
-UInt16 DR_SwapTwoBytes(UInt16 w);
-
-#endif