- only have one fopen call in the entire FileReader hierarchy

This is for an eventual implementation of UTF-8 handling. On Windows this will require replacement of fopen with _wfopen so let's try to keep the number of fopen calls low.
This commit is contained in:
Christoph Oelckers 2017-12-02 11:55:50 +01:00
parent cbd2fd34a0
commit 9cc8bab102
2 changed files with 8 additions and 1 deletions

View file

@ -50,6 +50,11 @@
//
//==========================================================================
FILE *FileReader::openfd(const char *filename)
{
return fopen(filename, "rb");
}
FileReader::FileReader ()
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false)
{
@ -93,7 +98,7 @@ FileReader::~FileReader ()
bool FileReader::Open (const char *filename)
{
File = fopen (filename, "rb");
File = openfd (filename);
if (File == NULL) return false;
FilePos = 0;
StartPos = 0;

View file

@ -93,6 +93,8 @@ public:
class FileReader : public FileReaderBase
{
protected:
FILE *openfd(const char *filename);
public:
FileReader ();
FileReader (const char *filename);