mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
- 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:
parent
cbd2fd34a0
commit
9cc8bab102
2 changed files with 8 additions and 1 deletions
|
@ -50,6 +50,11 @@
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
FILE *FileReader::openfd(const char *filename)
|
||||||
|
{
|
||||||
|
return fopen(filename, "rb");
|
||||||
|
}
|
||||||
|
|
||||||
FileReader::FileReader ()
|
FileReader::FileReader ()
|
||||||
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false)
|
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +98,7 @@ FileReader::~FileReader ()
|
||||||
|
|
||||||
bool FileReader::Open (const char *filename)
|
bool FileReader::Open (const char *filename)
|
||||||
{
|
{
|
||||||
File = fopen (filename, "rb");
|
File = openfd (filename);
|
||||||
if (File == NULL) return false;
|
if (File == NULL) return false;
|
||||||
FilePos = 0;
|
FilePos = 0;
|
||||||
StartPos = 0;
|
StartPos = 0;
|
||||||
|
|
|
@ -93,6 +93,8 @@ public:
|
||||||
|
|
||||||
class FileReader : public FileReaderBase
|
class FileReader : public FileReaderBase
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
FILE *openfd(const char *filename);
|
||||||
public:
|
public:
|
||||||
FileReader ();
|
FileReader ();
|
||||||
FileReader (const char *filename);
|
FileReader (const char *filename);
|
||||||
|
|
Loading…
Reference in a new issue