mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 12:18:56 +00:00
checksum: Don't read the entire input file in memory
Unsurprisingly, this doesn't work too well if the input file is in the gigabyte range.
This commit is contained in:
parent
eea5a5ed5d
commit
67f01fd82e
Notes:
sideshowbarker
2024-07-18 21:14:21 +09:00
Author: https://github.com/boricj
Commit: 67f01fd82e
Pull-request: https://github.com/SerenityOS/serenity/pull/5863
1 changed files with 3 additions and 1 deletions
|
@ -85,7 +85,9 @@ int main(int argc, char** argv)
|
|||
has_error = true;
|
||||
continue;
|
||||
}
|
||||
hash.update(file->read_all());
|
||||
|
||||
while (!file->eof() && !file->has_error())
|
||||
hash.update(file->read(PAGE_SIZE));
|
||||
auto digest = hash.digest();
|
||||
auto digest_data = digest.immutable_data();
|
||||
StringBuilder builder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue