| 376 | } |
| 377 | |
| 378 | unsigned 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.*/ |
| 390 | unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) { |
no test coverage detected