[devel] Made FIXED and FLOATING options consistent in the APIs they enable
and disable.  Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
diff --git a/ANNOUNCE b/ANNOUNCE
index 91120c6..0f3b7da 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.0beta32 - June 26, 2010
+Libpng 1.5.0beta33 - June 26, 2010
 
 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.
@@ -9,20 +9,20 @@
 Source files with LF line endings (for Unix/Linux) and with a
 "configure" script
 
-   1.5.0beta32.tar.xz (LZMA-compressed, recommended)
-   1.5.0beta32.tar.gz
-   1.5.0beta32.tar.bz2
+   1.5.0beta33.tar.xz (LZMA-compressed, recommended)
+   1.5.0beta33.tar.gz
+   1.5.0beta33.tar.bz2
 
 Source files with CRLF line endings (for Windows), without the
 "configure" script
 
-   lp150b32.zip
-   lp150b32.7z
+   lp150b33.zip
+   lp150b33.7z
 
 Other information:
 
-   1.5.0beta32-README.txt
-   1.5.0beta32-LICENSE.txt
+   1.5.0beta33-README.txt
+   1.5.0beta33-LICENSE.txt
 
 Changes since the last public release (1.4.1):
 
@@ -252,7 +252,12 @@
   Removed some trailing blanks.
 
 version 1.5.0beta32 [June 26, 2010]
-  Removed leftover scripts/options.patch and scripts/options.rej.
+  Removed leftover scripts/options.patch and scripts/options.rej
+
+version 1.5.0beta32 [June 26, 2010]
+  Made FIXED and FLOATING options consistent in the APIs they enable and
+    disable.  Corrected scripts/options.awk to handle both command line
+    options and options specified in the .dfa files.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index 90d0fe3..cac7d2a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2736,6 +2736,11 @@
 version 1.5.0beta32 [June 26, 2010]
   Removed leftover scripts/options.patch and scripts/options.rej
 
+version 1.5.0beta32 [June 26, 2010]
+  Made FIXED and FLOATING options consistent in the APIs they enable and
+    disable.  Corrected scripts/options.awk to handle both command line
+    options and options specified in the .dfa files.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/png.h b/png.h
index 2b4effe..24f25b9 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.5.0beta32 - June 26, 2010
+ * libpng version 1.5.0beta33 - June 26, 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.5.0beta32 - June 26, 2010: Glenn
+ *   libpng versions 0.97, January 1998, through 1.5.0beta33 - June 26, 2010: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -140,7 +140,7 @@
  *    1.4.1                   14    10401  14.so.14.1[.0]
  *    1.4.2                   14    10402  14.so.14.2[.0]
  *    1.4.3                   14    10403  14.so.14.3[.0]
- *    1.5.0beta01-32          15    10500  15.so.15.0[.0]
+ *    1.5.0beta01-33          15    10500  15.so.15.0[.0]
  *
  *   Henceforth the source version will match the shared-library major
  *   and minor numbers; the shared-library major version number will be
@@ -172,7 +172,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta32, June 26, 2010, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.0beta33, June 26, 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:
@@ -290,7 +290,7 @@
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.5.0beta32 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.5.0beta33 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
@@ -346,9 +346,9 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.5.0beta32"
+#define PNG_LIBPNG_VER_STRING "1.5.0beta33"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.5.0beta32 - June 26, 2010\n"
+     " libpng version 1.5.0beta33 - June 26, 2010\n"
 
 #define PNG_LIBPNG_VER_SONUM   15
 #define PNG_LIBPNG_VER_DLLNUM  15
@@ -361,7 +361,7 @@
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  */
 
-#define PNG_LIBPNG_VER_BUILD  32
+#define PNG_LIBPNG_VER_BUILD  33
 
 /* Release Status */
 #define PNG_LIBPNG_BUILD_ALPHA    1
@@ -836,7 +836,7 @@
 /* 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_5_0beta32;
+typedef png_structp version_1_5_0beta33;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -998,16 +998,17 @@
 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 /* Expand the grayscale to 24-bit RGB if necessary. */
 extern PNG_EXPORT(void,png_set_gray_to_rgb,(png_structp png_ptr),,31);
-#endif
 
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 /* Reduce RGB to grayscale. */
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
 extern PNG_EXPORT(void,png_set_rgb_to_gray,(png_structp png_ptr,
     int error_action, double red, double green ),,32);
 #  endif
+#  ifdef PNG_FIXED_POINT_SUPPORTED
 extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed,(png_structp png_ptr,
     int error_action, png_fixed_point red, png_fixed_point green),,33);
+#  endif
+
 extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status,(png_structp png_ptr),,
     34);
 #endif
@@ -1081,6 +1082,7 @@
     png_color_16p background_color, int background_gamma_code,
     int need_expand, double background_gamma),,47);
 #  endif
+/* TODO: png_set_background_fixed */
 #  define PNG_BACKGROUND_GAMMA_UNKNOWN 0
 #  define PNG_BACKGROUND_GAMMA_SCREEN  1
 #  define PNG_BACKGROUND_GAMMA_FILE    2
@@ -1107,6 +1109,7 @@
 extern PNG_EXPORT(void,png_set_gamma,(png_structp png_ptr,
     double screen_gamma, double default_file_gamma),,50);
 #  endif
+/* TODO: png_set_gamma_fixed */
 #endif
 
 
@@ -1267,6 +1270,7 @@
     int heuristic_method, int num_weights, png_doublep filter_weights,
     png_doublep filter_costs),,68);
 #  endif
+/* TODO: png_set_filter_heuristics_fixed */
 #endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
 
 /* Heuristic used for row filter selection.  These defines should NOT be
@@ -1582,6 +1586,7 @@
 extern PNG_EXPORT(float, png_get_pixel_aspect_ratio,
     (png_structp png_ptr, png_infop info_ptr),,125);
 #  endif
+/* TODO: png_get_pixel_aspect_ratio_fixed */
 
 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
 extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels,
@@ -1648,8 +1653,10 @@
 extern PNG_EXPORT(png_uint_32,png_get_gAMA,(png_structp png_ptr,
     png_infop info_ptr, double *file_gamma),,137);
 #  endif
+#  ifdef PNG_FIXED_POINT_SUPPORTED
 extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed,(png_structp png_ptr,
     png_infop info_ptr, png_fixed_point *int_file_gamma),,138);
+#  endif
 #endif
 
 #ifdef PNG_gAMA_SUPPORTED
@@ -1657,8 +1664,10 @@
 extern PNG_EXPORT(void,png_set_gAMA,(png_structp png_ptr,
     png_infop info_ptr, double file_gamma),,139);
 #  endif
+#  ifdef PNG_FIXED_POINT_SUPPORTED
 extern PNG_EXPORT(void,png_set_gAMA_fixed,(png_structp png_ptr,
     png_infop info_ptr, png_fixed_point int_file_gamma),,140);
+#  endif
 #endif
 
 #ifdef PNG_hIST_SUPPORTED
@@ -1813,12 +1822,11 @@
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
 extern PNG_EXPORT(png_uint_32,png_get_sCAL,(png_structp png_ptr,
     png_infop info_ptr, int *unit, double *width, double *height),,168);
-#  else
-#    ifdef PNG_FIXED_POINT_SUPPORTED
+#  endif
+#  ifdef PNG_FIXED_POINT_SUPPORTED
 extern PNG_EXPORT(png_uint_32,png_get_sCAL_s,(png_structp png_ptr,
     png_infop info_ptr, int *unit, png_charpp swidth,
     png_charpp sheight),,169);
-#    endif
 #  endif
 #endif /* PNG_sCAL_SUPPORTED */
 
@@ -1826,12 +1834,11 @@
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
 extern PNG_EXPORT(void,png_set_sCAL,(png_structp png_ptr,
     png_infop info_ptr, int unit, double width, double height),,170);
-#  else
-#    ifdef PNG_FIXED_POINT_SUPPORTED
+#  endif
+#  ifdef PNG_FIXED_POINT_SUPPORTED
 extern PNG_EXPORT(void,png_set_sCAL_s,(png_structp png_ptr,
     png_infop info_ptr, int unit, png_charp swidth,
     png_charp sheight),,171);
-#    endif
 #  endif
 #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
 
diff --git a/pngget.c b/pngget.c
index 296876f..6052f74 100644
--- a/pngget.c
+++ b/pngget.c
@@ -684,7 +684,7 @@
 
    return(0);
 }
-#else
+#endif
 #ifdef PNG_FIXED_POINT_SUPPORTED
 png_uint_32 PNGAPI
 png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
@@ -703,7 +703,6 @@
 }
 #endif
 #endif
-#endif
 
 #ifdef PNG_pHYs_SUPPORTED
 png_uint_32 PNGAPI
diff --git a/pngrtran.c b/pngrtran.c
index 86ba1c5..084503a 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -662,26 +662,12 @@
 #endif
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-/* Convert a RGB image to a grayscale of the same width.  This allows us,
- * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
- */
-
-void PNGAPI
-png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
-    double green)
-{
-   int red_fixed = (int)((float)red*100000.0 + 0.5);
-   int green_fixed = (int)((float)green*100000.0 + 0.5);
-
-   if (png_ptr == NULL)
-      return;
-
-   png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
-}
+void
+#ifdef PNG_FIXED_POINT_SUPPORTED
+    PNGAPI
+#else
+    /* PRIVATE */
 #endif
-
-void PNGAPI
 png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
     png_fixed_point red, png_fixed_point green)
 {
@@ -741,6 +727,26 @@
           (png_uint_16)(32768 - red_int - green_int);
    }
 }
+
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+/* Convert a RGB image to a grayscale of the same width.  This allows us,
+ * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
+ */
+
+void PNGAPI
+png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
+    double green)
+{
+   int red_fixed = (int)((float)red*100000.0 + 0.5);
+   int green_fixed = (int)((float)green*100000.0 + 0.5);
+
+   if (png_ptr == NULL)
+      return;
+
+   png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
+}
+#endif /* FLOATING POINT */
+
 #endif
 
 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
diff --git a/pngrutil.c b/pngrutil.c
index a3b37d9..c91b1c8 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -746,8 +746,8 @@
    png_ptr->gamma = file_gamma;
 #  endif
    png_set_gAMA(png_ptr, info_ptr, file_gamma);
-#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
+#else
+   /* Fixed point must be set! */
    png_set_gAMA_fixed(png_ptr, info_ptr, igamma);
 #endif
 }
@@ -3187,7 +3187,7 @@
          break;
       }
       default:
-         png_warning(png_ptr, "Ignoring bad adaptive filter type");
+         png_error(png_ptr, "Ignoring bad adaptive filter type");
          *row = 0;
          break;
    }
diff --git a/pngset.c b/pngset.c
index 59d8225..85c4bc5 100644
--- a/pngset.c
+++ b/pngset.c
@@ -141,6 +141,7 @@
       png_warning(png_ptr, "Setting gamma = 0");
 }
 #endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
 void PNGAPI
 png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
     int_gamma)
@@ -172,15 +173,14 @@
 #ifdef PNG_FLOATING_POINT_SUPPORTED
    info_ptr->gamma = (float)(png_gamma/100000.);
 #endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
    info_ptr->int_gamma = png_gamma;
-#endif
    info_ptr->valid |= PNG_INFO_gAMA;
 
    if (png_gamma == 0)
       png_warning(png_ptr, "Setting gamma = 0");
 }
 #endif
+#endif
 
 #ifdef PNG_hIST_SUPPORTED
 void PNGAPI
@@ -368,7 +368,7 @@
 }
 #endif
 
-#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 void PNGAPI
 png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
@@ -385,7 +385,7 @@
 
    info_ptr->valid |= PNG_INFO_sCAL;
 }
-#else
+#endif
 #ifdef PNG_FIXED_POINT_SUPPORTED
 void PNGAPI
 png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
@@ -440,7 +440,6 @@
 }
 #endif
 #endif
-#endif
 
 #ifdef PNG_pHYs_SUPPORTED
 void PNGAPI
@@ -558,13 +557,13 @@
    png_set_sRGB(png_ptr, info_ptr, intent);
 
 #ifdef PNG_gAMA_SUPPORTED
-#ifdef PNG_FLOATING_POINT_SUPPORTED
-   file_gamma = (float).45455;
-   png_set_gAMA(png_ptr, info_ptr, file_gamma);
-#endif
 #ifdef PNG_FIXED_POINT_SUPPORTED
    int_file_gamma = 45455L;
    png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma);
+#else
+   /* Floating point must be set! */
+   file_gamma = (float).45455;
+   png_set_gAMA(png_ptr, info_ptr, file_gamma);
 #endif
 #endif
 
diff --git a/scripts/options.awk b/scripts/options.awk
index 0b80cec..234074d 100755
--- a/scripts/options.awk
+++ b/scripts/options.awk
@@ -85,6 +85,36 @@
     }
 }
 
+# variable=value
+#   Sets the given variable to the given value (the syntax is fairly
+#   free form, except for deb (you are expected to understand how to
+#   set the debug variable...)
+#
+#   This happens before the check on 'pre' below skips most of the
+#   rest of the actions, so the variable settings happen during
+#   preprocessing but are recorded in the END action too.  This
+#   allows them to be set on the command line too.
+$0 ~ /^[ 	]*everything[ 	=]*off[ 	]*$/{
+    everything = "off"
+    next
+}
+$0 ~ /^[ 	]*everything[ 	=]*on[ 	]*$/{
+    everything = "on"
+    next
+}
+$0 ~ /^[ 	]*logunsupported[ 	=]*0[ 	]*$/{
+    logunsupported = 0
+    next
+}
+$0 ~ /^[ 	]*logunsupported[ 	=]*1[ 	]*$/{
+    logunsupported = 1
+    next
+}
+$1 == "deb" && $2 == "=" && NF == 3{
+    deb = $3
+    next
+}
+
 # Preprocessing - this just copies the input file with lines
 # that need preprocessing (just chunk at present) expanded
 # The bare "pre" instead of "pre != 0" crashes under Sunos awk
@@ -153,31 +183,6 @@
     next
 }
 
-# variable=value
-#   Sets the given variable to the given value (the syntax is fairly
-#   free form, except for deb (you are expected to understand how to
-#   set the debug variable...)
-$0 ~ /^[ 	]*everything[ 	=]*off[ 	]*$/{
-    everything = "off"
-    next
-}
-$0 ~ /^[ 	]*everything[ 	=]*on[ 	]*$/{
-    everything = "on"
-    next
-}
-$0 ~ /^[ 	]*logunsupported[ 	=]*0[ 	]*$/{
-    logunsupported = 0
-    next
-}
-$0 ~ /^[ 	]*logunsupported[ 	=]*1[ 	]*$/{
-    logunsupported = 1
-    next
-}
-$1 == "deb" && $2 == "=" && NF == 3{
-    deb = $3
-    next
-}
-
 # option NAME ( (requires|enables|if) NAME* | on | off | disabled )*
 #   Declares an option 'NAME' and describes its default setting (disabled)
 #   and its relationship to other options.  The option is disabled
@@ -403,12 +408,12 @@
     if (err) exit 1
 
     if (pre) {
-    	# Record the variables
-	print "deb =", deb
+    	# Record the final value of the variables
+	print "deb =", deb >out
 	if (everything != "") {
-	    print "everything =", everything
+	    print "everything =", everything >out
         }
-	print "logunsupported =", logunsupported
+	print "logunsupported =", logunsupported >out
 	exit 0
     }
 
diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa
index 1cbccde..4c55f52 100644
--- a/scripts/pnglibconf.dfa
+++ b/scripts/pnglibconf.dfa
@@ -166,7 +166,7 @@
 option WRITE enables WRITE_INT_FUNCTIONS
 
 # Generic options - affect both read and write.
-option BENIGN_ERRORS disabled
+option BENIGN_ERRORS
 option MNG_FEATURES
 option FLOATING_POINT enables ok_math
 option FIXED_POINT enables ok_math
@@ -288,7 +288,7 @@
 = NO_READ_COMPOSITE_NODIV PNG_NO_READ_COMPOSITED_NODIV
 
 # Inch conversions: not switched on by default
-option INCH_CONVERSIONS requires FLOATING_POINT disabled
+option INCH_CONVERSIONS requires FLOATING_POINT
 = INCH_CONVERSIONS PNG_INCH_CONVERSIONS
 
 # IN DEVELOPMENT
diff --git a/scripts/pnglibconf.h b/scripts/pnglibconf.h
index 76db2da..33c4494 100644
--- a/scripts/pnglibconf.h
+++ b/scripts/pnglibconf.h
@@ -1,4 +1,4 @@
-/* libpng-1.5.0beta32 STANDARD API DEFINITION */
+/* libpng-1.5.0beta33 STANDARD API DEFINITION */
 /* pnglibconf.h - library build configuration */
 
 /* last changed in libpng version 1.5.0 - June 26, 2010 */
@@ -36,12 +36,12 @@
 #define PNG_ERROR_TEXT_SUPPORTED
 #define PNG_READ_SUPPORTED
 /*#undef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED*/
-/*#undef PNG_BENIGN_ERRORS_SUPPORTED*/
+#define PNG_BENIGN_ERRORS_SUPPORTED
 #define PNG_SETJMP_SUPPORTED
 #define PNG_WRITE_FLUSH_SUPPORTED
 #define PNG_MNG_FEATURES_SUPPORTED
 #define PNG_FLOATING_POINT_SUPPORTED
-/*#undef PNG_INCH_CONVERSIONS_SUPPORTED*/
+#define PNG_INCH_CONVERSIONS_SUPPORTED
 #define PNG_STDIO_SUPPORTED
 #define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
 #define PNG_USER_MEM_SUPPORTED
diff --git a/scripts/pngwin.def b/scripts/pngwin.def
index a42cbb8..a445f0d 100644
--- a/scripts/pngwin.def
+++ b/scripts/pngwin.def
@@ -11,7 +11,7 @@
 ;OS2 CODE PRELOAD MOVEABLE DISCARDABLE
 
 EXPORTS
-;Version 1.5.0beta32
+;Version 1.5.0beta33
  png_access_version_number @1
  png_set_sig_bytes @2
  png_sig_cmp @3
@@ -117,6 +117,9 @@
  png_chunk_error @103
  png_warning @105
  png_chunk_warning @106
+ png_benign_error @107
+ png_chunk_benign_error @108
+ png_set_benign_errors @109
  png_get_valid @110
  png_get_rowbytes @111
  png_get_rows @112
@@ -176,7 +179,9 @@
  png_get_tRNS @166
  png_set_tRNS @167
  png_get_sCAL @168
+ png_get_sCAL_s @169
  png_set_sCAL @170
+ png_set_sCAL_s @171
  png_set_keep_unknown_chunks @172
  png_handle_as_unknown @173
  png_set_unknown_chunks @174
@@ -197,6 +202,12 @@
  png_get_chunk_cache_max @190
  png_set_chunk_malloc_max @191
  png_get_chunk_malloc_max @192
+ png_get_pixels_per_inch @193
+ png_get_x_pixels_per_inch @194
+ png_get_y_pixels_per_inch @195
+ png_get_x_offset_inches @196
+ png_get_y_offset_inches @197
+ png_get_pHYs_dpi @198
  png_get_io_state @199
  png_get_io_chunk_name @200
  png_get_uint_32 @201