Fix sign-compare issues

- Temp remove smdh size check (to fix usage with _3dsx)
This commit is contained in:
2026-03-11 15:46:31 +01:00
parent 7bc7c60a15
commit a000b46f7d
4 changed files with 5 additions and 5 deletions

View File

@@ -47,7 +47,7 @@ CTRFF_API void BCLIM::CreateByImage(const std::vector<u8>& data, int w, int h,
pImag.Height = h;
pImag.ImageSize = data.size();
pBuffer.resize(data.size());
for (int i = 0; i < data.size(); i++) {
for (size_t i = 0; i < data.size(); i++) {
pBuffer[i] = data[i];
}
pCurrent.FileSize = pBuffer.size() + pCurrent.HeaderSize + pImag.HeaderSize;

View File

@@ -30,7 +30,7 @@ CTRFF_API ctrff::u32 ctrff::TileIndex(const int &x, const int &y,
CTRFF_API void ctrff::RGB565toRGBA(std::vector<ctrff::u8> &img,
const ctrff::u16 *icon, const int &w,
const int &h) {
if (img.size() != (w * h * 4)) {
if (img.size() != size_t(w * h * 4)) {
img.clear();
img.resize(w * h * 4);
}

View File

@@ -166,7 +166,7 @@ CTRFF_API std::vector<ctrff::u8> Decompress(const std::vector<ctrff::u8>& in) {
dst_off++;
}
}
if (dst_off >= len) return ret;
if ((u32)dst_off >= len) return ret;
header <<= 1;
}
}

View File

@@ -18,12 +18,12 @@ CTRFF_API void ctrff::SMDH::Write(std::fstream &f) const {
}
CTRFF_API void ctrff::SMDH::Read(std::fstream &f) {
f.seekg(0, std::ios::end);
/*f.seekg(0, std::ios::end);
if (f.tellg() != SMDH_Size) {
throw std::runtime_error(
"SMDH: File size does not match the SMDH Header size!");
}
f.seekg(0, std::ios::beg);
f.seekg(0, std::ios::beg);*/
f.read(reinterpret_cast<char *>(Magic), sizeof(Magic));
if (std::string(Magic) != smdh_magic) {
throw std::runtime_error("SMDH: Invalid SMDH file!");