diff options
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/asyncfile.nim | 5 | ||||
-rw-r--r-- | lib/pure/nativesockets.nim | 12 | ||||
-rw-r--r-- | lib/pure/os.nim | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/pure/asyncfile.nim b/lib/pure/asyncfile.nim index 86cd8d1be..9bd060e30 100644 --- a/lib/pure/asyncfile.nim +++ b/lib/pure/asyncfile.nim @@ -312,7 +312,7 @@ proc setFilePos*(f: AsyncFile, pos: int64) = ## operations. The file's first byte has the index zero. f.offset = pos when not defined(windows) and not defined(nimdoc): - let ret = lseek(f.fd.cint, pos, SEEK_SET) + let ret = lseek(f.fd.cint, pos.Off, SEEK_SET) if ret == -1: raiseOSError(osLastError()) @@ -481,7 +481,8 @@ proc setFileSize*(f: AsyncFile, length: int64) = (setEndOfFile(f.fd.Handle) == 0): raiseOSError(osLastError()) else: - if ftruncate(f.fd.cint, length) == -1: + # will truncate if Off is a 32-bit type! + if ftruncate(f.fd.cint, length.Off) == -1: raiseOSError(osLastError()) proc close*(f: AsyncFile) = diff --git a/lib/pure/nativesockets.nim b/lib/pure/nativesockets.nim index a9c72286d..fa3fa4aea 100644 --- a/lib/pure/nativesockets.nim +++ b/lib/pure/nativesockets.nim @@ -113,7 +113,7 @@ proc `==`*(a, b: Port): bool {.borrow.} proc `$`*(p: Port): string {.borrow.} ## returns the port number as a string -proc toInt*(domain: Domain): cint +proc toInt*(domain: Domain): cshort ## Converts the Domain enum to a platform-dependent ``cint``. proc toInt*(typ: SockType): cint @@ -123,11 +123,11 @@ proc toInt*(p: Protocol): cint ## Converts the Protocol enum to a platform-dependent ``cint``. when not useWinVersion: - proc toInt(domain: Domain): cint = + proc toInt(domain: Domain): cshort = case domain - of AF_UNIX: result = posix.AF_UNIX - of AF_INET: result = posix.AF_INET - of AF_INET6: result = posix.AF_INET6 + of AF_UNIX: result = posix.AF_UNIX.cshort + of AF_INET: result = posix.AF_INET.cshort + of AF_INET6: result = posix.AF_INET6.cshort else: discard proc toInt(typ: SockType): cint = @@ -149,7 +149,7 @@ when not useWinVersion: else: discard else: - proc toInt(domain: Domain): cint = + proc toInt(domain: Domain): cshort = result = toU16(ord(domain)) proc toInt(typ: SockType): cint = diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 82acb2a59..98b6aa309 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1716,7 +1716,7 @@ template rawToFormalFileInfo(rawInfo, path, formalInfo): untyped = formalInfo.permissions.incl(formalMode) formalInfo.id = (rawInfo.st_dev, rawInfo.st_ino) formalInfo.size = rawInfo.st_size - formalInfo.linkCount = rawInfo.st_Nlink + formalInfo.linkCount = rawInfo.st_Nlink.BiggestInt formalInfo.lastAccessTime = rawInfo.st_atime formalInfo.lastWriteTime = rawInfo.st_mtime formalInfo.creationTime = rawInfo.st_ctime |