mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- got rid of M_WriteFile as well for the same reasons as M_ReadFile.
This commit is contained in:
parent
838e52001c
commit
690e7d8a84
3 changed files with 9 additions and 28 deletions
|
@ -2974,7 +2974,15 @@ bool G_CheckDemoStatus (void)
|
|||
formlen = demobuffer + 4;
|
||||
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);
|
||||
demorecording = false;
|
||||
stoprecording = false;
|
||||
|
|
|
@ -88,32 +88,6 @@ EXTERN_CVAR(Bool, longsavemessages);
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -33,7 +33,6 @@ class FIWadManager;
|
|||
|
||||
extern FGameConfigFile *GameConfig;
|
||||
|
||||
bool M_WriteFile (char const *name, void *source, int length);
|
||||
void M_FindResponseFile (void);
|
||||
|
||||
// [RH] M_ScreenShot now accepts a filename parameter.
|
||||
|
|
Loading…
Reference in a new issue