mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
portability: fix file size check on Windows
Resolved an issue where parsing failed due to mismatch between file size obtained via `ftell` and the actual bytes read by `fread`. This occurred because newline translation (`\r\n` to `\n`) in text mode altered the byte count, leading to incorrect assumptions about the data size.
This commit is contained in:
parent
285d1427ad
commit
72482877e7
1 changed files with 1 additions and 5 deletions
|
@ -234,11 +234,7 @@ bool LottieLoader::open(const char* path)
|
|||
|
||||
auto content = (char*)(malloc(sizeof(char) * size + 1));
|
||||
fseek(f, 0, SEEK_SET);
|
||||
auto ret = fread(content, sizeof(char), size, f);
|
||||
if (ret < size) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
size = fread(content, sizeof(char), size, f);
|
||||
content[size] = '\0';
|
||||
|
||||
fclose(f);
|
||||
|
|
Loading…
Add table
Reference in a new issue