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

Function lodepng_load_file

depends/lodepng/lodepng.cpp:378–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) {
379 long size = lodepng_filesize(filename);
380 if(size < 0) return 78;
381 *outsize = (size_t)size;
382
383 *out = (unsigned char*)lodepng_malloc((size_t)size);
384 if(!(*out) && size > 0) return 83; /*the above malloc failed*/
385
386 return lodepng_buffer_file(*out, (size_t)size, filename);
387}
388
389/*write given buffer to the file, overwriting the file, it doesn't append to it.*/
390unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) {

Callers 1

lodepng_decode_fileFunction · 0.85

Calls 3

lodepng_filesizeFunction · 0.85
lodepng_mallocFunction · 0.85
lodepng_buffer_fileFunction · 0.85

Tested by

no test coverage detected