load file into buffer that already has the correct allocated size. Returns error code.*/
| 363 | |
| 364 | /* load file into buffer that already has the correct allocated size. Returns error code.*/ |
| 365 | static unsigned lodepng_buffer_file(unsigned char* out, size_t size, const char* filename) { |
| 366 | FILE* file; |
| 367 | size_t readsize; |
| 368 | file = fopen(filename, "rb"); |
| 369 | if(!file) return 78; |
| 370 | |
| 371 | readsize = fread(out, 1, size, file); |
| 372 | fclose(file); |
| 373 | |
| 374 | if(readsize != size) return 78; |
| 375 | return 0; |
| 376 | } |
| 377 | |
| 378 | unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* filename) { |
| 379 | long size = lodepng_filesize(filename); |
no outgoing calls
no test coverage detected