MCPcopy Create free account
hub / github.com/DFHack/dfhack / lodepng_buffer_file

Function lodepng_buffer_file

depends/lodepng/lodepng.cpp:365–376  ·  view source on GitHub ↗

load file into buffer that already has the correct allocated size. Returns error code.*/

Source from the content-addressed store, hash-verified

363
364/* load file into buffer that already has the correct allocated size. Returns error code.*/
365static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) {
366 FILE* file;
367 size_t readsize;
368 file = fopen(filename, "rb");
369 if(!file) return 78;
370
371 readsize = fread(out, 1, size, file);
372 fclose(file);
373
374 if(readsize != size) return 78;
375 return 0;
376}
377
378unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) {
379 long size = lodepng_filesize(filename);

Callers 2

lodepng_load_fileFunction · 0.85
load_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected