2010-06-11 08:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* external/png/pngconf.h
* external/png/LICENSE
* external/png/pngwio.c
* external/png/pngrutil.c
* external/png/pngread.c
* external/png/pngmem.c
* external/png/pngget.c
* external/png/png.c
* external/png/png.h
* external/png/pngpriv.h
* external/png/pngrtran.c
* external/png/pngtrans.c
- external/jpeg/wrjpgcom.c
* external/jpeg/jdatasrc.c
* external/jpeg/jversion.h
* Updated libpng component to 1.4.2 (from 1.4.1)
* Updated jpeg component to 8b (from 8a)
; Thanks for Tamas Tevesz for these patches.
* external/jpeg/link.txt
* Updated link.
This commit is contained in:
@@ -16,6 +16,29 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-06-11 08:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* external/png/pngconf.h
|
||||
* external/png/LICENSE
|
||||
* external/png/pngwio.c
|
||||
* external/png/pngrutil.c
|
||||
* external/png/pngread.c
|
||||
* external/png/pngmem.c
|
||||
* external/png/pngget.c
|
||||
* external/png/png.c
|
||||
* external/png/png.h
|
||||
* external/png/pngpriv.h
|
||||
* external/png/pngrtran.c
|
||||
* external/png/pngtrans.c
|
||||
- external/jpeg/wrjpgcom.c
|
||||
* external/jpeg/jdatasrc.c
|
||||
* external/jpeg/jversion.h
|
||||
* Updated libpng component to 1.4.2 (from 1.4.1)
|
||||
* Updated jpeg component to 8b (from 8a)
|
||||
; Thanks for Tamas Tevesz for these patches.
|
||||
|
||||
* external/jpeg/link.txt
|
||||
* Updated link.
|
||||
|
||||
2010-06-11 00:53 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* external/zlib/Makefile
|
||||
+ Added extra build option for mingw/cygwin compilers to
|
||||
@@ -69,7 +92,7 @@
|
||||
Please note that on all platforms except Windows and Symbian,
|
||||
it's not necessary to create separate HBQT builds for
|
||||
static and dynamic QT libraries. Instead, on these
|
||||
platforms (Linux, Darwin and possible OS/2) it's enough to
|
||||
platforms (Linux, Darwin and possibly OS/2) it's enough to
|
||||
just link the same HBQT libs with either static or dynamic
|
||||
QT libs. For this reason, recently added HBQT_ISSTATICLINK()
|
||||
function will only work on Windows, thus it's not portable.
|
||||
|
||||
4
harbour/external/jpeg/jdatasrc.c
vendored
4
harbour/external/jpeg/jdatasrc.c
vendored
@@ -2,7 +2,7 @@
|
||||
* jdatasrc.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009 by Guido Vollbeding.
|
||||
* Modified 2009-2010 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -163,7 +163,7 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long) src->bytes_in_buffer) {
|
||||
num_bytes -= (long) src->bytes_in_buffer;
|
||||
(void) fill_input_buffer(cinfo);
|
||||
(void) (*src->fill_input_buffer) (cinfo);
|
||||
/* note we assume that fill_input_buffer will never return FALSE,
|
||||
* so suspension need not be handled.
|
||||
*/
|
||||
|
||||
2
harbour/external/jpeg/jversion.h
vendored
2
harbour/external/jpeg/jversion.h
vendored
@@ -9,6 +9,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#define JVERSION "8a 28-Feb-2010"
|
||||
#define JVERSION "8b 16-May-2010"
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 2010, Thomas G. Lane, Guido Vollbeding"
|
||||
|
||||
2
harbour/external/jpeg/link.txt
vendored
2
harbour/external/jpeg/link.txt
vendored
@@ -2,4 +2,4 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
http://www.ijg.org/files/jpegsr8a.zip
|
||||
http://www.ijg.org/files/jpegsr8b.zip
|
||||
|
||||
583
harbour/external/jpeg/wrjpgcom.c
vendored
583
harbour/external/jpeg/wrjpgcom.c
vendored
@@ -1,583 +0,0 @@
|
||||
/*
|
||||
* wrjpgcom.c
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains a very simple stand-alone application that inserts
|
||||
* user-supplied text as a COM (comment) marker in a JFIF file.
|
||||
* This may be useful as an example of the minimum logic needed to parse
|
||||
* JPEG markers.
|
||||
*/
|
||||
|
||||
#define JPEG_CJPEG_DJPEG /* to get the command-line config symbols */
|
||||
#include "jinclude.h" /* get auto-config symbols, <stdio.h> */
|
||||
|
||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc() */
|
||||
extern void * malloc ();
|
||||
#endif
|
||||
#include <ctype.h> /* to declare isupper(), tolower() */
|
||||
#ifdef USE_SETMODE
|
||||
#include <fcntl.h> /* to declare setmode()'s parameter macros */
|
||||
/* If you have setmode() but not <io.h>, just delete this line: */
|
||||
#include <io.h> /* to declare setmode() */
|
||||
#endif
|
||||
|
||||
#ifdef USE_CCOMMAND /* command-line reader for Macintosh */
|
||||
#ifdef __MWERKS__
|
||||
#include <SIOUX.h> /* Metrowerks needs this */
|
||||
#include <console.h> /* ... and this */
|
||||
#endif
|
||||
#ifdef THINK_C
|
||||
#include <console.h> /* Think declares it here */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */
|
||||
#define READ_BINARY "r"
|
||||
#define WRITE_BINARY "w"
|
||||
#else
|
||||
#ifdef VMS /* VMS is very nonstandard */
|
||||
#define READ_BINARY "rb", "ctx=stm"
|
||||
#define WRITE_BINARY "wb", "ctx=stm"
|
||||
#else /* standard ANSI-compliant case */
|
||||
#define READ_BINARY "rb"
|
||||
#define WRITE_BINARY "wb"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EXIT_FAILURE /* define exit() codes if not provided */
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
#ifndef EXIT_SUCCESS
|
||||
#ifdef VMS
|
||||
#define EXIT_SUCCESS 1 /* VMS is very nonstandard */
|
||||
#else
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Reduce this value if your malloc() can't allocate blocks up to 64K.
|
||||
* On DOS, compiling in large model is usually a better solution.
|
||||
*/
|
||||
|
||||
#ifndef MAX_COM_LENGTH
|
||||
#define MAX_COM_LENGTH 65000L /* must be <= 65533 in any case */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* These macros are used to read the input file and write the output file.
|
||||
* To reuse this code in another application, you might need to change these.
|
||||
*/
|
||||
|
||||
static FILE * infile; /* input JPEG file */
|
||||
|
||||
/* Return next input byte, or EOF if no more */
|
||||
#define NEXTBYTE() getc(infile)
|
||||
|
||||
static FILE * outfile; /* output JPEG file */
|
||||
|
||||
/* Emit an output byte */
|
||||
#define PUTBYTE(x) putc((x), outfile)
|
||||
|
||||
|
||||
/* Error exit handler */
|
||||
#define ERREXIT(msg) (fprintf(stderr, "%s\n", msg), exit(EXIT_FAILURE))
|
||||
|
||||
|
||||
/* Read one byte, testing for EOF */
|
||||
static int
|
||||
read_1_byte (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = NEXTBYTE();
|
||||
if (c == EOF)
|
||||
ERREXIT("Premature EOF in JPEG file");
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Read 2 bytes, convert to unsigned int */
|
||||
/* All 2-byte quantities in JPEG markers are MSB first */
|
||||
static unsigned int
|
||||
read_2_bytes (void)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
c1 = NEXTBYTE();
|
||||
if (c1 == EOF)
|
||||
ERREXIT("Premature EOF in JPEG file");
|
||||
c2 = NEXTBYTE();
|
||||
if (c2 == EOF)
|
||||
ERREXIT("Premature EOF in JPEG file");
|
||||
return (((unsigned int) c1) << 8) + ((unsigned int) c2);
|
||||
}
|
||||
|
||||
|
||||
/* Routines to write data to output file */
|
||||
|
||||
static void
|
||||
write_1_byte (int c)
|
||||
{
|
||||
PUTBYTE(c);
|
||||
}
|
||||
|
||||
static void
|
||||
write_2_bytes (unsigned int val)
|
||||
{
|
||||
PUTBYTE((val >> 8) & 0xFF);
|
||||
PUTBYTE(val & 0xFF);
|
||||
}
|
||||
|
||||
static void
|
||||
write_marker (int marker)
|
||||
{
|
||||
PUTBYTE(0xFF);
|
||||
PUTBYTE(marker);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_rest_of_file (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = NEXTBYTE()) != EOF)
|
||||
PUTBYTE(c);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* JPEG markers consist of one or more 0xFF bytes, followed by a marker
|
||||
* code byte (which is not an FF). Here are the marker codes of interest
|
||||
* in this program. (See jdmarker.c for a more complete list.)
|
||||
*/
|
||||
|
||||
#define M_SOF0 0xC0 /* Start Of Frame N */
|
||||
#define M_SOF1 0xC1 /* N indicates which compression process */
|
||||
#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
|
||||
#define M_SOF3 0xC3
|
||||
#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
|
||||
#define M_SOF6 0xC6
|
||||
#define M_SOF7 0xC7
|
||||
#define M_SOF9 0xC9
|
||||
#define M_SOF10 0xCA
|
||||
#define M_SOF11 0xCB
|
||||
#define M_SOF13 0xCD
|
||||
#define M_SOF14 0xCE
|
||||
#define M_SOF15 0xCF
|
||||
#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */
|
||||
#define M_EOI 0xD9 /* End Of Image (end of datastream) */
|
||||
#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
|
||||
#define M_COM 0xFE /* COMment */
|
||||
|
||||
|
||||
/*
|
||||
* Find the next JPEG marker and return its marker code.
|
||||
* We expect at least one FF byte, possibly more if the compressor used FFs
|
||||
* to pad the file. (Padding FFs will NOT be replicated in the output file.)
|
||||
* There could also be non-FF garbage between markers. The treatment of such
|
||||
* garbage is unspecified; we choose to skip over it but emit a warning msg.
|
||||
* NB: this routine must not be used after seeing SOS marker, since it will
|
||||
* not deal correctly with FF/00 sequences in the compressed image data...
|
||||
*/
|
||||
|
||||
static int
|
||||
next_marker (void)
|
||||
{
|
||||
int c;
|
||||
int discarded_bytes = 0;
|
||||
|
||||
/* Find 0xFF byte; count and skip any non-FFs. */
|
||||
c = read_1_byte();
|
||||
while (c != 0xFF) {
|
||||
discarded_bytes++;
|
||||
c = read_1_byte();
|
||||
}
|
||||
/* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs
|
||||
* are legal as pad bytes, so don't count them in discarded_bytes.
|
||||
*/
|
||||
do {
|
||||
c = read_1_byte();
|
||||
} while (c == 0xFF);
|
||||
|
||||
if (discarded_bytes != 0) {
|
||||
fprintf(stderr, "Warning: garbage data found in JPEG file\n");
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read the initial marker, which should be SOI.
|
||||
* For a JFIF file, the first two bytes of the file should be literally
|
||||
* 0xFF M_SOI. To be more general, we could use next_marker, but if the
|
||||
* input file weren't actually JPEG at all, next_marker might read the whole
|
||||
* file and then return a misleading error message...
|
||||
*/
|
||||
|
||||
static int
|
||||
first_marker (void)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
c1 = NEXTBYTE();
|
||||
c2 = NEXTBYTE();
|
||||
if (c1 != 0xFF || c2 != M_SOI)
|
||||
ERREXIT("Not a JPEG file");
|
||||
return c2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Most types of marker are followed by a variable-length parameter segment.
|
||||
* This routine skips over the parameters for any marker we don't otherwise
|
||||
* want to process.
|
||||
* Note that we MUST skip the parameter segment explicitly in order not to
|
||||
* be fooled by 0xFF bytes that might appear within the parameter segment;
|
||||
* such bytes do NOT introduce new markers.
|
||||
*/
|
||||
|
||||
static void
|
||||
copy_variable (void)
|
||||
/* Copy an unknown or uninteresting variable-length marker */
|
||||
{
|
||||
unsigned int length;
|
||||
|
||||
/* Get the marker parameter length count */
|
||||
length = read_2_bytes();
|
||||
write_2_bytes(length);
|
||||
/* Length includes itself, so must be at least 2 */
|
||||
if (length < 2)
|
||||
ERREXIT("Erroneous JPEG marker length");
|
||||
length -= 2;
|
||||
/* Skip over the remaining bytes */
|
||||
while (length > 0) {
|
||||
write_1_byte(read_1_byte());
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
skip_variable (void)
|
||||
/* Skip over an unknown or uninteresting variable-length marker */
|
||||
{
|
||||
unsigned int length;
|
||||
|
||||
/* Get the marker parameter length count */
|
||||
length = read_2_bytes();
|
||||
/* Length includes itself, so must be at least 2 */
|
||||
if (length < 2)
|
||||
ERREXIT("Erroneous JPEG marker length");
|
||||
length -= 2;
|
||||
/* Skip over the remaining bytes */
|
||||
while (length > 0) {
|
||||
(void) read_1_byte();
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse the marker stream until SOFn or EOI is seen;
|
||||
* copy data to output, but discard COM markers unless keep_COM is true.
|
||||
*/
|
||||
|
||||
static int
|
||||
scan_JPEG_header (int keep_COM)
|
||||
{
|
||||
int marker;
|
||||
|
||||
/* Expect SOI at start of file */
|
||||
if (first_marker() != M_SOI)
|
||||
ERREXIT("Expected SOI marker first");
|
||||
write_marker(M_SOI);
|
||||
|
||||
/* Scan miscellaneous markers until we reach SOFn. */
|
||||
for (;;) {
|
||||
marker = next_marker();
|
||||
switch (marker) {
|
||||
/* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
|
||||
* treated as SOFn. C4 in particular is actually DHT.
|
||||
*/
|
||||
case M_SOF0: /* Baseline */
|
||||
case M_SOF1: /* Extended sequential, Huffman */
|
||||
case M_SOF2: /* Progressive, Huffman */
|
||||
case M_SOF3: /* Lossless, Huffman */
|
||||
case M_SOF5: /* Differential sequential, Huffman */
|
||||
case M_SOF6: /* Differential progressive, Huffman */
|
||||
case M_SOF7: /* Differential lossless, Huffman */
|
||||
case M_SOF9: /* Extended sequential, arithmetic */
|
||||
case M_SOF10: /* Progressive, arithmetic */
|
||||
case M_SOF11: /* Lossless, arithmetic */
|
||||
case M_SOF13: /* Differential sequential, arithmetic */
|
||||
case M_SOF14: /* Differential progressive, arithmetic */
|
||||
case M_SOF15: /* Differential lossless, arithmetic */
|
||||
return marker;
|
||||
|
||||
case M_SOS: /* should not see compressed data before SOF */
|
||||
ERREXIT("SOS without prior SOFn");
|
||||
break;
|
||||
|
||||
case M_EOI: /* in case it's a tables-only JPEG stream */
|
||||
return marker;
|
||||
|
||||
case M_COM: /* Existing COM: conditionally discard */
|
||||
if (keep_COM) {
|
||||
write_marker(marker);
|
||||
copy_variable();
|
||||
} else {
|
||||
skip_variable();
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* Anything else just gets copied */
|
||||
write_marker(marker);
|
||||
copy_variable(); /* we assume it has a parameter count... */
|
||||
break;
|
||||
}
|
||||
} /* end loop */
|
||||
}
|
||||
|
||||
|
||||
/* Command line parsing code */
|
||||
|
||||
static const char * progname; /* program name for error messages */
|
||||
|
||||
|
||||
static void
|
||||
usage (void)
|
||||
/* complain about bad command line */
|
||||
{
|
||||
fprintf(stderr, "wrjpgcom inserts a textual comment in a JPEG file.\n");
|
||||
fprintf(stderr, "You can add to or replace any existing comment(s).\n");
|
||||
|
||||
fprintf(stderr, "Usage: %s [switches] ", progname);
|
||||
#ifdef TWO_FILE_COMMANDLINE
|
||||
fprintf(stderr, "inputfile outputfile\n");
|
||||
#else
|
||||
fprintf(stderr, "[inputfile]\n");
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "Switches (names may be abbreviated):\n");
|
||||
fprintf(stderr, " -replace Delete any existing comments\n");
|
||||
fprintf(stderr, " -comment \"text\" Insert comment with given text\n");
|
||||
fprintf(stderr, " -cfile name Read comment from named file\n");
|
||||
fprintf(stderr, "Notice that you must put quotes around the comment text\n");
|
||||
fprintf(stderr, "when you use -comment.\n");
|
||||
fprintf(stderr, "If you do not give either -comment or -cfile on the command line,\n");
|
||||
fprintf(stderr, "then the comment text is read from standard input.\n");
|
||||
fprintf(stderr, "It can be multiple lines, up to %u characters total.\n",
|
||||
(unsigned int) MAX_COM_LENGTH);
|
||||
#ifndef TWO_FILE_COMMANDLINE
|
||||
fprintf(stderr, "You must specify an input JPEG file name when supplying\n");
|
||||
fprintf(stderr, "comment text from standard input.\n");
|
||||
#endif
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
keymatch (char * arg, const char * keyword, int minchars)
|
||||
/* Case-insensitive matching of (possibly abbreviated) keyword switches. */
|
||||
/* keyword is the constant keyword (must be lower case already), */
|
||||
/* minchars is length of minimum legal abbreviation. */
|
||||
{
|
||||
register int ca, ck;
|
||||
register int nmatched = 0;
|
||||
|
||||
while ((ca = *arg++) != '\0') {
|
||||
if ((ck = *keyword++) == '\0')
|
||||
return 0; /* arg longer than keyword, no good */
|
||||
if (isupper(ca)) /* force arg to lcase (assume ck is already) */
|
||||
ca = tolower(ca);
|
||||
if (ca != ck)
|
||||
return 0; /* no good */
|
||||
nmatched++; /* count matched characters */
|
||||
}
|
||||
/* reached end of argument; fail if it's too short for unique abbrev */
|
||||
if (nmatched < minchars)
|
||||
return 0;
|
||||
return 1; /* A-OK */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The main program.
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int argn;
|
||||
char * arg;
|
||||
int keep_COM = 1;
|
||||
char * comment_arg = NULL;
|
||||
FILE * comment_file = NULL;
|
||||
unsigned int comment_length = 0;
|
||||
int marker;
|
||||
|
||||
/* On Mac, fetch a command line. */
|
||||
#ifdef USE_CCOMMAND
|
||||
argc = ccommand(&argv);
|
||||
#endif
|
||||
|
||||
progname = argv[0];
|
||||
if (progname == NULL || progname[0] == 0)
|
||||
progname = "wrjpgcom"; /* in case C library doesn't provide it */
|
||||
|
||||
/* Parse switches, if any */
|
||||
for (argn = 1; argn < argc; argn++) {
|
||||
arg = argv[argn];
|
||||
if (arg[0] != '-')
|
||||
break; /* not switch, must be file name */
|
||||
arg++; /* advance over '-' */
|
||||
if (keymatch(arg, "replace", 1)) {
|
||||
keep_COM = 0;
|
||||
} else if (keymatch(arg, "cfile", 2)) {
|
||||
if (++argn >= argc) usage();
|
||||
if ((comment_file = fopen(argv[argn], "r")) == NULL) {
|
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else if (keymatch(arg, "comment", 1)) {
|
||||
if (++argn >= argc) usage();
|
||||
comment_arg = argv[argn];
|
||||
/* If the comment text starts with '"', then we are probably running
|
||||
* under MS-DOG and must parse out the quoted string ourselves. Sigh.
|
||||
*/
|
||||
if (comment_arg[0] == '"') {
|
||||
comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH);
|
||||
if (comment_arg == NULL)
|
||||
ERREXIT("Insufficient memory");
|
||||
strcpy(comment_arg, argv[argn]+1);
|
||||
for (;;) {
|
||||
comment_length = (unsigned int) strlen(comment_arg);
|
||||
if (comment_length > 0 && comment_arg[comment_length-1] == '"') {
|
||||
comment_arg[comment_length-1] = '\0'; /* zap terminating quote */
|
||||
break;
|
||||
}
|
||||
if (++argn >= argc)
|
||||
ERREXIT("Missing ending quote mark");
|
||||
strcat(comment_arg, " ");
|
||||
strcat(comment_arg, argv[argn]);
|
||||
}
|
||||
}
|
||||
comment_length = (unsigned int) strlen(comment_arg);
|
||||
} else
|
||||
usage();
|
||||
}
|
||||
|
||||
/* Cannot use both -comment and -cfile. */
|
||||
if (comment_arg != NULL && comment_file != NULL)
|
||||
usage();
|
||||
/* If there is neither -comment nor -cfile, we will read the comment text
|
||||
* from stdin; in this case there MUST be an input JPEG file name.
|
||||
*/
|
||||
if (comment_arg == NULL && comment_file == NULL && argn >= argc)
|
||||
usage();
|
||||
|
||||
/* Open the input file. */
|
||||
if (argn < argc) {
|
||||
if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
|
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
/* default input file is stdin */
|
||||
#ifdef USE_SETMODE /* need to hack file mode? */
|
||||
setmode(fileno(stdin), O_BINARY);
|
||||
#endif
|
||||
#ifdef USE_FDOPEN /* need to re-open in binary mode? */
|
||||
if ((infile = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
|
||||
fprintf(stderr, "%s: can't open stdin\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#else
|
||||
infile = stdin;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Open the output file. */
|
||||
#ifdef TWO_FILE_COMMANDLINE
|
||||
/* Must have explicit output file name */
|
||||
if (argn != argc-2) {
|
||||
fprintf(stderr, "%s: must name one input and one output file\n",
|
||||
progname);
|
||||
usage();
|
||||
}
|
||||
if ((outfile = fopen(argv[argn+1], WRITE_BINARY)) == NULL) {
|
||||
fprintf(stderr, "%s: can't open %s\n", progname, argv[argn+1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#else
|
||||
/* Unix style: expect zero or one file name */
|
||||
if (argn < argc-1) {
|
||||
fprintf(stderr, "%s: only one input file\n", progname);
|
||||
usage();
|
||||
}
|
||||
/* default output file is stdout */
|
||||
#ifdef USE_SETMODE /* need to hack file mode? */
|
||||
setmode(fileno(stdout), O_BINARY);
|
||||
#endif
|
||||
#ifdef USE_FDOPEN /* need to re-open in binary mode? */
|
||||
if ((outfile = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
|
||||
fprintf(stderr, "%s: can't open stdout\n", progname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#else
|
||||
outfile = stdout;
|
||||
#endif
|
||||
#endif /* TWO_FILE_COMMANDLINE */
|
||||
|
||||
/* Collect comment text from comment_file or stdin, if necessary */
|
||||
if (comment_arg == NULL) {
|
||||
FILE * src_file;
|
||||
int c;
|
||||
|
||||
comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH);
|
||||
if (comment_arg == NULL)
|
||||
ERREXIT("Insufficient memory");
|
||||
comment_length = 0;
|
||||
src_file = (comment_file != NULL ? comment_file : stdin);
|
||||
while ((c = getc(src_file)) != EOF) {
|
||||
if (comment_length >= (unsigned int) MAX_COM_LENGTH) {
|
||||
fprintf(stderr, "Comment text may not exceed %u bytes\n",
|
||||
(unsigned int) MAX_COM_LENGTH);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
comment_arg[comment_length++] = (char) c;
|
||||
}
|
||||
if (comment_file != NULL)
|
||||
fclose(comment_file);
|
||||
}
|
||||
|
||||
/* Copy JPEG headers until SOFn marker;
|
||||
* we will insert the new comment marker just before SOFn.
|
||||
* This (a) causes the new comment to appear after, rather than before,
|
||||
* existing comments; and (b) ensures that comments come after any JFIF
|
||||
* or JFXX markers, as required by the JFIF specification.
|
||||
*/
|
||||
marker = scan_JPEG_header(keep_COM);
|
||||
/* Insert the new COM marker, but only if nonempty text has been supplied */
|
||||
if (comment_length > 0) {
|
||||
write_marker(M_COM);
|
||||
write_2_bytes(comment_length + 2);
|
||||
while (comment_length > 0) {
|
||||
write_1_byte(*comment_arg++);
|
||||
comment_length--;
|
||||
}
|
||||
}
|
||||
/* Duplicate the remainder of the source file.
|
||||
* Note that any COM markers occuring after SOF will not be touched.
|
||||
*/
|
||||
write_marker(marker);
|
||||
copy_rest_of_file();
|
||||
|
||||
/* All done. */
|
||||
exit(EXIT_SUCCESS);
|
||||
return 0; /* suppress no-return-value warnings */
|
||||
}
|
||||
4
harbour/external/png/LICENSE
vendored
4
harbour/external/png/LICENSE
vendored
@@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.1, February 25, 2010, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.2, May 6, 2010, are
|
||||
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
February 25, 2010
|
||||
May 6, 2010
|
||||
|
||||
12
harbour/external/png/png.c
vendored
12
harbour/external/png/png.c
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.4.1 [February 25, 2010]
|
||||
* Last changed in libpng 1.4.2 [May 6, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_1 Your_png_h_is_not_version_1_4_1;
|
||||
typedef version_1_4_2 Your_png_h_is_not_version_1_4_2;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h.
|
||||
@@ -551,13 +551,13 @@ png_get_copyright(png_structp png_ptr)
|
||||
#else
|
||||
#ifdef __STDC__
|
||||
return ((png_charp) PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.1 - February 25, 2010" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.2 - May 6, 2010" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE);
|
||||
#else
|
||||
return ((png_charp) "libpng version 1.4.1 - February 25, 2010\
|
||||
return ((png_charp) "libpng version 1.4.2 - May 6, 2010\
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||
@@ -622,7 +622,9 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* This function, added to libpng-1.0.6g, is untested. */
|
||||
int PNGAPI
|
||||
png_reset_zstream(png_structp png_ptr)
|
||||
@@ -631,7 +633,7 @@ png_reset_zstream(png_structp png_ptr)
|
||||
return Z_STREAM_ERROR;
|
||||
return (inflateReset(&png_ptr->zstream));
|
||||
}
|
||||
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
/* This function was added to libpng-1.0.7 */
|
||||
png_uint_32 PNGAPI
|
||||
|
||||
54
harbour/external/png/png.h
vendored
54
harbour/external/png/png.h
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.4.1 - February 25, 2010
|
||||
* libpng version 1.4.2 - May 6, 2010
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -11,7 +11,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.4.1 - February 25, 2010: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.4.2 - May 6, 2010: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@@ -139,6 +139,9 @@
|
||||
* 1.4.1beta04-12 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1rc02-04 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1 14 10401 14.so.14.1[.0]
|
||||
* 1.4.2beta01 14 10402 14.so.14.2[.0]
|
||||
* 1.4.2rc02-06 14 10402 14.so.14.2[.0]
|
||||
* 1.4.2 14 10402 14.so.14.2[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@@ -170,7 +173,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.1, February 25, 2010, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.2, May 6, 2010, are
|
||||
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
@@ -282,13 +285,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* February 25, 2010
|
||||
* May 6, 2010
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.4.1 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.4.2 are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
@@ -344,9 +347,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.1"
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.2"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.4.1 - February 25, 2010\n"
|
||||
" libpng version 1.4.2 - May 6, 2010\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 14
|
||||
#define PNG_LIBPNG_VER_DLLNUM 14
|
||||
@@ -354,7 +357,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 4
|
||||
#define PNG_LIBPNG_VER_RELEASE 1
|
||||
#define PNG_LIBPNG_VER_RELEASE 2
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
*/
|
||||
@@ -384,7 +387,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10401 /* 1.4.1 */
|
||||
#define PNG_LIBPNG_VER 10402 /* 1.4.2 */
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Include the compression library's header */
|
||||
@@ -1332,13 +1335,13 @@ struct png_struct_def
|
||||
png_uint_16 offset_table_count_free PNG_DEPSTRUCT;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */
|
||||
png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for quantizing */
|
||||
png_bytep quantize_index PNG_DEPSTRUCT; /* index translation for palette
|
||||
files */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
||||
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
||||
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
|
||||
#endif
|
||||
|
||||
@@ -1422,9 +1425,9 @@ struct png_struct_def
|
||||
png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current
|
||||
(unfiltered) row */
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
/* The following three members were added at version 1.0.14 and 1.2.4 */
|
||||
png_bytep dither_sort PNG_DEPSTRUCT; /* working sort array */
|
||||
png_bytep quantize_sort PNG_DEPSTRUCT; /* working sort array */
|
||||
png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original
|
||||
index currently is
|
||||
in the palette */
|
||||
@@ -1468,7 +1471,7 @@ struct png_struct_def
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef png_structp version_1_4_1;
|
||||
typedef png_structp version_1_4_2;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@@ -1495,6 +1498,11 @@ extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
|
||||
extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
|
||||
png_size_t num_to_check));
|
||||
|
||||
/* Simple signature checking function. This is the same as calling
|
||||
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
|
||||
*/
|
||||
#define png_check_sig(sig,n) !png_sig_cmp((sig), 0, (n))
|
||||
|
||||
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
|
||||
extern PNG_EXPORT(png_structp,png_create_read_struct)
|
||||
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
@@ -1532,8 +1540,10 @@ extern PNG_EXPORT(jmp_buf*, png_set_longjmp_fn)
|
||||
(LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Reset the compression stream */
|
||||
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
@@ -1710,14 +1720,16 @@ extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
|
||||
extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
/* Turn on dithering, and reduce the palette to the number of colors
|
||||
* available.
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
/* Turn on quantizing, and reduce the palette to the number of colors
|
||||
* available. Prior to libpng-1.4.2, this was png_set_dither().
|
||||
*/
|
||||
extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
|
||||
extern PNG_EXPORT(void,png_set_quantize) PNGARG((png_structp png_ptr,
|
||||
png_colorp palette, int num_palette, int maximum_colors,
|
||||
png_uint_16p histogram, int full_dither));
|
||||
png_uint_16p histogram, int full_quantize));
|
||||
#endif
|
||||
/* This migration aid will be removed from libpng-1.5.0 */
|
||||
#define png_set_dither png_set_quantize
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
/* Handle gamma correction. Screen_gamma=(display_exponent) */
|
||||
|
||||
41
harbour/external/png/pngconf.h
vendored
41
harbour/external/png/pngconf.h
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.1 - February 25, 2010
|
||||
* libpng version 1.4.2 - May 6, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -391,18 +391,32 @@
|
||||
|
||||
/* Other defines for things like memory and the like can go here. */
|
||||
|
||||
/* This controls how fine the dithering gets. As this allocates
|
||||
/* This controls how fine the quantizing gets. As this allocates
|
||||
* a largish chunk of memory (32K), those who are not as concerned
|
||||
* with dithering quality can decrease some or all of these.
|
||||
* with quantizing quality can decrease some or all of these.
|
||||
*/
|
||||
#ifndef PNG_DITHER_RED_BITS
|
||||
# define PNG_DITHER_RED_BITS 5
|
||||
|
||||
/* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS
|
||||
* These migration aids will be removed from libpng-1.5.0.
|
||||
*/
|
||||
#ifdef PNG_DITHER_RED_BITS
|
||||
# define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS
|
||||
#endif
|
||||
#ifndef PNG_DITHER_GREEN_BITS
|
||||
# define PNG_DITHER_GREEN_BITS 5
|
||||
#ifdef PNG_DITHER_GREEN_BITS
|
||||
# define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS
|
||||
#endif
|
||||
#ifndef PNG_DITHER_BLUE_BITS
|
||||
# define PNG_DITHER_BLUE_BITS 5
|
||||
#ifdef PNG_DITHER_BLUE_BITS
|
||||
# define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS
|
||||
#endif
|
||||
|
||||
#ifndef PNG_QUANTIZE_RED_BITS
|
||||
# define PNG_QUANTIZE_RED_BITS 5
|
||||
#endif
|
||||
#ifndef PNG_QUANTIZE_GREEN_BITS
|
||||
# define PNG_QUANTIZE_GREEN_BITS 5
|
||||
#endif
|
||||
#ifndef PNG_QUANTIZE_BLUE_BITS
|
||||
# define PNG_QUANTIZE_BLUE_BITS 5
|
||||
#endif
|
||||
|
||||
/* This controls how fine the gamma correction becomes when you
|
||||
@@ -499,11 +513,12 @@
|
||||
# ifndef PNG_NO_READ_INVERT
|
||||
# define PNG_READ_INVERT_SUPPORTED
|
||||
# endif
|
||||
#if 0 /* removed from libpng-1.4.0 */
|
||||
# ifndef PNG_NO_READ_DITHER
|
||||
# define PNG_READ_DITHER_SUPPORTED
|
||||
# ifndef PNG_NO_READ_QUANTIZE
|
||||
/* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */
|
||||
# ifndef PNG_NO_READ_DITHER /* This migration aid will be removed */
|
||||
# define PNG_READ_QUANTIZE_SUPPORTED
|
||||
# endif
|
||||
# endif
|
||||
#endif /* 0 */
|
||||
# ifndef PNG_NO_READ_BACKGROUND
|
||||
# define PNG_READ_BACKGROUND_SUPPORTED
|
||||
# endif
|
||||
|
||||
2
harbour/external/png/pngget.c
vendored
2
harbour/external/png/pngget.c
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.1 [February 25, 2010]
|
||||
* Last changed in libpng 1.4.2 [May 6, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
||||
2
harbour/external/png/pngmem.c
vendored
2
harbour/external/png/pngmem.c
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [February 25, 2010]
|
||||
* Last changed in libpng 1.4.2 [May 6, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
||||
10
harbour/external/png/pngpriv.h
vendored
10
harbour/external/png/pngpriv.h
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.1 - February 25, 2010
|
||||
* libpng version 1.4.2 - May 6, 2010
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -106,7 +106,7 @@
|
||||
#define PNG_SHIFT 0x0008
|
||||
#define PNG_SWAP_BYTES 0x0010
|
||||
#define PNG_INVERT_MONO 0x0020
|
||||
#define PNG_DITHER 0x0040
|
||||
#define PNG_QUANTIZE 0x0040 /* formerly PNG_DITHER */
|
||||
#define PNG_BACKGROUND 0x0080
|
||||
#define PNG_BACKGROUND_EXPAND 0x0100
|
||||
/* 0x0200 unused */
|
||||
@@ -588,9 +588,9 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
|
||||
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
|
||||
png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
|
||||
png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));
|
||||
|
||||
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
|
||||
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
|
||||
|
||||
6
harbour/external/png/pngread.c
vendored
6
harbour/external/png/pngread.c
vendored
@@ -1080,9 +1080,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
|
||||
png_free(png_ptr, png_ptr->big_row_buf);
|
||||
png_free(png_ptr, png_ptr->prev_row);
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
png_free(png_ptr, png_ptr->palette_lookup);
|
||||
png_free(png_ptr, png_ptr->dither_index);
|
||||
png_free(png_ptr, png_ptr->quantize_index);
|
||||
#endif
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
png_free(png_ptr, png_ptr->gamma_table);
|
||||
@@ -1257,7 +1257,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
png_set_expand(png_ptr);
|
||||
#endif
|
||||
|
||||
/* We don't handle background color or gamma transformation or dithering.
|
||||
/* We don't handle background color or gamma transformation or quantizing.
|
||||
*/
|
||||
|
||||
#ifdef PNG_READ_INVERT_SUPPORTED
|
||||
|
||||
158
harbour/external/png/pngrtran.c
vendored
158
harbour/external/png/pngrtran.c
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.4.1 [February 25, 2010]
|
||||
* Last changed in libpng 1.4.2 [May 6, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -141,13 +141,13 @@ png_set_strip_alpha(png_structp png_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
/* Dither file to 8 bit. Supply a palette, the current number
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
/* Quantize file to 8 bit. Supply a palette, the current number
|
||||
* of elements in the palette, the maximum number of elements
|
||||
* allowed, and a histogram if possible. If the current number
|
||||
* of colors is greater then the maximum number, the palette will be
|
||||
* modified to fit in the maximum number. "full_dither" indicates
|
||||
* whether we need a dithering cube set up for RGB images, or if we
|
||||
* modified to fit in the maximum number. "full_quantize" indicates
|
||||
* whether we need a quantizeing cube set up for RGB images, or if we
|
||||
* simply are reducing the number of colors in a paletted image.
|
||||
*/
|
||||
|
||||
@@ -161,24 +161,24 @@ typedef png_dsort FAR * png_dsortp;
|
||||
typedef png_dsort FAR * FAR * png_dsortpp;
|
||||
|
||||
void PNGAPI
|
||||
png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
png_set_quantize(png_structp png_ptr, png_colorp palette,
|
||||
int num_palette, int maximum_colors, png_uint_16p histogram,
|
||||
int full_dither)
|
||||
int full_quantize)
|
||||
{
|
||||
png_debug(1, "in png_set_dither");
|
||||
png_debug(1, "in png_set_quantize");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
png_ptr->transformations |= PNG_DITHER;
|
||||
png_ptr->transformations |= PNG_QUANTIZE;
|
||||
|
||||
if (!full_dither)
|
||||
if (!full_quantize)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * png_sizeof(png_byte)));
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->dither_index[i] = (png_byte)i;
|
||||
png_ptr->quantize_index[i] = (png_byte)i;
|
||||
}
|
||||
|
||||
if (num_palette > maximum_colors)
|
||||
@@ -192,12 +192,12 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
int i;
|
||||
|
||||
/* Initialize an array to sort colors */
|
||||
png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * png_sizeof(png_byte)));
|
||||
|
||||
/* Initialize the dither_sort array */
|
||||
/* Initialize the quantize_sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->dither_sort[i] = (png_byte)i;
|
||||
png_ptr->quantize_sort[i] = (png_byte)i;
|
||||
|
||||
/* Find the least used palette entries by starting a
|
||||
* bubble sort, and running it until we have sorted
|
||||
@@ -214,14 +214,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
done = 1;
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
if (histogram[png_ptr->dither_sort[j]]
|
||||
< histogram[png_ptr->dither_sort[j + 1]])
|
||||
if (histogram[png_ptr->quantize_sort[j]]
|
||||
< histogram[png_ptr->quantize_sort[j + 1]])
|
||||
{
|
||||
png_byte t;
|
||||
|
||||
t = png_ptr->dither_sort[j];
|
||||
png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1];
|
||||
png_ptr->dither_sort[j + 1] = t;
|
||||
t = png_ptr->quantize_sort[j];
|
||||
png_ptr->quantize_sort[j] = png_ptr->quantize_sort[j + 1];
|
||||
png_ptr->quantize_sort[j + 1] = t;
|
||||
done = 0;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
}
|
||||
|
||||
/* Swap the palette around, and set up a table, if necessary */
|
||||
if (full_dither)
|
||||
if (full_quantize)
|
||||
{
|
||||
int j = num_palette;
|
||||
|
||||
@@ -239,11 +239,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
*/
|
||||
for (i = 0; i < maximum_colors; i++)
|
||||
{
|
||||
if ((int)png_ptr->dither_sort[i] >= maximum_colors)
|
||||
if ((int)png_ptr->quantize_sort[i] >= maximum_colors)
|
||||
{
|
||||
do
|
||||
j--;
|
||||
while ((int)png_ptr->dither_sort[j] >= maximum_colors);
|
||||
while ((int)png_ptr->quantize_sort[j] >= maximum_colors);
|
||||
palette[i] = palette[j];
|
||||
}
|
||||
}
|
||||
@@ -258,32 +258,32 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
for (i = 0; i < maximum_colors; i++)
|
||||
{
|
||||
/* Only move the colors we need to */
|
||||
if ((int)png_ptr->dither_sort[i] >= maximum_colors)
|
||||
if ((int)png_ptr->quantize_sort[i] >= maximum_colors)
|
||||
{
|
||||
png_color tmp_color;
|
||||
|
||||
do
|
||||
j--;
|
||||
while ((int)png_ptr->dither_sort[j] >= maximum_colors);
|
||||
while ((int)png_ptr->quantize_sort[j] >= maximum_colors);
|
||||
|
||||
tmp_color = palette[j];
|
||||
palette[j] = palette[i];
|
||||
palette[i] = tmp_color;
|
||||
/* Indicate where the color went */
|
||||
png_ptr->dither_index[j] = (png_byte)i;
|
||||
png_ptr->dither_index[i] = (png_byte)j;
|
||||
png_ptr->quantize_index[j] = (png_byte)i;
|
||||
png_ptr->quantize_index[i] = (png_byte)j;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find closest color for those colors we are not using */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
if ((int)png_ptr->dither_index[i] >= maximum_colors)
|
||||
if ((int)png_ptr->quantize_index[i] >= maximum_colors)
|
||||
{
|
||||
int min_d, k, min_k, d_index;
|
||||
|
||||
/* Find the closest color to one we threw out */
|
||||
d_index = png_ptr->dither_index[i];
|
||||
d_index = png_ptr->quantize_index[i];
|
||||
min_d = PNG_COLOR_DIST(palette[d_index], palette[0]);
|
||||
for (k = 1, min_k = 0; k < maximum_colors; k++)
|
||||
{
|
||||
@@ -298,12 +298,12 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
}
|
||||
}
|
||||
/* Point to closest color */
|
||||
png_ptr->dither_index[i] = (png_byte)min_k;
|
||||
png_ptr->quantize_index[i] = (png_byte)min_k;
|
||||
}
|
||||
}
|
||||
}
|
||||
png_free(png_ptr, png_ptr->dither_sort);
|
||||
png_ptr->dither_sort = NULL;
|
||||
png_free(png_ptr, png_ptr->quantize_sort);
|
||||
png_ptr->quantize_sort = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -410,19 +410,19 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
num_new_palette--;
|
||||
palette[png_ptr->index_to_palette[j]]
|
||||
= palette[num_new_palette];
|
||||
if (!full_dither)
|
||||
if (!full_quantize)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < num_palette; k++)
|
||||
{
|
||||
if (png_ptr->dither_index[k] ==
|
||||
if (png_ptr->quantize_index[k] ==
|
||||
png_ptr->index_to_palette[j])
|
||||
png_ptr->dither_index[k] =
|
||||
png_ptr->quantize_index[k] =
|
||||
png_ptr->index_to_palette[next_j];
|
||||
if ((int)png_ptr->dither_index[k] ==
|
||||
if ((int)png_ptr->quantize_index[k] ==
|
||||
num_new_palette)
|
||||
png_ptr->dither_index[k] =
|
||||
png_ptr->quantize_index[k] =
|
||||
png_ptr->index_to_palette[j];
|
||||
}
|
||||
}
|
||||
@@ -475,15 +475,15 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
}
|
||||
png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
|
||||
if (full_dither)
|
||||
if (full_quantize)
|
||||
{
|
||||
int i;
|
||||
png_bytep distance;
|
||||
int total_bits = PNG_DITHER_RED_BITS + PNG_DITHER_GREEN_BITS +
|
||||
PNG_DITHER_BLUE_BITS;
|
||||
int num_red = (1 << PNG_DITHER_RED_BITS);
|
||||
int num_green = (1 << PNG_DITHER_GREEN_BITS);
|
||||
int num_blue = (1 << PNG_DITHER_BLUE_BITS);
|
||||
int total_bits = PNG_QUANTIZE_RED_BITS + PNG_QUANTIZE_GREEN_BITS +
|
||||
PNG_QUANTIZE_BLUE_BITS;
|
||||
int num_red = (1 << PNG_QUANTIZE_RED_BITS);
|
||||
int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
|
||||
int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
|
||||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||
|
||||
png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr,
|
||||
@@ -496,16 +496,16 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
int ir, ig, ib;
|
||||
int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS));
|
||||
int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS));
|
||||
int b = (palette[i].blue >> (8 - PNG_DITHER_BLUE_BITS));
|
||||
int r = (palette[i].red >> (8 - PNG_QUANTIZE_RED_BITS));
|
||||
int g = (palette[i].green >> (8 - PNG_QUANTIZE_GREEN_BITS));
|
||||
int b = (palette[i].blue >> (8 - PNG_QUANTIZE_BLUE_BITS));
|
||||
|
||||
for (ir = 0; ir < num_red; ir++)
|
||||
{
|
||||
/* int dr = abs(ir - r); */
|
||||
int dr = ((ir > r) ? ir - r : r - ir);
|
||||
int index_r = (ir << (PNG_DITHER_BLUE_BITS +
|
||||
PNG_DITHER_GREEN_BITS));
|
||||
int index_r = (ir << (PNG_QUANTIZE_BLUE_BITS +
|
||||
PNG_QUANTIZE_GREEN_BITS));
|
||||
|
||||
for (ig = 0; ig < num_green; ig++)
|
||||
{
|
||||
@@ -513,7 +513,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
int dg = ((ig > g) ? ig - g : g - ig);
|
||||
int dt = dr + dg;
|
||||
int dm = ((dr > dg) ? dr : dg);
|
||||
int index_g = index_r | (ig << PNG_DITHER_BLUE_BITS);
|
||||
int index_g = index_r | (ig << PNG_QUANTIZE_BLUE_BITS);
|
||||
|
||||
for (ib = 0; ib < num_blue; ib++)
|
||||
{
|
||||
@@ -536,7 +536,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
png_free(png_ptr, distance);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||
/* Transform the image from the file_gamma to the screen_gamma. We
|
||||
@@ -1229,8 +1229,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
|
||||
info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_DITHER)
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_QUANTIZE)
|
||||
{
|
||||
if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
|
||||
(info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&
|
||||
@@ -1451,13 +1451,13 @@ png_do_read_transformations(png_structp png_ptr)
|
||||
png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_DITHER)
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_QUANTIZE)
|
||||
{
|
||||
png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||
png_ptr->palette_lookup, png_ptr->dither_index);
|
||||
png_do_quantize((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
|
||||
png_ptr->palette_lookup, png_ptr->quantize_index);
|
||||
if (png_ptr->row_info.rowbytes == (png_uint_32)0)
|
||||
png_error(png_ptr, "png_do_dither returned rowbytes=0");
|
||||
png_error(png_ptr, "png_do_quantize returned rowbytes=0");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3790,16 +3790,16 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_DITHER_SUPPORTED
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_do_dither(png_row_infop row_info, png_bytep row,
|
||||
png_bytep palette_lookup, png_bytep dither_lookup)
|
||||
png_do_quantize(png_row_infop row_info, png_bytep row,
|
||||
png_bytep palette_lookup, png_bytep quantize_lookup)
|
||||
{
|
||||
png_bytep sp, dp;
|
||||
png_uint_32 i;
|
||||
png_uint_32 row_width=row_info->width;
|
||||
|
||||
png_debug(1, "in png_do_dither");
|
||||
png_debug(1, "in png_do_quantize");
|
||||
|
||||
{
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
|
||||
@@ -3821,14 +3821,14 @@ png_do_dither(png_row_infop row_info, png_bytep row,
|
||||
* (((g >> 3) & 0x1f) << 5) |
|
||||
* ((b >> 3) & 0x1f);
|
||||
*/
|
||||
p = (((r >> (8 - PNG_DITHER_RED_BITS)) &
|
||||
((1 << PNG_DITHER_RED_BITS) - 1)) <<
|
||||
(PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) |
|
||||
(((g >> (8 - PNG_DITHER_GREEN_BITS)) &
|
||||
((1 << PNG_DITHER_GREEN_BITS) - 1)) <<
|
||||
(PNG_DITHER_BLUE_BITS)) |
|
||||
((b >> (8 - PNG_DITHER_BLUE_BITS)) &
|
||||
((1 << PNG_DITHER_BLUE_BITS) - 1));
|
||||
p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) &
|
||||
((1 << PNG_QUANTIZE_RED_BITS) - 1)) <<
|
||||
(PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) |
|
||||
(((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) &
|
||||
((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) <<
|
||||
(PNG_QUANTIZE_BLUE_BITS)) |
|
||||
((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) &
|
||||
((1 << PNG_QUANTIZE_BLUE_BITS) - 1));
|
||||
|
||||
*dp++ = palette_lookup[p];
|
||||
}
|
||||
@@ -3850,14 +3850,14 @@ png_do_dither(png_row_infop row_info, png_bytep row,
|
||||
b = *sp++;
|
||||
sp++;
|
||||
|
||||
p = (((r >> (8 - PNG_DITHER_RED_BITS)) &
|
||||
((1 << PNG_DITHER_RED_BITS) - 1)) <<
|
||||
(PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) |
|
||||
(((g >> (8 - PNG_DITHER_GREEN_BITS)) &
|
||||
((1 << PNG_DITHER_GREEN_BITS) - 1)) <<
|
||||
(PNG_DITHER_BLUE_BITS)) |
|
||||
((b >> (8 - PNG_DITHER_BLUE_BITS)) &
|
||||
((1 << PNG_DITHER_BLUE_BITS) - 1));
|
||||
p = (((r >> (8 - PNG_QUANTIZE_RED_BITS)) &
|
||||
((1 << PNG_QUANTIZE_RED_BITS) - 1)) <<
|
||||
(PNG_QUANTIZE_GREEN_BITS + PNG_QUANTIZE_BLUE_BITS)) |
|
||||
(((g >> (8 - PNG_QUANTIZE_GREEN_BITS)) &
|
||||
((1 << PNG_QUANTIZE_GREEN_BITS) - 1)) <<
|
||||
(PNG_QUANTIZE_BLUE_BITS)) |
|
||||
((b >> (8 - PNG_QUANTIZE_BLUE_BITS)) &
|
||||
((1 << PNG_QUANTIZE_BLUE_BITS) - 1));
|
||||
|
||||
*dp++ = palette_lookup[p];
|
||||
}
|
||||
@@ -3867,12 +3867,12 @@ png_do_dither(png_row_infop row_info, png_bytep row,
|
||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
|
||||
}
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
dither_lookup && row_info->bit_depth == 8)
|
||||
quantize_lookup && row_info->bit_depth == 8)
|
||||
{
|
||||
sp = row;
|
||||
for (i = 0; i < row_width; i++, sp++)
|
||||
{
|
||||
*sp = dither_lookup[*sp];
|
||||
*sp = quantize_lookup[*sp];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
123
harbour/external/png/pngrutil.c
vendored
123
harbour/external/png/pngrutil.c
vendored
@@ -203,7 +203,7 @@ png_crc_error(png_structp png_ptr)
|
||||
defined(PNG_READ_iCCP_SUPPORTED)
|
||||
static png_size_t
|
||||
png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
png_bytep output, png_size_t output_size)
|
||||
png_bytep output, png_size_t output_size)
|
||||
{
|
||||
png_size_t count = 0;
|
||||
|
||||
@@ -229,11 +229,11 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
|
||||
{
|
||||
if (output != 0 && output_size > count)
|
||||
{
|
||||
int copy = output_size - count;
|
||||
if (avail < copy) copy = avail;
|
||||
png_memcpy(output + count, png_ptr->zbuf, copy);
|
||||
}
|
||||
{
|
||||
int copy = output_size - count;
|
||||
if (avail < copy) copy = avail;
|
||||
png_memcpy(output + count, png_ptr->zbuf, copy);
|
||||
}
|
||||
count += avail;
|
||||
}
|
||||
|
||||
@@ -254,31 +254,33 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
* buffer if available.
|
||||
*/
|
||||
{
|
||||
char *msg, umsg[52];
|
||||
if (png_ptr->zstream.msg != 0)
|
||||
msg = png_ptr->zstream.msg;
|
||||
else
|
||||
{
|
||||
char *msg;
|
||||
if (png_ptr->zstream.msg != 0)
|
||||
msg = png_ptr->zstream.msg;
|
||||
else
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
switch (ret)
|
||||
{
|
||||
case Z_BUF_ERROR:
|
||||
msg = "Buffer error in compressed datastream in %s chunk";
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
msg = "Data error in compressed datastream in %s chunk";
|
||||
break;
|
||||
default:
|
||||
msg = "Incomplete compressed datastream in %s chunk";
|
||||
break;
|
||||
}
|
||||
char umsg[52];
|
||||
|
||||
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
|
||||
msg = umsg;
|
||||
switch (ret)
|
||||
{
|
||||
case Z_BUF_ERROR:
|
||||
msg = "Buffer error in compressed datastream in %s chunk";
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
msg = "Data error in compressed datastream in %s chunk";
|
||||
break;
|
||||
default:
|
||||
msg = "Incomplete compressed datastream in %s chunk";
|
||||
break;
|
||||
}
|
||||
|
||||
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
|
||||
msg = umsg;
|
||||
#else
|
||||
msg = "Damaged compressed datastream in chunk other than IDAT";
|
||||
msg = "Damaged compressed datastream in chunk other than IDAT";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
@@ -313,9 +315,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
{
|
||||
png_size_t expanded_size = png_inflate(png_ptr,
|
||||
(png_bytep)(png_ptr->chunkdata + prefix_size),
|
||||
(png_bytep)(png_ptr->chunkdata + prefix_size),
|
||||
chunklength - prefix_size,
|
||||
0/*output*/, 0/*output size*/);
|
||||
0/*output*/, 0/*output size*/);
|
||||
|
||||
/* Now check the limits on this chunk - if the limit fails the
|
||||
* compressed data will be removed, the prefix will remain.
|
||||
@@ -334,44 +336,49 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
* and we have nothing to do - the code will exit through the
|
||||
* error case below.
|
||||
*/
|
||||
else if (expanded_size > 0)
|
||||
#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
|
||||
defined(PNG_USER_CHUNK_MALLOC_MAX)
|
||||
else
|
||||
#endif
|
||||
if (expanded_size > 0)
|
||||
{
|
||||
/* Success (maybe) - really uncompress the chunk. */
|
||||
png_size_t new_size = 0;
|
||||
png_charp text = png_malloc_warn(png_ptr,
|
||||
prefix_size + expanded_size + 1);
|
||||
png_size_t new_size = 0;
|
||||
png_charp text = png_malloc_warn(png_ptr,
|
||||
prefix_size + expanded_size + 1);
|
||||
|
||||
if (text != NULL)
|
||||
{
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
new_size = png_inflate(png_ptr,
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
new_size = png_inflate(png_ptr,
|
||||
(png_bytep)(png_ptr->chunkdata + prefix_size),
|
||||
chunklength - prefix_size,
|
||||
chunklength - prefix_size,
|
||||
(png_bytep)(text + prefix_size), expanded_size);
|
||||
text[prefix_size + expanded_size] = 0; /* just in case */
|
||||
text[prefix_size + expanded_size] = 0; /* just in case */
|
||||
|
||||
if (new_size == expanded_size)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
*newlength = prefix_size + expanded_size;
|
||||
return; /* The success return! */
|
||||
}
|
||||
if (new_size == expanded_size)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
*newlength = prefix_size + expanded_size;
|
||||
return; /* The success return! */
|
||||
}
|
||||
|
||||
png_warning(png_ptr, "png_inflate logic error");
|
||||
png_free(png_ptr, text);
|
||||
}
|
||||
else
|
||||
png_warning(png_ptr, "png_inflate logic error");
|
||||
png_free(png_ptr, text);
|
||||
}
|
||||
else
|
||||
png_warning(png_ptr, "Not enough memory to decompress chunk");
|
||||
}
|
||||
}
|
||||
|
||||
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
char umsg[50];
|
||||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", comp_type);
|
||||
png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d",
|
||||
comp_type);
|
||||
png_warning(png_ptr, umsg);
|
||||
#else
|
||||
png_warning(png_ptr, "Unknown zTXt compression type");
|
||||
@@ -388,13 +395,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
|
||||
if (text != NULL)
|
||||
{
|
||||
if (prefix_size > 0)
|
||||
if (prefix_size > 0)
|
||||
png_memcpy(text, png_ptr->chunkdata, prefix_size);
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = text;
|
||||
|
||||
/* This is an extra zero in the 'uncompressed' part. */
|
||||
*(png_ptr->chunkdata + prefix_size) = 0x00;
|
||||
/* This is an extra zero in the 'uncompressed' part. */
|
||||
*(png_ptr->chunkdata + prefix_size) = 0x00;
|
||||
}
|
||||
/* Ignore a malloc error here - it is safe. */
|
||||
}
|
||||
@@ -890,9 +897,11 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
green_x, green_y, blue_x, blue_y);
|
||||
#else
|
||||
fprintf(stderr, "wx=%ld, wy=%ld, rx=%ld, ry=%ld\n",
|
||||
int_x_white, int_y_white, int_x_red, int_y_red);
|
||||
(long)int_x_white, (long)int_y_white,
|
||||
(long)int_x_red, (long)int_y_red);
|
||||
fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n",
|
||||
int_x_green, int_y_green, int_x_blue, int_y_blue);
|
||||
(long)int_x_green, (long)int_y_green,
|
||||
(long)int_x_blue, (long)int_y_blue);
|
||||
#endif
|
||||
#endif /* PNG_CONSOLE_IO_SUPPORTED */
|
||||
}
|
||||
|
||||
5
harbour/external/png/pngtrans.c
vendored
5
harbour/external/png/pngtrans.c
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Last changed in libpng 1.4.2 [April 29, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@@ -655,7 +655,6 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||
"This version of libpng does not support user transform info");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function returns a pointer to the user_transform_ptr associated with
|
||||
* the user transform functions. The application should free any memory
|
||||
@@ -673,4 +672,6 @@ png_get_user_transform_ptr(png_structp png_ptr)
|
||||
return (NULL);
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
||||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
|
||||
2
harbour/external/png/pngwio.c
vendored
2
harbour/external/png/pngwio.c
vendored
@@ -155,7 +155,7 @@ png_default_flush(png_structp png_ptr)
|
||||
* arguments a pointer to a png_struct. After a call to
|
||||
* the flush function, there should be no data in any buffers
|
||||
* or pending transmission. If the output method doesn't do
|
||||
* any buffering of ouput, a function prototype must still be
|
||||
* any buffering of output, a function prototype must still be
|
||||
* supplied although it doesn't have to do anything. If
|
||||
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||
* time, output_flush_fn will be ignored, although it must be
|
||||
|
||||
Reference in New Issue
Block a user