22#ifdef PNG_WRITE_SUPPORTED
32png_write_data(png_structrp png_ptr, png_const_bytep data,
size_t length)
35 if (png_ptr->write_data_fn != NULL )
36 (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
40 png_error(png_ptr,
"Call to NULL write function");
43#ifdef PNG_STDIO_SUPPORTED
50png_default_write_data(png_structp png_ptr, png_bytep data,
size_t length)
57 check = fwrite(data, 1, length, (FILE *)png_ptr->io_ptr);
60 png_error(png_ptr,
"Write Error");
68#ifdef PNG_WRITE_FLUSH_SUPPORTED
70png_flush(png_structrp png_ptr)
72 if (png_ptr->output_flush_fn != NULL)
73 (*(png_ptr->output_flush_fn))(png_ptr);
76# ifdef PNG_STDIO_SUPPORTED
78png_default_flush(png_structp png_ptr)
85 io_ptr = png_voidcast(FILE *, png_ptr->io_ptr);
121png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
122 png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
127 png_ptr->io_ptr = io_ptr;
129#ifdef PNG_STDIO_SUPPORTED
130 if (write_data_fn != NULL)
131 png_ptr->write_data_fn = write_data_fn;
134 png_ptr->write_data_fn = png_default_write_data;
136 png_ptr->write_data_fn = write_data_fn;
139#ifdef PNG_WRITE_FLUSH_SUPPORTED
140# ifdef PNG_STDIO_SUPPORTED
142 if (output_flush_fn != NULL)
143 png_ptr->output_flush_fn = output_flush_fn;
146 png_ptr->output_flush_fn = png_default_flush;
149 png_ptr->output_flush_fn = output_flush_fn;
152 PNG_UNUSED(output_flush_fn)
155#ifdef PNG_READ_SUPPORTED
157 if (png_ptr->read_data_fn != NULL)
159 png_ptr->read_data_fn = NULL;
162 "Can't set both read_data_fn and write_data_fn in the"