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

Function load_file

depends/lodepng/lodepng.cpp:6276–6281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6274
6275#ifdef LODEPNG_COMPILE_DISK
6276unsigned load_file(std::vector<unsigned char>& buffer, const std::string& filename) {
6277 long size = lodepng_filesize(filename.c_str());
6278 if(size < 0) return 78;
6279 buffer.resize((size_t)size);
6280 return size == 0 ? 0 : lodepng_buffer_file(&buffer[0], (size_t)size, filename.c_str());
6281}
6282
6283/*write given buffer to the file, overwriting the file, it doesn't append to it.*/
6284unsigned save_file(const std::vector<unsigned char>& buffer, const std::string& filename) {

Callers 1

decodeFunction · 0.70

Calls 4

lodepng_filesizeFunction · 0.85
lodepng_buffer_fileFunction · 0.85
c_strMethod · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected