Fix C4267/C4244 warnings

Address warnings involving lossy conversions from larger integer-types into smaller integer-types
This commit is contained in:
Wunkolo 2023-06-19 20:10:43 -07:00
parent 86de7d8aa3
commit 37b75f0928
11 changed files with 77 additions and 83 deletions

View file

@ -138,8 +138,8 @@ std::optional<u32> NCCHArchive::readFile(FileSession* file, u64 offset, u32 size
// Seek to file offset depending on if we're reading from RomFS, ExeFS, etc
switch (type) {
case PathType::RomFS: {
const u32 romFSSize = cxi->romFS.size;
const u32 romFSOffset = cxi->romFS.offset;
const u64 romFSSize = cxi->romFS.size;
const u64 romFSOffset = cxi->romFS.offset;
if ((offset >> 32) || (offset >= romFSSize) || (offset + size >= romFSSize)) {
Helpers::panic("Tried to read from NCCH with too big of an offset");
}
@ -161,8 +161,8 @@ std::optional<u32> NCCHArchive::readFile(FileSession* file, u64 offset, u32 size
}
for (u64 i = 0; i < bytesRead; i++) {
mem.write8(dataPointer + i, data[i]);
mem.write8(u32(dataPointer + i), data[i]);
}
return bytesRead;
return u32(bytesRead);
}