Integrate C++11 branch into 5_1-new
This commit is contained in:
@@ -313,7 +313,7 @@ int RageFileObjDeflate::FlushInternal()
|
||||
*/
|
||||
RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t *iCRC32 )
|
||||
{
|
||||
auto_ptr<RageFileBasic> pFile(pFile_);
|
||||
unique_ptr<RageFileBasic> pFile(pFile_);
|
||||
|
||||
sError = "";
|
||||
|
||||
@@ -324,12 +324,12 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
char magic[2];
|
||||
FileReading::ReadBytes( *pFile, magic, 2, sError );
|
||||
if( sError != "" )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( magic[0] != '\x1f' || magic[1] != '\x8b' )
|
||||
{
|
||||
sError = "Not a gzipped file";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
FileReading::read_8( *pFile, sError ); /* xfl */
|
||||
FileReading::read_8( *pFile, sError ); /* os */
|
||||
if( sError != "" )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#define FTEXT 1<<0
|
||||
#define FHCRC 1<<1
|
||||
@@ -350,7 +350,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
if( iCompressionMethod != 8 )
|
||||
{
|
||||
sError = ssprintf( "Unsupported compression: %i", iCompressionMethod );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Warning: flags other than FNAME are untested, since gzip doesn't
|
||||
@@ -358,7 +358,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
if( iFlags & UNSUPPORTED_MASK )
|
||||
{
|
||||
sError = ssprintf( "Unsupported flags: %x", iFlags );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( iFlags & FEXTRA )
|
||||
@@ -385,12 +385,12 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
uint16_t iExpectedCRC16 = FileReading::read_u16_le( *pFile, sError );
|
||||
uint16_t iActualCRC16 = int16_t( iActualCRC32 & 0xFFFF );
|
||||
if( sError != "" )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( iActualCRC16 != iExpectedCRC16 )
|
||||
{
|
||||
sError = "Header CRC error";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
pFile->EnableCRC32( false );
|
||||
|
||||
if( sError != "" )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
int iDataPos = pFile->Tell();
|
||||
|
||||
@@ -410,13 +410,13 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
|
||||
uint32_t iExpectedCRC32 = FileReading::read_u32_le( *pFile, sError );
|
||||
uint32_t iUncompressedSize = FileReading::read_u32_le( *pFile, sError );
|
||||
if( iCRC32 != NULL )
|
||||
if( iCRC32 != nullptr )
|
||||
*iCRC32 = iExpectedCRC32;
|
||||
|
||||
FileReading::Seek( *pFile, iDataPos, sError );
|
||||
|
||||
if( sError != "" )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RageFileDriverSlice *pSliceFile = new RageFileDriverSlice( pFile.release(), iDataPos, iFooterPos-iDataPos );
|
||||
pSliceFile->DeleteFileWhenFinished();
|
||||
@@ -424,7 +424,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
|
||||
pInflateFile->DeleteFileWhenFinished();
|
||||
|
||||
/* Enable CRC calculation only if the caller is interested. */
|
||||
if( iCRC32 != NULL )
|
||||
if( iCRC32 != nullptr )
|
||||
pInflateFile->EnableCRC32();
|
||||
|
||||
return pInflateFile;
|
||||
@@ -532,7 +532,7 @@ bool GunzipString( const RString &sIn, RString &sOut, RString &sError )
|
||||
|
||||
uint32_t iCRC32;
|
||||
RageFileBasic *pFile = GunzipFile( mem, sError, &iCRC32 );
|
||||
if( pFile == NULL )
|
||||
if( pFile == nullptr )
|
||||
return false;
|
||||
|
||||
pFile->Read( sOut );
|
||||
|
||||
Reference in New Issue
Block a user