Skip to content

Commit

Permalink
llava : fix compilation warning that fread return value is not used (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
huawei-lin authored Nov 17, 2023
1 parent f7d5e97 commit c7cce12
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/llava/llava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ static bool load_file_to_bytes(const char* path, unsigned char** bytesOut, long
fclose(file);
return false;
}
fread(buffer, 1, fileSize, file); // Read the file into the buffer
errno = 0;
size_t ret = fread(buffer, 1, fileSize, file); // Read the file into the buffer
if (ferror(file)) {
die_fmt("read error: %s", strerror(errno));
}
if (ret != (size_t) fileSize) {
die("unexpectedly reached end of file");
}
fclose(file); // Close the file

*bytesOut = buffer;
Expand Down

0 comments on commit c7cce12

Please sign in to comment.