summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/pngwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/libpng/pngwrite.c')
-rw-r--r--Build/source/libs/libpng/pngwrite.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/Build/source/libs/libpng/pngwrite.c b/Build/source/libs/libpng/pngwrite.c
index df7ade3349a..b1f6a593aae 100644
--- a/Build/source/libs/libpng/pngwrite.c
+++ b/Build/source/libs/libpng/pngwrite.c
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.2.15 January 5, 2007
+ * Last changed in libpng 1.2.24 December 14, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -391,11 +391,6 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* write end of PNG file */
png_write_IEND(png_ptr);
-#if 0
-/* This flush, added in libpng-1.0.8, causes some applications to crash
- because they do not set png_ptr->output_flush_fn */
- png_flush(png_ptr);
-#endif
}
#if defined(PNG_WRITE_tIME_SUPPORTED)
@@ -459,14 +454,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_ptr == NULL)
return (NULL);
-#if !defined(PNG_1_0_X)
-#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
-#ifdef PNG_MMX_CODE_SUPPORTED
- png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
-#endif
-#endif
-#endif /* PNG_1_0_X */
-
/* added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
@@ -517,11 +504,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
char msg[80];
if (user_png_ver)
{
- sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
+ png_snprintf(msg, 80,
+ "Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
- sprintf(msg, "Application is running with png.c from libpng-%.20s",
+ png_snprintf(msg, 80,
+ "Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
#endif
@@ -587,11 +576,13 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->warning_fn=NULL;
if (user_png_ver)
{
- sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
+ png_snprintf(msg, 80,
+ "Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
- sprintf(msg, "Application is running with png.c from libpng-%.20s",
+ png_snprintf(msg, 80,
+ "Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
}
@@ -671,14 +662,6 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
#endif
-#if !defined(PNG_1_0_X)
-#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
-#ifdef PNG_MMX_CODE_SUPPORTED
- png_init_mmx_flags(png_ptr); /* 1.2.0 addition */
-#endif
-#endif
-#endif /* PNG_1_0_X */
-
#ifdef PNG_SETJMP_SUPPORTED
/* restore jump buffer */
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
@@ -1077,11 +1060,13 @@ png_write_destroy(png_structp png_ptr)
/* free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->row_buf);
+#ifndef PNG_NO_WRITE_FILTERING
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->sub_row);
png_free(png_ptr, png_ptr->up_row);
png_free(png_ptr, png_ptr->avg_row);
png_free(png_ptr, png_ptr->paeth_row);
+#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
png_free(png_ptr, png_ptr->time_buffer);
@@ -1137,15 +1122,26 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
switch (filters & (PNG_ALL_FILTERS | 0x07))
{
+#ifndef PNG_NO_WRITE_FILTER
case 5:
case 6:
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
- case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break;
- case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break;
- case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break;
- case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break;
- case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break;
+#endif /* PNG_NO_WRITE_FILTER */
+ case PNG_FILTER_VALUE_NONE:
+ png_ptr->do_filter=PNG_FILTER_NONE; break;
+#ifndef PNG_NO_WRITE_FILTER
+ case PNG_FILTER_VALUE_SUB:
+ png_ptr->do_filter=PNG_FILTER_SUB; break;
+ case PNG_FILTER_VALUE_UP:
+ png_ptr->do_filter=PNG_FILTER_UP; break;
+ case PNG_FILTER_VALUE_AVG:
+ png_ptr->do_filter=PNG_FILTER_AVG; break;
+ case PNG_FILTER_VALUE_PAETH:
+ png_ptr->do_filter=PNG_FILTER_PAETH; break;
default: png_ptr->do_filter = (png_byte)filters; break;
+#else
+ default: png_warning(png_ptr, "Unknown row filter for method 0");
+#endif /* PNG_NO_WRITE_FILTER */
}
/* If we have allocated the row_buf, this means we have already started
@@ -1159,6 +1155,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
*/
if (png_ptr->row_buf != NULL)
{
+#ifndef PNG_NO_WRITE_FILTER
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
{
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
@@ -1213,6 +1210,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
}
if (png_ptr->do_filter == PNG_NO_FILTERS)
+#endif /* PNG_NO_WRITE_FILTER */
png_ptr->do_filter = PNG_FILTER_NONE;
}
}
@@ -1511,8 +1509,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* 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 == NULL)
- /* quiet compiler warnings */ return;
+ transforms = transforms; /* quiet compiler warnings */
+ params = params;
}
#endif
#endif /* PNG_WRITE_SUPPORTED */