| 393 | } |
| 394 | |
| 395 | unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) |
| 396 | { |
| 397 | long size = lodepng_filesize(filename); |
| 398 | if (size < 0) return 78; |
| 399 | *outsize = (size_t)size; |
| 400 | |
| 401 | *out = (unsigned char*)lodepng_malloc((size_t)size); |
| 402 | if(!(*out) && size > 0) return 83; /*the above malloc failed*/ |
| 403 | |
| 404 | return lodepng_buffer_file(*out, (size_t)size, filename); |
| 405 | } |
| 406 | |
| 407 | /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ |
| 408 | unsigned lodepng_save_file(const unsigned char* buffer, size_t buffersize, const char* filename) |
no test coverage detected