summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/resources/imagewriter.cpp2
6 files changed, 7 insertions, 47 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
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 7cfa16b4..93f834f2 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -56,8 +56,6 @@ bool ImageWriter::writePNG(SDL_Surface *surface,
return false;
}
- info_ptr = png_create_info_struct(png_ptr);
- if (!info_ptr)
{
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
logger->log("Could not create png_info");