Imported from libpng-1.0.11rc1.tar
diff --git a/pngwrite.c b/pngwrite.c
index 18ce24c..10c04aa 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
- * libpng 1.0.11beta3 - April 15, 2001
+ * libpng 1.0.11rc1 - April 20, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -512,8 +512,6 @@
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
- if (png_ptr->zbuf == (png_bytep)NULL)
- png_error(png_ptr, "Could not allocate zbuf for writing");
png_set_write_fn(png_ptr, NULL, NULL, NULL);
@@ -583,8 +581,6 @@
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
- if (png_ptr->zbuf == (png_bytep)NULL)
- png_error(png_ptr, "Could not allocate zbuf for writing");
png_set_write_fn(png_ptr, NULL, NULL, NULL);
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
@@ -1033,8 +1029,6 @@
{
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
- if (png_ptr->sub_row == (png_bytep)NULL)
- png_error(png_ptr, "Could not allocate sub_row");
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
}
@@ -1049,10 +1043,6 @@
{
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
- if (png_ptr->up_row == (png_bytep)NULL)
- {
- png_error(png_ptr, "Could not allocate sub_row");
- }
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
}
}
@@ -1068,8 +1058,6 @@
{
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
- if (png_ptr->avg_row == (png_bytep)NULL)
- png_error(png_ptr, "Could not allocate avg_row");
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
}
}
@@ -1086,8 +1074,6 @@
{
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
- if (png_ptr->paeth_row == (png_bytep)NULL)
- png_error(png_ptr, "Could not allocate avg_row");
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
}
}
@@ -1143,13 +1129,10 @@
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(sizeof(png_byte) * num_weights));
- if (png_ptr->prev_filters != (png_bytep)NULL)
+ /* To make sure that the weighting starts out fairly */
+ for (i = 0; i < num_weights; i++)
{
- /* To make sure that the weighting starts out fairly */
- for (i = 0; i < num_weights; i++)
- {
- png_ptr->prev_filters[i] = 255;
- }
+ png_ptr->prev_filters[i] = 255;
}
}
@@ -1160,22 +1143,11 @@
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(sizeof(png_uint_16) * num_weights));
- if (png_ptr->inv_filter_weights == (png_uint_16p)NULL)
+ for (i = 0; i < num_weights; i++)
{
- png_free(png_ptr, png_ptr->filter_weights);
- png_ptr->filter_weights = NULL;
+ png_ptr->inv_filter_weights[i] =
+ png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
}
- if (png_ptr->filter_weights != (png_uint_16p)NULL &&
- png_ptr->inv_filter_weights != (png_uint_16p)NULL)
- {
- for (i = 0; i < num_weights; i++)
- {
- png_ptr->inv_filter_weights[i] =
- png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
- }
- }
- else
- num_weights=0;
}
for (i = 0; i < num_weights; i++)
@@ -1387,7 +1359,7 @@
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
- if(transforms == 0 || params == (voidp)NULL)
+ if(transforms == 0 || params == NULL)
/* quiet compiler warnings */ return;
}
#endif