summaryrefslogtreecommitdiffstats
path: root/third_party/libpng/pngwio.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libpng/pngwio.c')
-rw-r--r--third_party/libpng/pngwio.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/third_party/libpng/pngwio.c b/third_party/libpng/pngwio.c
index 740b71d..5a4d04a 100644
--- a/third_party/libpng/pngwio.c
+++ b/third_party/libpng/pngwio.c
@@ -1,12 +1,15 @@
/* pngwio.c - functions for data output
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
- * For conditions of distribution and use, see copyright notice in png.h
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
*
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ *
* This file provides a location for all output. Users who need
* special handling are expected to write functions that have the same
* arguments as these and perform similar functions, but that possibly
@@ -16,6 +19,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
@@ -35,7 +39,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL write function");
}
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual writing of data. If you are
* not writing to a standard C stream, you should create a replacement
* write_data function and use it at run time with png_set_write_fn(), rather
@@ -49,7 +53,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL)
return;
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
@@ -81,7 +85,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)near_data == data)
{
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
check = 0;
#else
@@ -98,7 +102,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
err = 0;
#else
@@ -126,7 +130,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* to disk). After png_flush is called, there should be no data pending
* writing in any buffers.
*/
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */
png_flush(png_structp png_ptr)
{
@@ -134,16 +138,16 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr);
}
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
void PNGAPI
png_default_flush(png_structp png_ptr)
{
-#if !defined(_WIN32_WCE)
+#ifndef _WIN32_WCE
png_FILE_p io_ptr;
#endif
if (png_ptr == NULL)
return;
-#if !defined(_WIN32_WCE)
+#ifndef _WIN32_WCE
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr);
#endif
@@ -189,7 +193,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->io_ptr = io_ptr;
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn;
@@ -199,8 +203,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->write_data_fn = write_data_fn;
#endif
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+#ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;
@@ -222,8 +226,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
}
}
-#if defined(USE_FAR_KEYWORD)
-#if defined(_MSC_VER)
+#ifdef USE_FAR_KEYWORD
+#ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{
void *near_ptr;