Merge commit 'upstream/master~1'

This commit is contained in:
Alam Arias 2019-03-22 10:18:10 -04:00
commit 544f806f92
1 changed files with 6 additions and 11 deletions

View File

@ -1187,23 +1187,17 @@ void zerr(int ret)
#define NO_PNG_LUMPS #define NO_PNG_LUMPS
#ifdef NO_PNG_LUMPS #ifdef NO_PNG_LUMPS
static void ErrorIfPNG(void *d, size_t s, char *f, char *l) static void ErrorIfPNG(UINT8 *d, size_t s, char *f, char *l)
{ {
if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/ if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/
return; return;
#define sigcheck ((UINT8 *)d) // Check for PNG file signature using memcmp
if (sigcheck[0] == 0x89 // As it may be faster on CPUs with slow unaligned memory access
&& sigcheck[1] == 0x50 // Ref: http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature
&& sigcheck[2] == 0x4e if (memcmp(&d[0], "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0)
&& sigcheck[3] == 0x47
&& sigcheck[4] == 0x0d
&& sigcheck[5] == 0x0a
&& sigcheck[6] == 0x1a
&& sigcheck[7] == 0x0a)
{ {
I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f); I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f);
} }
#undef sigcheck
} }
#endif #endif
@ -1297,6 +1291,7 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
//I_Error("ZWAD files not supported on this platform."); //I_Error("ZWAD files not supported on this platform.");
return 0; return 0;
#endif #endif
} }
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support. case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support.