Address feedback

This commit is contained in:
Henrik Rydgård committed 2023-03-08 08:29:23 +01:00
1 parent 76c6058abe
commit c4652d30e2
2 files changed
+4 -1

No files matched your search

+2
View File
@@ -15,6 +15,8 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth,
// PNG peeker - just read the start of a PNG straight into this struct, in order to
// look at basic parameters like width and height. Note that while PNG is a chunk-based
// format, the IHDR chunk is REQUIRED to be the first one, so this will work.
// Does not handle Apple's weirdo extension CgBI. http://iphonedevwiki.net/index.php/CgBI_file_format
// That should not be an issue.
struct PNGHeaderPeek {
uint32_t magic;
uint32_t ignore0;
+2 -1
View File
@@ -648,12 +648,13 @@ bool TextureReplacer::PopulateLevelFromZip(ReplacedTextureLevel &level, bool ign
} else if (imageType == ReplacedImageType::PNG) {
PNGHeaderPeek headerPeek;
good = zip_fread(zf, &headerPeek, sizeof(headerPeek)) == sizeof(headerPeek);
if (headerPeek.IsValidPNGHeader()) {
if (good && headerPeek.IsValidPNGHeader()) {
level.w = headerPeek.Width();
level.h = headerPeek.Height();
good = true;
} else {
ERROR_LOG(G3D, "Could not get PNG dimensions: %s (zip)", level.file.ToVisualString().c_str());
good = false;
}
} else {
ERROR_LOG(G3D, "Could not load texture replacement info: %s - unsupported format (zip)", level.file.ToVisualString().c_str());