Fix Windows handling of large files#7437
Conversation
|
@DennisOSRM I tested the entire US dataset today using OSRM V6.0.0 with this patch, it is working now on Windows 11 and Windows server 2019. |
| static int file_seek(mtar_t *tar, mtar_size_t offset) { | ||
| int res = fseek(tar->stream, offset, SEEK_SET); | ||
| int res; | ||
| #if defined(_WIN32) |
There was a problem hiding this comment.
No need to support 32 bit environment. We dropped support some time ago.
There was a problem hiding this comment.
Marco _WIN32 is defined for both 32-bit and 64-bit. Do you want me to update it to _WIN64 for 64-bit only?
There was a problem hiding this comment.
If I understand this right, then we don‘t need the if defined block and can replace it with this single line:
int res = _fseeki64(tar->stream, (__int64) offset, SEEK_SET);
There was a problem hiding this comment.
_fseeki64 is windows only. Not available in linux, so if the os is not windows, we still need to use fseek.
There was a problem hiding this comment.
Ah! Thanks for the clarification.
So, yes, if there's a WINDOWS or WIN64 define to indicate Windows environment, then let's use that. Otherwise, your patch looks good.
DennisOSRM
left a comment
There was a problem hiding this comment.
Thank you for your contribution to the code base
No problem. I am very glad i can make contribution. |
Issue
What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here.
This PR is targeting OSRM windows build. issue #7308
This issue was caused by fseek function in microtar library. According to microsoft doc , on windows _fseeki64 is an better option.