summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authoralaviss <leorize+oss@disroot.org>2020-06-03 11:17:06 -0500
committerGitHub <noreply@github.com>2020-06-03 18:17:06 +0200
commit55f0df164befdf2304841c74daeaacc5391e08fd (patch)
treeaa7815d57d028b3de6af1592970a8ba5e4e5a2e0 /lib
parent4301a3da9d333de88cf01cd952760716e8117bfa (diff)
downloadNim-55f0df164befdf2304841c74daeaacc5391e08fd.tar.gz
io: correct signature for some win32 apis (#14551)
See https://github.com/nim-lang/Nim/pull/14550#issuecomment-637937649
Diffstat (limited to 'lib')
-rw-r--r--lib/system/io.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/system/io.nim b/lib/system/io.nim
index b1f6bb61b..d1a7f1fc7 100644
--- a/lib/system/io.nim
+++ b/lib/system/io.nim
@@ -279,10 +279,10 @@ elif defined(posix) and not defined(nimscript):
     importc: "fcntl", header: "<fcntl.h>", varargs.}
 elif defined(windows):
   const HANDLE_FLAG_INHERIT = culong 0x1
-  proc getOsfhandle(fd: cint): FileHandle {.
+  proc getOsfhandle(fd: cint): int {.
     importc: "_get_osfhandle", header: "<io.h>".}
 
-  proc setHandleInformation(handle: FileHandle, mask, flags: culong): cint {.
+  proc setHandleInformation(handle: int, mask, flags: culong): cint {.
     importc: "SetHandleInformation", header: "<handleapi.h>".}
 
 const
@@ -318,7 +318,7 @@ proc getOsFileHandle*(f: File): FileHandle =
   ## returns the OS file handle of the file ``f``. This is only useful for
   ## platform specific programming.
   when defined(windows):
-    result = getOsfhandle(getFileHandle(f))
+    result = FileHandle getOsfhandle(cint getFileHandle(f))
   else:
     result = c_fileno(f)
 
@@ -339,7 +339,7 @@ when defined(nimdoc) or (defined(posix) and not defined(nimscript)) or defined(w
       flags = if inheritable: flags and not FD_CLOEXEC else: flags or FD_CLOEXEC
       result = c_fcntl(f, F_SETFD, flags) != -1
     else:
-      result = setHandleInformation(f, HANDLE_FLAG_INHERIT, culong inheritable) != 0
+      result = setHandleInformation(f.int, HANDLE_FLAG_INHERIT, culong inheritable) != 0
 
 proc readLine*(f: File, line: var TaintedString): bool {.tags: [ReadIOEffect],
               benign.} =
@@ -647,7 +647,7 @@ proc open*(f: var File, filehandle: FileHandle,
   ##
   ## The passed file handle will no longer be inheritable.
   when not defined(nimInheritHandles) and declared(setInheritable):
-    let oshandle = when defined(windows): getOsfhandle(filehandle) else: filehandle
+    let oshandle = when defined(windows): FileHandle getOsfhandle(filehandle) else: filehandle
     if not setInheritable(oshandle, false):
       return false
   f = c_fdopen(filehandle, FormatOpen[mode])