Imported from libpng-1.0.5d.tar
diff --git a/pngwutil.c b/pngwutil.c
index a34201e..2b08369 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
- * libpng 1.0.5c - November 27, 1999
+ * libpng 1.0.5d - November 29, 1999
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
@@ -142,7 +142,9 @@
int bit_depth, int color_type, int compression_type, int filter_type,
int interlace_type)
{
- const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_IHDR;
+#endif
png_byte buf[13]; /* buffer to store the IHDR info */
png_debug(1, "in png_write_IHDR\n");
@@ -281,7 +283,9 @@
void
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
{
- const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_PLTE;
+#endif
png_uint_32 i;
png_colorp pal_ptr;
png_byte buf[3];
@@ -323,7 +327,9 @@
void
png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
{
- const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_IDAT;
+#endif
png_debug(1, "in png_write_IDAT\n");
png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length);
png_ptr->mode |= PNG_HAVE_IDAT;
@@ -333,7 +339,9 @@
void
png_write_IEND(png_structp png_ptr)
{
- const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_IEND;
+#endif
png_debug(1, "in png_write_IEND\n");
png_write_chunk(png_ptr, (png_bytep)png_IEND, NULL, (png_size_t)0);
png_ptr->mode |= PNG_HAVE_IEND;
@@ -344,7 +352,9 @@
void
png_write_gAMA(png_structp png_ptr, double file_gamma)
{
- const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_gAMA;
+#endif
png_uint_32 igamma;
png_byte buf[4];
@@ -361,7 +371,9 @@
void
png_write_sRGB(png_structp png_ptr, int srgb_intent)
{
- const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_sRGB;
+#endif
png_byte buf[1];
png_debug(1, "in png_write_sRGB\n");
@@ -378,7 +390,9 @@
void
png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
{
- const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_sBIT;
+#endif
png_byte buf[4];
png_size_t size;
@@ -434,7 +448,9 @@
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y)
{
- const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_cHRM;
+#endif
png_uint_32 itemp;
png_byte buf[32];
@@ -494,7 +510,9 @@
png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
int num_trans, int color_type)
{
- const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_tRNS;
+#endif
png_byte buf[6];
png_debug(1, "in png_write_tRNS\n");
@@ -534,7 +552,9 @@
void
png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
{
- const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_bKGD;
+#endif
png_byte buf[6];
png_debug(1, "in png_write_bKGD\n");
@@ -573,7 +593,9 @@
void
png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
{
- const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_hIST;
+#endif
int i;
png_byte buf[3];
@@ -722,7 +744,9 @@
png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t text_len)
{
- const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_tEXt;
+#endif
png_size_t key_len;
png_charp new_key;
@@ -758,7 +782,9 @@
png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t text_len, int compression)
{
- const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_zTXt;
+#endif
png_size_t key_len;
char buf[1];
png_charp new_key;
@@ -963,7 +989,9 @@
png_uint_32 y_offset,
int unit_type)
{
- const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_oFFs;
+#endif
png_byte buf[9];
png_debug(1, "in png_write_oFFs\n");
@@ -984,7 +1012,9 @@
png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_int_32 X1, int type, int nparams, png_charp units, png_charpp params)
{
- const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_pCAL;
+#endif
png_size_t purpose_len, units_len, total_len;
png_uint_32p params_len;
png_byte buf[10];
@@ -1043,7 +1073,9 @@
png_uint_32 y_pixels_per_unit,
int unit_type)
{
- const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_pHYs;
+#endif
png_byte buf[9];
png_debug(1, "in png_write_pHYs\n");
@@ -1065,7 +1097,9 @@
void
png_write_tIME(png_structp png_ptr, png_timep mod_time)
{
- const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'};
+#ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_tIME;
+#endif
png_byte buf[7];
png_debug(1, "in png_write_tIME\n");
@@ -1092,6 +1126,7 @@
void
png_write_start_row(png_structp png_ptr)
{
+#ifdef PNG_USE_LOCAL_ARRAYS
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
@@ -1105,6 +1140,7 @@
/* offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+#endif
png_size_t buf_size;
@@ -1184,6 +1220,7 @@
void
png_write_finish_row(png_structp png_ptr)
{
+#ifdef PNG_USE_LOCAL_ARRAYS
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
@@ -1197,6 +1234,7 @@
/* offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+#endif
int ret;
@@ -1296,6 +1334,7 @@
void
png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
{
+#ifdef PNG_USE_LOCAL_ARRAYS
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
@@ -1303,6 +1342,7 @@
/* offset to next interlace block */
int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+#endif
png_debug(1, "in png_do_write_interlace\n");
/* we don't have to do anything on the last pass (6) */