diff options
author | Clay Sweetser <Varriount@users.noreply.github.com> | 2021-11-12 22:51:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-12 22:51:43 -0500 |
commit | 0a1049881eaa08cb7d10194d9b446d8a9ca52122 (patch) | |
tree | b645de2881072e8c178ac16b59b48938a0c25e2e /lib/pure | |
parent | c6fc3b2eae5aac68480a787b7fa3b81e3748bc2f (diff) | |
download | Nim-0a1049881eaa08cb7d10194d9b446d8a9ca52122.tar.gz |
Merge file size fields correctly on Windows (#19141)
* Merge file size fields correctly on Windows Merge file size fields correctly on Windows - Merge the two 32-bit file size fields from `BY_HANDLE_FILE_INFORMATION` correctly in `rawToFormalFileInfo`. - Fixes #19135 * Update os.nim
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/os.nim | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 513e09b48..9b08fe2e1 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -3255,7 +3255,11 @@ template rawToFormalFileInfo(rawInfo, path, formalInfo): untyped = ## 'rawInfo' is either a 'BY_HANDLE_FILE_INFORMATION' structure on Windows, ## or a 'Stat' structure on posix when defined(windows): - template merge(a, b): untyped = a or (b shl 32) + template merge(a, b): untyped = + int64( + (uint64(cast[uint32](a))) or + (uint64(cast[uint32](b)) shl 32) + ) formalInfo.id.device = rawInfo.dwVolumeSerialNumber formalInfo.id.file = merge(rawInfo.nFileIndexLow, rawInfo.nFileIndexHigh) formalInfo.size = merge(rawInfo.nFileSizeLow, rawInfo.nFileSizeHigh) |