From 902d4d109afd16f71806d73a96653795b7095dcf Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 3 Aug 2010 21:10:04 -0500 Subject: [PATCH] [master] Correct use of _WINDOWS_ in pngconf.h --- ANNOUNCE | 1 + CHANGES | 1 + pngconf.h | 21 +++++++++++---------- pngpriv.h | 6 +----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 96f6bb834..74571fbbe 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -52,6 +52,7 @@ version 1.4.4beta04 [July 31, 2010] version 1.4.4beta05 [August 4, 2010] Updated projects/visualc71 so it can find scripts/pnglibconf.h Removed unused png_mem_* defines from pngconf.h. + Correct use of _WINDOWS_ in pngconf.h Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index c303dac8b..aa6e46166 100644 --- a/CHANGES +++ b/CHANGES @@ -2636,6 +2636,7 @@ version 1.4.4beta04 [July 31, 2010] version 1.4.4beta05 [August 4, 2010] Updated projects/visualc71 so it can find scripts/pnglibconf.h Removed unused png_mem_* defines from pngconf.h. + Correct use of _WINDOWS_ in pngconf.h Send comments/corrections/commendations to glennrp at users.sourceforge.net or to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngconf.h b/pngconf.h index 819f665d4..47dcd0148 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1124,7 +1124,7 @@ typedef unsigned char png_byte; #else typedef size_t png_size_t; #endif -#define png_sizeof(x) sizeof(x) +#define png_sizeof(x) (sizeof (x)) /* The following is needed for medium model support. It cannot be in the * pngpriv.h header. Needs modification for other compilers besides @@ -1428,14 +1428,10 @@ typedef char FAR * FAR * FAR * png_charppp; /* memory model/platform independent fns */ #ifndef PNG_ABORT -# ifdef _WIN32_WCE -# define PNG_ABORT() exit(-1) +# ifdef _WINDOWS_ +# define PNG_ABORT() ExitProcess(0) # else -# ifdef _WINDOWS_ -# define PNG_ABORT() ExitProcess(0) -# else -# define PNG_ABORT() abort() -# endif +# define PNG_ABORT() abort() # endif #endif @@ -1514,8 +1510,13 @@ typedef char FAR * FAR * FAR * png_charppp; # if defined(_MSC_VER) && defined(MAXSEG_64K) typedef unsigned long png_alloc_size_t; # else -# if defined(_WINDOWS_) && (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) - typedef DWORD png_alloc_size_t; + /* This is an attempt to detect an old Windows system where (int) is + * actually 16 bits, in that case png_malloc must have an argument with a + * bigger size to accomodate the requirements of the library. + */ +# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \ + (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) + typedef DWORD png_alloc_size_t; # else typedef png_size_t png_alloc_size_t; # endif diff --git a/pngpriv.h b/pngpriv.h index 2079b2949..22b96df4c 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng * - * libpng version 1.4.4beta05 - August 3, 2010 + * libpng version 1.4.4beta05 - August 4, 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) @@ -77,10 +77,6 @@ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) # include /* defines _WINDOWS_ macro */ -/* I have no idea why is this necessary... */ -# ifdef _MSC_VER -# include -# endif #endif /* Various modes of operation. Note that after an init, mode is set to