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

@ -174,7 +174,7 @@ inline OutputClass horrible_cast(const InputClass input){
// Cause a compile-time error if in, out and u are not the same size.
// If the compile fails here, it means the compiler has peculiar
// unions which would prevent the cast from working.
typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
typedef S32 ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
u.in = input;
return u.out;
@ -270,7 +270,7 @@ struct VoidToDefaultVoid<void> { typedef DefaultVoid type; };
#endif
// The size of a single inheritance member function pointer.
const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
const S32 SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
// SimplifyMemFunc< >::Convert()
//
@ -284,7 +284,7 @@ const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
// template specialisation, I use full specialisation of a wrapper struct.
// general case -- don't know how to convert it. Force a compile failure
template <int N>
template <S32 N>
struct SimplifyMemFunc {
template <class X, class XFuncType, class GenericMemFuncType>
inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
@ -344,11 +344,11 @@ struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
XFuncType func;
struct {
GenericMemFuncType funcaddress; // points to the actual member function
int delta; // #BYTES to be added to the 'this' pointer
S32 delta; // #BYTES to be added to the 'this' pointer
}s;
} u;
// Check that the horrible_cast will work
typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
typedef S32 ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
u.func = function_to_bind;
bound_func = u.s.funcaddress;
return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
@ -367,8 +367,8 @@ struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
// is internally defined as:
struct MicrosoftVirtualMFP {
void (GenericClass::*codeptr)(); // points to the actual member function
int delta; // #bytes to be added to the 'this' pointer
int vtable_index; // or 0 if no virtual inheritance
S32 delta; // #bytes to be added to the 'this' pointer
S32 vtable_index; // or 0 if no virtual inheritance
};
// The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the
// m_codeptr member is *always* called, regardless of the values of the other
@ -405,7 +405,7 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*sizeof(int) >
MicrosoftVirtualMFP s;
} u2;
// Check that the horrible_cast<>s will work
typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
typedef S32 ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
&& sizeof(function_to_bind)==sizeof(u.ProbeFunc)
&& sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1];
// Unfortunately, taking the address of a MF prevents it from being inlined, so
@ -477,24 +477,24 @@ struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
// is internally defined as:
struct {
GenericMemFuncType m_funcaddress; // points to the actual member function
int delta; // #bytes to be added to the 'this' pointer
int vtordisp; // #bytes to add to 'this' to find the vtable
int vtable_index; // or 0 if no virtual inheritance
S32 delta; // #bytes to be added to the 'this' pointer
S32 vtordisp; // #bytes to add to 'this' to find the vtable
S32 vtable_index; // or 0 if no virtual inheritance
} s;
} u;
// Check that the horrible_cast will work
typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
typedef S32 ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
u.func = function_to_bind;
bound_func = u.s.funcaddress;
int virtual_delta = 0;
S32 virtual_delta = 0;
if (u.s.vtable_index) { // Virtual inheritance is used
// First, get to the vtable.
// It is 'vtordisp' bytes from the start of the class.
const int * vtable = *reinterpret_cast<const int *const*>(
const S32 * vtable = *reinterpret_cast<const S32 *const*>(
reinterpret_cast<const char *>(pthis) + u.s.vtordisp );
// 'vtable_index' tells us where in the table we should be looking.
virtual_delta = u.s.vtordisp + *reinterpret_cast<const int *>(
virtual_delta = u.s.vtordisp + *reinterpret_cast<const S32 *>(
reinterpret_cast<const char *>(vtable) + u.s.vtable_index);
}
// The int at 'virtual_delta' gives us the amount to add to 'this'.
@ -777,7 +777,7 @@ public:
// Ensure that there's a compilation failure if function pointers
// and data pointers have different sizes.
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
typedef S32 ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
m_pthis = horrible_cast<GenericClass *>(function_to_bind);
// MSVC, SunC++ and DMC accept the following (non-standard) code:
// m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
@ -792,7 +792,7 @@ public:
// Ensure that there's a compilation failure if function pointers
// and data pointers have different sizes.
// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
typedef S32 ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
return horrible_cast<UnvoidStaticFuncPtr>(this);
}
#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
@ -906,7 +906,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -991,7 +991,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1076,7 +1076,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1161,7 +1161,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1246,7 +1246,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1331,7 +1331,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1416,7 +1416,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1501,7 +1501,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1586,7 +1586,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1671,7 +1671,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1756,7 +1756,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
@ -1841,7 +1841,7 @@ public:
// Implicit conversion to "bool" using the safe_bool idiom
private:
typedef struct SafeBoolStruct {
int a_data_pointer_to_this_is_0_on_buggy_compilers;
S32 a_data_pointer_to_this_is_0_on_buggy_compilers;
StaticFunctionPtr m_nonzero;
} UselessTypedef;
typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;

View file

@ -55,7 +55,7 @@ public:
}
protected:
int mOffset;
S32 mOffset;
};
#endif // _UTIL_DELEGATE_H_

View file

@ -37,7 +37,7 @@ public:
volatile U8 *u8Mem = reinterpret_cast<U8 *>( memory );
for( int i = 0; i < size >> 2; i++ )
for( S32 i = 0; i < size >> 2; i++ )
{
// g = garbage byte
// Input: [X|Y|Z|g] (rgba)
@ -57,7 +57,7 @@ public:
volatile const U8 *srcU8 = reinterpret_cast<const U8 *>( source );
volatile U8 *dstU8 = reinterpret_cast<U8 *>( destination );
for( int i = 0; i < size >> 2; i++ )
for( S32 i = 0; i < size >> 2; i++ )
{
// g = garbage byte
// Input: [X|Y|Z|g] (rgba)
@ -85,13 +85,13 @@ public:
virtual void ToBuffer( void *destination, const void *source, const dsize_t size ) const
{
AssertFatal( size % 3 == 0, "Bad buffer size for DXT5nm Swizzle" );
const int pixels = size / 3;
const S32 pixels = size / 3;
volatile const U8 *srcU8 = reinterpret_cast<const U8 *>( source );
volatile U8 *dstU8 = reinterpret_cast<U8 *>( destination );
// destination better damn well be the right size
for( int i = 0; i < pixels; i++ )
for( S32 i = 0; i < pixels; i++ )
{
// g = garbage byte
// Input: [X|Y|Z|g] (rgba)

View file

@ -56,7 +56,7 @@ void Path::_split(String name)
idx = name.find('/', 0, String::Right);
if (idx >= pos)
{
int len = idx - pos;
S32 len = idx - pos;
mPath = name.substr(pos,len? len: 1);
mPath = Path::CleanSeparators(mPath);
pos = idx + 1;

View file

@ -126,11 +126,11 @@ inline void Swizzle<T, mapLength>::ToBuffer( void *destination, const void *sour
T *dest = reinterpret_cast<T *>( destination );
const T *src = reinterpret_cast<const T *>( source );
for( int i = 0; i < size / ( mapLength * sizeof( T ) ); i++ )
for( S32 i = 0; i < size / ( mapLength * sizeof( T ) ); i++ )
{
dMemcpy( dest, src, mapLength * sizeof( T ) );
for( int j = 0; j < mapLength; j++ )
for( S32 j = 0; j < mapLength; j++ )
*dest++ = src[mMap[j]];
src += mapLength;

View file

@ -37,7 +37,7 @@ inline void Swizzle<U8, 4>::InPlace( void *memory, const dsize_t size ) const
U8 *src = reinterpret_cast<U8 *>( memory );
// Fast divide by 4 since we are assured a proper size
for( int i = 0; i < size >> 2; i++ )
for( S32 i = 0; i < size >> 2; i++ )
{
BYTESWAP( *dest++, src[mMap[0]] );
BYTESWAP( *dest++, src[mMap[1]] );
@ -57,7 +57,7 @@ inline void Swizzle<U8, 4>::ToBuffer( void *destination, const void *source, con
const U8 *src = reinterpret_cast<const U8 *>( source );
// Fast divide by 4 since we are assured a proper size
for( int i = 0; i < size >> 2; i++ )
for( S32 i = 0; i < size >> 2; i++ )
{
*dest++ = src[mMap[0]];
*dest++ = src[mMap[1]];
@ -80,7 +80,7 @@ inline void Swizzle<U8, 3>::InPlace( void *memory, const dsize_t size ) const
U8 *dest = reinterpret_cast<U8 *>( memory );
U8 *src = reinterpret_cast<U8 *>( memory );
for( int i = 0; i < size /3; i++ )
for( S32 i = 0; i < size /3; i++ )
{
BYTESWAP( *dest++, src[mMap[0]] );
BYTESWAP( *dest++, src[mMap[1]] );
@ -98,7 +98,7 @@ inline void Swizzle<U8, 3>::ToBuffer( void *destination, const void *source, con
U8 *dest = reinterpret_cast<U8 *>( destination );
const U8 *src = reinterpret_cast<const U8 *>( source );
for( int i = 0; i < size / 3; i++ )
for( S32 i = 0; i < size / 3; i++ )
{
*dest++ = src[mMap[0]];
*dest++ = src[mMap[1]];

View file

@ -25,7 +25,7 @@
/// A vector with a compile-time constant size.
template< typename T, int SIZE >
template< typename T, S32 SIZE >
class FixedSizeVector
{
protected:

View file

@ -24,7 +24,7 @@
#include "core/util/tSignal.h"
void SignalBase::DelegateLink::insert(DelegateLink* node, float order)
void SignalBase::DelegateLink::insert(DelegateLink* node, F32 order)
{
// Note: can only legitimately be called on list head
DelegateLink * walk = next;

View file

@ -135,7 +135,7 @@ public:
{
if( del->mDelegate == dlg )
{
for ( int i = 0; i < mTriggerNext.size(); i++ )
for ( S32 i = 0; i < mTriggerNext.size(); i++ )
{
if( mTriggerNext[i] == ptr )
mTriggerNext[i] = ptr->next;

View file

@ -508,7 +508,7 @@ template<class T> inline void Vector<T>::compact()
resize(mElementCount);
}
typedef int (QSORT_CALLBACK *qsort_compare_func)(const void *, const void *);
typedef S32 (QSORT_CALLBACK *qsort_compare_func)(const void *, const void *);
template<class T> inline void Vector<T>::sort(compare_func f)
{
@ -800,7 +800,7 @@ class VectorPtr : public Vector<void *>
const_iterator end() const;
void insert(iterator,const T&);
void insert(int idx) { Parent::insert(idx); }
void insert(S32 idx) { Parent::insert(idx); }
void erase(iterator);
T& front();

View file

@ -72,10 +72,10 @@ CreateUnitTest( TestVector, "Util/Vector" )
TEST( dtorVals[ 9 ] );
}
static S32 QSORT_CALLBACK sortInts( const int* a, const int* b )
static S32 QSORT_CALLBACK sortInts( const S32* a, const S32* b )
{
int av = *a;
int bv = *b;
S32 av = *a;
S32 bv = *b;
if( av < bv )
return -1;
@ -87,7 +87,7 @@ CreateUnitTest( TestVector, "Util/Vector" )
void testSort()
{
Vector< int > v;
Vector< S32 > v;
v.push_back( 0 );
v.push_back( 10 );

View file

@ -216,7 +216,7 @@ String ZipObject::getFileEntry(S32 idx)
const Zip::CentralDir &dir = (*mZipArchive)[idx];
char buffer[1024];
int chars = dSprintf(buffer, sizeof(buffer), "%s\t%d\t%d\t%d\t%08x",
S32 chars = dSprintf(buffer, sizeof(buffer), "%s\t%d\t%d\t%d\t%08x",
dir.mFilename.c_str(), dir.mUncompressedSize, dir.mCompressedSize,
dir.mCompressMethod, dir.mCRC32);
if (chars < sizeof(buffer))