mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-02 10:11:04 +00:00
silenced some warnings.
This commit is contained in:
parent
27da9b6b79
commit
af4eaf69e3
13 changed files with 27 additions and 26 deletions
|
@ -190,7 +190,7 @@ public:
|
||||||
return (entry < NumLumps) ? Entries[entry].FileName : nullptr;
|
return (entry < NumLumps) ? Entries[entry].FileName : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual FileData Read(int entry);
|
virtual FileData Read(uint32_t entry);
|
||||||
|
|
||||||
virtual FCompressedBuffer GetRawData(uint32_t entry);
|
virtual FCompressedBuffer GetRawData(uint32_t entry);
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
F7ZFile(const char * filename, FileReader &filer, StringPool* sp);
|
F7ZFile(const char * filename, FileReader &filer, StringPool* sp);
|
||||||
bool Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf);
|
bool Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf);
|
||||||
virtual ~F7ZFile();
|
virtual ~F7ZFile();
|
||||||
FileData Read(int entry) override;
|
FileData Read(uint32_t entry) override;
|
||||||
FileReader GetEntryReader(uint32_t entry, int, int) 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);
|
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);
|
Printf(FSMessageLevel::Error, "%s: unsupported 7z/LZMA file!\n", FileName);
|
||||||
return false;
|
return false;
|
||||||
|
@ -314,15 +314,15 @@ F7ZFile::~F7ZFile()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FileData F7ZFile::Read(int entry)
|
FileData F7ZFile::Read(uint32_t entry)
|
||||||
{
|
{
|
||||||
FileData buffer;
|
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);
|
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.
|
// 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);
|
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();
|
if (code != SZ_OK) buffer.clear();
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -332,7 +332,7 @@ FCompressedBuffer FZipFile::GetRawData(uint32_t entry)
|
||||||
{
|
{
|
||||||
FCompressedBuffer cbuf;
|
FCompressedBuffer cbuf;
|
||||||
|
|
||||||
if (entry >= NumLumps >> Entries[entry].Length == 0)
|
if (entry >= NumLumps || Entries[entry].Length == 0)
|
||||||
{
|
{
|
||||||
cbuf = { 0, 0, METHOD_STORED, 0, 0, nullptr };
|
cbuf = { 0, 0, METHOD_STORED, 0, 0, nullptr };
|
||||||
}
|
}
|
||||||
|
|
|
@ -931,7 +931,7 @@ bool OpenDecompressor(FileReader& self, FileReader &parent, FileReader::Size len
|
||||||
{
|
{
|
||||||
FileData buffer(nullptr, length);
|
FileData buffer(nullptr, length);
|
||||||
FZipExploder exploder;
|
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)
|
if (exceptions)
|
||||||
{
|
{
|
||||||
|
@ -947,7 +947,7 @@ bool OpenDecompressor(FileReader& self, FileReader &parent, FileReader::Size len
|
||||||
case METHOD_SHRINK:
|
case METHOD_SHRINK:
|
||||||
{
|
{
|
||||||
FileData buffer(nullptr, length);
|
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);
|
fr = new MemoryArrayReader(buffer);
|
||||||
flags &= ~(DCF_SEEKABLE | DCF_CACHED);
|
flags &= ~(DCF_SEEKABLE | DCF_CACHED);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -101,10 +101,6 @@ struct FileSystem::LumpRecord
|
||||||
|
|
||||||
void SetFromLump(FResourceFile* file, int fileindex, int filenum, StringPool* sp, const char* name = nullptr)
|
void SetFromLump(FResourceFile* file, int fileindex, int filenum, StringPool* sp, const char* name = nullptr)
|
||||||
{
|
{
|
||||||
if (fileindex == 649 && filenum == 0)
|
|
||||||
{
|
|
||||||
int a = 0;
|
|
||||||
}
|
|
||||||
resfile = file;
|
resfile = file;
|
||||||
resindex = fileindex;
|
resindex = fileindex;
|
||||||
rfnum = filenum;
|
rfnum = filenum;
|
||||||
|
|
|
@ -709,7 +709,7 @@ FileReader FResourceFile::GetEntryReader(uint32_t entry, int readertype, int rea
|
||||||
return fr;
|
return fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileData FResourceFile::Read(int entry)
|
FileData FResourceFile::Read(uint32_t entry)
|
||||||
{
|
{
|
||||||
if (!(Entries[entry].Flags & RESFF_COMPRESSED) && Reader.isOpen())
|
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;
|
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);
|
auto lumpd = fileSystem.ReadFile(lump);
|
||||||
const char * buffer = lumpd.string();
|
const char * buffer = lumpd.string();
|
||||||
|
|
||||||
|
@ -208,7 +214,7 @@ unsigned FindModel(const char * path, const char * modelfile, bool silent)
|
||||||
|
|
||||||
if (model != nullptr)
|
if (model != nullptr)
|
||||||
{
|
{
|
||||||
if (!model->Load(path, lump, buffer, len))
|
if (!model->Load(path, lump, buffer, (int)len))
|
||||||
{
|
{
|
||||||
delete model;
|
delete model;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -852,7 +852,7 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpLength)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
PARAM_INT(lump);
|
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)
|
FFlatTexture::FFlatTexture (int lumpnum)
|
||||||
: FImageSource(lumpnum)
|
: FImageSource(lumpnum)
|
||||||
{
|
{
|
||||||
int area;
|
|
||||||
int bits;
|
int bits;
|
||||||
|
|
||||||
area = fileSystem.FileLength (lumpnum);
|
auto area = fileSystem.FileLength (lumpnum);
|
||||||
|
|
||||||
switch (area)
|
switch (area)
|
||||||
{
|
{
|
||||||
|
|
|
@ -285,7 +285,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the amount of names reported is correct.
|
// 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))
|
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",
|
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)
|
if (lump1 >= 0)
|
||||||
{
|
{
|
||||||
auto texdir = fileSystem.ReadFile(lump1);
|
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)
|
if (lump2 >= 0)
|
||||||
{
|
{
|
||||||
auto texdir = fileSystem.ReadFile(lump2);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ static std::pair<uint16_t, uint16_t> time_to_dos(struct tm *time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val.first = (time->tm_year - 80) * 512 + (time->tm_mon + 1) * 32 + time->tm_mday;
|
val.first = time->tm_hour * 2048 + time->tm_min * 32 + time->tm_sec / 2;
|
||||||
val.second= time->tm_hour * 2048 + time->tm_min * 32 + time->tm_sec / 2;
|
val.second = (time->tm_year - 80) * 512 + (time->tm_mon + 1) * 32 + time->tm_mday;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ void InsertMap(int lumpnum)
|
||||||
current->entries.Last().displayname = path.Last();
|
current->entries.Last().displayname = path.Last();
|
||||||
current->entries.Last().filename = fileSystem.GetFileFullName(lumpnum);
|
current->entries.Last().filename = fileSystem.GetFileFullName(lumpnum);
|
||||||
current->entries.Last().container = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum));
|
current->entries.Last().container = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum));
|
||||||
current->entries.Last().size = fileSystem.FileLength(lumpnum);
|
current->entries.Last().size = (int)fileSystem.FileLength(lumpnum);
|
||||||
auto mapinfo = FindMapByName(StripExtension(path.Last().GetChars()).GetChars());
|
auto mapinfo = FindMapByName(StripExtension(path.Last().GetChars()).GetChars());
|
||||||
if (mapinfo) current->entries.Last().info = mapinfo->name;
|
if (mapinfo) current->entries.Last().info = mapinfo->name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ TArray<uint8_t> RazeSoundEngine::ReadSound(int lumpnum)
|
||||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||||
TArray<uint8_t> buffer(wlump.GetLength(), true);
|
TArray<uint8_t> buffer(wlump.GetLength(), true);
|
||||||
auto len = wlump.Read(buffer.data(), buffer.size());
|
auto len = wlump.Read(buffer.data(), buffer.size());
|
||||||
buffer.Resize(len);
|
buffer.Resize((unsigned)len);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue