The file drivers are one of the few things that can be accessed before LOG is set up, guard all accesses.

This commit is contained in:
Steve Checkoway
2007-04-23 05:52:51 +00:00
parent 9681c7fb3f
commit 4c614ae701
5 changed files with 51 additions and 41 deletions
+7 -5
View File
@@ -23,6 +23,8 @@
#include <zlib.h>
#endif
#define Trace(args...) if( LOG ) LOG->Trace( args ); else fprintf( stderr, args )
RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedSize )
{
m_bFileOwned = false;
@@ -37,7 +39,7 @@ RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedS
if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK )
LOG->Trace( "Huh? inflateInit2() err = %i", err );
Trace( "Huh? inflateInit2() err = %i", err );
decomp_buf_ptr = decomp_buf;
m_iFilePos = 0;
@@ -73,7 +75,7 @@ RageFileObjInflate::~RageFileObjInflate()
int err = inflateEnd( m_pInflate );
if( err != Z_OK )
LOG->Trace( "Huh? inflateEnd() err = %i", err );
Trace( "Huh? inflateEnd() err = %i", err );
delete m_pInflate;
}
@@ -128,7 +130,7 @@ int RageFileObjInflate::ReadInternal( void *buf, size_t bytes )
case Z_OK:
break;
default:
LOG->Trace( "Huh? inflate err %i", err );
Trace( "Huh? inflate err %i", err );
}
const int used = (char *)m_pInflate->next_in - decomp_buf_ptr;
@@ -205,7 +207,7 @@ RageFileObjDeflate::RageFileObjDeflate( RageFileBasic *pFile )
if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK )
LOG->Trace( "Huh? inflateInit2() err = %i", err );
Trace( "Huh? inflateInit2() err = %i", err );
}
@@ -218,7 +220,7 @@ RageFileObjDeflate::~RageFileObjDeflate()
int err = deflateEnd( m_pDeflate );
if( err != Z_OK )
LOG->Trace( "Huh? deflateEnd() err = %i", err );
Trace( "Huh? deflateEnd() err = %i", err );
delete m_pDeflate;
}