mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
warnings and debug code cleanup
This commit is contained in:
parent
133b415b84
commit
958303556f
9 changed files with 22 additions and 21 deletions
|
@ -190,7 +190,7 @@ public:
|
|||
return (entry < NumLumps) ? Entries[entry].FileName : nullptr;
|
||||
}
|
||||
|
||||
virtual FileData Read(int entry);
|
||||
virtual FileData Read(uint32_t entry);
|
||||
|
||||
virtual FCompressedBuffer GetRawData(uint32_t entry);
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
F7ZFile(const char * filename, FileReader &filer, StringPool* sp);
|
||||
bool Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf);
|
||||
virtual ~F7ZFile();
|
||||
FileData Read(int entry) override;
|
||||
FileData Read(uint32_t entry) override;
|
||||
FileReader GetEntryReader(uint32_t entry, int, int) override;
|
||||
};
|
||||
|
||||
|
@ -282,7 +282,7 @@ bool F7ZFile::Open(LumpFilterInfo *filter, FileSystemMessageFunc Printf)
|
|||
|
||||
FileData temp(nullptr, Entries[0].Length);
|
||||
|
||||
if (SZ_OK != Archive->Extract(Entries[0].Position, (char*)temp.writable()))
|
||||
if (SZ_OK != Archive->Extract((UInt32)Entries[0].Position, (char*)temp.writable()))
|
||||
{
|
||||
Printf(FSMessageLevel::Error, "%s: unsupported 7z/LZMA file!\n", FileName);
|
||||
return false;
|
||||
|
@ -314,15 +314,15 @@ F7ZFile::~F7ZFile()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FileData F7ZFile::Read(int entry)
|
||||
FileData F7ZFile::Read(uint32_t entry)
|
||||
{
|
||||
FileData buffer;
|
||||
if ((entry >= 0 || entry < NumLumps) && Entries[entry].Length > 0)
|
||||
if (entry < NumLumps && Entries[entry].Length > 0)
|
||||
{
|
||||
auto p = buffer.allocate(Entries[entry].Length);
|
||||
// There is no realistic way to keep multiple references to a 7z file open without massive overhead so to make this thread-safe a mutex is the only option.
|
||||
std::lock_guard<FCriticalSection> lock(critsec);
|
||||
SRes code = Archive->Extract(Entries[entry].Position, (char*)p);
|
||||
SRes code = Archive->Extract((UInt32)Entries[entry].Position, (char*)p);
|
||||
if (code != SZ_OK) buffer.clear();
|
||||
}
|
||||
return buffer;
|
||||
|
|
|
@ -931,7 +931,7 @@ bool OpenDecompressor(FileReader& self, FileReader &parent, FileReader::Size len
|
|||
{
|
||||
FileData buffer(nullptr, length);
|
||||
FZipExploder exploder;
|
||||
if (exploder.Explode(buffer.writable(), length, *p, p->GetLength(), method - METHOD_IMPLODE_MIN) == -1)
|
||||
if (exploder.Explode(buffer.writable(), (unsigned)length, *p, (unsigned)p->GetLength(), method - METHOD_IMPLODE_MIN) == -1)
|
||||
{
|
||||
if (exceptions)
|
||||
{
|
||||
|
@ -947,7 +947,7 @@ bool OpenDecompressor(FileReader& self, FileReader &parent, FileReader::Size len
|
|||
case METHOD_SHRINK:
|
||||
{
|
||||
FileData buffer(nullptr, length);
|
||||
ShrinkLoop(buffer.writable(), length, *p, p->GetLength()); // this never fails.
|
||||
ShrinkLoop(buffer.writable(), (unsigned)length, *p, (unsigned)p->GetLength()); // this never fails.
|
||||
fr = new MemoryArrayReader(buffer);
|
||||
flags &= ~(DCF_SEEKABLE | DCF_CACHED);
|
||||
break;
|
||||
|
|
|
@ -101,10 +101,6 @@ struct FileSystem::LumpRecord
|
|||
|
||||
void SetFromLump(FResourceFile* file, int fileindex, int filenum, StringPool* sp, const char* name = nullptr)
|
||||
{
|
||||
if (fileindex == 649 && filenum == 0)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
resfile = file;
|
||||
resindex = fileindex;
|
||||
rfnum = filenum;
|
||||
|
|
|
@ -709,7 +709,7 @@ FileReader FResourceFile::GetEntryReader(uint32_t entry, int readertype, int rea
|
|||
return fr;
|
||||
}
|
||||
|
||||
FileData FResourceFile::Read(int entry)
|
||||
FileData FResourceFile::Read(uint32_t entry)
|
||||
{
|
||||
if (!(Entries[entry].Flags & RESFF_COMPRESSED) && Reader.isOpen())
|
||||
{
|
||||
|
|
|
@ -163,7 +163,13 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
if (!Models[i]->mFileName.CompareNoCase(fullname)) return i;
|
||||
}
|
||||
|
||||
int len = fileSystem.FileLength(lump);
|
||||
auto len = fileSystem.FileLength(lump);
|
||||
if (len >= 0x80000000ll)
|
||||
{
|
||||
Printf(PRINT_HIGH, "LoadModel: File to large: '%s'\n", fullname.GetChars());
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto lumpd = fileSystem.ReadFile(lump);
|
||||
const char * buffer = lumpd.string();
|
||||
|
||||
|
@ -208,7 +214,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
|||
|
||||
if (model != nullptr)
|
||||
{
|
||||
if (!model->Load(path, lump, buffer, len))
|
||||
if (!model->Load(path, lump, buffer, (int)len))
|
||||
{
|
||||
delete model;
|
||||
return -1;
|
||||
|
|
|
@ -852,7 +852,7 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpLength)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(lump);
|
||||
ACTION_RETURN_INT(fileSystem.FileLength(lump));
|
||||
ACTION_RETURN_INT((int)fileSystem.FileLength(lump));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -74,10 +74,9 @@ FImageSource *FlatImage_TryCreate(FileReader & file, int lumpnum)
|
|||
FFlatTexture::FFlatTexture (int lumpnum)
|
||||
: FImageSource(lumpnum)
|
||||
{
|
||||
int area;
|
||||
int bits;
|
||||
|
||||
area = fileSystem.FileLength (lumpnum);
|
||||
auto area = fileSystem.FileLength (lumpnum);
|
||||
|
||||
switch (area)
|
||||
{
|
||||
|
|
|
@ -285,7 +285,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
|
|||
}
|
||||
|
||||
// Check whether the amount of names reported is correct.
|
||||
int lumplength = fileSystem.FileLength(patcheslump);
|
||||
uint32_t lumplength = (uint32_t)fileSystem.FileLength(patcheslump);
|
||||
if (numpatches > uint32_t((lumplength - 4) / 8))
|
||||
{
|
||||
Printf("PNAMES lump is shorter than required (%u entries reported but only %d bytes (%d entries) long\n",
|
||||
|
@ -398,12 +398,12 @@ void FMultipatchTextureBuilder::AddTexturesLumps(int lump1, int lump2, int patch
|
|||
if (lump1 >= 0)
|
||||
{
|
||||
auto texdir = fileSystem.ReadFile(lump1);
|
||||
AddTexturesLump(texdir.data(), fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true);
|
||||
AddTexturesLump(texdir.data(), (int)fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true);
|
||||
}
|
||||
if (lump2 >= 0)
|
||||
{
|
||||
auto texdir = fileSystem.ReadFile(lump2);
|
||||
AddTexturesLump(texdir.data(), fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false);
|
||||
AddTexturesLump(texdir.data(), (int)fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue