- got rid of M_WriteFile as well for the same reasons as M_ReadFile.

This commit is contained in:
Christoph Oelckers 2017-12-02 13:18:20 +01:00
parent 838e52001c
commit 690e7d8a84
3 changed files with 9 additions and 28 deletions

View file

@ -2974,7 +2974,15 @@ bool G_CheckDemoStatus (void)
formlen = demobuffer + 4; formlen = demobuffer + 4;
WriteLong (int(demo_p - demobuffer - 8), &formlen); WriteLong (int(demo_p - demobuffer - 8), &formlen);
bool saved = M_WriteFile (demoname, demobuffer, int(demo_p - demobuffer)); auto fw = FileWriter::Open(demoname);
bool saved = false;
if (fw != nullptr)
{
auto size = long(demo_p - demobuffer);
saved = fw->Write(demobuffer, size) == size;
delete fw;
if (!saved) remove(demoname);
}
M_Free (demobuffer); M_Free (demobuffer);
demorecording = false; demorecording = false;
stoprecording = false; stoprecording = false;

View file

@ -88,32 +88,6 @@ EXTERN_CVAR(Bool, longsavemessages);
static long ParseCommandLine (const char *args, int *argc, char **argv); static long ParseCommandLine (const char *args, int *argc, char **argv);
//
// M_WriteFile
//
#ifndef O_BINARY
#define O_BINARY 0
#endif
bool M_WriteFile (char const *name, void *source, int length)
{
int handle;
int count;
handle = open ( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
if (handle == -1)
return false;
count = write (handle, source, length);
close (handle);
if (count < length)
return false;
return true;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //

View file

@ -33,7 +33,6 @@ class FIWadManager;
extern FGameConfigFile *GameConfig; extern FGameConfigFile *GameConfig;
bool M_WriteFile (char const *name, void *source, int length);
void M_FindResponseFile (void); void M_FindResponseFile (void);
// [RH] M_ScreenShot now accepts a filename parameter. // [RH] M_ScreenShot now accepts a filename parameter.