summaryrefslogtreecommitdiff
path: root/third_party/libpng16/pngwrite.c
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-04 22:42:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-04 22:42:56 +0000
commit424621e3129f7029283f72e953fe0c69f982d257 (patch)
tree47d64c877a652cffd8d6da60982f2f706a07ee22 /third_party/libpng16/pngwrite.c
parentd51c66c57a4fa6033f025d6ddd5d17a7d4e1d001 (diff)
downloadpdfium-424621e3129f7029283f72e953fe0c69f982d257.tar.xz
Revert "Update libpng from 1.6.22 -> 1.6.34"chromium/3543
This reverts commit 6b2e2f0ec7c5f629c5270d14c2339197af7392d8. Reason for revert: Broke Chromium integration. Original change's description: > Update libpng from 1.6.22 -> 1.6.34 > > Updates third_party/libpng16 to Chromium's third_party/libpng @ > e87a02987101e2dbe319a4aba6b52470f7624b4a and applies PDFium specific > patches. > > BUG=chromium:880322 > > Change-Id: I6724f55099c70a79da6d6e4863b9c6c9157ec571 > Reviewed-on: https://pdfium-review.googlesource.com/41910 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,rharrison@chromium.org Change-Id: I2fd1f78e5d07ca983b2430bf078544185292ee1d No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:880322 Reviewed-on: https://pdfium-review.googlesource.com/41970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'third_party/libpng16/pngwrite.c')
-rw-r--r--third_party/libpng16/pngwrite.c173
1 files changed, 78 insertions, 95 deletions
diff --git a/third_party/libpng16/pngwrite.c b/third_party/libpng16/pngwrite.c
index e25e5dcfdc..181a899438 100644
--- a/third_party/libpng16/pngwrite.c
+++ b/third_party/libpng16/pngwrite.c
@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.32 [August 24, 2017]
- * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Copyright (c) 1998-2002,2004,2006-2015 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.)
*
@@ -22,7 +22,7 @@
/* Write out all the unknown chunks for the current given location */
static void
write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr,
- unsigned int where)
+ unsigned int where)
{
if (info_ptr->unknown_chunks_num != 0)
{
@@ -148,11 +148,11 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
# ifdef PNG_WRITE_sRGB_SUPPORTED
if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
png_app_warning(png_ptr,
- "profile matches sRGB but writing iCCP instead");
+ "profile matches sRGB but writing iCCP instead");
# endif
png_write_iCCP(png_ptr, info_ptr->iccp_name,
- info_ptr->iccp_profile);
+ info_ptr->iccp_profile);
}
# ifdef PNG_WRITE_sRGB_SUPPORTED
else
@@ -237,11 +237,6 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
#endif
-#ifdef PNG_WRITE_eXIf_SUPPORTED
- if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
- png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
-#endif
-
#ifdef PNG_WRITE_hIST_SUPPORTED
if ((info_ptr->valid & PNG_INFO_hIST) != 0)
png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
@@ -388,7 +383,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
for (i = 0; i < info_ptr->num_text; i++)
{
png_debug2(2, "Writing trailer text chunk %d, type %d", i,
- info_ptr->text[i].compression);
+ info_ptr->text[i].compression);
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
@@ -437,12 +432,6 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
}
}
#endif
-
-#ifdef PNG_WRITE_eXIf_SUPPORTED
- if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
- png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
-#endif
-
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
#endif
@@ -677,9 +666,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
- png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
- png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
+ png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
+ png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
+ png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)(red >> 8);
@@ -704,7 +693,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
return;
png_debug2(1, "in png_write_row (row %u, pass %d)",
- png_ptr->row_number, png_ptr->pass);
+ png_ptr->row_number, png_ptr->pass);
/* Initialize transformations and other stuff if first time */
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
@@ -912,7 +901,7 @@ png_set_flush(png_structrp png_ptr, int nrows)
if (png_ptr == NULL)
return;
- png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows);
+ png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
}
/* Flush the current output buffers now */
@@ -948,10 +937,6 @@ png_write_destroy(png_structrp png_ptr)
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
png_free(png_ptr, png_ptr->row_buf);
png_ptr->row_buf = NULL;
-#ifdef PNG_READ_EXPANDED_SUPPORTED
- png_free(png_ptr, png_ptr->riffled_palette);
- png_ptr->riffled_palette = NULL;
-#endif
#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->try_row);
@@ -1022,8 +1007,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
case 5:
case 6:
case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
+ /* FALL THROUGH */
#endif /* WRITE_FILTER */
- /* FALLTHROUGH */
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
@@ -1084,7 +1069,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
* is not available so the filter can't be used. Just warn here.
*/
png_app_warning(png_ptr,
- "png_set_filter: UP/AVG/PAETH cannot be added after start");
+ "png_set_filter: UP/AVG/PAETH cannot be added after start");
filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
}
@@ -1110,13 +1095,13 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
if (png_ptr->try_row == NULL)
png_ptr->try_row = png_voidcast(png_bytep,
- png_malloc(png_ptr, buf_size));
+ png_malloc(png_ptr, buf_size));
if (num_filters > 1)
{
if (png_ptr->tst_row == NULL)
png_ptr->tst_row = png_voidcast(png_bytep,
- png_malloc(png_ptr, buf_size));
+ png_malloc(png_ptr, buf_size));
}
}
png_ptr->do_filter = (png_byte)filters;
@@ -1540,8 +1525,7 @@ png_write_image_16bit(png_voidp argument)
display->first_row);
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
png_uint_16p row_end;
- const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
- 3 : 1;
+ const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
int aindex = 0;
png_uint_32 y = image->height;
@@ -1555,9 +1539,9 @@ png_write_image_16bit(png_voidp argument)
++output_row;
}
else
- aindex = (int)channels;
+ aindex = channels;
# else
- aindex = (int)channels;
+ aindex = channels;
# endif
}
@@ -1570,7 +1554,7 @@ png_write_image_16bit(png_voidp argument)
*/
row_end = output_row + image->width * (channels+1);
- for (; y > 0; --y)
+ while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_uint_16p out_ptr = output_row;
@@ -1591,7 +1575,7 @@ png_write_image_16bit(png_voidp argument)
if (alpha > 0 && alpha < 65535)
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
- c = (int)channels;
+ c = channels;
do /* always at least one channel */
{
png_uint_16 component = *in_ptr++;
@@ -1626,7 +1610,7 @@ png_write_image_16bit(png_voidp argument)
}
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
- input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
+ input_row += display->row_bytes/(sizeof (png_uint_16));
}
return 1;
@@ -1644,7 +1628,7 @@ png_write_image_16bit(png_voidp argument)
static png_byte
png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
- png_uint_32 reciprocal/*from the above macro*/)
+ png_uint_32 reciprocal/*from the above macro*/)
{
/* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0
* is represented as some other value there is more likely to be a
@@ -1699,8 +1683,7 @@ png_write_image_8bit(png_voidp argument)
display->first_row);
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
png_uint_32 y = image->height;
- const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
- 3 : 1;
+ const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
{
@@ -1717,12 +1700,12 @@ png_write_image_8bit(png_voidp argument)
else
# endif
- aindex = (int)channels;
+ aindex = channels;
/* Use row_end in place of a loop counter: */
row_end = output_row + image->width * (channels+1);
- for (; y > 0; --y)
+ while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
@@ -1740,7 +1723,7 @@ png_write_image_8bit(png_voidp argument)
if (alphabyte > 0 && alphabyte < 255)
reciprocal = UNP_RECIPROCAL(alpha);
- c = (int)channels;
+ c = channels;
do /* always at least one channel */
*out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
while (--c > 0);
@@ -1752,7 +1735,7 @@ png_write_image_8bit(png_voidp argument)
png_write_row(png_ptr, png_voidcast(png_const_bytep,
display->local_row));
- input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
+ input_row += display->row_bytes/(sizeof (png_uint_16));
} /* while y */
}
@@ -1763,7 +1746,7 @@ png_write_image_8bit(png_voidp argument)
*/
png_bytep row_end = output_row + image->width * channels;
- for (; y > 0; --y)
+ while (y-- > 0)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
@@ -1777,7 +1760,7 @@ png_write_image_8bit(png_voidp argument)
}
png_write_row(png_ptr, output_row);
- input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
+ input_row += display->row_bytes/(sizeof (png_uint_16));
}
}
@@ -1794,7 +1777,7 @@ png_image_set_PLTE(png_image_write_control *display)
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
const png_uint_32 format = image->format;
- const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
+ const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
@@ -1826,7 +1809,7 @@ png_image_set_PLTE(png_image_write_control *display)
{
png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
- entry += (unsigned int)i * channels;
+ entry += i * channels;
if ((channels & 1) != 0) /* no alpha */
{
@@ -1865,16 +1848,16 @@ png_image_set_PLTE(png_image_write_control *display)
if (channels >= 3) /* RGB */
{
palette[i].blue = png_unpremultiply(entry[afirst + (2 ^ bgr)],
- alpha, reciprocal);
+ alpha, reciprocal);
palette[i].green = png_unpremultiply(entry[afirst + 1], alpha,
- reciprocal);
+ reciprocal);
palette[i].red = png_unpremultiply(entry[afirst + bgr], alpha,
- reciprocal);
+ reciprocal);
}
else /* gray */
palette[i].blue = palette[i].red = palette[i].green =
- png_unpremultiply(entry[afirst], alpha, reciprocal);
+ png_unpremultiply(entry[afirst], alpha, reciprocal);
}
}
@@ -1882,7 +1865,7 @@ png_image_set_PLTE(png_image_write_control *display)
{
png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
- entry += (unsigned int)i * channels;
+ entry += i * channels;
switch (channels)
{
@@ -1890,7 +1873,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[afirst ? 0 : 3];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALLTHROUGH */
+ /* FALL THROUGH */
case 3:
palette[i].blue = entry[afirst + (2 ^ bgr)];
palette[i].green = entry[afirst + 1];
@@ -1901,7 +1884,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[1 ^ afirst];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALLTHROUGH */
+ /* FALL THROUGH */
case 1:
palette[i].blue = palette[i].red = palette[i].green =
entry[afirst];
@@ -1921,20 +1904,20 @@ png_image_set_PLTE(png_image_write_control *display)
# endif
png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
- entries);
+ entries);
if (num_trans > 0)
png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
- num_trans, NULL);
+ num_trans, NULL);
- image->colormap_entries = (png_uint_32)entries;
+ image->colormap_entries = entries;
}
static int
png_image_write_main(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
@@ -1944,7 +1927,7 @@ png_image_write_main(png_voidp argument)
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
- int write_16bit = linear && (display->convert_to_8bit == 0);
+ int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
/* Make sure we error out on any bad situation */
@@ -1957,7 +1940,7 @@ png_image_write_main(png_voidp argument)
{
const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
- if (image->width <= 0x7fffffffU/channels) /* no overflow */
+ if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
{
png_uint_32 check;
const png_uint_32 png_row_stride = image->width * channels;
@@ -1966,10 +1949,10 @@ png_image_write_main(png_voidp argument)
display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
if (display->row_stride < 0)
- check = (png_uint_32)(-display->row_stride);
+ check = -display->row_stride;
else
- check = (png_uint_32)display->row_stride;
+ check = display->row_stride;
if (check >= png_row_stride)
{
@@ -1977,7 +1960,7 @@ png_image_write_main(png_voidp argument)
* limits the whole image size to 32 bits for API compatibility with
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
*/
- if (image->height > 0xffffffffU/png_row_stride)
+ if (image->height > 0xFFFFFFFF/png_row_stride)
png_error(image->opaque->png_ptr, "memory image too large");
}
@@ -1997,24 +1980,24 @@ png_image_write_main(png_voidp argument)
png_uint_32 entries = image->colormap_entries;
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
- entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
- PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
+ PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_image_set_PLTE(display);
}
else
png_error(image->opaque->png_ptr,
- "no color-map for color-mapped image");
+ "no color-map for color-mapped image");
}
else
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
- write_16bit ? 16 : 8,
- ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
- ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
- PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ write_16bit ? 16 : 8,
+ ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
+ ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* Counter-intuitively the data transformations must be called *after*
* png_write_info, not before as in the read code, but the 'set' functions
@@ -2029,11 +2012,11 @@ png_image_write_main(png_voidp argument)
if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
png_set_cHRM_fixed(png_ptr, info_ptr,
- /* color x y */
- /* white */ 31270, 32900,
- /* red */ 64000, 33000,
- /* green */ 30000, 60000,
- /* blue */ 15000, 6000
+ /* color x y */
+ /* white */ 31270, 32900,
+ /* red */ 64000, 33000,
+ /* green */ 30000, 60000,
+ /* blue */ 15000, 6000
);
}
@@ -2127,7 +2110,7 @@ png_image_write_main(png_voidp argument)
(colormap == 0 && display->convert_to_8bit != 0))
{
png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
- png_get_rowbytes(png_ptr, info_ptr)));
+ png_get_rowbytes(png_ptr, info_ptr)));
int result;
display->local_row = row;
@@ -2153,7 +2136,7 @@ png_image_write_main(png_voidp argument)
ptrdiff_t row_bytes = display->row_bytes;
png_uint_32 y = image->height;
- for (; y > 0; --y)
+ while (y-- > 0)
{
png_write_row(png_ptr, row);
row += row_bytes;
@@ -2167,10 +2150,10 @@ png_image_write_main(png_voidp argument)
static void (PNGCBAPI
image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
- png_size_t size)
+ png_size_t size)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
+ png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
const png_alloc_size_t ob = display->output_bytes;
/* Check for overflow; this should never happen: */
@@ -2201,22 +2184,22 @@ static int
png_image_write_memory(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- argument);
+ argument);
/* The rest of the memory-specific init and write_main in an error protected
* environment. This case needs to use callbacks for the write operations
* since libpng has no built in support for writing to memory.
*/
png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
- image_memory_write, image_memory_flush);
+ image_memory_write, image_memory_flush);
return png_image_write_main(display);
}
int PNGAPI
png_image_write_to_memory(png_imagep image, void *memory,
- png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
- const void *buffer, png_int_32 row_stride, const void *colormap)
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
+ const void *buffer, png_int_32 row_stride, const void *colormap)
{
/* Write the image to the given buffer, or count the bytes if it is NULL */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
@@ -2268,12 +2251,12 @@ png_image_write_to_memory(png_imagep image, void *memory,
else
return png_image_error(image,
- "png_image_write_to_memory: invalid argument");
+ "png_image_write_to_memory: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
+ "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
else
return 0;
@@ -2282,7 +2265,7 @@ png_image_write_to_memory(png_imagep image, void *memory,
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
int PNGAPI
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
- const void *buffer, png_int_32 row_stride, const void *colormap)
+ const void *buffer, png_int_32 row_stride, const void *colormap)
{
/* Write the image to the given (FILE*). */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
@@ -2318,12 +2301,12 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
else
return png_image_error(image,
- "png_image_write_to_stdio: invalid argument");
+ "png_image_write_to_stdio: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
+ "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
else
return 0;
@@ -2331,8 +2314,8 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
int PNGAPI
png_image_write_to_file(png_imagep image, const char *file_name,
- int convert_to_8bit, const void *buffer, png_int_32 row_stride,
- const void *colormap)
+ int convert_to_8bit, const void *buffer, png_int_32 row_stride,
+ const void *colormap)
{
/* Write the image to the named file. */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
@@ -2344,7 +2327,7 @@ png_image_write_to_file(png_imagep image, const char *file_name,
if (fp != NULL)
{
if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer,
- row_stride, colormap) != 0)
+ row_stride, colormap) != 0)
{
int error; /* from fflush/fclose */
@@ -2385,12 +2368,12 @@ png_image_write_to_file(png_imagep image, const char *file_name,
else
return png_image_error(image,
- "png_image_write_to_file: invalid argument");
+ "png_image_write_to_file: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
+ "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
else
return 0;