[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Fix #484 [Win64]Cannot save and load image files with a heap whose size is more than 0xff ff ff ff (~4.1GB) (#485)
Vincent Blondeau
notifications at github.com
Sun Apr 12 09:45:08 UTC 2020
@VincentBlondeau commented on this pull request.
> position = sqImageFilePosition(h);
- ReadFile((HANDLE)(h-1), (LPVOID) ptr, count*sz, &dwReallyRead, NULL);
- while(dwReallyRead != (DWORD)(count*sz)) {
- DWORD err = GetLastError();
- if(sqMessageBox(MB_ABORTRETRYIGNORE, TEXT("Squeak Warning"),TEXT("Image file read problem (%d out of %d bytes read)"), dwReallyRead, count*sz)
- == IDABORT) return (dwReallyRead / sz);
- sqImageFileSeek(h, position);
- ReadFile((HANDLE)(h-1), (LPVOID) ptr, count*sz, &dwReallyRead, NULL);
+ while (reallyRead != totalToRead) {
+ DWORD toRead = (totalToRead - reallyRead) > (size_t)MAX_DWORD ? MAX_DWORD : totalToRead - reallyRead;
+ BOOL ret = ReadFile((HANDLE)(h - 1), (LPVOID)((sqInt)ptr + (sqInt)reallyRead), toRead, &dwReallyRead, NULL);
+ reallyRead += dwReallyRead;
+
+ if (!ret | dwReallyRead != toRead) {
It is not clever code here. Thanks for spotting it!
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/485#discussion_r407173808
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200412/5d9909b3/attachment.html>
More information about the Vm-dev
mailing list