This commit is contained in:
Glenn Maynard
2003-12-21 09:18:06 +00:00
parent efc1ce7a5d
commit 788f4a24ad
+8 -11
View File
@@ -1117,15 +1117,12 @@ bool FileCopy( CString sSrcFile, CString sDstFile )
if( !out.Open(sDstFile, RageFile::WRITE) ) if( !out.Open(sDstFile, RageFile::WRITE) )
return false; return false;
#define CLEANUP_AND_RETURN(b) { delete data; return b; } CString data;
if( in.Read(data) == -1 )
int size = in.GetFileSize(); return false;
char *data = new char[size]; if( out.Write(data) == -1 )
if( !data ) return false;
CLEANUP_AND_RETURN( false ); if( out.Flush() == -1 )
if( !in.Read(data,size) ) return false;
CLEANUP_AND_RETURN( false ); return true;
if( !out.Write(data,size) )
CLEANUP_AND_RETURN( false );
CLEANUP_AND_RETURN( true );
} }