Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [r56213] Maximize Restore History

upgrade libpng to 1.6.3

erikgreenwald 2013-07-25

1 2 3 > >> (Page 1 of 3)
added /brlcad/trunk/src/other/libpng/contrib/tools/pngfix.c
changed /brlcad/trunk/NEWS
changed /brlcad/trunk/src/other/libpng/ANNOUNCE
changed /brlcad/trunk/src/other/libpng/CHANGES
changed /brlcad/trunk/src/other/libpng/CMakeLists.txt
changed /brlcad/trunk/src/other/libpng/LICENSE
changed /brlcad/trunk/src/other/libpng/Makefile.am
changed /brlcad/trunk/src/other/libpng/Makefile.in
changed /brlcad/trunk/src/other/libpng/README
changed /brlcad/trunk/src/other/libpng/arm/arm_init.c
changed /brlcad/trunk/src/other/libpng/arm/filter_neon.S
changed /brlcad/trunk/src/other/libpng/config.h.in
changed /brlcad/trunk/src/other/libpng/configure
changed /brlcad/trunk/src/other/libpng/configure.ac
changed /brlcad/trunk/src/other/libpng/contrib/libtests/timepng.c
changed /brlcad/trunk/src/other/libpng/contrib/pngminim/decoder/makefile
changed /brlcad/trunk/src/other/libpng/contrib/pngminim/encoder/makefile
changed /brlcad/trunk/src/other/libpng/contrib/pngminim/encoder/pngusr.dfa
changed /brlcad/trunk/src/other/libpng/contrib/pngminim/preader/makefile
changed /brlcad/trunk/src/other/libpng/contrib/pngminus/pnm2png.c
changed /brlcad/trunk/src/other/libpng/example.c
changed /brlcad/trunk/src/other/libpng/libpng-manual.txt
changed /brlcad/trunk/src/other/libpng/libpng.3
copied /brlcad/trunk/src/other/libpng/contrib/tools/fixitxt.c -> /brlcad/trunk/src/other/libpng/contrib/tools/png-fix-itxt.c
/brlcad/trunk/src/other/libpng/contrib/tools/pngfix.c Diff Switch to side-by-side view
Loading...
/brlcad/trunk/NEWS Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/ANNOUNCE Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/CHANGES Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/CMakeLists.txt Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/LICENSE Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/Makefile.am Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/Makefile.in Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/README Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/arm/arm_init.c Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/arm/filter_neon.S Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/config.h.in Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/configure Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/configure.ac Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/libtests/timepng.c Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/pngminim/decoder/makefile Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/pngminim/encoder/makefile Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/pngminim/encoder/pngusr.dfa Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/pngminim/preader/makefile Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/pngminus/pnm2png.c Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/example.c Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/libpng-manual.txt Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/libpng.3 Diff Switch to side-by-side view
Loading...
/brlcad/trunk/src/other/libpng/contrib/tools/fixitxt.c to /brlcad/trunk/src/other/libpng/contrib/tools/png-fix-itxt.c
--- a/brlcad/trunk/src/other/libpng/contrib/tools/fixitxt.c
+++ b/brlcad/trunk/src/other/libpng/contrib/tools/png-fix-itxt.c
@@ -1,8 +1,8 @@
-#include <stdio.h>
 
-/* fixitxt version 1.0.0
+/* png-fix-itxt version 1.0.0
  *
  * Copyright 2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.3 [July 18, 2013]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
@@ -10,7 +10,7 @@
  *
  * Usage:            
  *
- *     fixitxt.exe < bad.png > good.png
+ *     png-fix-itxt.exe < bad.png > good.png
  *
  * Fixes a PNG file written with libpng-1.6.0 or 1.6.1 that has one or more
  * uncompressed iTXt chunks.  Assumes that the actual length is greater
@@ -22,20 +22,28 @@
  *
  * Requires zlib (for crc32 and Z_NULL); build with
  *
- *     gcc -O -o fixitxt fixitxt.c -lz
+ *     gcc -O -o png-fix-itxt png-fix-itxt.c -lz
+ *
+ * If you need to handle iTXt chunks larger than 500000 kbytes you must
+ * rebuild png-fix-itxt with a larger values of MAX_LENGTH (or a smaller value
+ * if you know you will never encounter such huge iTXt chunks).
  */
+
+#include <stdio.h>
+#include <zlib.h>
 
 #define MAX_LENGTH 500000
 
-#define GETBREAK c=getchar(); if (c == EOF) break;
-#include <zlib.h>
+#define GETBREAK ((unsigned char)(inchar=getchar())); if (inchar == EOF) break
 
-main()
+int
+main(void)
 {
    unsigned int i;
    unsigned char buf[MAX_LENGTH];
    unsigned long crc;
-   unsigned int c;
+   unsigned char c;
+   int inchar;
 
 /* Skip 8-byte signature */
    for (i=8; i; i--)
@@ -44,17 +52,16 @@
       putchar(c);
    }
 
-if (c != EOF)
+if (inchar != EOF)
 for (;;)
  {
    /* Read the length */
-   unsigned long length;
-   c=GETBREAK; buf[0] = c;
-   c=GETBREAK; buf[1] = c;
-   c=GETBREAK; buf[2] = c;
-   c=GETBREAK; buf[3] = c;
+   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;
 
-   length=((((unsigned long) buf[0]<<8 + buf[1]<<16) + buf[2] << 8) + buf[3]);
    /* Read the chunkname */
    c=GETBREAK; buf[4] = c;
    c=GETBREAK; buf[5] = c;
@@ -102,10 +109,10 @@
       }
 
       /* Update length bytes */
-        buf[0] = (length << 24) & 0xff;
-        buf[1] = (length << 16) & 0xff;
-        buf[2] = (length <<  8) & 0xff;
-        buf[3] = (length      ) & 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) */
       for (i=0; i<length+12; i++)
@@ -125,7 +132,7 @@
          putchar(c);
       }
 
-      if (c == EOF)
+      if (inchar == EOF)
       {
          break;
       }
@@ -135,10 +142,12 @@
          break;
    }
 
-   if (c == EOF)
+   if (inchar == EOF)
       break;
 
    if (buf[4] == 73 && buf[5] == 69 && buf[6] == 78 && buf[7] == 68)
      break;
  }
+
+ return 0;
 }
1 2 3 > >> (Page 1 of 3)