Commit af6ec8b2 authored by hybrid's avatar hybrid

Fix warnings about long qualifier.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2454 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f1800c04
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "CLimitReadFile.h" #include "CLimitReadFile.h"
#include "os.h" #include "os.h"
#include "coreutil.h" #include "coreutil.h"
#include "errno.h"
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
...@@ -25,12 +26,6 @@ CArchiveLoaderTAR::CArchiveLoaderTAR(io::IFileSystem* fs) ...@@ -25,12 +26,6 @@ CArchiveLoaderTAR::CArchiveLoaderTAR(io::IFileSystem* fs)
} }
//! destructor
CArchiveLoaderTAR::~CArchiveLoaderTAR()
{
}
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
bool CArchiveLoaderTAR::isALoadableFileFormat(const core::string<c16>& filename) const bool CArchiveLoaderTAR::isALoadableFileFormat(const core::string<c16>& filename) const
{ {
...@@ -55,6 +50,7 @@ IFileArchive* CArchiveLoaderTAR::createArchive(const core::string<c16>& filename ...@@ -55,6 +50,7 @@ IFileArchive* CArchiveLoaderTAR::createArchive(const core::string<c16>& filename
return archive; return archive;
} }
//! creates/loads an archive from the file. //! creates/loads an archive from the file.
//! \return Pointer to the created archive. Returns 0 if loading failed. //! \return Pointer to the created archive. Returns 0 if loading failed.
IFileArchive* CArchiveLoaderTAR::createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const IFileArchive* CArchiveLoaderTAR::createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const
...@@ -86,8 +82,7 @@ bool CArchiveLoaderTAR::isALoadableFileFormat(io::IReadFile* file) const ...@@ -86,8 +82,7 @@ bool CArchiveLoaderTAR::isALoadableFileFormat(io::IReadFile* file) const
file->read(&fHead, sizeof(STarHeader)); file->read(&fHead, sizeof(STarHeader));
u32 checksum = 0; u32 checksum = 0;
sscanf(fHead.Checksum, "%lo", &checksum); sscanf(fHead.Checksum, "%o", &checksum);
// verify checksum // verify checksum
...@@ -98,8 +93,7 @@ bool CArchiveLoaderTAR::isALoadableFileFormat(io::IReadFile* file) const ...@@ -98,8 +93,7 @@ bool CArchiveLoaderTAR::isALoadableFileFormat(io::IReadFile* file) const
s32 checksum2=0; s32 checksum2=0;
// remember to blank the checksum field! // remember to blank the checksum field!
for (u32 i=0; i<8;++i) memset(fHead.Checksum, ' ', 8);
fHead.Checksum[i] = ' ';
// old header // old header
for (u8* p = (u8*)(&fHead); p < (u8*)(&fHead.Magic[0]); ++p) for (u8* p = (u8*)(&fHead); p < (u8*)(&fHead.Magic[0]); ++p)
...@@ -141,6 +135,7 @@ CTarReader::CTarReader(IReadFile* file, bool ignoreCase, bool ignorePaths) ...@@ -141,6 +135,7 @@ CTarReader::CTarReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
} }
} }
CTarReader::~CTarReader() CTarReader::~CTarReader()
{ {
if (File) if (File)
...@@ -148,6 +143,7 @@ CTarReader::~CTarReader() ...@@ -148,6 +143,7 @@ CTarReader::~CTarReader()
} }
u32 CTarReader::populateFileList() u32 CTarReader::populateFileList()
{ {
STarHeader fHead; STarHeader fHead;
...@@ -189,7 +185,7 @@ u32 CTarReader::populateFileList() ...@@ -189,7 +185,7 @@ u32 CTarReader::populateFileList()
} }
fullPath.replace('\\', '/'); fullPath.replace('\\', '/');
s32 lastSlash = fullPath.findLast('/'); const s32 lastSlash = fullPath.findLast('/');
if (IgnoreCase) if (IgnoreCase)
fullPath.make_lower(); fullPath.make_lower();
...@@ -218,7 +214,9 @@ u32 CTarReader::populateFileList() ...@@ -218,7 +214,9 @@ u32 CTarReader::populateFileList()
np++; np++;
} }
sscanf(sSize.c_str(), "%lo", &entry.size); entry.size=strtoul(sSize.c_str(), NULL, 8);
if (errno==ERANGE)
os::Printer::log("File too large", fullPath, ELL_WARNING);
// save start position // save start position
entry.startPos = pos + 512; entry.startPos = pos + 512;
...@@ -246,7 +244,7 @@ u32 CTarReader::populateFileList() ...@@ -246,7 +244,7 @@ u32 CTarReader::populateFileList()
//! opens a file by file name //! opens a file by file name
IReadFile* CTarReader::createAndOpenFile(const core::string<c16>& filename) IReadFile* CTarReader::createAndOpenFile(const core::string<c16>& filename)
{ {
s32 index = findFile(filename); const s32 index = findFile(filename);
if (index != -1) if (index != -1)
return createAndOpenFile(index); return createAndOpenFile(index);
...@@ -285,6 +283,7 @@ const core::string<c16>& CTarReader::getArchiveName() ...@@ -285,6 +283,7 @@ const core::string<c16>& CTarReader::getArchiveName()
return Base; return Base;
} }
//! returns fileindex //! returns fileindex
s32 CTarReader::findFile(const core::string<c16>& simpleFilename) s32 CTarReader::findFile(const core::string<c16>& simpleFilename)
{ {
...@@ -297,9 +296,7 @@ s32 CTarReader::findFile(const core::string<c16>& simpleFilename) ...@@ -297,9 +296,7 @@ s32 CTarReader::findFile(const core::string<c16>& simpleFilename)
if (IgnorePaths) if (IgnorePaths)
core::deletePathFromFilename(entry.simpleFileName); core::deletePathFromFilename(entry.simpleFileName);
s32 res = FileList.binary_search(entry); return FileList.binary_search(entry);
return res;
} }
} // end namespace io } // end namespace io
......
...@@ -75,9 +75,6 @@ namespace io ...@@ -75,9 +75,6 @@ namespace io
//! Constructor //! Constructor
CArchiveLoaderTAR(io::IFileSystem* fs); CArchiveLoaderTAR(io::IFileSystem* fs);
//! destructor
virtual ~CArchiveLoaderTAR();
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".tar") //! based on the file extension (e.g. ".tar")
virtual bool isALoadableFileFormat(const core::string<c16>& filename) const; virtual bool isALoadableFileFormat(const core::string<c16>& filename) const;
......
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