Prusa MINI Firmware overview
pngrio.c File Reference
#include "pngpriv.h"

Functions

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

Function Documentation

◆ png_read_data()

void png_read_data ( png_structrp  png_ptr,
png_bytep  data,
size_t  length 
)
33 {
34  png_debug1(4, "reading %d bytes", (int)length);
35 
36  if (png_ptr->read_data_fn != NULL)
37  (*(png_ptr->read_data_fn))(png_ptr, data, length);
38 
39  else
40  png_error(png_ptr, "Call to NULL read function");
41 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_default_read_data()

void PNGCBAPI png_default_read_data ( png_structp  png_ptr,
png_bytep  data,
size_t  length 
)
51 {
52  size_t check;
53 
54  if (png_ptr == NULL)
55  return;
56 
57  /* fread() returns 0 on error, so it is OK to store this in a size_t
58  * instead of an int, which is what fread() actually returns.
59  */
60  check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
61 
62  if (check != length)
63  png_error(png_ptr, "Read Error");
64 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_set_read_fn()

void PNGAPI png_set_read_fn ( png_structrp  png_ptr,
png_voidp  io_ptr,
png_rw_ptr  read_data_fn 
)
89 {
90  if (png_ptr == NULL)
91  return;
92 
93  png_ptr->io_ptr = io_ptr;
94 
95 #ifdef PNG_STDIO_SUPPORTED
96  if (read_data_fn != NULL)
97  png_ptr->read_data_fn = read_data_fn;
98 
99  else
100  png_ptr->read_data_fn = png_default_read_data;
101 #else
102  png_ptr->read_data_fn = read_data_fn;
103 #endif
104 
105 #ifdef PNG_WRITE_SUPPORTED
106  /* It is an error to write to a read device */
107  if (png_ptr->write_data_fn != NULL)
108  {
109  png_ptr->write_data_fn = NULL;
111  "Can't set both read_data_fn and write_data_fn in the"
112  " same structure");
113  }
114 #endif
115 
116 #ifdef PNG_WRITE_FLUSH_SUPPORTED
117  png_ptr->output_flush_fn = NULL;
118 #endif
119 }
Here is the call graph for this function:
Here is the caller graph for this function:
data
uint8_t data[8]
Definition: masstorage.h:49
png_voidcast
#define png_voidcast(type, value)
Definition: pngpriv.h:494
NULL
#define NULL
Definition: usbd_def.h:53
png_ptr
png_structrp png_ptr
Definition: png.h:1083
png_default_read_data
void PNGCBAPI png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
Definition: pngrio.c:50
png_error
else png_error(png_ptr, "png_image_write_to_memory: PNG too big")
png_debug1
#define png_debug1(l, m, p1)
Definition: pngdebug.h:148
length
png_uint_32 length
Definition: png.c:2247
png_warning
void PNGAPI png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
Definition: pngerror.c:216