Back to index

plt-scheme  4.2.1
Defines | Functions
pngrio.c File Reference
#include "png.h"

Go to the source code of this file.

Defines

#define PNG_INTERNAL

Functions

void png_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
void PNGAPI png_default_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
void PNGAPI png_set_read_fn (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)

Define Documentation

#define PNG_INTERNAL

Definition at line 18 of file pngrio.c.


Function Documentation

void PNGAPI png_default_read_data ( png_structp  png_ptr,
png_bytep  data,
png_size_t  length 
)

Definition at line 43 of file pngrio.c.

{
   png_size_t check;

   /* fread() returns 0 on error, so it is OK to store this in a png_size_t
    * instead of an int, which is what fread() actually returns.
    */
#if defined(_WIN32_WCE)
   if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
      check = 0;
#else
   check = (png_size_t)fread(data, (png_size_t)1, length,
      (png_FILE_p)png_ptr->io_ptr);
#endif

   if (check != length)
      png_error(png_ptr, "Read Error");
}

Here is the call graph for this function:

void png_read_data ( png_structp  png_ptr,
png_bytep  data,
png_size_t  length 
)

Definition at line 27 of file pngrio.c.

{
   png_debug1(4,"reading %d bytes\n", (int)length);
   if (png_ptr->read_data_fn != NULL)
      (*(png_ptr->read_data_fn))(png_ptr, data, length);
   else
      png_error(png_ptr, "Call to NULL read function");
}

Here is the call graph for this function:

void PNGAPI png_set_read_fn ( png_structp  png_ptr,
png_voidp  io_ptr,
png_rw_ptr  read_data_fn 
)

Definition at line 134 of file pngrio.c.

{
   png_ptr->io_ptr = io_ptr;

#if !defined(PNG_NO_STDIO)
   if (read_data_fn != NULL)
      png_ptr->read_data_fn = read_data_fn;
   else
      png_ptr->read_data_fn = png_default_read_data;
#else
   png_ptr->read_data_fn = read_data_fn;
#endif

   /* It is an error to write to a read device */
   if (png_ptr->write_data_fn != NULL)
   {
      png_ptr->write_data_fn = NULL;
      png_warning(png_ptr,
         "It's an error to set both read_data_fn and write_data_fn in the ");
      png_warning(png_ptr,
         "same structure.  Resetting write_data_fn to NULL.");
   }

#if defined(PNG_WRITE_FLUSH_SUPPORTED)
   png_ptr->output_flush_fn = NULL;
#endif
}

Here is the call graph for this function: