Imported from libpng-1.0.5h.tar

This commit is contained in:
Glenn Randers-Pehrson 1999-12-10 09:43:02 -06:00
parent 074af5e9ca
commit 166c5a397e
62 changed files with 3740 additions and 1045 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.0.5d - November 29, 1999
Libpng 1.0.5h - December 10, 1999
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@ -33,14 +33,53 @@ version libpng-1.0.5c November 26, 1999
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
Removed some extraneous "-I" from contrib/pngminus/makefile.std
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
version 1.0.5d [November 29, 1999]
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
version libpng-1.0.5d November 29, 1999
Add type cast (png_const_charp) two places in png.c
Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays.
Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available
to applications a macro "PNG_USE_LOCAL_ARRAYS".
#ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined.
Added PNG_EXPORT_VAR macro to accommodate making DLL's.
version libpng-1.0.5e November 30, 1999
Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text
structure; refactored the inflate/deflate support to make adding new chunks
with trailing compressed parts easier in the future, and added new functions
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
NOTE: Applications that write text chunks MUST define png_text->lang. Before
calling png_set_text(). It must be set to NULL if you want to write tEXt or
zTXt chunks. If you want your application to be able to run with older
versions of libpng, use
#ifdef PNG_iTXt_SUPPORTED
png_text[i].lang = NULL;
#endif
Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned
offsets (Eric S. Raymond).
Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into
PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED
macros, leaving the separate macros also available.
Removed comments on #endifs at the end of many short, non-nested #if-blocks.
version libpng-1.0.5f December 6, 1999
Changed makefile.solaris to issue a warning about potential problems when
the ucb "ld" is in the path ahead of the ccs "ld".
Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3.
Added sCAL chunk support (Eric S. Raymond).
version libpng-1.0.5g December 7, 1999
Fixed "png_free_spallettes" typo in png.h
Added code to handle new chunks in pngpread.c
Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block
Added "translated_key" to png_text structure and png_write_iTXt().
Added code in pngwrite.c to work around a newly discovered zlib bug.
version 1.0.5h [December 10, 1999]
NOTE: regarding the not for version 1.0.5e, the following must also
be included in your code:
png_text[i].translated_key = NULL;
Unknown chunk handling is now supported.
Option to eliminate all floating point support was added. Some new
fixed-point functions such as png_set_gAMA_fixed() were added.
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

41
CHANGES
View File

@ -503,7 +503,7 @@ version 1.0.5c [November 26, 1999]
PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined.
Removed some extraneous "-I" from contrib/pngminus/makefile.std
Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2.
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3
version 1.0.5d [November 29, 1999]
Add type cast (png_const_charp) two places in png.c
Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays.
@ -511,3 +511,42 @@ version 1.0.5d [November 29, 1999]
to applications a macro "PNG_USE_LOCAL_ARRAYS".
#ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined.
Added PNG_EXPORT_VAR macro to accommodate making DLL's.
version 1.0.5e [November 30, 1999]
Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text
structure; refactored the inflate/deflate support to make adding new chunks
with trailing compressed parts easier in the future, and added new functions
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
NOTE: Applications that write text chunks MUST define png_text->lang and
before calling png_set_text(). It must be set to NULL if you want to
write tEXt or zTXt chunks. If you want your application to be able to
run with older versions of libpng, use
#ifdef PNG_iTXt_SUPPORTED
png_text[i].lang = NULL;
#endif
Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned
offsets (Eric S. Raymond).
Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into
PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED
macros, leaving the separate macros also available.
Removed comments on #endifs at the end of many short, non-nested #if-blocks.
version 1.0.5f [December 6, 1999]
Changed makefile.solaris to issue a warning about potential problems when
the ucb "ld" is in the path ahead of the ccs "ld".
Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3.
Added sCAL chunk support (Eric S. Raymond).
version 1.0.5g [December 7, 1999]
Fixed "png_free_spallettes" typo in png.h
Added code to handle new chunks in pngpread.c
Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block
Added "translated_key" to png_text structure and png_write_iTXt().
Added code in pngwrite.c to work around a newly discovered zlib bug.
version 1.0.5h [December 10, 1999]
NOTE: regarding the not for version 1.0.5e, the following must also
be included in your code:
png_text[i].translated_key = NULL;
Unknown chunk handling is now supported.
Option to eliminate all floating point support was added. Some new
fixed-point functions such as png_set_gAMA_fixed() were added.

View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.5d - November 29, 1999
Installing libpng version 1.0.5h - December 10, 1999
Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.0.5d" or "lpng103" and "zlib-1.1.3"
might be called "libpng-1.0.5h" or "lpng103" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@ -51,8 +51,8 @@ include
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.sgi => Silicon Graphics IRIX makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5d)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5d)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.5h)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.5h)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

View File

@ -14,8 +14,8 @@ Known bugs and suggested enhancements in libpng-1.0.5
Question whether i-- or --i is better.
STATUS: Under investigation, postponed until after
libpng-1.0.5. About 160 loops will be turned around
in libpng-1.0.Nn, for testing.
libpng-1.1.0. About 160 loops will be turned around
in libpng-1.1.Nn, for testing.
2. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
@ -43,7 +43,7 @@ Known bugs and suggested enhancements in libpng-1.0.5
pngvcrd.c is failing for interlaced PNGs that have empty passes.
STATUS: A check for "width != 0" is required in several places.
Fixed in libpng-1.0.5a/1.0.6
Fixed in libpng-1.0.5a/1.1.0
5. October 1999 -- BUG
@ -56,4 +56,12 @@ Known bugs and suggested enhancements in libpng-1.0.5
text->key strings. Fix for the latter problem is to duplicate code
from png.c.
Fixed in libpng-1.0.5a/1.0.6
Fixed in libpng-1.0.5a/1.1.0
6. December 1999 -- new BUG
The png_text structure was modified in libpng-1.0.5e in a manner that
is not backward compatible (the lang member was added, and the
translated_key member was added to libpng-1.0.5g)
STATUS: Will be fixed before the next public release.

View File

@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.5d, November 29, 1999)
(libpng versions 0.97, January 1998, through 1.0.5h, December 10, 1999)
For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals:
@ -18,6 +18,7 @@ is defined as the following set of individuals:
Tom Lane
Dave Martindale
Glenn Randers-Pehrson
Eric S. Raymond
Greg Roelofs
Guy Eric Schalnat
Paul Schmidt
@ -67,4 +68,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
randeg@alum.rpi.edu
November 29, 1999
December 10, 1999

6
README
View File

@ -1,4 +1,4 @@
README for libpng 1.0.5d - November 29, 1999 (shared library 2.1)
README for libpng 1.0.5h - December 10, 1999 (shared library 2.1)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@ -171,9 +171,9 @@ Files in this distribution:
makefile.sgi => Silicon Graphics IRIX makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.5d)
(gcc, creates libpng.so.2.1.0.5h)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.5d)
(gcc, creates libpng.so.2.1.0.5h)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile

2
TODO
View File

@ -4,7 +4,6 @@ Final bug fixes.
Fix problem with C++ and EXTERN "C".
Better C++ wrapper/full C++ implementation?
Keep up with public chunks.
sPLT chunk handling.
cHRM transformation.
Support for application-defined chunk handlers.
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
@ -17,7 +16,6 @@ Man pages for function calls.
Better documentation.
Better filter selection
(counting huffman bits/precompression? filter inertia? filter costs?).
Optional palette (sPLT) creation.
Histogram creation.
Text conversion between different code pages (Latin-1 -> Mac and DOS).
Improve API by hiding the info_ptr.

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
November 29, 1999
December 10, 1999
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.0.5d are Y2K compliant. It is my belief that earlier
upward through 1.0.5h 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

View File

@ -17,7 +17,7 @@
# "c:\windows\command.com /e:4096" as the program command line and set the
# working directory to this directory. Then double-click to open the new
# DOS-prompt window with a bigger environment and retry the commands above.
#
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.

View File

@ -45,20 +45,20 @@ $ CALL MAKE writepng.OBJ "cc ''CCOPT' writepng" -
$ write sys$output "Building rpng-x..."
$ CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" -
rpng-x.c readpng.h
$ call make rpng-x.exe -
"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
$ call make rpng-x.exe -
"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
rpng-x.obj readpng.obj
$ write sys$output "Building rpng2-x..."
$ CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" -
rpng2-x.c readpng2.h
$ call make rpng2-x.exe -
"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
$ call make rpng2-x.exe -
"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
rpng2-x.obj readpng2.obj
$ write sys$output "Building wpng..."
$ CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" -
wpng.c writepng.h
$ call make wpng.exe -
"LINK wpng,writepng,lib.opt/opt" -
$ call make wpng.exe -
"LINK wpng,writepng,lib.opt/opt" -
wpng.obj writepng.obj
$ exit
$!

View File

@ -32,8 +32,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "png.h" /* libpng header; includes zlib.h */
#include "readpng.h" /* typedefs, common macros, public prototypes */
#include "png.h" /* libpng header; includes zlib.h */
#include "readpng.h" /* typedefs, common macros, public prototypes */
static png_structp png_ptr = NULL;
@ -50,7 +50,7 @@ void readpng_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
}
}
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */

View File

@ -30,10 +30,10 @@
---------------------------------------------------------------------------*/
#include <stdlib.h> /* for exit() prototype */
#include <stdlib.h> /* for exit() prototype */
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "readpng2.h" /* typedefs, common macros, public prototypes */
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "readpng2.h" /* typedefs, common macros, public prototypes */
/* local prototypes */
@ -53,7 +53,7 @@ void readpng2_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
}
}
@ -70,7 +70,7 @@ int readpng2_check_sig(uch *sig, int num)
int readpng2_init(mainprog_info *mainprog_ptr)
{
png_structp png_ptr; /* note: temporary variables! */
png_structp png_ptr; /* note: temporary variables! */
png_infop info_ptr;
@ -176,7 +176,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
mainprog_ptr = png_get_progressive_ptr(png_ptr);
if (mainprog_ptr == NULL) { /* we be hosed */
if (mainprog_ptr == NULL) { /* we be hosed */
fprintf(stderr,
"readpng2 error: main struct not recoverable in info_callback.\n");
fflush(stderr);
@ -408,7 +408,7 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
fflush(stderr);
mainprog_ptr = png_get_error_ptr(png_ptr);
if (mainprog_ptr == NULL) { /* we are completely hosed now */
if (mainprog_ptr == NULL) { /* we are completely hosed now */
fprintf(stderr,
"readpng2 severe error: jmpbuf not recoverable; terminating.\n");
fflush(stderr);

View File

@ -61,7 +61,7 @@ typedef struct _mainprog_info {
uch *image_data;
uch **row_pointers;
jmp_buf jmpbuf;
int passes; /* not used */
int passes; /* not used */
int rowbytes;
int channels;
int need_bgcolor;

View File

@ -53,7 +53,7 @@
/* #define DEBUG : this enables the Trace() macros */
#include "readpng.h" /* typedefs, common macros, readpng prototypes */
#include "readpng.h" /* typedefs, common macros, readpng prototypes */
/* could just include png.h, but this macro is the only thing we need
@ -61,10 +61,10 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
@ -78,7 +78,7 @@ LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char *progname = PROGNAME;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@ -104,15 +104,15 @@ static HWND global_hwnd;
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
{
char *args[1024]; /* arbitrary limit, but should suffice */
char *args[1024]; /* arbitrary limit, but should suffice */
char *p, *q, **argv = args;
int argc = 0;
int rc, alen, flen;
int error = 0;
int have_bg = FALSE;
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
MSG msg;
@ -150,7 +150,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
LUT_exponent = 1.8 / 2.61;
/*
if (some_mac_function_that_returns_gamma(&mac_gamma))
LUT_exponent = mac_gamma / 2.61;
LUT_exponent = mac_gamma / 2.61;
*/
#else
LUT_exponent = 1.0; /* assume no LUT: most PCs */
@ -371,7 +371,7 @@ static int rpng_win_create_window(HINSTANCE hInst, int showmode)
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
wimage_rowbytes*image_height)))
{
return 4; /* fail */
return 4; /* fail */
}
/*---------------------------------------------------------------------------
@ -477,7 +477,7 @@ static int rpng_win_display_image()
g = *src++;
b = *src++;
*dest++ = b;
*dest++ = g; /* note reverse order */
*dest++ = g; /* note reverse order */
*dest++ = r;
}
} else /* if (image_channels == 4) */ {
@ -582,15 +582,15 @@ LRESULT CALLBACK rpng_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
/* wait for the user to tell us when to quit */
case WM_CHAR:
switch (wP) { /* only need one, so ignore repeat count */
switch (wP) { /* only need one, so ignore repeat count */
case 'q':
case 'Q':
case 0x1B: /* Esc key */
case 0x1B: /* Esc key */
PostQuitMessage(0);
}
return 0;
case WM_LBUTTONDOWN: /* another way of quitting */
case WM_LBUTTONDOWN: /* another way of quitting */
case WM_DESTROY:
PostQuitMessage(0);
return 0;

View File

@ -54,18 +54,18 @@
/* #define DEBUG : this enables the Trace() macros */
#include "readpng.h" /* typedefs, common macros, readpng prototypes */
#include "readpng.h" /* typedefs, common macros, readpng prototypes */
/* could just include png.h, but this macro is the only thing we need
* (name and typedefs changed to local versions); note that side effects
* only happen with alpha (which could easily be avoided with
* (name and typedefs changed to local versions); note that side effects
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
@ -123,9 +123,9 @@ int main(int argc, char **argv)
int rc, alen, flen;
int error = 0;
int have_bg = FALSE;
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
XEvent e;
KeySym k;
@ -222,7 +222,7 @@ int main(int argc, char **argv)
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error;
} else {
if ((rc = readpng_init(infile, (long *)(&image_width),
if ((rc = readpng_init(infile, (long *)(&image_width),
(long *)(&image_height))) != 0) {
switch (rc) {
case 1:
@ -408,11 +408,11 @@ static int rpng_x_create_window()
}
have_colormap = TRUE;
} else if (depth == 16) {
RPixelShift = 15 - rpng_x_msb(RedMask); /* these are right-shifts */
RPixelShift = 15 - rpng_x_msb(RedMask); /* these are right-shifts */
GPixelShift = 15 - rpng_x_msb(GreenMask);
BPixelShift = 15 - rpng_x_msb(BlueMask);
} else /* if (depth > 16) */ {
RPixelShift = rpng_x_msb(RedMask) - 7; /* these are left-shifts */
RPixelShift = rpng_x_msb(RedMask) - 7; /* these are left-shifts */
GPixelShift = rpng_x_msb(GreenMask) - 7;
BPixelShift = rpng_x_msb(BlueMask) - 7;
}

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------
rpng2 - progressive-model PNG display program rpng2-win.c
rpng2 - progressive-model PNG display program rpng2-win.c
This program decodes and displays PNG files progressively, as if it were
a web browser (though the front end is only set up to read from files).
@ -57,9 +57,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <time.h>
#include <math.h> /* only for PvdM background code */
#include <math.h> /* only for PvdM background code */
#include <windows.h>
/* all for PvdM background code: */
@ -80,9 +80,9 @@
#define rgb2_max bg_bsat
#define rgb2_min bg_brot
/* #define DEBUG */ /* this enables the Trace() macros */
/* #define DEBUG */ /* this enables the Trace() macros */
#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
/* could just include png.h, but this macro is the only thing we need
@ -90,18 +90,18 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
* block size corresponds roughly to a download
* speed 10% faster than theoretical 33.6K maximum
* (assuming 8 data bits, 1 stop bit and no other
* overhead) */
#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
* block size corresponds roughly to a download
* speed 10% faster than theoretical 33.6K maximum
* (assuming 8 data bits, 1 stop bit and no other
* overhead) */
/* local prototypes */
static void rpng2_win_init(void);
@ -116,7 +116,7 @@ LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char *progname = PROGNAME;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@ -125,7 +125,7 @@ static mainprog_info rpng2_info;
static uch inbuf[INBUFSIZE];
static int incount;
static int pat = 6; /* must be less than num_bgpat */
static int pat = 6; /* must be less than num_bgpat */
static int bg_image = 0;
static int bgscale = 16;
static ulg bg_rowbytes;
@ -134,22 +134,22 @@ static uch *bg_data;
static struct rgb_color {
uch r, g, b;
} rgb[] = {
{ 0, 0, 0}, /* 0: black */
{255, 255, 255}, /* 1: white */
{173, 132, 57}, /* 2: tan */
{ 64, 132, 0}, /* 3: medium green */
{189, 117, 1}, /* 4: gold */
{253, 249, 1}, /* 5: yellow */
{ 0, 0, 255}, /* 6: blue */
{ 0, 0, 120}, /* 7: medium blue */
{255, 0, 255}, /* 8: magenta */
{ 64, 0, 64}, /* 9: dark magenta */
{255, 0, 0}, /* 10: red */
{ 64, 0, 0}, /* 11: dark red */
{255, 127, 0}, /* 12: orange */
{192, 96, 0}, /* 13: darker orange */
{ 24, 60, 0}, /* 14: dark green-yellow */
{ 85, 125, 200} /* 15: ice blue */
{ 0, 0, 0}, /* 0: black */
{255, 255, 255}, /* 1: white */
{173, 132, 57}, /* 2: tan */
{ 64, 132, 0}, /* 3: medium green */
{189, 117, 1}, /* 4: gold */
{253, 249, 1}, /* 5: yellow */
{ 0, 0, 255}, /* 6: blue */
{ 0, 0, 120}, /* 7: medium blue */
{255, 0, 255}, /* 8: magenta */
{ 64, 0, 64}, /* 9: dark magenta */
{255, 0, 0}, /* 10: red */
{ 64, 0, 0}, /* 11: dark red */
{255, 127, 0}, /* 12: orange */
{192, 96, 0}, /* 13: darker orange */
{ 24, 60, 0}, /* 14: dark green-yellow */
{ 85, 125, 200} /* 15: ice blue */
};
/* not used for now, but should be for error-checking:
static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@ -174,25 +174,25 @@ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
*/
static struct background_pattern {
ush type;
int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
} bg[] = {
{0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
{0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
{0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
{0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
{0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
{0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
{0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
{1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
{1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
{1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
{1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
{1, 3,0, 0,0}, /* diamonds: medium green vs. black */
{2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
{2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
{2, 16, 256, 100, 250}, /* radial: very tight spiral */
{2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
{0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
{0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
{0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
{0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
{0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
{0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
{0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
{1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
{1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
{1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
{1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
{1, 3,0, 0,0}, /* diamonds: medium green vs. black */
{2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
{2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
{2, 16, 256, 100, 250}, /* radial: very tight spiral */
{2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
};
static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);
@ -212,16 +212,16 @@ static int global_showmode;
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
{
char *args[1024]; /* arbitrary limit, but should suffice */
char *args[1024]; /* arbitrary limit, but should suffice */
char *p, *q, *bgstr = NULL, **argv = args;
int argc = 0;
int rc, alen, flen;
int error = 0;
int timing = FALSE;
int have_bg = FALSE;
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
double default_display_exponent; /* whole display system */
MSG msg;
@ -267,7 +267,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
LUT_exponent = 1.8 / 2.61;
/*
if (some_mac_function_that_returns_gamma(&mac_gamma))
LUT_exponent = mac_gamma / 2.61;
LUT_exponent = mac_gamma / 2.61;
*/
#else
LUT_exponent = 1.0; /* assume no LUT: most PCs */
@ -560,7 +560,7 @@ static int rpng2_win_create_window()
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
wimage_rowbytes*rpng2_info.height)))
{
return 4; /* fail */
return 4; /* fail */
}
/*---------------------------------------------------------------------------
@ -655,7 +655,7 @@ static int rpng2_win_create_window()
TextOut(hdc, ((x < 0)? 0 : x), ((y < 0)? 0 : y), msg, len);
ReleaseDC(global_hwnd, hdc);
rpng2_win_load_bg_image(); /* resets bg_image if fails */
rpng2_win_load_bg_image(); /* resets bg_image if fails */
}
if (!bg_image) {
@ -753,7 +753,7 @@ static int rpng2_win_load_bg_image()
even_odd = even_odd_vert ^ even_odd_horiz;
invert_column =
(even_odd_horiz && (bg[pat].type & 0x10));
if (even_odd == 0) { /* gradient #1 */
if (even_odd == 0) { /* gradient #1 */
if (invert_column) {
*dest++ = r1_inv;
*dest++ = g1_inv;
@ -763,7 +763,7 @@ static int rpng2_win_load_bg_image()
*dest++ = g1;
*dest++ = b1;
}
} else { /* gradient #2 */
} else { /* gradient #2 */
if ((invert_column && invert_gradient2) ||
(!invert_column && !invert_gradient2))
{
@ -786,8 +786,8 @@ static int rpng2_win_load_bg_image()
} else if ((bg[pat].type & 0x07) == 1) {
hmax = (bgscale-1)/2; /* half the max weight of a color */
max = 2*hmax; /* the max weight of a color */
hmax = (bgscale-1)/2; /* half the max weight of a color */
max = 2*hmax; /* the max weight of a color */
r1 = rgb[bg[pat].rgb1_max].r;
g1 = rgb[bg[pat].rgb1_max].g;
@ -908,7 +908,7 @@ static int rpng2_win_load_bg_image()
g1 = *src++;
b1 = *src++;
*dest++ = b1;
*dest++ = g1; /* note reverse order */
*dest++ = g1; /* note reverse order */
*dest++ = r1;
}
}
@ -962,7 +962,7 @@ static void rpng2_win_display_row(ulg row)
g = *src++;
b = *src++;
*dest++ = b;
*dest++ = g; /* note reverse order */
*dest++ = g; /* note reverse order */
*dest++ = r;
}
} else /* if (rpng2_info.channels == 4) */ {
@ -1084,15 +1084,15 @@ LRESULT CALLBACK rpng2_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
/* wait for the user to tell us when to quit */
case WM_CHAR:
switch (wP) { /* only need one, so ignore repeat count */
switch (wP) { /* only need one, so ignore repeat count */
case 'q':
case 'Q':
case 0x1B: /* Esc key */
case 0x1B: /* Esc key */
PostQuitMessage(0);
}
return 0;
case WM_LBUTTONDOWN: /* another way of quitting */
case WM_LBUTTONDOWN: /* another way of quitting */
case WM_DESTROY:
PostQuitMessage(0);
return 0;

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------
rpng2 - progressive-model PNG display program rpng2-x.c
rpng2 - progressive-model PNG display program rpng2-x.c
This program decodes and displays PNG files progressively, as if it were
a web browser (though the front end is only set up to read from files).
@ -49,13 +49,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <time.h>
#include <math.h> /* only for PvdM background code */
#include <math.h> /* only for PvdM background code */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/keysym.h> /* defines XK_* macros */
#include <X11/keysym.h> /* defines XK_* macros */
#ifdef VMS
#include <unistd.h>
@ -79,9 +79,9 @@
#define rgb2_max bg_bsat
#define rgb2_min bg_brot
/* #define DEBUG */ /* this enables the Trace() macros */
/* #define DEBUG */ /* this enables the Trace() macros */
#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
/* could just include png.h, but this macro is the only thing we need
@ -89,18 +89,18 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
#define alpha_composite(composite, fg, alpha, bg) { \
ush temp = ((ush)(fg)*(ush)(alpha) + \
(ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
(composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
* block size corresponds roughly to a download
* speed 10% faster than theoretical 33.6K maximum
* (assuming 8 data bits, 1 stop bit and no other
* overhead) */
#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
* block size corresponds roughly to a download
* speed 10% faster than theoretical 33.6K maximum
* (assuming 8 data bits, 1 stop bit and no other
* overhead) */
/* local prototypes */
static void rpng2_x_init(void);
@ -123,7 +123,7 @@ static mainprog_info rpng2_info;
static uch inbuf[INBUFSIZE];
static int incount;
static int pat = 6; /* must be less than num_bgpat */
static int pat = 6; /* must be less than num_bgpat */
static int bg_image = 0;
static int bgscale = 16;
static ulg bg_rowbytes;
@ -132,22 +132,22 @@ static uch *bg_data;
static struct rgb_color {
uch r, g, b;
} rgb[] = {
{ 0, 0, 0}, /* 0: black */
{255, 255, 255}, /* 1: white */
{173, 132, 57}, /* 2: tan */
{ 64, 132, 0}, /* 3: medium green */
{189, 117, 1}, /* 4: gold */
{253, 249, 1}, /* 5: yellow */
{ 0, 0, 255}, /* 6: blue */
{ 0, 0, 120}, /* 7: medium blue */
{255, 0, 255}, /* 8: magenta */
{ 64, 0, 64}, /* 9: dark magenta */
{255, 0, 0}, /* 10: red */
{ 64, 0, 0}, /* 11: dark red */
{255, 127, 0}, /* 12: orange */
{192, 96, 0}, /* 13: darker orange */
{ 24, 60, 0}, /* 14: dark green-yellow */
{ 85, 125, 200} /* 15: ice blue */
{ 0, 0, 0}, /* 0: black */
{255, 255, 255}, /* 1: white */
{173, 132, 57}, /* 2: tan */
{ 64, 132, 0}, /* 3: medium green */
{189, 117, 1}, /* 4: gold */
{253, 249, 1}, /* 5: yellow */
{ 0, 0, 255}, /* 6: blue */
{ 0, 0, 120}, /* 7: medium blue */
{255, 0, 255}, /* 8: magenta */
{ 64, 0, 64}, /* 9: dark magenta */
{255, 0, 0}, /* 10: red */
{ 64, 0, 0}, /* 11: dark red */
{255, 127, 0}, /* 12: orange */
{192, 96, 0}, /* 13: darker orange */
{ 24, 60, 0}, /* 14: dark green-yellow */
{ 85, 125, 200} /* 15: ice blue */
};
/* not used for now, but should be for error-checking:
static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@ -172,21 +172,21 @@ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
*/
static struct background_pattern {
ush type;
int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
} bg[] = {
{0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
{0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
{0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
{0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
{0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
{0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
{0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
{1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
{1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
{1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
{1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
{1, 3,0, 0,0}, /* diamonds: medium green vs. black */
{0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
{0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
{0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
{0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
{0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
{0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
{0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
{1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
{1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
{1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
{1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
{1, 3,0, 0,0}, /* diamonds: medium green vs. black */
{2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
{2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
{2, 16, 256, 100, 250}, /* radial: very tight spiral */
@ -580,7 +580,7 @@ static int rpng2_x_create_window()
return 2;
}
have_colormap = TRUE;
bg_image = FALSE; /* gradient just wastes palette entries */
bg_image = FALSE; /* gradient just wastes palette entries */
} else if (depth == 16) {
RPixelShift = 15 - rpng2_x_msb(RedMask); /* these are right-shifts */
GPixelShift = 15 - rpng2_x_msb(GreenMask);
@ -684,7 +684,7 @@ static int rpng2_x_create_window()
---------------------------------------------------------------------------*/
if (bg_image)
rpng2_x_load_bg_image(); /* resets bg_image if fails */
rpng2_x_load_bg_image(); /* resets bg_image if fails */
if (!bg_image) {
if (depth == 24 || depth == 32) {
@ -795,7 +795,7 @@ static int rpng2_x_load_bg_image()
even_odd = even_odd_vert ^ even_odd_horiz;
invert_column =
(even_odd_horiz && (bg[pat].type & 0x10));
if (even_odd == 0) { /* gradient #1 */
if (even_odd == 0) { /* gradient #1 */
if (invert_column) {
*dest++ = r1_inv;
*dest++ = g1_inv;
@ -805,7 +805,7 @@ static int rpng2_x_load_bg_image()
*dest++ = g1;
*dest++ = b1;
}
} else { /* gradient #2 */
} else { /* gradient #2 */
if ((invert_column && invert_gradient2) ||
(!invert_column && !invert_gradient2))
{
@ -828,8 +828,8 @@ static int rpng2_x_load_bg_image()
} else if ((bg[pat].type & 0x07) == 1) {
hmax = (bgscale-1)/2; /* half the max weight of a color */
max = 2*hmax; /* the max weight of a color */
hmax = (bgscale-1)/2; /* half the max weight of a color */
max = 2*hmax; /* the max weight of a color */
r1 = rgb[bg[pat].rgb1_max].r;
g1 = rgb[bg[pat].rgb1_max].g;

View File

@ -57,27 +57,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h> /* for jmpbuf declaration in writepng.h */
#include <setjmp.h> /* for jmpbuf declaration in writepng.h */
#include <time.h>
#ifdef DOS_OS2_W32
# include <io.h> /* for isatty(), setmode() prototypes */
# include <fcntl.h> /* O_BINARY for fdopen() without text translation */
# include <io.h> /* for isatty(), setmode() prototypes */
# include <fcntl.h> /* O_BINARY for fdopen() without text translation */
# ifdef __EMX__
# ifndef getch
# define getch() _read_kbd(0, 1, 0) /* need getche() */
# define getch() _read_kbd(0, 1, 0) /* need getche() */
# endif
# else /* !__EMX__ */
# ifdef __GO32__
# include <pc.h>
# define getch() getkey() /* GRR: need getche() */
# define getch() getkey() /* GRR: need getche() */
# else
# include <conio.h> /* for getche() console input */
# include <conio.h> /* for getche() console input */
# endif
# endif /* ?__EMX__ */
# define FGETS(buf,len,stream) dos_kbd_gets(buf,len)
#else
# include <unistd.h> /* for isatty() prototype */
# include <unistd.h> /* for isatty() prototype */
# define FGETS fgets
#endif
@ -87,7 +87,7 @@
text that includes control characters discouraged by the PNG spec; text
that includes an escape character (27) must be re-entered regardless */
#include "writepng.h" /* typedefs, common macros, writepng prototypes */
#include "writepng.h" /* typedefs, common macros, writepng prototypes */
@ -112,7 +112,7 @@ int main(int argc, char **argv)
FILE *keybd;
#endif
#ifdef sgi
FILE *tmpfile; /* or we could just use keybd, since no overlap */
FILE *tmpfile; /* or we could just use keybd, since no overlap */
char tmpline[80];
#endif
char *inname = NULL, outname[256];
@ -269,7 +269,7 @@ int main(int argc, char **argv)
": unable to reopen stdout in binary mode\n");
fclose(wpng_info.infile);
++error;
} else
} else
wpng_info.filter = TRUE;
}
} else if ((len = strlen(inname)) > 250) {
@ -419,7 +419,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_TITLE;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_TITLE;
valid = FALSE;
}
@ -449,7 +449,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_AUTHOR;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_AUTHOR;
valid = FALSE;
}
@ -489,7 +489,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_DESC;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_DESC;
valid = FALSE;
}
@ -519,7 +519,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_COPY;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_COPY;
valid = FALSE;
}
@ -549,7 +549,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_EMAIL;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_EMAIL;
valid = FALSE;
}
@ -579,7 +579,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_URL;
valid = FALSE;
#else
if (p[result] == 27) { /* escape character */
if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_URL;
valid = FALSE;
}
@ -743,10 +743,10 @@ static int wpng_isvalid_latin1(uch *p, int len)
for (i = 0; i < len; ++i) {
if (p[i] == 10 || (p[i] > 31 && p[i] < 127) || p[i] > 160)
continue; /* character is completely OK */
continue; /* character is completely OK */
if (result < 0 || (p[result] != 27 && p[i] == 27))
result = i; /* mark location of first questionable one */
} /* or of first escape character (bad) */
result = i; /* mark location of first questionable one */
} /* or of first escape character (bad) */
return result;
}
@ -791,11 +791,11 @@ static char *dos_kbd_gets(char *buf, int len)
buf[count++] = ch = getche();
} while (ch != '\r' && count < len-1);
buf[count--] = '\0'; /* terminate string */
if (buf[count] == '\r') /* Enter key makes CR, so change to newline */
buf[count--] = '\0'; /* terminate string */
if (buf[count] == '\r') /* Enter key makes CR, so change to newline */
buf[count] = '\n';
fprintf(stderr, "\n"); /* Enter key does *not* cause a newline */
fprintf(stderr, "\n"); /* Enter key does *not* cause a newline */
fflush(stderr);
return buf;

View File

@ -30,10 +30,10 @@
---------------------------------------------------------------------------*/
#include <stdlib.h> /* for exit() prototype */
#include <stdlib.h> /* for exit() prototype */
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "writepng.h" /* typedefs, common macros, public prototypes */
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "writepng.h" /* typedefs, common macros, public prototypes */
/* local prototype */
@ -48,7 +48,7 @@ void writepng_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
}
}