You need to sign in or sign up before continuing.
Commit 3c066bd4 authored by hybrid's avatar hybrid

Changed file position data type to long in order to support large files on...

Changed file position data type to long in order to support large files on 64bit systems. Also added some constification and signedness changes to file classes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@953 dfc29bdd-3216-0410-991c-e03cc46cb475
parent fa1534ee
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
//! Returns the amount of files in the filelist. //! Returns the amount of files in the filelist.
//! \return //! \return
//! Returns the amount of files and directories in the file list. //! Returns the amount of files and directories in the file list.
virtual s32 getFileCount() = 0; virtual u32 getFileCount() const = 0;
//! Gets the name of a file in the list, based on an index. //! Gets the name of a file in the list, based on an index.
//! The path is not included in this name. Use getFullFileName for this. //! The path is not included in this name. Use getFullFileName for this.
...@@ -31,14 +31,14 @@ public: ...@@ -31,14 +31,14 @@ public:
//! be returned. The index has to be smaller than the amount getFileCount() returns. //! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return //! \return
//! Returns the file name of the file. Returns 0, if an error occured. //! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFileName(s32 index) = 0; virtual const c8* getFileName(u32 index) const = 0;
//! Gets the full name of a file in the list, path included, based on an index. //! Gets the full name of a file in the list, path included, based on an index.
//! \param index is the zero based index of the file which name should //! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns. //! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return //! \return
//! Returns the file name of the file. Returns 0, if an error occured. //! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFullFileName(s32 index) = 0; virtual const c8* getFullFileName(u32 index) = 0;
//! Returns of the file is a directory //! Returns of the file is a directory
//! \param //! \param
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
//! \return //! \return
//! Returns true, if the file is a directory, and false, if it is not. //! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined. //! If an error occurs, the result is undefined.
virtual bool isDirectory(s32 index) = 0; virtual bool isDirectory(u32 index) const = 0;
}; };
} // end namespace irr } // end namespace irr
......
...@@ -31,27 +31,27 @@ namespace io ...@@ -31,27 +31,27 @@ namespace io
//! changed relative to current position. Otherwise the position is changed //! changed relative to current position. Otherwise the position is changed
//! from beginning of file. //! from beginning of file.
//! \return Returns true if successful, otherwise false. //! \return Returns true if successful, otherwise false.
virtual bool seek(s32 finalPos, bool relativeMovement = false) = 0; virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
//! Returns size of file. //! Returns size of file.
//! \return Returns the size of the file in bytes. //! \return Returns the size of the file in bytes.
virtual s32 getSize() = 0; virtual long getSize() = 0;
//! Returns the current position in the file. //! Returns the current position in the file.
//! \return Returns the current position in the file in bytes. //! \return Returns the current position in the file in bytes.
virtual s32 getPos() = 0; virtual long getPos() = 0;
//! Returns name of file. //! Returns name of file.
//! \return Returns the file name as zero terminated character string. //! \return Returns the file name as zero terminated character string.
virtual const c8* getFileName() = 0; virtual const c8* getFileName() const = 0;
}; };
//! Internal function, please do not use. //! Internal function, please do not use.
IReadFile* createReadFile(const c8* fileName); IReadFile* createReadFile(const c8* fileName);
//! Internal function, please do not use. //! Internal function, please do not use.
IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, s32 areaSize); IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, long areaSize);
//! Internal function, please do not use. //! Internal function, please do not use.
IReadFile* createMemoryReadFile(void* memory, s32 size, const c8* fileName, bool deleteMemoryWhenDropped); IReadFile* createMemoryReadFile(void* memory, long size, const c8* fileName, bool deleteMemoryWhenDropped);
} // end namespace io } // end namespace io
} // end namespace irr } // end namespace irr
......
...@@ -21,9 +21,9 @@ namespace io ...@@ -21,9 +21,9 @@ namespace io
//! Reads an amount of bytes from the file. //! Reads an amount of bytes from the file.
//! \param buffer: Pointer to buffer of bytes to write. //! \param buffer: Pointer to buffer of bytes to write.
//! \param sizeToWrite: Amount of bytes to wrtie to the file. //! \param sizeToWrite: Amount of bytes to write to the file.
//! \return Returns how much bytes were written. //! \return Returns how much bytes were written.
virtual s32 write(const void* buffer, s32 sizeToWrite) = 0; virtual s32 write(const void* buffer, u32 sizeToWrite) = 0;
//! Changes position in file, returns true if successful. //! Changes position in file, returns true if successful.
//! \param finalPos: Destination position in the file. //! \param finalPos: Destination position in the file.
...@@ -31,15 +31,15 @@ namespace io ...@@ -31,15 +31,15 @@ namespace io
//! changed relative to current position. Otherwise the position is changed //! changed relative to current position. Otherwise the position is changed
//! from begin of file. //! from begin of file.
//! \return Returns true if successful, otherwise false. //! \return Returns true if successful, otherwise false.
virtual bool seek(s32 finalPos, bool relativeMovement = false) = 0; virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
//! Returns the current position in the file. //! Returns the current position in the file.
//! \return Returns the current position in the file in bytes. //! \return Returns the current position in the file in bytes.
virtual s32 getPos() = 0; virtual long getPos() = 0;
//! Returns name of file. //! Returns name of file.
//! \return Returns the file name as zero terminated character string. //! \return Returns the file name as zero terminated character string.
virtual const c8* getFileName() = 0; virtual const c8* getFileName() const = 0;
}; };
//! Internal function, please do not use. //! Internal function, please do not use.
......
...@@ -31,7 +31,6 @@ namespace io ...@@ -31,7 +31,6 @@ namespace io
CFileList::CFileList() CFileList::CFileList()
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CFileList"); setDebugName("CFileList");
#endif #endif
...@@ -131,30 +130,25 @@ CFileList::CFileList() ...@@ -131,30 +130,25 @@ CFileList::CFileList()
} }
CFileList::~CFileList() u32 CFileList::getFileCount() const
{
}
s32 CFileList::getFileCount()
{ {
return Files.size(); return Files.size();
} }
const c8* CFileList::getFileName(s32 index) const c8* CFileList::getFileName(u32 index) const
{ {
if (index < 0 || index > (s32)Files.size()) if (index < Files.size())
return 0;
return Files[index].Name.c_str(); return Files[index].Name.c_str();
else
return 0;
} }
//! Gets the full name of a file in the list, path included, based on an index. //! Gets the full name of a file in the list, path included, based on an index.
const c8* CFileList::getFullFileName(s32 index) const c8* CFileList::getFullFileName(u32 index)
{ {
if (index < 0 || index > (s32)Files.size()) if (index >= Files.size())
return 0; return 0;
if (Files[index].FullName.size() < Files[index].Name.size()) if (Files[index].FullName.size() < Files[index].Name.size())
...@@ -172,13 +166,16 @@ const c8* CFileList::getFullFileName(s32 index) ...@@ -172,13 +166,16 @@ const c8* CFileList::getFullFileName(s32 index)
} }
bool CFileList::isDirectory(s32 index) bool CFileList::isDirectory(u32 index) const
{ {
if (index < 0 || index > (s32)Files.size()) bool ret;
return false; if (index >= Files.size())
ret = false;
else
ret = Files[index].isDirectory;
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Files[index].isDirectory; return ret;
} }
} // end namespace irr } // end namespace irr
......
...@@ -25,23 +25,20 @@ public: ...@@ -25,23 +25,20 @@ public:
//! constructor //! constructor
CFileList(); CFileList();
//! destructor
virtual ~CFileList();
//! Returns the amount of files in the filelist. //! Returns the amount of files in the filelist.
//! \return //! \return
//! Returns the amount of files and directories in the file list. //! Returns the amount of files and directories in the file list.
virtual s32 getFileCount(); virtual u32 getFileCount() const;
//! Gets the name of a file in the list, based on an index. //! Gets the name of a file in the list, based on an index.
//! \param index is the zero based index of the file which name should //! \param index is the zero based index of the file which name should
//! be returned. The index has to be smaller than the amount getFileCount() returns. //! be returned. The index has to be smaller than the amount getFileCount() returns.
//! \return //! \return
//! Returns the file name of the file. Returns 0, if an error occured. //! Returns the file name of the file. Returns 0, if an error occured.
virtual const c8* getFileName(s32 index); virtual const c8* getFileName(u32 index) const;
//! Gets the full name of a file in the list, path included, based on an index. //! Gets the full name of a file in the list, path included, based on an index.
virtual const c8* getFullFileName(s32 index); virtual const c8* getFullFileName(u32 index);
//! Returns of the file is a directory //! Returns of the file is a directory
//! \param index is the zero based index of the file which name should //! \param index is the zero based index of the file which name should
...@@ -49,7 +46,7 @@ public: ...@@ -49,7 +46,7 @@ public:
//! \return //! \return
//! Returns true, if the file is a directory, and false, if it is not. //! Returns true, if the file is a directory, and false, if it is not.
//! If an error occurs, the result is undefined. //! If an error occurs, the result is undefined.
virtual bool isDirectory(s32 index); virtual bool isDirectory(u32 index) const;
private: private:
...@@ -57,7 +54,7 @@ private: ...@@ -57,7 +54,7 @@ private:
{ {
core::stringc Name; core::stringc Name;
core::stringc FullName; core::stringc FullName;
s32 Size; long Size;
bool isDirectory; bool isDirectory;
bool operator <(const struct FileEntry& other) const bool operator <(const struct FileEntry& other) const
......
...@@ -11,7 +11,7 @@ namespace io ...@@ -11,7 +11,7 @@ namespace io
{ {
CLimitReadFile::CLimitReadFile(IReadFile* alreadyOpenedFile, s32 areaSize, const c8* name) CLimitReadFile::CLimitReadFile(IReadFile* alreadyOpenedFile, long areaSize, const c8* name)
: Filename(name), AreaSize(areaSize), AreaStart(0), AreaEnd(0), File(alreadyOpenedFile) : Filename(name), AreaSize(areaSize), AreaStart(0), AreaEnd(0), File(alreadyOpenedFile)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -47,12 +47,12 @@ CLimitReadFile::~CLimitReadFile() ...@@ -47,12 +47,12 @@ CLimitReadFile::~CLimitReadFile()
//! returns how much was read //! returns how much was read
s32 CLimitReadFile::read(void* buffer, u32 sizeToRead) s32 CLimitReadFile::read(void* buffer, u32 sizeToRead)
{ {
s32 pos = File->getPos(); long pos = File->getPos();
if (pos >= AreaEnd) if (pos >= AreaEnd)
return 0; return 0;
if (pos + (s32)sizeToRead >= AreaEnd) if (pos + sizeToRead >= AreaEnd)
sizeToRead = AreaEnd - pos; sizeToRead = AreaEnd - pos;
return File->read(buffer, sizeToRead); return File->read(buffer, sizeToRead);
...@@ -63,9 +63,9 @@ s32 CLimitReadFile::read(void* buffer, u32 sizeToRead) ...@@ -63,9 +63,9 @@ s32 CLimitReadFile::read(void* buffer, u32 sizeToRead)
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
bool CLimitReadFile::seek(s32 finalPos, bool relativeMovement) bool CLimitReadFile::seek(long finalPos, bool relativeMovement)
{ {
s32 pos = File->getPos(); long pos = File->getPos();
if (relativeMovement) if (relativeMovement)
{ {
...@@ -75,7 +75,7 @@ bool CLimitReadFile::seek(s32 finalPos, bool relativeMovement) ...@@ -75,7 +75,7 @@ bool CLimitReadFile::seek(s32 finalPos, bool relativeMovement)
else else
{ {
finalPos += AreaStart; finalPos += AreaStart;
if ((s32)finalPos > AreaEnd) if (finalPos > AreaEnd)
return false; return false;
} }
...@@ -83,9 +83,8 @@ bool CLimitReadFile::seek(s32 finalPos, bool relativeMovement) ...@@ -83,9 +83,8 @@ bool CLimitReadFile::seek(s32 finalPos, bool relativeMovement)
} }
//! returns size of file //! returns size of file
s32 CLimitReadFile::getSize() long CLimitReadFile::getSize()
{ {
return AreaSize; return AreaSize;
} }
...@@ -93,7 +92,7 @@ s32 CLimitReadFile::getSize() ...@@ -93,7 +92,7 @@ s32 CLimitReadFile::getSize()
//! returns where in the file we are. //! returns where in the file we are.
s32 CLimitReadFile::getPos() long CLimitReadFile::getPos()
{ {
return File->getPos() - AreaStart; return File->getPos() - AreaStart;
} }
...@@ -101,13 +100,13 @@ s32 CLimitReadFile::getPos() ...@@ -101,13 +100,13 @@ s32 CLimitReadFile::getPos()
//! returns name of file //! returns name of file
const c8* CLimitReadFile::getFileName() const c8* CLimitReadFile::getFileName() const
{ {
return Filename.c_str(); return Filename.c_str();
} }
IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, s32 areaSize) IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, long areaSize)
{ {
return new CLimitReadFile(alreadyOpenedFile, areaSize, fileName); return new CLimitReadFile(alreadyOpenedFile, areaSize, fileName);
} }
...@@ -115,3 +114,4 @@ IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile, ...@@ -115,3 +114,4 @@ IReadFile* createLimitReadFile(const c8* fileName, IReadFile* alreadyOpenedFile,
} // end namespace io } // end namespace io
} // end namespace irr } // end namespace irr
...@@ -25,7 +25,7 @@ namespace io ...@@ -25,7 +25,7 @@ namespace io
{ {
public: public:
CLimitReadFile(IReadFile* alreadyOpenedFile, s32 areaSize, const c8* name); CLimitReadFile(IReadFile* alreadyOpenedFile, long areaSize, const c8* name);
virtual ~CLimitReadFile(); virtual ~CLimitReadFile();
...@@ -35,25 +35,25 @@ namespace io ...@@ -35,25 +35,25 @@ namespace io
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
virtual bool seek(s32 finalPos, bool relativeMovement = false); virtual bool seek(long finalPos, bool relativeMovement = false);
//! returns size of file //! returns size of file
virtual s32 getSize(); virtual long getSize();
//! returns where in the file we are. //! returns where in the file we are.
virtual s32 getPos(); virtual long getPos();
//! returns name of file //! returns name of file
virtual const c8* getFileName(); virtual const c8* getFileName() const;
private: private:
void init(); void init();
core::stringc Filename; core::stringc Filename;
s32 AreaSize; long AreaSize;
s32 AreaStart; long AreaStart;
s32 AreaEnd; long AreaEnd;
IReadFile* File; IReadFile* File;
}; };
......
...@@ -11,7 +11,7 @@ namespace io ...@@ -11,7 +11,7 @@ namespace io
{ {
CMemoryReadFile::CMemoryReadFile(void* memory, s32 len, const c8* fileName, bool d) CMemoryReadFile::CMemoryReadFile(void* memory, long len, const c8* fileName, bool d)
: Buffer(memory), Len(len), Pos(0), deleteMemoryWhenDropped(d) : Buffer(memory), Len(len), Pos(0), deleteMemoryWhenDropped(d)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -34,27 +34,26 @@ CMemoryReadFile::~CMemoryReadFile() ...@@ -34,27 +34,26 @@ CMemoryReadFile::~CMemoryReadFile()
//! returns how much was read //! returns how much was read
s32 CMemoryReadFile::read(void* buffer, u32 sizeToRead) s32 CMemoryReadFile::read(void* buffer, u32 sizeToRead)
{ {
s32 amount = sizeToRead; s32 amount = static_cast<s32>(sizeToRead);
if (Pos + amount > Len) if (Pos + amount > Len)
amount -= Pos + amount - Len; amount -= Pos + amount - Len;
if (amount < 0) if (amount <= 0)
amount = 0; return 0;
c8* p = (c8*)Buffer; c8* p = (c8*)Buffer;
memcpy(buffer, p + Pos, amount); memcpy(buffer, p + Pos, amount);
Pos += static_cast<u32> ( amount ); Pos += amount;
return amount; return amount;
} }
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
bool CMemoryReadFile::seek(s32 finalPos, bool relativeMovement) bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
{ {
if (relativeMovement) if (relativeMovement)
{ {
...@@ -65,7 +64,7 @@ bool CMemoryReadFile::seek(s32 finalPos, bool relativeMovement) ...@@ -65,7 +64,7 @@ bool CMemoryReadFile::seek(s32 finalPos, bool relativeMovement)
} }
else else
{ {
if ( (unsigned) finalPos > Len) if (finalPos > Len)
return false; return false;
Pos = finalPos; Pos = finalPos;
...@@ -77,7 +76,7 @@ bool CMemoryReadFile::seek(s32 finalPos, bool relativeMovement) ...@@ -77,7 +76,7 @@ bool CMemoryReadFile::seek(s32 finalPos, bool relativeMovement)
//! returns size of file //! returns size of file
s32 CMemoryReadFile::getSize() long CMemoryReadFile::getSize()
{ {
return Len; return Len;
} }
...@@ -85,7 +84,7 @@ s32 CMemoryReadFile::getSize() ...@@ -85,7 +84,7 @@ s32 CMemoryReadFile::getSize()
//! returns where in the file we are. //! returns where in the file we are.
s32 CMemoryReadFile::getPos() long CMemoryReadFile::getPos()
{ {
return Pos; return Pos;
} }
...@@ -93,14 +92,14 @@ s32 CMemoryReadFile::getPos() ...@@ -93,14 +92,14 @@ s32 CMemoryReadFile::getPos()
//! returns name of file //! returns name of file
const c8* CMemoryReadFile::getFileName() const c8* CMemoryReadFile::getFileName() const
{ {
return Filename.c_str(); return Filename.c_str();
} }
IReadFile* createMemoryReadFile(void* memory, s32 size, const c8* fileName, bool deleteMemoryWhenDropped) IReadFile* createMemoryReadFile(void* memory, long size, const c8* fileName, bool deleteMemoryWhenDropped)
{ {
CMemoryReadFile* file = new CMemoryReadFile(memory, size, fileName, deleteMemoryWhenDropped); CMemoryReadFile* file = new CMemoryReadFile(memory, size, fileName, deleteMemoryWhenDropped);
return file; return file;
......
...@@ -21,7 +21,7 @@ namespace io ...@@ -21,7 +21,7 @@ namespace io
{ {
public: public:
CMemoryReadFile(void* memory, s32 len, const c8* fileName, bool deleteMemoryWhenDropped); CMemoryReadFile(void* memory, long len, const c8* fileName, bool deleteMemoryWhenDropped);
virtual ~CMemoryReadFile(); virtual ~CMemoryReadFile();
...@@ -31,23 +31,23 @@ namespace io ...@@ -31,23 +31,23 @@ namespace io
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
virtual bool seek(s32 finalPos, bool relativeMovement = false); virtual bool seek(long finalPos, bool relativeMovement = false);
//! returns size of file //! returns size of file
virtual s32 getSize(); virtual long getSize();
//! returns where in the file we are. //! returns where in the file we are.
virtual s32 getPos(); virtual long getPos();
//! returns name of file //! returns name of file
virtual const c8* getFileName(); virtual const c8* getFileName() const;
private: private:
core::stringc Filename; core::stringc Filename;
void *Buffer; void *Buffer;
u32 Len; long Len;
u32 Pos; long Pos;
bool deleteMemoryWhenDropped; bool deleteMemoryWhenDropped;
}; };
......
...@@ -45,7 +45,7 @@ s32 CReadFile::read(void* buffer, u32 sizeToRead) ...@@ -45,7 +45,7 @@ s32 CReadFile::read(void* buffer, u32 sizeToRead)
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
bool CReadFile::seek(s32 finalPos, bool relativeMovement) bool CReadFile::seek(long finalPos, bool relativeMovement)
{ {
if (!isOpen()) if (!isOpen())
return false; return false;
...@@ -56,7 +56,7 @@ bool CReadFile::seek(s32 finalPos, bool relativeMovement) ...@@ -56,7 +56,7 @@ bool CReadFile::seek(s32 finalPos, bool relativeMovement)
//! returns size of file //! returns size of file
s32 CReadFile::getSize() long CReadFile::getSize()
{ {
return FileSize; return FileSize;
} }
...@@ -64,7 +64,7 @@ s32 CReadFile::getSize() ...@@ -64,7 +64,7 @@ s32 CReadFile::getSize()
//! returns where in the file we are. //! returns where in the file we are.
s32 CReadFile::getPos() long CReadFile::getPos()
{ {
return ftell(File); return ftell(File);
} }
...@@ -87,15 +87,14 @@ void CReadFile::openFile() ...@@ -87,15 +87,14 @@ void CReadFile::openFile()
// get FileSize // get FileSize
fseek(File, 0, SEEK_END); fseek(File, 0, SEEK_END);
FileSize = ftell(File); FileSize = getPos();
fseek(File, 0, SEEK_SET); fseek(File, 0, SEEK_SET);
} }
} }
//! returns name of file //! returns name of file
const c8* CReadFile::getFileName() const c8* CReadFile::getFileName() const
{ {
return Filename.c_str(); return Filename.c_str();
} }
......
...@@ -33,10 +33,10 @@ namespace io ...@@ -33,10 +33,10 @@ namespace io
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
virtual bool seek(s32 finalPos, bool relativeMovement = false); virtual bool seek(long finalPos, bool relativeMovement = false);
//! returns size of file //! returns size of file
virtual s32 getSize(); virtual long getSize();
//! returns if file is open //! returns if file is open
virtual bool isOpen() const virtual bool isOpen() const
...@@ -45,10 +45,10 @@ namespace io ...@@ -45,10 +45,10 @@ namespace io
} }
//! returns where in the file we are. //! returns where in the file we are.
virtual s32 getPos(); virtual long getPos();
//! returns name of file //! returns name of file
virtual const c8* getFileName(); virtual const c8* getFileName() const;
private: private:
...@@ -57,7 +57,7 @@ namespace io ...@@ -57,7 +57,7 @@ namespace io
core::stringc Filename; core::stringc Filename;
FILE* File; FILE* File;
s32 FileSize; long FileSize;
}; };
} // end namespace io } // end namespace io
......
...@@ -41,7 +41,7 @@ inline bool CWriteFile::isOpen() const ...@@ -41,7 +41,7 @@ inline bool CWriteFile::isOpen() const
//! returns how much was read //! returns how much was read
s32 CWriteFile::write(const void* buffer, s32 sizeToWrite) s32 CWriteFile::write(const void* buffer, u32 sizeToWrite)
{ {
if (!isOpen()) if (!isOpen())
return 0; return 0;
...@@ -54,7 +54,7 @@ s32 CWriteFile::write(const void* buffer, s32 sizeToWrite) ...@@ -54,7 +54,7 @@ s32 CWriteFile::write(const void* buffer, s32 sizeToWrite)
//! changes position in file, returns true if successful //! changes position in file, returns true if successful
//! if relativeMovement==true, the pos is changed relative to current pos, //! if relativeMovement==true, the pos is changed relative to current pos,
//! otherwise from begin of file //! otherwise from begin of file
bool CWriteFile::seek(s32 finalPos, bool relativeMovement) bool CWriteFile::seek(long finalPos, bool relativeMovement)
{ {
if (!isOpen()) if (!isOpen())
return false; return false;
...@@ -65,7 +65,7 @@ bool CWriteFile::seek(s32 finalPos, bool relativeMovement) ...@@ -65,7 +65,7 @@ bool CWriteFile::seek(s32 finalPos, bool relativeMovement)
//! returns where in the file we are. //! returns where in the file we are.
s32 CWriteFile::getPos() long CWriteFile::getPos()
{ {
return ftell(File); return ftell(File);
} }
...@@ -96,7 +96,7 @@ void CWriteFile::openFile(bool append) ...@@ -96,7 +96,7 @@ void CWriteFile::openFile(bool append)
//! returns name of file //! returns name of file
const c8* CWriteFile::getFileName() const c8* CWriteFile::getFileName() const
{ {
return Filename.c_str(); return Filename.c_str();
} }
......
...@@ -28,16 +28,16 @@ namespace io ...@@ -28,16 +28,16 @@ namespace io
virtual ~CWriteFile(); virtual ~CWriteFile();
//! Reads an amount of bytes from the file. //! Reads an amount of bytes from the file.
virtual s32 write(const void* buffer, s32 sizeToWrite); virtual s32 write(const void* buffer, u32 sizeToWrite);
//! Changes position in file, returns true if successful. //! Changes position in file, returns true if successful.
virtual bool seek(s32 finalPos, bool relativeMovement = false); virtual bool seek(long finalPos, bool relativeMovement = false);
//! Returns the current position in the file. //! Returns the current position in the file.
virtual s32 getPos(); virtual long getPos();
//! Returns name of file. //! Returns name of file.
virtual const c8* getFileName(); virtual const c8* getFileName() const;
//! returns if file is open //! returns if file is open
bool isOpen() const; bool isOpen() const;
...@@ -49,7 +49,7 @@ namespace io ...@@ -49,7 +49,7 @@ namespace io
core::stringc Filename; core::stringc Filename;
FILE* File; FILE* File;
s32 FileSize; long FileSize;
}; };
} // end namespace io } // end namespace io
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment