mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +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
bed521a08c
commit
0fc2e6adcb
1 changed files with 1 additions and 5 deletions
|
@ -233,11 +233,7 @@ bool LottieLoader::open(const string& 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