load file into buffer that already has the correct allocated size. Returns error code.*/
| 379 | |
| 380 | /* load file into buffer that already has the correct allocated size. Returns error code.*/ |
| 381 | static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) |
| 382 | { |
| 383 | FILE* file; |
| 384 | size_t readsize; |
| 385 | file = fopen(filename, "rb"); |
| 386 | if(!file) return 78; |
| 387 | |
| 388 | readsize = fread(out, 1, size, file); |
| 389 | fclose(file); |
| 390 | |
| 391 | if (readsize != size) return 78; |
| 392 | return 0; |
| 393 | } |
| 394 | |
| 395 | unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) |
| 396 | { |
no outgoing calls
no test coverage detected