Fix reads from cache outside the file.
Homebrew seems to all trigger us to read after the end of file, which was looping infinitely. Fixes #8773.
This commit is contained in:
parent
8d87a5b7a2
commit
1c357f7f7b
3 changed files with 19 additions and 4 deletions
|
@ -82,7 +82,12 @@ size_t DiskCachingFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data)
|
|||
while (readSize < bytes) {
|
||||
readSize += cache_->SaveIntoCache(backend_, absolutePos + readSize, bytes - readSize, (u8 *)data + readSize);
|
||||
// If there are already-cached blocks afterward, we have to read them.
|
||||
readSize += cache_->ReadFromCache(absolutePos + readSize, bytes - readSize, (u8 *)data + readSize);
|
||||
size_t bytesFromCache = cache_->ReadFromCache(absolutePos + readSize, bytes - readSize, (u8 *)data + readSize);
|
||||
readSize += bytesFromCache;
|
||||
if (bytesFromCache == 0) {
|
||||
// We can't read any more.
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
readSize = backend_->ReadAt(absolutePos, bytes, data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue