Remove SDL_swap* usage.

Closes #1937.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11482 4a71c877-e1ca-e34f-864e-861f7616d084
master
Safety0ff 2010-08-15 15:55:25 +00:00 committed by Git SVN Gateway
parent 0b2c7b2973
commit 8f55883a61
3 changed files with 15 additions and 9 deletions

View File

@ -17,17 +17,21 @@
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Endianness functions
*/
#ifndef ENDIAN_HACK_H
#define ENDIAN_HACK_H
#include <string.h>
#ifdef __cplusplus
extern "C"
{
#endif //__cplusplus
/* Endianness hacks */
// TODO Use SDL_SwapXXXX instead
static inline void endian_uword(UWORD* p)
{
uint8_t bytes[sizeof(*p)];

View File

@ -24,7 +24,7 @@
*
*/
#include <SDL.h>
#include <physfs.h>
#include "lib/framework/frame.h"
#include "lib/framework/frameresource.h"
@ -104,14 +104,14 @@ static void calcDataHash(uint8_t *pBuffer, uint32_t size, uint32_t index)
return;
}
DataHash[index] ^= SDL_SwapBE32(hashBuffer(pBuffer, size));
DataHash[index] ^= PHYSFS_swapUBE32(hashBuffer(pBuffer, size));
if (!DataHash[index] && oldHash)
{
debug(LOG_NET, "The new hash is 0, the old hash was %u. We XOR'ed the same value!", oldHash);
}
debug(LOG_NET, "DataHash[%2u] = %08x", index, SDL_SwapBE32(DataHash[index]));
debug(LOG_NET, "DataHash[%2u] = %08x", index, PHYSFS_swapUBE32(DataHash[index]));
return;
}

View File

@ -24,6 +24,9 @@
*
* Stuff to handle the comings and goings of players.
*/
#include <physfs.h>
#include "lib/framework/frame.h"
#include "lib/framework/strres.h"
#include "lib/framework/math_ext.h"
@ -64,7 +67,6 @@
#include "multistat.h"
#include "multigifts.h"
#include "scriptcb.h"
#include <SDL.h>
// ////////////////////////////////////////////////////////////////////////////
// External Variables
@ -352,8 +354,8 @@ bool recvDataCheck(NETQUEUE queue)
addConsoleMessage(msg, LEFT_JUSTIFY, NOTIFY_MESSAGE);
kickPlayer(player, "your data doesn't match the host's!", ERROR_WRONGDATA);
debug(LOG_WARNING, "%s (%u) has an incompatible mod. ([%d] got %x, expected %x)", getPlayerName(player), player, i, SDL_SwapBE32(tempBuffer[i]), SDL_SwapBE32(DataHash[i]));
debug(LOG_POPUP, "%s (%u), has an incompatible mod. ([%d] got %x, expected %x)", getPlayerName(player), player, i, SDL_SwapBE32(tempBuffer[i]), SDL_SwapBE32(DataHash[i]));
debug(LOG_WARNING, "%s (%u) has an incompatible mod. ([%d] got %x, expected %x)", getPlayerName(player), player, i, PHYSFS_swapUBE32(tempBuffer[i]), PHYSFS_swapUBE32(DataHash[i]));
debug(LOG_POPUP, "%s (%u), has an incompatible mod. ([%d] got %x, expected %x)", getPlayerName(player), player, i, PHYSFS_swapUBE32(tempBuffer[i]), PHYSFS_swapUBE32(DataHash[i]));
return false;
}