20 #ifdef PNG_WRITE_SUPPORTED 31 if (png_ptr->write_data_fn != NULL )
32 (*(png_ptr->write_data_fn))(png_ptr,
data,
length);
34 png_error(png_ptr,
"Call to NULL write function");
37 #if !defined(PNG_NO_STDIO) 42 #ifndef USE_FAR_KEYWORD 48 if (png_ptr == NULL)
return;
49 #if defined(_WIN32_WCE) 50 if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
53 check = fwrite(data, 1, length, (
png_FILE_p)(png_ptr->io_ptr));
64 #define NEAR_BUF_SIZE 1024 65 #define MIN(a,b) (a <= b ? a : b) 74 if (png_ptr == NULL)
return;
80 #if defined(_WIN32_WCE) 81 if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
84 check = fwrite(near_data, 1, length, io_ptr);
95 written =
MIN(NEAR_BUF_SIZE, remaining);
97 #if defined(_WIN32_WCE) 98 if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
101 err = fwrite(buf, 1, written, io_ptr);
108 remaining -= written;
110 while (remaining != 0);
122 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 126 if (png_ptr->output_flush_fn != NULL)
127 (*(png_ptr->output_flush_fn))(png_ptr);
130 #if !defined(PNG_NO_STDIO) 134 #if !defined(_WIN32_WCE) 137 if (png_ptr == NULL)
return;
138 #if !defined(_WIN32_WCE) 173 if (png_ptr == NULL)
return;
176 #if !defined(PNG_NO_STDIO) 177 if (write_data_fn != NULL)
185 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 186 #if !defined(PNG_NO_STDIO) 187 if (output_flush_fn != NULL)
197 if (png_ptr->read_data_fn != NULL)
199 png_ptr->read_data_fn = NULL;
201 "Attempted to set both read_data_fn and write_data_fn in");
203 "the same structure. Resetting read_data_fn to NULL.");
207 #if defined(USE_FAR_KEYWORD) 208 #if defined(_MSC_VER) 213 FP_OFF(near_ptr) = FP_OFF(
ptr);
214 far_ptr = (
void FAR *)near_ptr;
216 if (FP_SEG(
ptr) != FP_SEG(far_ptr))
217 png_error(png_ptr,
"segment lost in conversion");
225 near_ptr = (
void FAR *)
ptr;
226 far_ptr = (
void FAR *)near_ptr;
229 png_error(png_ptr,
"segment lost in conversion");
void PNGAPI png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_voidp png_rw_ptr write_data_fn
#define MIN(a, b)
Returns the min value between a and b.
void PNGAPI png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_bytep png_bytep png_size_t length
#define CVT_PTR_NOCHECK(ptr)
void png_flush(png_structp png_ptr)
void PNGAPI png_default_flush(png_structp png_ptr)
png_struct FAR * png_structp
void PNGAPI png_error(png_structp png_ptr, png_const_charp error_message)
png_voidp png_rw_ptr png_flush_ptr output_flush_fn
void PNGAPI png_warning(png_structp png_ptr, png_const_charp warning_message)
unsigned long png_uint_32