| 385 | } |
| 386 | |
| 387 | unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) |
| 388 | { |
| 389 | long size = lodepng_filesize(filename); |
| 390 | if (size < 0) return 78; |
| 391 | *outsize = (size_t)size; |
| 392 | |
| 393 | *out = (unsigned char*)lodepng_malloc((size_t)size); |
| 394 | if(!(*out) && size > 0) return 83; /*the above malloc failed*/ |
| 395 | |
| 396 | return lodepng_buffer_file(*out, (size_t)size, filename); |
| 397 | } |
| 398 | |
| 399 | /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ |
| 400 | unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) |
no test coverage detected