fixed some warnings.

This commit is contained in:
Christoph Oelckers 2023-12-10 13:31:50 +01:00
parent 36d05112d5
commit f873946bd0
5 changed files with 14 additions and 14 deletions

View file

@ -279,7 +279,7 @@ public:
if (len > 0)
{
Size length = mReader->Read(buffer.allocate(len), len);
if (length < len) buffer.allocate(length);
if ((size_t)length < len) buffer.allocate(length);
}
return buffer;
}

View file

@ -52,7 +52,7 @@ namespace FileSys {
//
//==========================================================================
static bool UncompressZipLump(char *Cache, FileReader &Reader, int Method, int LumpSize, int CompressedSize, int GPFlags, bool exceptions)
static bool UncompressZipLump(char *Cache, FileReader &Reader, int Method, ptrdiff_t LumpSize, ptrdiff_t CompressedSize, int GPFlags, bool exceptions)
{
switch (Method)
{
@ -79,7 +79,7 @@ static bool UncompressZipLump(char *Cache, FileReader &Reader, int Method, int L
case METHOD_IMPLODE:
{
FZipExploder exploder;
if (exploder.Explode((unsigned char*)Cache, LumpSize, Reader, CompressedSize, GPFlags) == -1)
if (exploder.Explode((unsigned char*)Cache, (unsigned)LumpSize, Reader, (unsigned)CompressedSize, GPFlags) == -1)
{
// decompression failed so zero the cache.
memset(Cache, 0, LumpSize);
@ -89,7 +89,7 @@ static bool UncompressZipLump(char *Cache, FileReader &Reader, int Method, int L
case METHOD_SHRINK:
{
ShrinkLoop((unsigned char *)Cache, LumpSize, Reader, CompressedSize);
ShrinkLoop((unsigned char *)Cache, (unsigned)LumpSize, Reader, (unsigned)CompressedSize);
break;
}
@ -604,8 +604,8 @@ static int AppendToZip(FileWriter *zip_file, const FCompressedBuffer &content, s
local.ModDate = LittleShort(dostime.first);
local.ModTime = LittleShort(dostime.second);
local.CRC32 = content.mCRC32;
local.UncompressedSize = LittleLong(content.mSize);
local.CompressedSize = LittleLong(content.mCompressedSize);
local.UncompressedSize = LittleLong((unsigned)content.mSize);
local.CompressedSize = LittleLong((unsigned)content.mCompressedSize);
local.NameLength = LittleShort((unsigned short)strlen(content.filename));
local.ExtraLength = 0;
@ -646,8 +646,8 @@ int AppendCentralDirectory(FileWriter *zip_file, const FCompressedBuffer &conten
dir.ModTime = LittleShort(dostime.first);
dir.ModDate = LittleShort(dostime.second);
dir.CRC32 = content.mCRC32;
dir.CompressedSize32 = LittleLong(content.mCompressedSize);
dir.UncompressedSize32 = LittleLong(content.mSize);
dir.CompressedSize32 = LittleLong((unsigned)content.mCompressedSize);
dir.UncompressedSize32 = LittleLong((unsigned)content.mSize);
dir.NameLength = LittleShort((unsigned short)strlen(content.filename));
dir.ExtraLength = 0;
dir.CommentLength = 0;

View file

@ -323,7 +323,7 @@ char *MemoryReader::Gets(char *strbuf, ptrdiff_t len)
return strbuf;
}
int BufferingReader::FillBuffer(size_t newpos)
int BufferingReader::FillBuffer(ptrdiff_t newpos)
{
if (newpos > Length) newpos = Length;
if (newpos < bufferpos) return 0;

View file

@ -35,7 +35,7 @@ class BufferingReader : public MemoryReader
std::unique_ptr<FileReaderInterface> baseReader;
ptrdiff_t bufferpos = 0;
int FillBuffer(size_t newpos);
int FillBuffer(ptrdiff_t newpos);
public:
BufferingReader(FileReaderInterface* base)
: baseReader(base)

View file

@ -409,9 +409,9 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
uint32_t lumpstart = (uint32_t)FileInfo.size();
resfile->SetFirstLump(lumpstart);
for (uint32_t i=0; i < resfile->EntryCount(); i++)
for (int i = 0; i < resfile->EntryCount(); i++)
{
FResourceLump *lump = resfile->GetLump(i);
FResourceLump* lump = resfile->GetLump(i);
FileInfo.resize(FileInfo.size() + 1);
FileSystem::LumpRecord* lump_p = &FileInfo.back();
lump_p->SetFromLump((int)Files.size(), lump, stringpool);
@ -419,7 +419,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
Files.push_back(resfile);
for (uint32_t i=0; i < resfile->EntryCount(); i++)
for (int i = 0; i < resfile->EntryCount(); i++)
{
int flags = resfile->GetEntryFlags(i);
if (flags & LUMPF_EMBEDDED)
@ -454,7 +454,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
else
fprintf(hashfile, "file: %s, Directory structure\n", filename);
for (uint32_t i = 0; i < resfile->EntryCount(); i++)
for (int i = 0; i < resfile->EntryCount(); i++)
{
int flags = resfile->GetEntryFlags(i);
if (!(flags & LUMPF_EMBEDDED))