mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.0.6i.tar
This commit is contained in:
15
pngwrite.c
15
pngwrite.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.0.6h - April 24, 2000
|
||||
* libpng 1.0.6i - May 1, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
||||
@@ -480,6 +480,8 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
1, NULL, NULL);
|
||||
#endif
|
||||
|
||||
png_ptr->mode |= PNG_CREATED_WRITE_STRUCT;
|
||||
|
||||
return ((png_structp)png_ptr);
|
||||
}
|
||||
|
||||
@@ -505,6 +507,15 @@ png_write_init(png_structp png_ptr)
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
|
||||
#endif
|
||||
|
||||
#ifndef PNG_LEGACY_SUPPORTED
|
||||
if(!(png_ptr->mode & PNG_CREATED_WRITE_STRUCT))
|
||||
{
|
||||
png_ptr->error_fn=NULL;
|
||||
png_error(png_ptr,
|
||||
"Write struct not properly created; use a legacy-supporting libpng.");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
@@ -804,11 +815,13 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
|
||||
{
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
if (png_ptr->num_chunk_list)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->chunk_list);
|
||||
png_ptr->num_chunk_list=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
png_destroy_struct_2((png_voidp)info_ptr, free_fn);
|
||||
|
||||
Reference in New Issue
Block a user