1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Convert custom HeadSpin integer types to standard types from stdint.h

This commit is contained in:
2012-01-19 21:19:26 -05:00
parent a0d54e2644
commit 5027b5a4ac
1301 changed files with 14497 additions and 14532 deletions

View File

@ -68,7 +68,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// buffer, but if you do, it'll help this class do some internal space
// optimization.
plBSDiffBuffer::plBSDiffBuffer( UInt32 newLength, UInt32 oldLength )
plBSDiffBuffer::plBSDiffBuffer( uint32_t newLength, uint32_t oldLength )
: fNewLength( newLength )
, fPatchLength( 0 )
{
@ -82,7 +82,7 @@ plBSDiffBuffer::plBSDiffBuffer( UInt32 newLength, UInt32 oldLength )
// will be copied, so you don't need to keep it around after you construct
// this object.
plBSDiffBuffer::plBSDiffBuffer( void *buffer, UInt32 length )
plBSDiffBuffer::plBSDiffBuffer( void *buffer, uint32_t length )
: fNewLength( 0 )
, fPatchLength( 0 )
, fPatchBuffer( nil )
@ -111,21 +111,21 @@ plBSDiffBuffer::~plBSDiffBuffer()
//// Diff /////////////////////////////////////////////////////////////////////
// Diff() creates the diff buffer from the new and old.
UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength, void *newBuffer )
uint32_t plBSDiffBuffer::Diff( uint32_t oldLength, void *oldBuffer, uint32_t newLength, void *newBuffer )
{
hsAssert( fWriting, "Trying to Add() to a difference buffer that's reading" );
Int32 *I,*V;
int32_t *I,*V;
Int32 scan,pos,len;
Int32 lastscan,lastpos,lastoffset;
Int32 oldscore,scsc;
int32_t scan,pos,len;
int32_t lastscan,lastpos,lastoffset;
int32_t oldscore,scsc;
Int32 s,Sf,lenf,Sb,lenb;
Int32 overlap,Ss,lens;
Int32 i;
int32_t s,Sf,lenf,Sb,lenb;
int32_t overlap,Ss,lens;
int32_t i;
UInt32 cblen,dblen,eblen;
uint32_t cblen,dblen,eblen;
unsigned char *oldbuf, *newbuf;
unsigned char *cb,*db,*eb;
@ -142,8 +142,8 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength
oldbuf = (unsigned char *)oldBuffer;
newbuf = (unsigned char *)newBuffer;
if(((I=TRACKED_NEW Int32[oldLength+1])==nil) ||
((V=TRACKED_NEW Int32[oldLength+1])==nil))
if(((I=TRACKED_NEW int32_t[oldLength+1])==nil) ||
((V=TRACKED_NEW int32_t[oldLength+1])==nil))
{
delete[] I;
delete[] V;
@ -246,9 +246,9 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength
dblen+=lenf;
eblen+=(scan-lenb)-(lastscan+lenf);
IWriteUnsignedInt8(lenf,cb+cblen);
IWriteUnsignedInt8((scan-lenb)-(lastscan+lenf),cb+cblen+8);
IWriteUnsignedInt8((pos-lenb)-(lastpos+lenf),cb+cblen+16);
IWriteUnsignedint8_t(lenf,cb+cblen);
IWriteUnsignedint8_t((scan-lenb)-(lastscan+lenf),cb+cblen+8);
IWriteUnsignedint8_t((pos-lenb)-(lastpos+lenf),cb+cblen+16);
cblen+=24;
lastscan=scan-lenb;
@ -257,9 +257,9 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength
};
};
IWriteUnsignedInt8(cblen,header+8);
IWriteUnsignedInt8(dblen,header+16);
IWriteUnsignedInt8(newLength,header+24);
IWriteUnsignedint8_t(cblen,header+8);
IWriteUnsignedint8_t(dblen,header+16);
IWriteUnsignedint8_t(newLength,header+24);
fPatchLength = 32 + cblen + dblen + eblen;
fPatchBuffer = nil;
@ -290,7 +290,7 @@ UInt32 plBSDiffBuffer::Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength
// function will rewind the diff stream, so once you call it, you can't do
// anything else on the object.
void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr )
void plBSDiffBuffer::GetBuffer( uint32_t &length, void *&bufferPtr )
{
hsAssert( fWriting, "Trying to GetBuffer() on a difference buffer that's reading" );
@ -315,20 +315,20 @@ void plBSDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr )
// Patch() will take this diff buffer and apply it to the given old buffer,
// allocating and producing a new buffer. You are responsible for freeing the new buffer.
UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer )
uint32_t plBSDiffBuffer::Patch( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer )
{
hsAssert( !fWriting, "Trying to Patch() a difference buffer that's writing" );
unsigned char *ctrlpipe, *ctrlend;
unsigned char *diffpipe, *diffend;
unsigned char *extrapipe;
UInt32 ctrllen,datalen;
uint32_t ctrllen,datalen;
int version=0;
unsigned char *newpos, *newend;
unsigned char *oldpos, *oldend;
unsigned char *patchend;
UInt32 ctrl[3];
UInt32 i;
uint32_t ctrl[3];
uint32_t i;
if (oldBuffer == nil ||
oldLength < 0 ||
@ -375,9 +375,9 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng
if(!version) return (-1);
ctrllen=IReadUnsignedInt8(fPatchBuffer+8);
datalen=IReadUnsignedInt8(fPatchBuffer+16);
newLength=IReadUnsignedInt8(fPatchBuffer+24);
ctrllen=IReadUnsignedint8_t(fPatchBuffer+8);
datalen=IReadUnsignedint8_t(fPatchBuffer+16);
newLength=IReadUnsignedint8_t(fPatchBuffer+24);
if((ctrllen<0) || (datalen<0) || (newLength<0) ||
((version==1) && (32+ctrllen+datalen!=fPatchLength)))
return (-1);
@ -398,7 +398,7 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng
while(newpos<newend) {
for(i=0;i<=version;i++) {
if(ctrlend-ctrlpipe < 8) return (-1);
ctrl[i]=IReadUnsignedInt8(ctrlpipe);
ctrl[i]=IReadUnsignedint8_t(ctrlpipe);
ctrlpipe += 8;
};
@ -443,11 +443,11 @@ UInt32 plBSDiffBuffer::Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLeng
//// Private Helper Functions ///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Reads in an 8-byte unsigned integer least significant byte first and returns a
// UInt32. We'll ignore the top four bytes.
UInt32 plBSDiffBuffer::IReadUnsignedInt8(unsigned char *buf)
// Reads in an 8-uint8_t unsigned integer least significant uint8_t first and returns a
// uint32_t. We'll ignore the top four bytes.
uint32_t plBSDiffBuffer::IReadUnsignedint8_t(unsigned char *buf)
{
UInt32 y;
uint32_t y;
y=buf[7]&0x7F;
y=y*256;y+=buf[6];
@ -459,21 +459,21 @@ UInt32 plBSDiffBuffer::IReadUnsignedInt8(unsigned char *buf)
y=y*256;y+=buf[0];
// casting added so compiler doesn't warn about negating an unsigned value
Int32 signedY = (Int32)y;
int32_t signedY = (int32_t)y;
if(buf[7]&0x80) signedY=-signedY;
y = (UInt32)signedY;
y = (uint32_t)signedY;
return y;
}
void plBSDiffBuffer::IWriteUnsignedInt8(UInt32 x,unsigned char *buf)
void plBSDiffBuffer::IWriteUnsignedint8_t(uint32_t x,unsigned char *buf)
{
UInt32 y;
Int32 signedY, signedX = (Int32)x;
uint32_t y;
int32_t signedY, signedX = (int32_t)x;
// casting added so compiler doesn't warn about negating an unsigned value
if(x<0) signedY=-signedX; else signedY=signedX;
y = (UInt32)signedY;
y = (uint32_t)signedY;
buf[0]=(unsigned char)(y%256);y-=buf[0];
y=y/256;buf[1]=(unsigned char)(y%256);y-=buf[1];
@ -489,22 +489,22 @@ void plBSDiffBuffer::IWriteUnsignedInt8(UInt32 x,unsigned char *buf)
/*
* This function will ensure that no boundary errors occur. It also increments *src
* by nbytes when done.
* by nBytes when done.
*/
void plBSDiffBuffer::ISafeMemcpy(unsigned char *dest, unsigned char *src, size_t nbytes,
void plBSDiffBuffer::ISafeMemcpy(unsigned char *dest, unsigned char *src, size_t nBytes,
unsigned char *destend, unsigned char *srcend)
{
if((destend - dest < nbytes) ||
(srcend - src < nbytes))
if((destend - dest < nBytes) ||
(srcend - src < nBytes))
{
hsAssert(false,"Corrupt patch\n");
}
memcpy(dest,src,nbytes);
memcpy(dest,src,nBytes);
}
void plBSDiffBuffer::ISplit(Int32 *I,Int32 *V,UInt32 start,UInt32 len,UInt32 h)
void plBSDiffBuffer::ISplit(int32_t *I,int32_t *V,uint32_t start,uint32_t len,uint32_t h)
{
UInt32 i,j,k,x,tmp,jj,kk;
uint32_t i,j,k,x,tmp,jj,kk;
if(len<16) {
for(k=start;k<start+len;k+=j) {
@ -563,10 +563,10 @@ void plBSDiffBuffer::ISplit(Int32 *I,Int32 *V,UInt32 start,UInt32 len,UInt32 h)
if(start+len>kk) ISplit(I,V,kk,start+len-kk,h);
}
void plBSDiffBuffer::IQSuffixSort(Int32 *I,Int32 *V,unsigned char *old,UInt32 oldsize)
void plBSDiffBuffer::IQSuffixSort(int32_t *I,int32_t *V,unsigned char *old,uint32_t oldsize)
{
UInt32 buckets[256];
UInt32 i,h,len;
uint32_t buckets[256];
uint32_t i,h,len;
for(i=0;i<256;i++) buckets[i]=0;
for(i=0;i<oldsize;i++) buckets[old[i]]++;
@ -581,33 +581,33 @@ void plBSDiffBuffer::IQSuffixSort(Int32 *I,Int32 *V,unsigned char *old,UInt32 ol
for(i=1;i<256;i++) if(buckets[i]==buckets[i-1]+1) I[buckets[i]]=-1;
I[0]=-1;
// oldsize converted to Int32 to stop warning about negating unsigned numbers
for(h=1;I[0]!=-(Int32)(oldsize+1);h+=h) {
// oldsize converted to int32_t to stop warning about negating unsigned numbers
for(h=1;I[0]!=-(int32_t)(oldsize+1);h+=h) {
len=0;
for(i=0;i<oldsize+1;) {
if(I[i]<0) {
len-=I[i];
i-=I[i];
} else {
// len converted to Int32 to stop the warning about negating an unsigned number
if(len) I[i-len]=-(Int32)len;
// len converted to int32_t to stop the warning about negating an unsigned number
if(len) I[i-len]=-(int32_t)len;
len=V[I[i]]+1-i;
ISplit(I,V,i,len,h);
i+=len;
len=0;
};
};
// len converted to Int32 to stop the warning about negating an unsigned number
if(len) I[i-len]=-(Int32)len;
// len converted to int32_t to stop the warning about negating an unsigned number
if(len) I[i-len]=-(int32_t)len;
};
for(i=0;i<oldsize+1;i++) I[V[i]]=i;
}
UInt32 plBSDiffBuffer::IMatchLen( unsigned char *oldBuffer, UInt32 oldLength,
unsigned char *newBuffer, UInt32 newLength)
uint32_t plBSDiffBuffer::IMatchLen( unsigned char *oldBuffer, uint32_t oldLength,
unsigned char *newBuffer, uint32_t newLength)
{
UInt32 i;
uint32_t i;
for(i=0;(i<oldLength)&&(i<newLength);i++)
if(oldBuffer[i]!=newBuffer[i]) break;
@ -615,12 +615,12 @@ UInt32 plBSDiffBuffer::IMatchLen( unsigned char *oldBuffer, UInt32 oldLength,
return i;
}
UInt32 plBSDiffBuffer::ISearch( Int32 *I,
unsigned char *oldBuffer, UInt32 oldLength,
unsigned char *newBuffer, UInt32 newLength,
UInt32 st, UInt32 en, Int32 *pos)
uint32_t plBSDiffBuffer::ISearch( int32_t *I,
unsigned char *oldBuffer, uint32_t oldLength,
unsigned char *newBuffer, uint32_t newLength,
uint32_t st, uint32_t en, int32_t *pos)
{
UInt32 x,y;
uint32_t x,y;
if(en-st<2) {
x=IMatchLen(oldBuffer+I[st],oldLength-I[st],newBuffer,newLength);

View File

@ -76,13 +76,13 @@ class plBSDiffBuffer
protected:
hsBool fWriting;
UInt32 fNewLength, fPatchLength;
uint32_t fNewLength, fPatchLength;
unsigned char* fPatchBuffer;
public:
plBSDiffBuffer( UInt32 newLength, UInt32 oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations
plBSDiffBuffer( void *buffer, UInt32 length ); // Constructor for applying a given diff set
plBSDiffBuffer( uint32_t newLength, uint32_t oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations
plBSDiffBuffer( void *buffer, uint32_t length ); // Constructor for applying a given diff set
// to an old buffer
virtual ~plBSDiffBuffer();
@ -90,36 +90,36 @@ class plBSDiffBuffer
/// Creation/write functions
// Diff() creates the diff buffer from the new and old.
UInt32 Diff( UInt32 oldLength, void *oldBuffer, UInt32 newLength, void *newBuffer );
uint32_t Diff( uint32_t oldLength, void *oldBuffer, uint32_t newLength, void *newBuffer );
// GetBuffer() will copy the diff stream into a new buffer and return it. You are responsible for freeing the buffer.
void GetBuffer( UInt32 &length, void *&bufferPtr );
void GetBuffer( uint32_t &length, void *&bufferPtr );
/// Apply functions
// Apply() is another way to call Patch().
UInt32 Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer )
uint32_t Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer )
{ return Patch(oldLength, oldBuffer, newLength, newBuffer); };
// Patch() will take this diff buffer and apply it to the given old buffer,
// allocating and producing a new buffer. You are responsible for freeing the new buffer.
UInt32 Patch( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer );
uint32_t Patch( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer );
private:
UInt32 IReadUnsignedInt8(unsigned char *buf);
void IWriteUnsignedInt8(UInt32 x,unsigned char *buf);
void ISafeMemcpy(unsigned char *dest, unsigned char *src, size_t nbytes,
uint32_t IReadUnsignedint8_t(unsigned char *buf);
void IWriteUnsignedint8_t(uint32_t x,unsigned char *buf);
void ISafeMemcpy(unsigned char *dest, unsigned char *src, size_t nBytes,
unsigned char *destend, unsigned char *srcend);
void ISplit(Int32 *I,Int32 *V,UInt32 start,UInt32 len,UInt32 h);
void IQSuffixSort(Int32 *I,Int32 *V,unsigned char *old,UInt32 oldsize);
UInt32 IMatchLen( unsigned char *oldBuffer, UInt32 oldLength,
unsigned char *newBuffer, UInt32 newLength);
UInt32 ISearch( Int32 *I,
unsigned char *oldBuffer, UInt32 oldLength,
unsigned char *newBuffer, UInt32 newLength,
UInt32 st, UInt32 en, Int32 *pos);
void ISplit(int32_t *I,int32_t *V,uint32_t start,uint32_t len,uint32_t h);
void IQSuffixSort(int32_t *I,int32_t *V,unsigned char *old,uint32_t oldsize);
uint32_t IMatchLen( unsigned char *oldBuffer, uint32_t oldLength,
unsigned char *newBuffer, uint32_t newLength);
uint32_t ISearch( int32_t *I,
unsigned char *oldBuffer, uint32_t oldLength,
unsigned char *newBuffer, uint32_t newLength,
uint32_t st, uint32_t en, int32_t *pos);
};

View File

@ -73,7 +73,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// buffer, but if you do, it'll help this class do some internal space
// optimization.
plDiffBuffer::plDiffBuffer( UInt32 newLength, UInt32 oldLength )
plDiffBuffer::plDiffBuffer( uint32_t newLength, uint32_t oldLength )
: fBSDiffBuffer( nil )
, fIsBSDiff( false )
{
@ -98,7 +98,7 @@ plDiffBuffer::plDiffBuffer( UInt32 newLength, UInt32 oldLength )
// will be copied, so you don't need to keep it around after you construct
// this object.
plDiffBuffer::plDiffBuffer( void *buffer, UInt32 length )
plDiffBuffer::plDiffBuffer( void *buffer, uint32_t length )
: fBSDiffBuffer( nil )
, fStream( nil )
, fIsBSDiff( false )
@ -141,14 +141,14 @@ plDiffBuffer::~plDiffBuffer()
// supplied will be copied internally, so you can discard it after you call
// this function.
void plDiffBuffer::Add( Int32 length, void *newData )
void plDiffBuffer::Add( int32_t length, void *newData )
{
hsAssert( fWriting, "Trying to Add() to a difference buffer that's reading" );
// We flag our two different op types by the sign of the length. Negative
// lengths are an add operation, positive ones are copy ops.
if( f16BitMode )
fStream->WriteLE16( -( (Int16)length ) );
fStream->WriteLE16( -( (int16_t)length ) );
else
fStream->WriteLE32( -length );
fStream->Write( length, newData );
@ -157,7 +157,7 @@ void plDiffBuffer::Add( Int32 length, void *newData )
//// Copy ////////////////////////////////////////////////////////////////////
// Copy() appends a Copy-Data-From-Old operation to the diff buffer.
void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset )
void plDiffBuffer::Copy( int32_t length, uint32_t oldOffset )
{
hsAssert( fWriting, "Trying to Copy() to a difference buffer that's reading" );
@ -165,8 +165,8 @@ void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset )
// lengths are an add operation, positive ones are copy ops.
if( f16BitMode )
{
fStream->WriteLE16( (Int16)length );
fStream->WriteLE16( (UInt16)oldOffset );
fStream->WriteLE16( (int16_t)length );
fStream->WriteLE16( (uint16_t)oldOffset );
}
else
{
@ -182,12 +182,12 @@ void plDiffBuffer::Copy( Int32 length, UInt32 oldOffset )
// function will rewind the diff stream, so once you call it, you can't do
// anything else on the object.
void plDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr )
void plDiffBuffer::GetBuffer( uint32_t &length, void *&bufferPtr )
{
hsAssert( fWriting, "Trying to GetBuffer() on a difference buffer that's reading" );
length = fStream->GetPosition();
bufferPtr = (void *)TRACKED_NEW UInt8[ length ];
bufferPtr = (void *)TRACKED_NEW uint8_t[ length ];
fStream->Rewind();
fStream->Read( length, bufferPtr );
@ -205,7 +205,7 @@ void plDiffBuffer::GetBuffer( UInt32 &length, void *&bufferPtr )
#define hsAssertAndBreak( cond, msg ) { if( cond ) { hsAssert( false, msg ); break; } }
void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer )
void plDiffBuffer::Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer )
{
hsAssert( !fWriting, "Trying to Apply() a difference buffer that's writing" );
@ -218,24 +218,24 @@ void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLengt
/// Step 1: Allocate the new buffer
newLength = fNewLength;
UInt8 *new8Buffer = TRACKED_NEW UInt8[ newLength ];
UInt8 *old8Buffer = (UInt8 *)oldBuffer;
uint8_t *new8Buffer = TRACKED_NEW uint8_t[ newLength ];
uint8_t *old8Buffer = (uint8_t *)oldBuffer;
newBuffer = (void *)new8Buffer;
/// Step 2: Loop through the difference stream
Int32 opLength;
UInt32 newBufferPos = 0;
int32_t opLength;
uint32_t newBufferPos = 0;
while( newBufferPos < newLength )
{
// Read in the op length
if( f16BitMode )
{
Int16 opLen16 = fStream->ReadLE16();
int16_t opLen16 = fStream->ReadLE16();
if( opLen16 < 0 )
opLength = -( (Int32)( -opLen16 ) );
opLength = -( (int32_t)( -opLen16 ) );
else
opLength = (UInt32)opLen16;
opLength = (uint32_t)opLen16;
}
else
opLength = fStream->ReadLE32();
@ -252,7 +252,7 @@ void plDiffBuffer::Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLengt
else
{
// Copy op, so get the old offset and copy from there
UInt32 oldOffset = f16BitMode ? fStream->ReadLE16() : fStream->ReadLE32();
uint32_t oldOffset = f16BitMode ? fStream->ReadLE16() : fStream->ReadLE32();
hsAssertAndBreak( newBufferPos + opLength > newLength, "Destination buffer offset in plDiffBuffer() is out of range!" );
hsAssertAndBreak( oldOffset + opLength > oldLength, "Difference buffer offset in plDiffBuffer() is out of range of the old buffer!" );

View File

@ -82,7 +82,7 @@ class plDiffBuffer
protected:
hsBool fWriting, f16BitMode;
UInt32 fNewLength;
uint32_t fNewLength;
hsRAMStream *fStream;
// Support for BSDiff patch buffers (Patching only)
@ -91,8 +91,8 @@ class plDiffBuffer
public:
plDiffBuffer( UInt32 newLength, UInt32 oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations
plDiffBuffer( void *buffer, UInt32 length ); // Constructor for applying a given diff set
plDiffBuffer( uint32_t newLength, uint32_t oldLength = 0 ); // Constructor for writing new buffers. oldLength isn't required but helpful for optimizations
plDiffBuffer( void *buffer, uint32_t length ); // Constructor for applying a given diff set
// to an old buffer
virtual ~plDiffBuffer();
@ -100,19 +100,19 @@ class plDiffBuffer
/// Creation/write functions
// Add() appends an Add-New-Data operation to the diff buffer. The data supplied will be copied internally.
void Add( Int32 length, void *newData );
void Add( int32_t length, void *newData );
// Copy() appends a Copy-Data-From-Old operation to the diff buffer
void Copy( Int32 length, UInt32 oldOffset );
void Copy( int32_t length, uint32_t oldOffset );
// GetBuffer() will copy the diff stream into a new buffer and return it. You are responsible for freeing the buffer.
void GetBuffer( UInt32 &length, void *&bufferPtr );
void GetBuffer( uint32_t &length, void *&bufferPtr );
/// Apply functions
// Apply() will take this diff buffer and apply it to the given old buffer, allocating and producing a new buffer. You are responsible for freeing the new buffer.
void Apply( UInt32 oldLength, void *oldBuffer, UInt32 &newLength, void *&newBuffer );
void Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newLength, void *&newBuffer );
};

View File

@ -124,14 +124,14 @@ hsBool NameMatches(const char* obName, const char* pKName, hsBool subString)
plKey plKeyFinder::StupidSearch(const char * age, const char * rm,
const char *className, const char *obName, hsBool subString)
{
UInt16 ty = plFactory::FindClassIndex(className);
uint16_t ty = plFactory::FindClassIndex(className);
return StupidSearch(age, rm, ty, obName, subString);
}
class plKeyFinderIter : public plRegistryKeyIterator, public plRegistryPageIterator
{
protected:
UInt16 fClassType;
uint16_t fClassType;
const char *fObjName;
hsBool fSubstr;
plKey fFoundKey;
@ -140,10 +140,10 @@ protected:
public:
plKey GetFoundKey( void ) const { return fFoundKey; }
plKeyFinderIter( UInt16 classType, const char *obName, hsBool substr )
plKeyFinderIter( uint16_t classType, const char *obName, hsBool substr )
: fFoundKey( nil ), fClassType( classType ), fObjName( obName ), fSubstr( substr ) { }
plKeyFinderIter( UInt16 classType, const char *obName, hsBool substr, const char *ageName )
plKeyFinderIter( uint16_t classType, const char *obName, hsBool substr, const char *ageName )
: fFoundKey( nil ), fClassType( classType ), fObjName( obName ), fSubstr( substr ),
fAgeName( ageName ) {}
@ -187,7 +187,7 @@ public:
};
plKey plKeyFinder::StupidSearch(const char * age, const char * rm,
UInt16 classType, const char *obName, hsBool subString)
uint16_t classType, const char *obName, hsBool subString)
{
if (!obName)
return nil;
@ -196,9 +196,9 @@ plKey plKeyFinder::StupidSearch(const char * age, const char * rm,
fLastError = kOk;
UInt16 maxClasses = plFactory::GetNumClasses();
uint16_t maxClasses = plFactory::GetNumClasses();
UInt16 ty = classType;
uint16_t ty = classType;
if (ty == maxClasses) // error
{ fLastError = kInvalidClass;
return nil;
@ -281,14 +281,14 @@ class plKeyFinderIterator : public plRegistryKeyIterator, public plRegistryPageI
{
protected:
UInt16 fClassType;
uint16_t fClassType;
const char *fObjName;
std::vector<plKey> &fFoundKeys;
public:
plKeyFinderIterator( UInt16 classType, const char *obName, std::vector<plKey>& foundKeys )
plKeyFinderIterator( uint16_t classType, const char *obName, std::vector<plKey>& foundKeys )
: fClassType( classType ), fObjName( obName ), fFoundKeys( foundKeys ) { }
virtual hsBool EatKey( const plKey& key )
@ -309,7 +309,7 @@ class plKeyFinderIterator : public plRegistryKeyIterator, public plRegistryPageI
}
};
void plKeyFinder::ReallyStupidSubstringSearch(const char *name, UInt16 objType, std::vector<plKey>& foundKeys, const plLocation &hintLocation )
void plKeyFinder::ReallyStupidSubstringSearch(const char *name, uint16_t objType, std::vector<plKey>& foundKeys, const plLocation &hintLocation )
{
if (!name)
return;

View File

@ -90,7 +90,7 @@ public:
// These are Stupid search because they just do string searchs on the objects.
plKey StupidSearch(const char * age, const char * rm, const char *className, const char *obName, hsBool subString=false);
plKey StupidSearch(const char * age, const char * rm, UInt16 objType, const char *obName, hsBool subString=false);
plKey StupidSearch(const char * age, const char * rm, uint16_t objType, const char *obName, hsBool subString=false);
eErrCodes GetLastErrorCode() { return fLastError; }
const char* GetLastErrorString(); // For Console display
@ -98,7 +98,7 @@ public:
void ReallyStupidResponderSearch(const char* name, std::vector<plKey>& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc);
void ReallyStupidActivatorSearch(const char* name, std::vector<plKey>& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc);
void ReallyStupidSubstringSearch(const char* name, UInt16 objType, std::vector<plKey>& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc);
void ReallyStupidSubstringSearch(const char* name, uint16_t objType, std::vector<plKey>& foundKeys, const plLocation& hintLocation = plLocation::kInvalidLoc);
void GetActivatorNames(std::vector<std::string>& names);
void GetResponderNames(std::vector<std::string>& names);

View File

@ -65,7 +65,7 @@ class plLocFileParser
public:
plLocFileParser();
~plLocFileParser() { if (fpFile) fclose(fpFile); fpFile = 0; }
void ThrowBack(char *p,UInt8 lev) { fThrowBack = p; fThrowBackLevel = lev; }
void ThrowBack(char *p,uint8_t lev) { fThrowBack = p; fThrowBackLevel = lev; }
void ClearThrowBack() { fThrowBack = NULL; fThrowBackLevel = 0; }
bool ThrowBackAvailable() { return (fThrowBack == NULL) ? false: true; }
int NextLine(char **pP); // returns an Allocated string in pP of next valid line, and Level #, or LOC_EOF

View File

@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plUoid.h"
#include "plVersion.h"
static UInt32 sCurrPageInfoVersion = 6;
static uint32_t sCurrPageInfoVersion = 6;
//// Constructor/Destructor //////////////////////////////////////////////////
plPageInfo::plPageInfo()
@ -112,7 +112,7 @@ void plPageInfo::SetLocation( const plLocation &loc )
fLocation = loc;
}
void plPageInfo::AddClassVersion(UInt16 classIdx, UInt16 version)
void plPageInfo::AddClassVersion(uint16_t classIdx, uint16_t version)
{
ClassVersion cv;
cv.Class = classIdx;
@ -135,7 +135,7 @@ void plPageInfo::Read( hsStream *s )
// 5 is the earliest version since we began working again on the P20 codebase in Sep 2005,
// after Uru's online component was cancelled in Feb 2004, so I've removed support for
// anything prior to that to clean things up a bit.
UInt32 version = s->ReadLE32();
uint32_t version = s->ReadLE32();
if (version > sCurrPageInfoVersion || version < 5)
{
hsAssert( false, "Invalid header version in plPageInfo::Read()" );
@ -153,11 +153,11 @@ void plPageInfo::Read( hsStream *s )
if (version < 6)
{
UInt16 unusedMinorVersion;
uint16_t unusedMinorVersion;
s->ReadLE(&unusedMinorVersion);
Int32 unusedReleaseVersion;
int32_t unusedReleaseVersion;
s->ReadLE(&unusedReleaseVersion); // This was always zero... yanked.
UInt32 unusedFlags;
uint32_t unusedFlags;
s->ReadLE(&unusedFlags);
}
@ -168,9 +168,9 @@ void plPageInfo::Read( hsStream *s )
if (version >= 6)
{
UInt16 numClassVersions = s->ReadLE16();
uint16_t numClassVersions = s->ReadLE16();
fClassVersions.reserve(numClassVersions);
for (UInt16 i = 0; i < numClassVersions; i++)
for (uint16_t i = 0; i < numClassVersions; i++)
{
ClassVersion cv;
cv.Class = s->ReadLE16();
@ -190,9 +190,9 @@ void plPageInfo::Write( hsStream *s )
s->WriteLE( fChecksum );
s->WriteLE( fDataStart );
s->WriteLE( fIndexStart );
UInt16 numClassVersions = UInt16(fClassVersions.size());
uint16_t numClassVersions = uint16_t(fClassVersions.size());
s->WriteLE16(numClassVersions);
for (UInt16 i = 0; i < numClassVersions; i++)
for (uint16_t i = 0; i < numClassVersions; i++)
{
ClassVersion& cv = fClassVersions[i];
s->WriteLE16(cv.Class);

View File

@ -56,17 +56,17 @@ class plLocation;
class plPageInfo
{
public:
struct ClassVersion { UInt16 Class; UInt16 Version; };
struct ClassVersion { uint16_t Class; uint16_t Version; };
typedef std::vector<ClassVersion> ClassVerVec;
protected:
plLocation fLocation;
char* fAge;
char* fPage;
UInt16 fMajorVersion;
uint16_t fMajorVersion;
ClassVerVec fClassVersions;
UInt32 fChecksum;
UInt32 fDataStart, fIndexStart;
uint32_t fChecksum;
uint32_t fDataStart, fIndexStart;
void IInit( void );
void ISetFrom( const plPageInfo &src );
@ -84,7 +84,7 @@ public:
plPageInfo &operator=( const plPageInfo &src );
void ClearClassVersions() { fClassVersions.clear(); }
void AddClassVersion(UInt16 classIdx, UInt16 version);
void AddClassVersion(uint16_t classIdx, uint16_t version);
const ClassVerVec& GetClassVersions() const { return fClassVersions; }
void SetStrings( const char *age, const char *page );
@ -92,21 +92,21 @@ public:
void SetLocation(const plLocation& loc);
const plLocation& GetLocation() const;
UInt16 GetMajorVersion() const { return fMajorVersion; }
void SetMajorVersion(UInt16 major) { fMajorVersion = major; }
uint16_t GetMajorVersion() const { return fMajorVersion; }
void SetMajorVersion(uint16_t major) { fMajorVersion = major; }
void SetChecksum( UInt32 c ) { fChecksum = c; }
UInt32 GetChecksum( void ) const { return fChecksum; }
void SetChecksum( uint32_t c ) { fChecksum = c; }
uint32_t GetChecksum( void ) const { return fChecksum; }
void Read( hsStream *s );
void Write( hsStream *s );
hsBool IsValid( void ) const;
UInt32 GetDataStart( void ) const { return fDataStart; }
void SetDataStart( UInt32 s ) { fDataStart = s; }
uint32_t GetDataStart( void ) const { return fDataStart; }
void SetDataStart( uint32_t s ) { fDataStart = s; }
UInt32 GetIndexStart( void ) const { return fIndexStart; }
void SetIndexStart( UInt32 s ) { fIndexStart = s; }
uint32_t GetIndexStart( void ) const { return fIndexStart; }
void SetIndexStart( uint32_t s ) { fIndexStart = s; }
};
#endif // _plPageInfo_h

View File

@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStream.h"
#include <algorithm>
plRegistryKeyList::plRegistryKeyList(UInt16 classType)
plRegistryKeyList::plRegistryKeyList(uint16_t classType)
{
fClassType = classType;
fReffedStaticKeys = 0;
@ -108,7 +108,7 @@ plKeyImp* plRegistryKeyList::FindKey(const char* keyName)
plKeyImp* plRegistryKeyList::FindKey(const plUoid& uoid)
{
UInt32 objectID = uoid.GetObjectID();
uint32_t objectID = uoid.GetObjectID();
// Key is dynamic or doesn't know it's index. Do a find by name.
if (objectID == 0)
@ -202,7 +202,7 @@ void plRegistryKeyList::AddKey(plKeyImp* key, LoadStatus& loadStatusChange)
void plRegistryKeyList::SetKeyUsed(plKeyImp* key)
{
// If this is a static key, mark that we used it. Otherwise, just ignore it.
UInt32 id = key->GetUoid().GetObjectID();
uint32_t id = key->GetUoid().GetObjectID();
if (id > 0)
fReffedStaticKeys++;
}
@ -220,7 +220,7 @@ bool plRegistryKeyList::SetKeyUnused(plKeyImp* key, LoadStatus& loadStatusChange
}
// Check if it's a static key
UInt32 id = key->GetUoid().GetObjectID();
uint32_t id = key->GetUoid().GetObjectID();
hsAssert(id <= fStaticKeys.size(), "Bad static key id");
if (id != 0 && id <= fStaticKeys.size())
{
@ -293,7 +293,7 @@ void plRegistryKeyList::PrepForWrite()
}
// Start our new object id's after any already created ones
UInt32 objectID = fStaticKeys.size()+1;
uint32_t objectID = fStaticKeys.size()+1;
// Make room for our new keys
fStaticKeys.resize(fStaticKeys.size()+numDynKeys);
@ -318,7 +318,7 @@ void plRegistryKeyList::PrepForWrite()
void plRegistryKeyList::Read(hsStream* s)
{
UInt32 keyListLen = s->ReadLE32();
uint32_t keyListLen = s->ReadLE32();
if (!fStaticKeys.empty())
{
s->Skip(keyListLen);
@ -327,7 +327,7 @@ void plRegistryKeyList::Read(hsStream* s)
fFlags = s->ReadByte();
UInt32 numKeys = s->ReadLE32();
uint32_t numKeys = s->ReadLE32();
fStaticKeys.resize(numKeys);
for (int i = 0; i < numKeys; i++)
@ -341,7 +341,7 @@ void plRegistryKeyList::Read(hsStream* s)
void plRegistryKeyList::Write(hsStream* s)
{
// Save space for the length of our data
UInt32 beginPos = s->GetPosition();
uint32_t beginPos = s->GetPosition();
s->WriteLE32(0);
s->WriteByte(fFlags);
@ -356,8 +356,8 @@ void plRegistryKeyList::Write(hsStream* s)
}
// Go back to the start and write the length of our data
UInt32 endPos = s->GetPosition();
uint32_t endPos = s->GetPosition();
s->SetPosition(beginPos);
s->WriteLE32(endPos-beginPos-sizeof(UInt32));
s->WriteLE32(endPos-beginPos-sizeof(uint32_t));
s->SetPosition(endPos);
}

View File

@ -67,19 +67,19 @@ class plRegistryKeyList
protected:
friend class plKeyFinder;
UInt16 fClassType;
uint16_t fClassType;
// Lock counter for iterating. If this is >0, don't do any ops that
// can change key positions in the array (instead, just leave holes)
UInt16 fLocked;
uint16_t fLocked;
enum Flags { kStaticUnsorted = 0x1 };
UInt8 fFlags;
uint8_t fFlags;
// Static keys are one's we read off disk. These don't change and are
// assumed to be already sorted when they're read in.
typedef std::vector<plKeyImp*> StaticVec;
StaticVec fStaticKeys;
UInt32 fReffedStaticKeys; // Number of static keys that are loaded
uint32_t fReffedStaticKeys; // Number of static keys that are loaded
// Dynamic keys are anything created at runtime. They are put in the
// correct sorted position when they are added
@ -94,10 +94,10 @@ protected:
void IRepack();
public:
plRegistryKeyList(UInt16 classType);
plRegistryKeyList(uint16_t classType);
~plRegistryKeyList();
UInt16 GetClassType() const { return fClassType; }
uint16_t GetClassType() const { return fClassType; }
// Find a key by name (case-insensitive)
plKeyImp* FindKey(const char* keyName);

View File

@ -106,7 +106,7 @@ plRegistryPageNode::~plRegistryPageNode()
PageCond plRegistryPageNode::IVerify()
{
// Check the checksum values first, to make sure the files aren't corrupt
UInt32 ourChecksum = 0;
uint32_t ourChecksum = 0;
hsStream* stream = OpenStream();
if (stream)
{
@ -127,7 +127,7 @@ PageCond plRegistryPageNode::IVerify()
for (int i = 0; i < classVersions.size(); i++)
{
const plPageInfo::ClassVersion& cv = classVersions[i];
UInt16 curVersion = plVersion::GetCreatableVersion(cv.Class);
uint16_t curVersion = plVersion::GetCreatableVersion(cv.Class);
if (curVersion > cv.Version)
return kPageOutOfDate;
@ -175,14 +175,14 @@ void plRegistryPageNode::LoadKeys()
// If we're loading keys in the middle of a read because FindKey() failed, we'd better
// make note of our stream position and restore it when we're done.
UInt32 oldPos = stream->GetPosition();
uint32_t oldPos = stream->GetPosition();
stream->SetPosition(GetPageInfo().GetIndexStart());
// Read in the number of key types
UInt32 numTypes = stream->ReadLE32();
for (UInt32 i = 0; i < numTypes; i++)
uint32_t numTypes = stream->ReadLE32();
for (uint32_t i = 0; i < numTypes; i++)
{
UInt16 classType = stream->ReadLE16();
uint16_t classType = stream->ReadLE16();
plRegistryKeyList* keyList = IGetKeyList(classType);
if (!keyList)
{
@ -300,7 +300,7 @@ hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator) const
// Restricted version that only iterates through the keys of a given class
// type.
hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, UInt16 classToRestrictTo) const
hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, uint16_t classToRestrictTo) const
{
plRegistryKeyList* keyList = IGetKeyList(classToRestrictTo);
if (keyList != nil)
@ -309,7 +309,7 @@ hsBool plRegistryPageNode::IterateKeys(plRegistryKeyIterator* iterator, UInt16 c
return true;
}
plKeyImp* plRegistryPageNode::FindKey(UInt16 classType, const char* name) const
plKeyImp* plRegistryPageNode::FindKey(uint16_t classType, const char* name) const
{
plRegistryKeyList* keys = IGetKeyList(classType);
if (keys == nil)
@ -329,7 +329,7 @@ plKeyImp* plRegistryPageNode::FindKey(const plUoid& uoid) const
void plRegistryPageNode::AddKey(plKeyImp* key)
{
UInt16 classType = key->GetUoid().GetClassType();
uint16_t classType = key->GetUoid().GetClassType();
plRegistryKeyList* keys = fKeyLists[classType];
if (keys == nil)
{
@ -402,7 +402,7 @@ hsBool plRegistryPageNode::SetKeyUnused(plKeyImp* key)
return removed;
}
plRegistryKeyList* plRegistryPageNode::IGetKeyList(UInt16 classType) const
plRegistryKeyList* plRegistryPageNode::IGetKeyList(uint16_t classType) const
{
KeyMap::const_iterator it = fKeyLists.find(classType);
if (it != fKeyLists.end())

View File

@ -71,7 +71,7 @@ protected:
friend class plKeyFinder;
// Map from class type to a list of keys of that type
typedef std::map<UInt16, plRegistryKeyList*> KeyMap;
typedef std::map<uint16_t, plRegistryKeyList*> KeyMap;
KeyMap fKeyLists;
int fDynLoadedTypes; // The number of key types that have dynamic keys loaded
int fStaticLoadedTypes; // The number of key types that have all their keys loaded
@ -81,13 +81,13 @@ protected:
plPageInfo fPageInfo; // Info about this page
hsBufferedStream fStream; // Stream for reading/writing our page
UInt8 fOpenRequests; // How many handles there are to fStream (or
uint8_t fOpenRequests; // How many handles there are to fStream (or
// zero if it's closed)
hsBool fIsNewPage; // True if this page is new (not read off disk)
plRegistryPageNode() {}
plRegistryKeyList* IGetKeyList(UInt16 classType) const;
plRegistryKeyList* IGetKeyList(uint16_t classType) const;
PageCond IVerify();
public:
@ -118,7 +118,7 @@ public:
void UnloadKeys(); // Frees all our keys
// Find a key by type and name
plKeyImp* FindKey(UInt16 classType, const char* name) const;
plKeyImp* FindKey(uint16_t classType, const char* name) const;
// Find a key by direct uoid lookup (or fallback to name lookup if that doesn't work)
plKeyImp* FindKey(const plUoid& uoid) const;
@ -131,7 +131,7 @@ public:
hsBool SetKeyUnused(plKeyImp* key);
hsBool IterateKeys(plRegistryKeyIterator* iterator) const;
hsBool IterateKeys(plRegistryKeyIterator* iterator, UInt16 classToRestrictTo) const;
hsBool IterateKeys(plRegistryKeyIterator* iterator, uint16_t classToRestrictTo) const;
// Call this to get a read stream for the page. If a valid pointer is
// returned, make sure to call CloseStream when you're done using it.

View File

@ -71,7 +71,7 @@ hsBool gDataServerLocal = false;
/// Logging #define for easier use
#define kResMgrLog(level, log) if (plResMgrSettings::Get().GetLoggingLevel() >= level) log
static void ILog(UInt8 level, const char* format, ...)
static void ILog(uint8_t level, const char* format, ...)
{
static plStatusLog* log = plStatusLogMgr::GetInstance().CreateStatusLog
(
@ -83,7 +83,7 @@ static void ILog(UInt8 level, const char* format, ...)
va_list arguments;
va_start(arguments, format);
UInt32 color = 0;
uint32_t color = 0;
switch (level)
{
case 1: color = 0xffffffff; break;
@ -280,8 +280,8 @@ hsKeyedObject* plResManager::IGetSharedObject(plKeyImp* pKey)
plKeyImp* origKey = (plKeyImp*)pKey->GetCloneOwner();
// Find the first non-nil key and ask it to clone itself
UInt32 count = origKey->GetNumClones();
for (UInt32 i = 0; i < count; i++)
uint32_t count = origKey->GetNumClones();
for (uint32_t i = 0; i < count; i++)
{
plKey cloneKey = origKey->GetCloneByIdx(i);
if (cloneKey)
@ -352,10 +352,10 @@ hsBool plResManager::ReadObject(plKeyImp* key)
hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream)
{
static UInt64 totalTime = 0;
static uint64_t totalTime = 0;
UInt64 startTotalTime = totalTime;
UInt64 startTime = 0;
uint64_t startTotalTime = totalTime;
uint64_t startTime = 0;
if (fLogReadTimes)
startTime = hsTimer::GetFullTickCount();
@ -365,10 +365,10 @@ hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream)
if (pKey->GetUoid().GetLoadMask().DontLoad())
return nil;
hsAssert(pKey->GetStartPos() != UInt32(-1), "Missing StartPos");
hsAssert(pKey->GetDataLen() != UInt32(-1), "Missing Data Length");
hsAssert(pKey->GetStartPos() != uint32_t(-1), "Missing StartPos");
hsAssert(pKey->GetDataLen() != uint32_t(-1), "Missing Data Length");
if (pKey->GetStartPos() == UInt32(-1) || pKey->GetDataLen() == UInt32(-1))
if (pKey->GetStartPos() == uint32_t(-1) || pKey->GetDataLen() == uint32_t(-1))
return false; // Try to recover from this by just not reading an object
kResMgrLog(3, ILog(3, " Reading object %s::%s", plFactory::GetNameOfClass(pKey->GetUoid().GetClassType()), pKey->GetUoid().GetObjectName()));
@ -445,8 +445,8 @@ hsBool plResManager::IReadObject(plKeyImp* pKey, hsStream *stream)
if (fLogReadTimes)
{
UInt64 ourTime = hsTimer::GetFullTickCount() - startTime;
UInt64 childTime = totalTime - startTotalTime;
uint64_t ourTime = hsTimer::GetFullTickCount() - startTime;
uint64_t childTime = totalTime - startTotalTime;
ourTime -= childTime;
plStatusLog::AddLineS("readtimings.log", plStatusLog::kWhite, "%s, %s, %u, %.1f",
@ -467,10 +467,10 @@ class plPageOutIterator : public plRegistryPageIterator
{
protected:
plResManager* fResMgr;
UInt16 fHint;
uint16_t fHint;
public:
plPageOutIterator(plResManager* resMgr, UInt16 hint) : fResMgr(resMgr), fHint(hint)
plPageOutIterator(plResManager* resMgr, uint16_t hint) : fResMgr(resMgr), fHint(hint)
{
fResMgr->IterateAllPages(this);
}
@ -512,7 +512,7 @@ void plResManager::IPageOutSceneNodes(hsBool forceAll)
if (forceAll)
{
hsStatusMessage( "--- plResManager Object Leak Report (BEGIN) ---" );
plPageOutIterator iter(this, UInt16(-1));
plPageOutIterator iter(this, uint16_t(-1));
hsStatusMessage( "--- plResManager Object Leak Report (END) ---" );
}
else
@ -573,7 +573,7 @@ plKey plResManager::FindOriginalKey(const plUoid& uoid)
// Note: startPos of -1 means we didn't read it from disk, but 0 length
// is our special key that we're a passively created key
foundKey = TRACKED_NEW plKeyImp(uoid, UInt32(-1), UInt32(0));
foundKey = TRACKED_NEW plKeyImp(uoid, uint32_t(-1), uint32_t(0));
key = plKey::Make(foundKey);
}
@ -914,7 +914,7 @@ plKey plResManager::CloneKey(const plKey& objKey)
return ICloneKey(objKey->GetUoid(), plNetClientApp::GetInstance()->GetPlayerID(), fCloningCounter);
}
plKey plResManager::ICloneKey(const plUoid& objUoid, UInt32 playerID, UInt32 cloneID)
plKey plResManager::ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t cloneID)
{
hsAssert(fCurCloneID == 0, "Recursive clone");
fCurCloneID = cloneID;
@ -951,7 +951,7 @@ hsBool plResManager::Unload(const plKey& objKey)
plCreatable* plResManager::IReadCreatable(hsStream* s) const
{
UInt16 hClass = s->ReadLE16();
uint16_t hClass = s->ReadLE16();
plCreatable* pCre = plFactory::Create(hClass);
if (!pCre)
hsAssert( hClass == 0x8000, "Invalid creatable index" );
@ -977,7 +977,7 @@ plCreatable* plResManager::ReadCreatableVersion(hsStream* s)
inline void IWriteCreatable(hsStream* s, plCreatable* pCre)
{
Int16 hClass = pCre ? pCre->ClassIndex() : 0x8000;
int16_t hClass = pCre ? pCre->ClassIndex() : 0x8000;
hsAssert(pCre == nil || plFactory::IsValidClassIndex(hClass), "Invalid class index on write");
s->WriteLE16(hClass);
}
@ -1128,12 +1128,12 @@ void plResManager::IDropAllAgeKeys()
class plOurRefferAndFinder : public plRegistryKeyIterator
{
hsTArray<plKey> &fRefArray;
UInt16 fClassToFind;
uint16_t fClassToFind;
plKey &fFoundKey;
public:
plOurRefferAndFinder( hsTArray<plKey> &refArray, UInt16 classToFind, plKey &foundKey )
plOurRefferAndFinder( hsTArray<plKey> &refArray, uint16_t classToFind, plKey &foundKey )
: fRefArray( refArray ), fClassToFind( classToFind ), fFoundKey( foundKey ) { }
virtual hsBool EatKey( const plKey& key )
@ -1151,9 +1151,9 @@ class plOurRefferAndFinder : public plRegistryKeyIterator
}
};
void plResManager::PageInRoom(const plLocation& page, UInt16 objClassToRef, plRefMsg* refMsg)
void plResManager::PageInRoom(const plLocation& page, uint16_t objClassToRef, plRefMsg* refMsg)
{
UInt64 readRoomTime = 0;
uint64_t readRoomTime = 0;
if (fLogReadTimes)
readRoomTime = hsTimer::GetFullTickCount();
@ -1550,7 +1550,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
class plKeyImpRef : public plKeyImp
{
public:
UInt16 GetRefCnt() const { return fRefCount; }
uint16_t GetRefCnt() const { return fRefCount; }
};
static bool alreadyDone = false;
@ -1595,7 +1595,7 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
// Update 5.20: since there are so many problems with doing this, don't
// delete the objects, just print out a memleak report. -mcn
void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classIndexHint)
void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint)
{
if (!pageNode->IsLoaded())
return;
@ -1614,7 +1614,7 @@ void plResManager::UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classI
plUnloadObjectsIterator iterator;
if (classIndexHint != UInt16(-1))
if (classIndexHint != uint16_t(-1))
pageNode->IterateKeys(&iterator, classIndexHint);
else
pageNode->IterateKeys(&iterator);

View File

@ -135,7 +135,7 @@ public:
//---------------------------
void LoadAgeKeys(const char* age);
void DropAgeKeys(const char* age);
void PageInRoom(const plLocation& page, UInt16 objClassToRef, plRefMsg* refMsg);
void PageInRoom(const plLocation& page, uint16_t objClassToRef, plRefMsg* refMsg);
void PageInAge(const char* age);
// Usually, a page file is kept open during load because the first keyed object
@ -161,7 +161,7 @@ public:
// Helpers for key iterators
void LoadPageKeys(plRegistryPageNode* pageNode);
void UnloadPageObjects(plRegistryPageNode* pageNode, UInt16 classIndexHint);
void UnloadPageObjects(plRegistryPageNode* pageNode, uint16_t classIndexHint);
void DumpUnusedKeys(plRegistryPageNode* page) const;
plRegistryPageNode* FindPage(const plLocation& location) const;
plRegistryPageNode* FindPage(const char* age, const char* page) const;
@ -179,7 +179,7 @@ protected:
virtual hsBool IReadObject(plKeyImp* pKey, hsStream *stream);
plCreatable* IReadCreatable(hsStream* s) const;
plKey ICloneKey(const plUoid& objUoid, UInt32 playerID, UInt32 cloneID);
plKey ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t cloneID);
virtual void IKeyReffed(plKeyImp* key);
virtual void IKeyUnreffed(plKeyImp* key);
@ -209,7 +209,7 @@ protected:
plRegistryPageNode* CreatePage(const plLocation& location, const char* age, const char* page);
hsBool fInited;
UInt16 fPageOutHint;
uint16_t fPageOutHint;
// True if we're reading in an object. We only read one object at a time
hsBool fReadingObject;
@ -219,9 +219,9 @@ protected:
plDispatch* fDispatch;
UInt32 fCurCloneID; // Current clone ID. If it isn't zero, we're cloning
UInt32 fCurClonePlayerID;
UInt32 fCloningCounter; // Next clone ID to use.
uint32_t fCurCloneID; // Current clone ID. If it isn't zero, we're cloning
uint32_t fCurClonePlayerID;
uint32_t fCloningCounter; // Next clone ID to use.
typedef std::map<std::string,plResAgeHolder*> HeldAgeKeyMap;
HeldAgeKeyMap fHeldAgeKeys;
@ -231,7 +231,7 @@ protected:
hsBool fLogReadTimes;
UInt8 fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified
uint8_t fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified
hsBool fPagesNeedCleanup; // True if something modified the page lists while they were locked.
typedef std::set<plRegistryPageNode*> PageSet;

View File

@ -214,7 +214,7 @@ class plResMgrDebugInterface : public plInputInterface
plResMgrDebugInterface( plResManagerHelper * const mgr ) : fParent( mgr ) { SetEnabled( true ); }
virtual UInt32 GetPriorityLevel( void ) const { return kGUISystemPriority + 10; }
virtual uint32_t GetPriorityLevel( void ) const { return kGUISystemPriority + 10; }
virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg )
{
plKeyEventMsg *pKeyMsg = plKeyEventMsg::ConvertNoRef( pMsg );
@ -268,7 +268,7 @@ class plResMgrDebugInterface : public plInputInterface
return false;
}
virtual UInt32 GetCurrentCursorID( void ) const { return 0; }
virtual uint32_t GetCurrentCursorID( void ) const { return 0; }
virtual hsBool HasInterestingCursorID( void ) const { return false; }
};
@ -322,14 +322,14 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
{
public:
plStatusLog *fLog;
UInt8 fStep, fLines;
UInt32 &fLoadedCount, &fHoldingCount, fPageCount, fAgeIndex;
uint8_t fStep, fLines;
uint32_t &fLoadedCount, &fHoldingCount, fPageCount, fAgeIndex;
char fCurrAge[ 128 ];
UInt32 fLoadedKeys, fTotalKeys, fTotalSize, fLoadedSize;
uint32_t fLoadedKeys, fTotalKeys, fTotalSize, fLoadedSize;
plResManagerHelper *fParent;
plDebugPrintIterator( plResManagerHelper *parent, plStatusLog *log, UInt32 &loadedCount, UInt32 &holdingCount )
plDebugPrintIterator( plResManagerHelper *parent, plStatusLog *log, uint32_t &loadedCount, uint32_t &holdingCount )
: fParent( parent ), fLog( log ), fStep( 0 ), fLines( 0 ), fLoadedCount( loadedCount ), fHoldingCount( holdingCount )
{
fLoadedCount = fHoldingCount = 0;
@ -368,7 +368,7 @@ class plDebugPrintIterator : public plRegistryPageIterator, plRegistryKeyIterato
{
if( fLines < kLogSize - 4 )
{
UInt32 color = plStatusLog::kWhite;
uint32_t color = plStatusLog::kWhite;
if( fParent->fCurrAge == fAgeIndex )
color = plStatusLog::kYellow;
@ -491,7 +491,7 @@ void plResManagerHelper::IUpdateDebugScreen( hsBool force )
return;
plRegistry *reg = fResManager->IGetRegistry();
UInt32 loadedCnt, holdingCnt;
uint32_t loadedCnt, holdingCnt;
fDebugScreen->Clear();

View File

@ -63,7 +63,7 @@ protected:
bool fFilterOlderPageVersions;
bool fFilterNewerPageVersions;
UInt8 fLoggingLevel;
uint8_t fLoggingLevel;
bool fPassiveKeyRead;
bool fLoadPagesOnInit;
@ -93,8 +93,8 @@ public:
bool GetFilterNewerPageVersions() const { return fFilterNewerPageVersions; }
void SetFilterNewerPageVersions(bool f) { fFilterNewerPageVersions = f; }
UInt8 GetLoggingLevel() const { return fLoggingLevel; }
void SetLoggingLevel(UInt8 level) { fLoggingLevel = level; }
uint8_t GetLoggingLevel() const { return fLoggingLevel; }
void SetLoggingLevel(uint8_t level) { fLoggingLevel = level; }
bool GetPassiveKeyRead() const { return fPassiveKeyRead; }
void SetPassiveKeyRead(bool p) { fPassiveKeyRead = p; }

View File

@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// creatable that was changed. Every time the minor version is reset (for a
// major version change), delete all the entries.
//
static void GetChangedCreatables(int minorVersion, std::vector<UInt16>& creatables)
static void GetChangedCreatables(int minorVersion, std::vector<uint16_t>& creatables)
{
ChangedCreatable(1, plLoadAvatarMsg);
ChangedCreatable(1, plArmatureMod);
@ -72,18 +72,18 @@ static void CalcCreatableVersions()
for (int minorVer = 1; minorVer <= PLASMA2_MINOR_VERSION; minorVer++)
{
std::vector<UInt16> changedTypes;
std::vector<uint16_t> changedTypes;
changedTypes.reserve(10);
GetChangedCreatables(minorVer, changedTypes);
for (int i = 0; i < changedTypes.size(); i++)
{
UInt16 changedType = changedTypes[i];
uint16_t changedType = changedTypes[i];
CreatableVersions[changedType] = minorVer;
// Bump any classes that derive from this one
for (UInt16 toCheck = 0; toCheck < plFactory::GetNumClasses(); toCheck++)
for (uint16_t toCheck = 0; toCheck < plFactory::GetNumClasses(); toCheck++)
{
if (plFactory::DerivesFrom(changedType, toCheck))
CreatableVersions[toCheck] = minorVer;
@ -92,10 +92,10 @@ static void CalcCreatableVersions()
}
}
UInt16 plVersion::GetMajorVersion() { return PLASMA2_MAJOR_VERSION; }
UInt16 plVersion::GetMinorVersion() { return PLASMA2_MINOR_VERSION; }
uint16_t plVersion::GetMajorVersion() { return PLASMA2_MAJOR_VERSION; }
uint16_t plVersion::GetMinorVersion() { return PLASMA2_MINOR_VERSION; }
int plVersion::GetCreatableVersion(UInt16 creatableIndex)
int plVersion::GetCreatableVersion(uint16_t creatableIndex)
{
static bool calced = false;
if (!calced)

View File

@ -59,14 +59,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plVersion
{
public:
static UInt16 GetMajorVersion();
static UInt16 GetMinorVersion();
static uint16_t GetMajorVersion();
static uint16_t GetMinorVersion();
// Pass in a creatable index to get its current version. Zero means it
// hasn't changed since the last major version change, anything else is the
// last minor version it changed at. This takes into account the version of
// parent classes.
static int GetCreatableVersion(UInt16 creatableIndex);
static int GetCreatableVersion(uint16_t creatableIndex);
};
/* Major Log ---Death to those who do not log changes---
@ -138,7 +138,7 @@ public:
64 10/28/05 jeff changed plLocation to handle more pages and plUoid for optimization reasons
65 2/22/06 bob animation key rewrite to save space
66 2/27/06 bob 64-bit quaternion anim keys
67 2/28/06 bob Anims store UInt16 frame numbers, not 32-bit float times.
67 2/28/06 bob Anims store uint16_t frame numbers, not 32-bit float times.
68 3/03/06 bob constant anim channels (plMatrixConstant, plScalarConstant had no R/W methods)
69 5/08/06 bob changed plVertCoder and hsMatrix44::Read/Write
70 2/12/07 bob Merged in several registry/resMangaer fixes