diff --git a/src/common/filesystem/include/fs_files.h b/src/common/filesystem/include/fs_files.h index ada77ca6e..7a2871a71 100644 --- a/src/common/filesystem/include/fs_files.h +++ b/src/common/filesystem/include/fs_files.h @@ -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; } diff --git a/src/common/filesystem/source/file_zip.cpp b/src/common/filesystem/source/file_zip.cpp index 352c7adc2..dfeb41ea8 100644 --- a/src/common/filesystem/source/file_zip.cpp +++ b/src/common/filesystem/source/file_zip.cpp @@ -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; diff --git a/src/common/filesystem/source/files.cpp b/src/common/filesystem/source/files.cpp index d17ca7002..7bf013060 100644 --- a/src/common/filesystem/source/files.cpp +++ b/src/common/filesystem/source/files.cpp @@ -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; diff --git a/src/common/filesystem/source/files_internal.h b/src/common/filesystem/source/files_internal.h index d5613b329..aa3595cbf 100644 --- a/src/common/filesystem/source/files_internal.h +++ b/src/common/filesystem/source/files_internal.h @@ -35,7 +35,7 @@ class BufferingReader : public MemoryReader std::unique_ptr baseReader; ptrdiff_t bufferpos = 0; - int FillBuffer(size_t newpos); + int FillBuffer(ptrdiff_t newpos); public: BufferingReader(FileReaderInterface* base) : baseReader(base) diff --git a/src/common/filesystem/source/filesystem.cpp b/src/common/filesystem/source/filesystem.cpp index 9f38ecd9f..e265f5cba 100644 --- a/src/common/filesystem/source/filesystem.cpp +++ b/src/common/filesystem/source/filesystem.cpp @@ -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))