Merge pull request #1035 from bpay/memfixes

Memfixes
This commit is contained in:
Luis Anton Rebollo 2015-01-25 13:42:32 +01:00
commit 6492028bb2
26 changed files with 79 additions and 52 deletions

View file

@ -66,6 +66,7 @@ ConnectionProtocol::ConnectionProtocol()
mLastSendSeq = 0; // start sending at 1
mAckMask = 0;
mLastRecvAckAck = 0;
mConnectionEstablished = false;
}
void ConnectionProtocol::buildSendPacketHeader(BitStream *stream, S32 packetType)
{

View file

@ -601,10 +601,13 @@ bool chompUTF8BOM( const char *inString, char **outStringPtr )
{
*outStringPtr = const_cast<char *>( inString );
U8 bom[4];
dMemcpy( bom, inString, 4 );
bool valid = isValidUTF8BOM( bom );
bool valid = false;
if (inString[0] && inString[1] && inString[2])
{
U8 bom[4];
dMemcpy(bom, inString, 4);
valid = isValidUTF8BOM(bom);
}
// This is hackey, but I am not sure the best way to do it at the present.
// The only valid BOM is a UTF8 BOM, which is 3 bytes, even though we read

View file

@ -495,7 +495,7 @@ DefineConsoleFunction( dumpStringMemStats, void, (), , "()"
void* String::StringData::operator new( size_t size, U32 len )
{
AssertFatal( len != 0, "String::StringData::operator new() - string must not be empty" );
StringData *str = reinterpret_cast<StringData*>( dMalloc( size + len * sizeof(StringChar) ) );
StringData *str = static_cast<StringData*>( dMalloc( size + len * sizeof(StringChar) ) );
str->mLength = len;
@ -523,7 +523,7 @@ void String::StringData::operator delete(void *ptr)
void* String::StringData::operator new( size_t size, U32 len, DataChunker& chunker )
{
AssertFatal( len != 0, "String::StringData::operator new() - string must not be empty" );
StringData *str = reinterpret_cast<StringData*>( chunker.alloc( size + len * sizeof(StringChar) ) );
StringData *str = static_cast<StringData*>( chunker.alloc( size + len * sizeof(StringChar) ) );
str->mLength = len;