Fix sign-compare issues
- Temp remove smdh size check (to fix usage with _3dsx)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user