mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.13rc2.tar
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.2.13 July 20, 2006
|
||||
* Last changed in libpng 1.2.13 November 13, 2006
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -62,6 +62,7 @@ void PNGAPI
|
||||
png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
|
||||
png_bytep data, png_size_t length)
|
||||
{
|
||||
if(png_ptr == NULL) return;
|
||||
png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length);
|
||||
png_write_chunk_data(png_ptr, data, length);
|
||||
png_write_chunk_end(png_ptr);
|
||||
@@ -77,6 +78,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
|
||||
{
|
||||
png_byte buf[4];
|
||||
png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length);
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
/* write the length */
|
||||
png_save_uint_32(buf, length);
|
||||
@@ -98,6 +100,7 @@ void PNGAPI
|
||||
png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
/* write the data, and run the CRC over it */
|
||||
if(png_ptr == NULL) return;
|
||||
if (data != NULL && length > 0)
|
||||
{
|
||||
png_calculate_crc(png_ptr, data, length);
|
||||
@@ -111,6 +114,8 @@ png_write_chunk_end(png_structp png_ptr)
|
||||
{
|
||||
png_byte buf[4];
|
||||
|
||||
if(png_ptr == NULL) return;
|
||||
|
||||
/* write the crc */
|
||||
png_save_uint_32(buf, png_ptr->crc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user