[libpng16] Imported from libpng-1.6.18beta07.tar

This commit is contained in:
Glenn Randers-Pehrson
2015-06-06 16:31:52 -05:00
parent b26b51d154
commit 867f2ec058
20 changed files with 69 additions and 48 deletions

View File

@@ -1,8 +1,8 @@
/* png-fix-itxt version 1.0.0
*
* Copyright 2013 Glenn Randers-Pehrson
* Last changed in libpng 1.6.3 [July 18, 2013]
* Copyright 2015 Glenn Randers-Pehrson
* Last changed in libpng 1.6.18 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -57,16 +57,16 @@ for (;;)
{
/* Read the length */
unsigned long length; /* must be 32 bits! */
c=GETBREAK; buf[0] = c; length = c; length <<= 8;
c=GETBREAK; buf[1] = c; length += c; length <<= 8;
c=GETBREAK; buf[2] = c; length += c; length <<= 8;
c=GETBREAK; buf[3] = c; length += c;
c=GETBREAK; buf[0] = c & 0xff; length = (c & 0xff); length <<= 8;
c=GETBREAK; buf[1] = c & 0xff; length += (c & 0xff); length <<= 8;
c=GETBREAK; buf[2] = c & 0xff; length += (c & 0xff); length <<= 8;
c=GETBREAK; buf[3] = c & 0xff; length += (c & 0xff);
/* Read the chunkname */
c=GETBREAK; buf[4] = c;
c=GETBREAK; buf[5] = c;
c=GETBREAK; buf[6] = c;
c=GETBREAK; buf[7] = c;
c=GETBREAK; buf[4] = c & 0xff;
c=GETBREAK; buf[5] = c & 0xff;
c=GETBREAK; buf[6] = c & 0xff;
c=GETBREAK; buf[7] = c & 0xff;
/* The iTXt chunk type expressed as integers is (105, 84, 88, 116) */
@@ -81,7 +81,7 @@ for (;;)
/* Copy the data bytes */
for (i=8; i < length + 12; i++)
{
c=GETBREAK; buf[i] = c;
c=GETBREAK; buf[i] = c & 0xff;
}
/* Calculate the CRC */
@@ -102,16 +102,16 @@ for (;;)
break;
c=GETBREAK;
buf[length+11]=c;
buf[length+11] = c & 0xff;
/* Update the CRC */
crc = crc32(crc, buf+7+length, 1);
}
/* Update length bytes */
buf[0] = (unsigned char)((length << 24) & 0xff);
buf[1] = (unsigned char)((length << 16) & 0xff);
buf[2] = (unsigned char)((length << 8) & 0xff);
buf[0] = (unsigned char)((length >> 24) & 0xff);
buf[1] = (unsigned char)((length >> 16) & 0xff);
buf[2] = (unsigned char)((length >> 8) & 0xff);
buf[3] = (unsigned char)((length ) & 0xff);
/* Write the fixed iTXt chunk (length, name, data, crc) */
@@ -129,7 +129,7 @@ for (;;)
for (i=8; i< length+12; i++)
{
c=GETBREAK;
putchar(c);
putchar((c & 0xff));
}
if (inchar == EOF)