20 #if defined(PNG_READ_SUPPORTED) 30 png_debug1(4,
"reading %d bytes\n", (
int)length);
31 if (png_ptr->read_data_fn != NULL)
32 (*(png_ptr->read_data_fn))(png_ptr,
data,
length);
34 png_error(png_ptr,
"Call to NULL read function");
37 #if !defined(PNG_NO_STDIO) 42 #ifndef USE_FAR_KEYWORD 48 if (png_ptr == NULL)
return;
52 #if defined(_WIN32_WCE) 53 if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
69 #define NEAR_BUF_SIZE 1024 70 #define MIN(a,b) (a <= b ? a : b) 79 if (png_ptr == NULL)
return;
85 #if defined(_WIN32_WCE) 86 if ( !ReadFile((HANDLE)(png_ptr->io_ptr),
data, length, &check, NULL) )
89 check = fread(n_data, 1, length, io_ptr);
100 read =
MIN(NEAR_BUF_SIZE, remaining);
101 #if defined(_WIN32_WCE) 102 if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
105 err = fread(buf, (
png_size_t)1, read, io_ptr);
115 while (remaining != 0);
140 if (png_ptr == NULL)
return;
143 #if !defined(PNG_NO_STDIO) 144 if (read_data_fn != NULL)
153 if (png_ptr->write_data_fn != NULL)
155 png_ptr->write_data_fn = NULL;
157 "It's an error to set both read_data_fn and write_data_fn in the ");
159 "same structure. Resetting write_data_fn to NULL.");
162 #if defined(PNG_WRITE_FLUSH_SUPPORTED) 163 png_ptr->output_flush_fn = NULL;
#define MIN(a, b)
Returns the min value between a and b.
png_bytep png_bytep png_size_t length
#define CVT_PTR_NOCHECK(ptr)
png_struct FAR * png_structp
void PNGAPI png_error(png_structp png_ptr, png_const_charp error_message)
void PNGAPI png_warning(png_structp png_ptr, png_const_charp warning_message)
#define png_debug1(l, m, p1)
void PNGAPI png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)
void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_voidp png_rw_ptr read_data_fn
void PNGAPI png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
unsigned long png_uint_32