+
+ // this check guards against pngconf.h with unsigned int *width/height parameters on big endian systems by detecting the strange values and shifting them down 32bits
+ // (if it's little endian the unwritten bytes are the most significant
+ // ones and we don't worry about that)
+ //
+ // this is only necessary because of retarded 64bit png_uint_32 types in libpng 1.2, which can (conceivably) vary by platform
+#if LONG_MAX > 4000000000
+ if (my_png.Width > LONG_MAX || my_png.Height > LONG_MAX)
+ {
+ my_png.Width >>= 32;
+ my_png.Height >>= 32;
+ }
+#endif
+
+ if ((matchwidth && my_png.Width != (unsigned long)matchwidth) || (matchheight && my_png.Height != (unsigned long)matchheight))