Merge remote-tracking branch 'smally/platform_type_consistency' into platform-type-consistency

Conflicts:
	Engine/source/platform/platformCPUCount.cpp
This commit is contained in:
Daniel Buckmaster 2014-04-04 13:43:25 +11:00
commit 87d9e245b7
210 changed files with 896 additions and 896 deletions

View file

@ -500,7 +500,7 @@ void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEve
newEvent.postToSignal(Input::smInputEvent);
}
void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, float fValue)
void InputEventManager::buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, F32 fValue)
{
InputEventInfo newEvent;

View file

@ -496,7 +496,7 @@ public:
void buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, S32 iValue);
/// Build an input event based on a single fValue
void buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, float fValue);
void buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, F32 fValue);
/// Build an input event based on a Point3F
void buildInputEvent(U32 deviceType, U32 deviceInst, InputEventType objType, InputObjectInstances objInst, InputActionType action, Point3F& pValue);

View file

@ -212,7 +212,7 @@ namespace Platform
void debugBreak();
// Random
float getRandom();
F32 getRandom();
// Window state
void setWindowLocked(bool locked);
@ -412,7 +412,7 @@ namespace Platform
//------------------------------------------------------------------------------
// Misc StdLib functions
#define QSORT_CALLBACK FN_CDECL
inline void dQsort(void *base, U32 nelem, U32 width, int (QSORT_CALLBACK *fcmp)(const void *, const void *))
inline void dQsort(void *base, U32 nelem, U32 width, S32 (QSORT_CALLBACK *fcmp)(const void *, const void *))
{
qsort(base, nelem, width, fcmp);
}
@ -507,7 +507,7 @@ extern void* dRealloc_r(void* in_pResize, dsize_t in_size, const char*, const ds
extern void* dRealMalloc(dsize_t);
extern void dRealFree(void*);
extern void *dMalloc_aligned(dsize_t in_size, int alignment);
extern void *dMalloc_aligned(dsize_t in_size, S32 alignment);
extern void dFree_aligned(void *);
@ -525,8 +525,8 @@ template<class T,class S> void dCopyArray(T *dst, const S *src, dsize_t size)
extern void* dMemcpy(void *dst, const void *src, dsize_t size);
extern void* dMemmove(void *dst, const void *src, dsize_t size);
extern void* dMemset(void *dst, int c, dsize_t size);
extern int dMemcmp(const void *ptr1, const void *ptr2, dsize_t size);
extern void* dMemset(void *dst, S32 c, dsize_t size);
extern S32 dMemcmp(const void *ptr1, const void *ptr2, dsize_t size);
// Special case of the above function when the arrays are the same type (use memcpy)
template<class T> void dCopyArray(T *dst, const T *src, dsize_t size)
@ -565,8 +565,8 @@ enum DFILE_STATUS
extern FILE_HANDLE dOpenFileRead(const char *name, DFILE_STATUS &error);
extern FILE_HANDLE dOpenFileReadWrite(const char *name, bool append, DFILE_STATUS &error);
extern int dFileRead(FILE_HANDLE handle, U32 bytes, char *dst, DFILE_STATUS &error);
extern int dFileWrite(FILE_HANDLE handle, U32 bytes, const char *dst, DFILE_STATUS &error);
extern S32 dFileRead(FILE_HANDLE handle, U32 bytes, char *dst, DFILE_STATUS &error);
extern S32 dFileWrite(FILE_HANDLE handle, U32 bytes, const char *dst, DFILE_STATUS &error);
extern void dFileClose(FILE_HANDLE handle);
extern StringTableEntry osGetTemporaryDirectory();

View file

@ -80,13 +80,13 @@ namespace CPUInfo {
#ifndef TORQUE_OS_MAC
static unsigned int CpuIDSupported(void);
static unsigned int find_maskwidth(unsigned int);
static unsigned int HWD_MTSupported(void);
static unsigned int MaxLogicalProcPerPhysicalProc(void);
static unsigned int MaxCorePerPhysicalProc(void);
static unsigned char GetAPIC_ID(void);
static unsigned char GetNzbSubID(unsigned char, unsigned char, unsigned char);
static U32 CpuIDSupported(void);
static U32 find_maskwidth(unsigned int);
static U32 HWD_MTSupported(void);
static U32 MaxLogicalProcPerPhysicalProc(void);
static U32 MaxCorePerPhysicalProc(void);
static U8 GetAPIC_ID(void);
static U8 GetNzbSubID(U8, U8, U8);
#endif
static char g_s3Levels[2048];
@ -97,9 +97,9 @@ namespace CPUInfo {
// CpuIDSupported will return 0 if CPUID instruction is unavailable. Otherwise, it will return
// the maximum supported standard function.
//
static unsigned int CpuIDSupported(void)
static U32 CpuIDSupported(void)
{
unsigned int maxInputValue = 0;
U32 maxInputValue = 0;
// If CPUID instruction is supported
#ifdef TORQUE_COMPILER_GCC
try
@ -150,12 +150,12 @@ namespace CPUInfo {
// maximum value.
//
static unsigned int MaxCorePerPhysicalProc(void)
static U32 MaxCorePerPhysicalProc(void)
{
unsigned int Regeax = 0;
U32 Regeax = 0;
if (!HWD_MTSupported()) return (unsigned int) 1; // Single core
if (!HWD_MTSupported()) return (U32) 1; // Single core
#ifdef TORQUE_COMPILER_GCC
{
asm
@ -206,7 +206,7 @@ multi_core:
#else
# error Not implemented.
#endif
return (unsigned int)((Regeax & NUM_CORE_BITS) >> 26)+1;
return (U32)((Regeax & NUM_CORE_BITS) >> 26)+1;
}
@ -215,11 +215,11 @@ multi_core:
//
// The function returns 0 when the hardware multi-threaded bit is not set.
//
static unsigned int HWD_MTSupported(void)
static U32 HWD_MTSupported(void)
{
unsigned int Regedx = 0;
U32 Regedx = 0;
if ((CpuIDSupported() >= 1))
@ -259,12 +259,12 @@ multi_core:
// AVAILABLE logical processors per physical to be used by an application might be less than this
// maximum value.
//
static unsigned int MaxLogicalProcPerPhysicalProc(void)
static U32 MaxLogicalProcPerPhysicalProc(void)
{
unsigned int Regebx = 0;
U32 Regebx = 0;
if (!HWD_MTSupported()) return (unsigned int) 1;
if (!HWD_MTSupported()) return (U32) 1;
#ifdef TORQUE_COMPILER_GCC
asm
(
@ -289,10 +289,10 @@ multi_core:
}
static unsigned char GetAPIC_ID(void)
static U8 GetAPIC_ID(void)
{
unsigned int Regebx = 0;
U32 Regebx = 0;
#ifdef TORQUE_COMPILER_GCC
asm
(
@ -321,9 +321,9 @@ multi_core:
//
// Determine the width of the bit field that can represent the value count_item.
//
unsigned int find_maskwidth(unsigned int CountItem)
U32 find_maskwidth(U32 CountItem)
{
unsigned int MaskWidth,
U32 MaskWidth,
count = CountItem;
#ifdef TORQUE_COMPILER_GCC
asm
@ -389,16 +389,16 @@ next:
//
// Extract the subset of bit field from the 8-bit value FullID. It returns the 8-bit sub ID value
//
static unsigned char GetNzbSubID(unsigned char FullID,
unsigned char MaxSubIDValue,
unsigned char ShiftCount)
static U8 GetNzbSubID(U8 FullID,
U8 MaxSubIDValue,
U8 ShiftCount)
{
unsigned int MaskWidth;
unsigned char MaskBits;
U32 MaskWidth;
U8 MaskBits;
MaskWidth = find_maskwidth((unsigned int) MaxSubIDValue);
MaskWidth = find_maskwidth((U32) MaxSubIDValue);
MaskBits = (0xff << ShiftCount) ^
((unsigned char) (0xff << (ShiftCount + MaskWidth)));
((U8) (0xff << (ShiftCount + MaskWidth)));
return (FullID & MaskBits);
}
@ -417,8 +417,8 @@ next:
TotAvailCore = 1;
PhysicalNum = 1;
unsigned int numLPEnabled = 0;
int MaxLPPerCore = 1;
U32 numLPEnabled = 0;
S32 MaxLPPerCore = 1;
#ifdef TORQUE_OS_MAC
@ -427,8 +427,8 @@ next:
// like there isn't a way to do this that's working across all OSX incarnations
// and machine configurations anyway.
int numCPUs;
int numPackages;
S32 numCPUs;
S32 numPackages;
// Get the number of CPUs.
@ -447,9 +447,9 @@ next:
#else
U32 dwAffinityMask;
int j = 0;
unsigned char apicID, PackageIDMask;
unsigned char tblPkgID[256], tblCoreID[256], tblSMTID[256];
S32 j = 0;
U8 apicID, PackageIDMask;
U8 tblPkgID[256], tblCoreID[256], tblSMTID[256];
char tmp[256];
#ifdef TORQUE_OS_LINUX
@ -461,14 +461,14 @@ next:
// Linux doesn't easily allow us to look at the Affinity Bitmask directly,
// but it does provide an API to test affinity maskbits of the current process
// against each logical processor visible under OS.
int sysNumProcs = sysconf(_SC_NPROCESSORS_CONF); //This will tell us how many
S32 sysNumProcs = sysconf(_SC_NPROCESSORS_CONF); //This will tell us how many
//CPUs are currently enabled.
//this will tell us which processors this process can run on.
cpu_set_t allowedCPUs;
sched_getaffinity(0, sizeof(allowedCPUs), &allowedCPUs);
for (int i = 0; i < sysNumProcs; i++ )
for (S32 i = 0; i < sysNumProcs; i++ )
{
if ( CPU_ISSET(i, &allowedCPUs) == 0 )
return CONFIG_UserConfigIssue;
@ -519,8 +519,8 @@ next:
// processors per core
tblSMTID[j] = GetNzbSubID(apicID, MaxLPPerCore, 0);
unsigned char maxCorePPP = MaxCorePerPhysicalProc();
unsigned char maskWidth = find_maskwidth(MaxLPPerCore);
U8 maxCorePPP = MaxCorePerPhysicalProc();
U8 maskWidth = find_maskwidth(MaxLPPerCore);
tblCoreID[j] = GetNzbSubID(apicID, maxCorePPP, maskWidth);
// Extract package ID, assume single cluster.
@ -557,9 +557,9 @@ next:
//
// Count available cores (TotAvailCore) in the system
//
unsigned char CoreIDBucket[256];
U8 CoreIDBucket[256];
DWORD ProcessorMask, pCoreMask[256];
unsigned int i, ProcessorNum;
U32 i, ProcessorNum;
CoreIDBucket[0] = tblPkgID[0] | tblCoreID[0];
ProcessorMask = 1;
@ -595,7 +595,7 @@ next:
//
// Count physical processor (PhysicalNum) in the system
//
unsigned char PackageIDBucket[256];
U8 PackageIDBucket[256];
DWORD pPackageMask[256];
PackageIDBucket[0] = tblPkgID[0];

View file

@ -367,7 +367,7 @@ static U32 validateTreeRecurse(TreeNode *tree)
if(tree == NIL)
return 1;
// check my left tree
int lcount, rcount, nc = 0;
S32 lcount, rcount, nc = 0;
if(tree->color == Red)
{
@ -1586,7 +1586,7 @@ dsize_t getMemoryUsed()
}
#ifdef TORQUE_DEBUG_GUARD
DefineEngineFunction( dumpAlloc, void, ( int allocNum ),,
DefineEngineFunction( dumpAlloc, void, ( S32 allocNum ),,
"@brief Dumps information about the given allocated memory block.\n\n"
"@param allocNum Memory block to dump information about."
"@note Available in debug builds only. "

View file

@ -34,7 +34,7 @@
#define ioctl ioctlsocket
typedef int socklen_t;
typedef S32 socklen_t;
#elif defined ( TORQUE_OS_MAC )
@ -88,7 +88,7 @@ typedef in_addr IN_ADDR;
#define TORQUE_USE_WINSOCK
#define EINPROGRESS WSAEINPROGRESS
#define ioctl ioctlsocket
typedef int socklen_t;
typedef S32 socklen_t;
DWORD _getLastErrorAndClear()
{
@ -103,7 +103,7 @@ DWORD _getLastErrorAndClear()
#endif
#if defined(TORQUE_USE_WINSOCK)
static const char* strerror_wsa( int code )
static const char* strerror_wsa( S32 code )
{
switch( code )
{
@ -141,7 +141,7 @@ static const char* strerror_wsa( int code )
static Net::Error getLastError();
static S32 defaultPort = 28000;
static S32 netPort = 0;
static int udpSocket = InvalidSocket;
static S32 udpSocket = InvalidSocket;
ConnectionNotifyEvent Net::smConnectionNotify;
ConnectionAcceptedEvent Net::smConnectionAccept;
@ -445,7 +445,7 @@ void Net::closeConnectTo(NetSocket sock)
return;
// if this socket is in the list of polled sockets, remove it
for (int i = 0; i < gPolledSockets.size(); ++i)
for (S32 i = 0; i < gPolledSockets.size(); ++i)
{
if (gPolledSockets[i]->fd == sock)
{
@ -458,7 +458,7 @@ void Net::closeConnectTo(NetSocket sock)
closeSocket(sock);
}
Net::Error Net::sendtoSocket(NetSocket socket, const U8 *buffer, int bufferSize)
Net::Error Net::sendtoSocket(NetSocket socket, const U8 *buffer, S32 bufferSize)
{
if(Journal::IsPlaying())
{
@ -484,7 +484,7 @@ bool Net::openPort(S32 port, bool doBind)
// we turn off VDP in non-release builds because VDP does not support broadcast packets
// which are required for LAN queries (PC->Xbox connectivity). The wire protocol still
// uses the VDP packet structure, though.
int protocol = 0;
S32 protocol = 0;
bool useVDP = false;
#ifdef TORQUE_DISABLE_PC_CONNECTIVITY
// Xbox uses a VDP (voice/data protocol) socket for networking
@ -621,7 +621,7 @@ void Net::process()
sockaddr_in ipAddr;
NetSocket incoming = InvalidSocket;
char out_h_addr[1024];
int out_h_length = 0;
S32 out_h_length = 0;
RawData readBuff;
for (S32 i = 0; i < gPolledSockets.size();
@ -731,7 +731,7 @@ void Net::process()
if(::connect(currentSock->fd, (struct sockaddr *)&ipAddr,
sizeof(ipAddr)) == -1)
{
int errorCode;
S32 errorCode;
#if defined(TORQUE_USE_WINSOCK)
errorCode = WSAGetLastError();
if( errorCode == WSAEINPROGRESS || errorCode == WSAEWOULDBLOCK )
@ -790,7 +790,7 @@ void Net::process()
NetSocket Net::openSocket()
{
int retSocket;
S32 retSocket;
retSocket = socket(AF_INET, SOCK_STREAM, 0);
if(retSocket == InvalidSocket)
@ -835,7 +835,7 @@ NetSocket Net::accept(NetSocket acceptSocket, NetAddress *remoteAddress)
sockaddr_in socketAddress;
socklen_t addrLen = sizeof(socketAddress);
int retVal = ::accept(acceptSocket, (sockaddr *) &socketAddress, &addrLen);
S32 retVal = ::accept(acceptSocket, (sockaddr *) &socketAddress, &addrLen);
if(retVal != InvalidSocket)
{
IPSocketToNetAddress(&socketAddress, remoteAddress);

View file

@ -31,14 +31,14 @@
#define MAXPACKETSIZE 1500
#endif
typedef int NetConnectionId;
typedef S32 NetConnectionId;
/// Generic network address
///
/// This is used to represent IP addresses.
struct NetAddress
{
int type; ///< Type of address (IPAddress currently)
S32 type; ///< Type of address (IPAddress currently)
/// Acceptable NetAddress types.
enum
@ -93,7 +93,7 @@ struct Net
TCPProtocol
};
static const int MaxPacketDataSize = MAXPACKETSIZE;
static const S32 MaxPacketDataSize = MAXPACKETSIZE;
static ConnectionNotifyEvent smConnectionNotify;
static ConnectionAcceptedEvent smConnectionAccept;

View file

@ -48,7 +48,7 @@ struct NetAsync::NameLookupRequest
NetSocket sock;
char remoteAddr[4096];
char out_h_addr[4096];
int out_h_length;
S32 out_h_length;
bool complete;
NameLookupRequest()
@ -140,7 +140,7 @@ void NetAsync::queueLookup(const char* remoteAddr, NetSocket socket)
{
// do we have it already?
unsigned int i = 0;
U32 i = 0;
for (i = 0; i < mLookupRequests.size(); ++i)
{
if (mLookupRequests[i].sock == socket)
@ -160,7 +160,7 @@ void NetAsync::queueLookup(const char* remoteAddr, NetSocket socket)
}
bool NetAsync::checkLookup(NetSocket socket, char* out_h_addr,
int* out_h_length, int out_h_addr_size)
S32* out_h_length, S32 out_h_addr_size)
{
bool found = false;

View file

@ -54,7 +54,7 @@ class NetAsync
// out_h_length will be set appropriately. if out_h_length is -1, then
// name could not be resolved. otherwise, it provides the number of
// address bytes copied into out_h_addr.
bool checkLookup(NetSocket socket, char* out_h_addr, int* out_h_length, int out_h_addr_size);
bool checkLookup(NetSocket socket, char* out_h_addr, int* out_h_length, S32 out_h_addr_size);
};
// the global net async object

View file

@ -311,7 +311,7 @@ CreateUnitTest( SemaphoreWaitTest, "Platform/Threads/SemaphoreWaitTest")
void *mMutex;
U32 mDoneCount;
const static int csmThreadCount = 10;
const static S32 csmThreadCount = 10;
void run()
{
@ -381,7 +381,7 @@ CreateUnitTest( MutexWaitTest, "Platform/Threads/MutexWaitTest")
void *mMutex;
U32 mDoneCount;
const static int csmThreadCount = 10;
const static S32 csmThreadCount = 10;
void run()
{

View file

@ -218,13 +218,13 @@ inline S8 getMin(S8 a, S8 b)
}
/// Returns the lesser of the two parameters: a & b.
inline float getMin(float a, float b)
inline F32 getMin(F32 a, F32 b)
{
return a>b ? b : a;
}
/// Returns the lesser of the two parameters: a & b.
inline double getMin(double a, double b)
inline F64 getMin(F64 a, F64 b)
{
return a>b ? b : a;
}
@ -266,13 +266,13 @@ inline S8 getMax(S8 a, S8 b)
}
/// Returns the greater of the two parameters: a & b.
inline float getMax(float a, float b)
inline F32 getMax(F32 a, F32 b)
{
return a>b ? a : b;
}
/// Returns the greater of the two parameters: a & b.
inline double getMax(double a, double b)
inline F64 getMax(F64 a, F64 b)
{
return a>b ? a : b;
}