minor fixes

This commit is contained in:
Glenn Maynard
2004-12-13 00:21:06 +00:00
parent 36990c4a4c
commit 328ddf6b2e
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -233,7 +233,7 @@ int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
if( err != Z_OK ) if( err != Z_OK )
FAIL_M( ssprintf("deflate: err %i", err) ); FAIL_M( ssprintf("deflate: err %i", err) );
if( m_pDeflate->avail_out > 0 ) if( m_pDeflate->avail_out < sizeof(buf) )
{ {
int iRet = m_pFile->Write( buf, sizeof(buf)-m_pDeflate->avail_out ); int iRet = m_pFile->Write( buf, sizeof(buf)-m_pDeflate->avail_out );
if( iRet == -1 ) if( iRet == -1 )
@@ -247,6 +247,9 @@ int RageFileObjDeflate::WriteInternal( const void *pBuffer, size_t iBytes )
return iBytes; return iBytes;
} }
/* Note that flushing clears compression state, so (unlike most Flush() calls)
* calling this *does* change the result of the output if you continue writing
* data. */
int RageFileObjDeflate::FlushInternal() int RageFileObjDeflate::FlushInternal()
{ {
m_pDeflate->avail_in = 0; m_pDeflate->avail_in = 0;
@@ -272,7 +275,7 @@ int RageFileObjDeflate::FlushInternal()
} }
if( err == Z_STREAM_END ) if( err == Z_STREAM_END )
return 0; return m_pFile->Flush();
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ public:
int GetFileSize() const { return m_pFile->GetFileSize(); } int GetFileSize() const { return m_pFile->GetFileSize(); }
void DeleteFileWhenFinished() { m_bFileOwned = true; } void DeleteFileWhenFinished() { m_bFileOwned = true; }
private: protected:
int ReadInternal( void *pBuffer, size_t iBytes ) { SetError( "Not implemented" ); return -1; } int ReadInternal( void *pBuffer, size_t iBytes ) { SetError( "Not implemented" ); return -1; }
int WriteInternal( const void *pBuffer, size_t iBytes ); int WriteInternal( const void *pBuffer, size_t iBytes );
int FlushInternal(); int FlushInternal();