diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 50c360d1..c66ad58c 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -545,57 +545,6 @@ static void FS_CheckFilenameIsNotExecutable( const char *filename, } } - -/* -================= -FS_CopyFile - -Copy a fully specified file from one place to another -================= -*/ -static void FS_CopyFile( char *fromOSPath, char *toOSPath ) { - FILE *f; - int len; - byte *buf; - - Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath ); - - FS_CheckFilenameIsNotExecutable( toOSPath, __func__ ); - - if (strstr(fromOSPath, "journal.dat") || strstr(fromOSPath, "journaldata.dat")) { - Com_Printf( "Ignoring journal files\n"); - return; - } - - f = fopen( fromOSPath, "rb" ); - if ( !f ) { - return; - } - fseek (f, 0, SEEK_END); - len = ftell (f); - fseek (f, 0, SEEK_SET); - - // we are using direct malloc instead of Z_Malloc here, so it - // probably won't work on a mac... Its only for developers anyway... - buf = malloc( len ); - if (fread( buf, 1, len, f ) != len) - Com_Error( ERR_FATAL, "Short read in FS_Copyfiles()\n" ); - fclose( f ); - - if( FS_CreatePath( toOSPath ) ) { - return; - } - - f = fopen( toOSPath, "wb" ); - if ( !f ) { - return; - } - if (fwrite( buf, 1, len, f ) != len) - Com_Error( ERR_FATAL, "Short write in FS_Copyfiles()\n" ); - fclose( f ); - free( buf ); -} - /* =========== FS_Remove @@ -807,11 +756,7 @@ void FS_SV_Rename( const char *from, const char *to ) { FS_CheckFilenameIsNotExecutable( to_ospath, __func__ ); - if (rename( from_ospath, to_ospath )) { - // Failed, try copying it and deleting the original - FS_CopyFile ( from_ospath, to_ospath ); - FS_Remove ( from_ospath ); - } + rename(from_ospath, to_ospath); } @@ -841,11 +786,7 @@ void FS_Rename( const char *from, const char *to ) { FS_CheckFilenameIsNotExecutable( to_ospath, __func__ ); - if (rename( from_ospath, to_ospath )) { - // Failed, try copying it and deleting the original - FS_CopyFile ( from_ospath, to_ospath ); - FS_Remove ( from_ospath ); - } + rename(from_ospath, to_ospath); } /* diff --git a/code/qcommon/unzip.c b/code/qcommon/unzip.c index d0b3d2a5..b307e98d 100644 --- a/code/qcommon/unzip.c +++ b/code/qcommon/unzip.c @@ -35,23 +35,10 @@ woven in by Terry Thorsen 1/2003. */ -#include -#include -#include +#include "../qcommon/q_shared.h" +#include "../qcommon/qcommon.h" #include "unzip.h" -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - - #ifndef local # define local static #endif @@ -74,10 +61,10 @@ woven in by Terry Thorsen 1/2003. #endif #ifndef ALLOC -# define ALLOC(size) (malloc(size)) +# define ALLOC(size) (Z_Malloc(size)) #endif #ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} +# define TRYFREE(p) {if (p) Z_Free(p);} #endif #define SIZECENTRALDIRITEM (0x2e)