summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorlit <litlighilit@foxmail.com>2024-05-08 23:07:32 +0800
committerGitHub <noreply@github.com>2024-05-08 09:07:32 -0600
commit6cc783f7f363a4cecd390563ca4fa1780c9af9d1 (patch)
tree7b55414a1f5994829d38fc1aa082f0b870df0414 /lib/pure
parent3b4078a7f8a3bfd4f0047ed0b843e5485b08ffde (diff)
downloadNim-6cc783f7f363a4cecd390563ca4fa1780c9af9d1.tar.gz
fixes #23442, fix for FileId under Windows (#23444)
See according issue:

Details:
<https://github.com/nim-lang/Nim/issues/23442#issuecomment-2021763669>

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 3afb9cdd7..6a7b4af1b 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -754,14 +754,14 @@ 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 =
-      int64(
+    template merge[T](a, b): untyped =
+       cast[T](
         (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)
+    formalInfo.id.file = merge[FileId](rawInfo.nFileIndexLow, rawInfo.nFileIndexHigh)
+    formalInfo.size = merge[BiggestInt](rawInfo.nFileSizeLow, rawInfo.nFileSizeHigh)
     formalInfo.linkCount = rawInfo.nNumberOfLinks
     formalInfo.lastAccessTime = fromWinTime(rdFileTime(rawInfo.ftLastAccessTime))
     formalInfo.lastWriteTime = fromWinTime(rdFileTime(rawInfo.ftLastWriteTime))