[devel] Added more blank lines for readability.
diff --git a/pngwio.c b/pngwio.c
index 4e4891a..f8842fe 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
- * Last changed in libpng 1.5.0 [April 29, 2010]
+ * Last changed in libpng 1.5.0 [May 6, 2010]
* Copyright (c) 1998-2010 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.)
@@ -34,6 +34,7 @@
{
if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, data, length);
+
else
png_error(png_ptr, "Call to NULL write function");
}
@@ -52,7 +53,9 @@
if (png_ptr == NULL)
return;
+
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
+
if (check != length)
png_error(png_ptr, "Write Error");
}
@@ -74,24 +77,29 @@
if (png_ptr == NULL)
return;
+
/* Check if data really is near. If so, use usual code. */
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
+
if ((png_bytep)near_data == data)
{
check = fwrite(near_data, 1, length, io_ptr);
}
+
else
{
png_byte buf[NEAR_BUF_SIZE];
png_size_t written, remaining, err;
check = 0;
remaining = length;
+
do
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
err = fwrite(buf, 1, written, io_ptr);
+
if (err != written)
break;
@@ -103,6 +111,7 @@
}
while (remaining != 0);
}
+
if (check != length)
png_error(png_ptr, "Write Error");
}
@@ -127,8 +136,10 @@
png_default_flush(png_structp png_ptr)
{
png_FILE_p io_ptr;
+
if (png_ptr == NULL)
return;
+
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr);
}
@@ -154,7 +165,7 @@
* arguments a pointer to a png_struct. After a call to
* the flush function, there should be no data in any buffers
* or pending transmission. If the output method doesn't do
- * any buffering of ouput, a function prototype must still be
+ * any buffering of output, a function prototype must still be
* supplied although it doesn't have to do anything. If
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
* time, output_flush_fn will be ignored, although it must be
@@ -185,11 +196,13 @@
#ifdef PNG_WRITE_FLUSH_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
+
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;
else
png_ptr->output_flush_fn = png_default_flush;
+
# else
png_ptr->output_flush_fn = output_flush_fn;
# endif
@@ -199,6 +212,7 @@
if (png_ptr->read_data_fn != NULL)
{
png_ptr->read_data_fn = NULL;
+
png_warning(png_ptr,
"Can't set both read_data_fn and write_data_fn in the"
" same structure");