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

Functions

void png_write_data (png_structrp png_ptr, png_const_bytep data, size_t length)
 
void PNGCBAPI png_default_write_data (png_structp png_ptr, png_bytep data, size_t length)
 
void png_flush (png_structrp png_ptr)
 
void PNGCBAPI png_default_flush (png_structp png_ptr)
 
void PNGAPI png_set_write_fn (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
 

Function Documentation

◆ png_write_data()

void png_write_data ( png_structrp  png_ptr,
png_const_bytep  data,
size_t  length 
)
34 {
35  /* NOTE: write_data_fn must not change the buffer! */
36  if (png_ptr->write_data_fn != NULL )
37  (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
38  length);
39 
40  else
41  png_error(png_ptr, "Call to NULL write function");
42 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_default_write_data()

void PNGCBAPI png_default_write_data ( png_structp  png_ptr,
png_bytep  data,
size_t  length 
)
52 {
53  size_t check;
54 
55  if (png_ptr == NULL)
56  return;
57 
58  check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
59 
60  if (check != length)
61  png_error(png_ptr, "Write Error");
62 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_flush()

void png_flush ( png_structrp  png_ptr)
72 {
73  if (png_ptr->output_flush_fn != NULL)
74  (*(png_ptr->output_flush_fn))(png_ptr);
75 }
Here is the caller graph for this function:

◆ png_default_flush()

void PNGCBAPI png_default_flush ( png_structp  png_ptr)
80 {
81  png_FILE_p io_ptr;
82 
83  if (png_ptr == NULL)
84  return;
85 
86  io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr));
87  fflush(io_ptr);
88 }
Here is the caller graph for this function:

◆ png_set_write_fn()

void PNGAPI png_set_write_fn ( png_structrp  png_ptr,
png_voidp  io_ptr,
png_rw_ptr  write_data_fn,
png_flush_ptr  output_flush_fn 
)
124 {
125  if (png_ptr == NULL)
126  return;
127 
128  png_ptr->io_ptr = io_ptr;
129 
130 #ifdef PNG_STDIO_SUPPORTED
131  if (write_data_fn != NULL)
132  png_ptr->write_data_fn = write_data_fn;
133 
134  else
135  png_ptr->write_data_fn = png_default_write_data;
136 #else
137  png_ptr->write_data_fn = write_data_fn;
138 #endif
139 
140 #ifdef PNG_WRITE_FLUSH_SUPPORTED
141 # ifdef PNG_STDIO_SUPPORTED
142 
143  if (output_flush_fn != NULL)
144  png_ptr->output_flush_fn = output_flush_fn;
145 
146  else
147  png_ptr->output_flush_fn = png_default_flush;
148 
149 # else
150  png_ptr->output_flush_fn = output_flush_fn;
151 # endif
152 #else
153  PNG_UNUSED(output_flush_fn)
154 #endif /* WRITE_FLUSH */
155 
156 #ifdef PNG_READ_SUPPORTED
157  /* It is an error to read while writing a png file */
158  if (png_ptr->read_data_fn != NULL)
159  {
160  png_ptr->read_data_fn = NULL;
161 
163  "Can't set both read_data_fn and write_data_fn in the"
164  " same structure");
165  }
166 #endif
167 }
Here is the call graph for this function:
Here is the caller graph for this function:
PNG_UNUSED
#define PNG_UNUSED(param)
Definition: pngpriv.h:438
png_default_flush
void PNGCBAPI png_default_flush(png_structp png_ptr)
Definition: pngwio.c:79
data
uint8_t data[8]
Definition: masstorage.h:49
png_bytep
png_byte * png_bytep
Definition: pngconf.h:579
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_write_data
void PNGCBAPI png_default_write_data(png_structp png_ptr, png_bytep data, size_t length)
Definition: pngwio.c:51
png_error
else png_error(png_ptr, "png_image_write_to_memory: PNG too big")
png_constcast
#define png_constcast(type, value)
Definition: pngpriv.h:504
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