Skip to content

Commit

Permalink
Move remaining fopen calls to FileOpen
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Jun 9, 2024
1 parent 92753ac commit 615269b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions source/bsp_wad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Wad_file * Wad_file::Open(const char *filename, char mode)
FILE *fp = NULL;

retry:
fp = fopen(filename, (mode == 'r' ? "rb" : "r+b"));
fp = FileOpen(filename, (mode == 'r' ? "rb" : "r+b"));

if (! fp)
{
Expand Down Expand Up @@ -281,7 +281,7 @@ Wad_file * Wad_file::Create(const char *filename, char mode)
{
FileMessage("Creating new WAD file: %s\n", filename);

FILE *fp = fopen(filename, "w+b");
FILE *fp = FileOpen(filename, "w+b");
if (! fp)
return NULL;

Expand All @@ -304,7 +304,7 @@ Wad_file * Wad_file::Create(const char *filename, char mode)

bool Wad_file::Validate(const char *filename)
{
FILE *fp = fopen(filename, "rb");
FILE *fp = FileOpen(filename, "rb");

if (! fp)
return false;
Expand Down
2 changes: 1 addition & 1 deletion source/m_manage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class UI_Manage_Config : public Fl_Double_Window {
}

bool LoadFromFile(std::string filename) {
FILE *fp = fl_fopen(filename.c_str(), "rb");
FILE *fp = FileOpen(filename.c_str(), "rb");

if (!fp) {
DLG_ShowError(_("Cannot open: %s\n\n%s"),
Expand Down
2 changes: 1 addition & 1 deletion source/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static void main_win_preset_CB(Fl_Widget *w, void *data) {
std::string *preset = (std::string *)data;

// adapted from our Config Manager Load/Use callbacks
FILE *fp = fl_fopen(preset->c_str(), "rb");
FILE *fp = FileOpen(preset->c_str(), "rb");
if (!fp) {
DLG_ShowError(_("Cannot open: %s\n\n%s"),
preset->c_str(),
Expand Down
6 changes: 1 addition & 5 deletions source/slump_dump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ dumphandle OpenDump(config *c)
} headerstuff;

answer = (dumphandle)malloc(sizeof (*answer));
#ifdef _WIN32
answer->f = _wfopen(UTF8ToWString(c->outfile).c_str(), UTF8ToWString("wb").c_str());
#else
answer->f = fopen(c->outfile,"wb");
#endif
answer->f = FileOpen(c->outfile,"wb");
if (answer->f==NULL) {
fprintf(stderr,"Error opening <%s>.\n",c->outfile);
perror("Maybe");
Expand Down

0 comments on commit 615269b

Please sign in to comment.