Skip to content

Commit aefde8b

Browse files
committed
Fix incorrect CRC in IDAT chunk. Examples PNGs passed pngcheck.
1 parent 21ac97b commit aefde8b

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

rgb.png

0 Bytes
Loading

rgba.png

0 Bytes
Loading

svpng.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
/*! \file
3131
\brief svpng() is a minimalistic C function for saving RGB/RGBA image into uncompressed PNG.
3232
\author Milo Yip
33-
\version 0.1.0
33+
\version 0.1.1
3434
\copyright MIT license
3535
\sa http://github.com/miloyip/svpng
3636
*/
@@ -82,7 +82,7 @@ SVPNG_LINKAGE void svpng(SVPNG_OUTPUT, unsigned w, unsigned h, const unsigned ch
8282
#define SVPNG_U32(u) do { SVPNG_PUT((u) >> 24); SVPNG_PUT(((u) >> 16) & 255); SVPNG_PUT(((u) >> 8) & 255); SVPNG_PUT((u) & 255); } while(0)
8383
#define SVPNG_U8C(u) do { SVPNG_PUT(u); c ^= (u); c = (c >> 4) ^ t[c & 15]; c = (c >> 4) ^ t[c & 15]; } while(0)
8484
#define SVPNG_U8AC(ua, l) for (i = 0; i < l; i++) SVPNG_U8C((ua)[i])
85-
#define SVPNG_U16LC(u) do { SVPNG_U8C(u); SVPNG_U8C(((u) >> 8) & 255); } while(0)
85+
#define SVPNG_U16LC(u) do { SVPNG_U8C((u) & 255); SVPNG_U8C(((u) >> 8) & 255); } while(0)
8686
#define SVPNG_U32C(u) do { SVPNG_U8C((u) >> 24); SVPNG_U8C(((u) >> 16) & 255); SVPNG_U8C(((u) >> 8) & 255); SVPNG_U8C((u) & 255); } while(0)
8787
#define SVPNG_U8ADLER(u) do { SVPNG_U8C(u); a = (a + (u)) % 65521; b = (b + a) % 65521; } while(0)
8888
#define SVPNG_BEGIN(s, l) do { SVPNG_U32(l); c = ~0U; SVPNG_U8AC(s, 4); } while(0)

0 commit comments

Comments
 (0)