diff options
author | rockcavera <rockcavera@gmail.com> | 2020-12-12 05:35:18 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 09:35:18 +0100 |
commit | d15f63a0f2d431a516601530196ac01c26e00f53 (patch) | |
tree | 1e1551438daa21a40b7696aec66ec10b153d6715 /lib | |
parent | b1c232aca1baf7d9ccc6c7a86e9ac5a127bc2354 (diff) | |
download | Nim-d15f63a0f2d431a516601530196ac01c26e00f53.tar.gz |
Fix #14259 #15621 (#16322) [backport:1.4]
* IPv6 text representation according to RFC 5952 * Revert IPv6 text representation according to RFC 5952 * fix #14259 #15621 fix #14259 #15621 * Update lib/system/io.nim * reverted IoHandle removal * adaptation of types for WinAPI Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/io.nim | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/system/io.nim b/lib/system/io.nim index c3b2976fb..b3e1725b4 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -278,7 +278,12 @@ elif defined(posix) and not defined(lwip) and not defined(nimscript): proc c_fcntl(fd: cint, cmd: cint): cint {. importc: "fcntl", header: "<fcntl.h>", varargs.} elif defined(windows): - const HANDLE_FLAG_INHERIT = culong 0x1 + type + WinDWORD = culong + WinBOOL = cint + + const HANDLE_FLAG_INHERIT = 1.WinDWORD + proc getOsfhandle(fd: cint): int {. importc: "_get_osfhandle", header: "<io.h>".} @@ -286,8 +291,10 @@ elif defined(windows): IoHandle = distinct pointer ## Windows' HANDLE type. Defined as an untyped pointer but is **not** ## one. Named like this to avoid collision with other `system` modules. - proc setHandleInformation(handle: IoHandle, mask, flags: culong): cint {. - importc: "SetHandleInformation", header: "<handleapi.h>".} + + proc setHandleInformation(hObject: IoHandle, dwMask, dwFlags: WinDWORD): + WinBOOL {.stdcall, dynlib: "kernel32", + importc: "SetHandleInformation".} const BufSize = 4000 @@ -346,7 +353,7 @@ when defined(nimdoc) or (defined(posix) and not defined(nimscript)) or defined(w result = c_fcntl(f, F_SETFD, flags) != -1 else: result = setHandleInformation(cast[IoHandle](f), HANDLE_FLAG_INHERIT, - culong inheritable) != 0 + inheritable.WinDWORD) != 0 proc readLine*(f: File, line: var TaintedString): bool {.tags: [ReadIOEffect], benign.} = |