Incoming mmap alignment changes breaks reading from mmap'd file
Me again ;)
9f8132c93fc0669e08187f55204f440f8363b9a1 causes breakage when trying to read from a mmap'd file, as we return an adjusted pointer that no longer points to the beginning of the actual file data.
I'm afraid I don't have a convenient test case as it is currently locked deep in the bowels of Qt ;)
Doing something like this:
if (ptr % PAGE_SIZE != 0) { var old = ptr; ptr = _malloc(num + PAGE_SIZE); ret = alignMemoryPage(ptr); _memcpy(ret, old, num); _free(old); }
(i.e. copy the file contents to the newly adjusted pointer, not to the pre-adjusted one) appears to fix it based on very brief testing, but I've no idea if this still works with unmmapping etc.
Ah yes, I am writing the file data to the wrong place, silly me... :)
Fixed on incoming, added a testcase. Please reopen or comment if it isn't resolved for your project.