summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/posix/posix.nim4
-rw-r--r--lib/pure/asyncdispatch.nim4
-rw-r--r--lib/pure/asyncnet.nim2
-rw-r--r--lib/pure/collections/queues.nim2
-rw-r--r--lib/pure/future.nim1
-rw-r--r--lib/pure/oids.nim4
-rw-r--r--lib/pure/osproc.nim2
-rw-r--r--lib/pure/sockets.nim2
-rw-r--r--lib/system/sets.nim4
-rw-r--r--lib/windows/windows.nim16
-rw-r--r--lib/wrappers/openssl.nim2
11 files changed, 21 insertions, 22 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index e206447cc..cdca826ca 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -846,7 +846,7 @@ var
   FE_UPWARD* {.importc, header: "<fenv.h>".}: cint
   FE_DFL_ENV* {.importc, header: "<fenv.h>".}: cint
 
-when not defined(haiku):
+when not defined(haiku) and not defined(OpenBSD):
   var
     MM_HARD* {.importc, header: "<fmtmsg.h>".}: cint
       ## Source of the condition is hardware.
@@ -1816,7 +1816,7 @@ proc feholdexcept*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
 proc fesetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
 proc feupdateenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
 
-when not defined(haiku):
+when not defined(haiku) and not defined(OpenBSD):
   proc fmtmsg*(a1: int, a2: cstring, a3: cint,
               a4, a5, a6: cstring): cint {.importc, header: "<fmtmsg.h>".}
 
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index fcf947831..f42945460 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -532,7 +532,7 @@ when defined(windows) or defined(nimdoc):
     result.TSocketHandle.setBlocking(false)
     register(result)
 
-  proc close*(socket: TAsyncFD) =
+  proc closeSocket*(socket: TAsyncFD) =
     ## Closes a socket and ensures that it is unregistered.
     socket.TSocketHandle.close()
     getGlobalDispatcher().handles.excl(socket)
@@ -581,7 +581,7 @@ else:
     result.TSocketHandle.setBlocking(false)
     register(result)
   
-  proc close*(sock: TAsyncFD) =
+  proc closeSocket*(sock: TAsyncFD) =
     let disp = getGlobalDispatcher()
     sock.TSocketHandle.close()
     disp.selector.unregister(sock.TSocketHandle)
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim
index 9394078c8..d16c85c58 100644
--- a/lib/pure/asyncnet.nim
+++ b/lib/pure/asyncnet.nim
@@ -220,7 +220,7 @@ proc listen*(socket: PAsyncSocket, backlog = SOMAXCONN) =
 
 proc close*(socket: PAsyncSocket) =
   ## Closes the socket.
-  socket.fd.TAsyncFD.close()
+  socket.fd.TAsyncFD.closeSocket()
   # TODO SSL
 
 when isMainModule:
diff --git a/lib/pure/collections/queues.nim b/lib/pure/collections/queues.nim
index 5481272f0..db1d50569 100644
--- a/lib/pure/collections/queues.nim
+++ b/lib/pure/collections/queues.nim
@@ -59,7 +59,7 @@ proc enqueue*[T](q: var TQueue[T], item: T) =
 
 proc dequeue*[T](q: var TQueue[T]): T =
   ## removes and returns the first element of the queue `q`.
-  assert q.count > 0
+  assert q.len > 0
   dec q.count
   result = q.data[q.rd]
   q.rd = (q.rd + 1) and q.mask
diff --git a/lib/pure/future.nim b/lib/pure/future.nim
index e0e4c4176..b7df05207 100644
--- a/lib/pure/future.nim
+++ b/lib/pure/future.nim
@@ -18,7 +18,6 @@ proc createProcType(p, b: PNimrodNode): PNimrodNode {.compileTime.} =
   result = newNimNode(nnkProcTy)
   var formalParams = newNimNode(nnkFormalParams)
 
-  expectKind(b, nnkIdent)
   formalParams.add b
 
   case p.kind
diff --git a/lib/pure/oids.nim b/lib/pure/oids.nim
index b3e74d2a1..2843e6c65 100644
--- a/lib/pure/oids.nim
+++ b/lib/pure/oids.nim
@@ -62,9 +62,9 @@ var
 
 proc genOid*(): TOid =
   ## generates a new OID.
-  proc rand(): cint {.importc: "rand", nodecl.}
+  proc rand(): cint {.importc: "rand", header: "<stdlib.h>", nodecl.}
   proc gettime(dummy: ptr cint): cint {.importc: "time", header: "<time.h>".}
-  proc srand(seed: cint) {.importc: "srand", nodecl.}
+  proc srand(seed: cint) {.importc: "srand", header: "<stdlib.h>", nodecl.}
 
   var t = gettime(nil)
   
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index 6e250f9d5..d2ada7014 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -903,7 +903,7 @@ elif not defined(useNimRtl):
       createStream(p.errStream, p.errHandle, fmRead)
     return p.errStream
 
-  proc csystem(cmd: cstring): cint {.nodecl, importc: "system".}
+  proc csystem(cmd: cstring): cint {.nodecl, importc: "system", header: "<stdlib.h>".}
 
   proc execCmd(command: string): int =
     when defined(linux):
diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim
index 8d96cbaaf..7b8b3d557 100644
--- a/lib/pure/sockets.nim
+++ b/lib/pure/sockets.nim
@@ -295,7 +295,7 @@ when defined(ssl):
     of protSSLv23:
       newCTX = SSL_CTX_new(SSLv23_method()) # SSlv2,3 and TLS1 support.
     of protSSLv2:
-      when not defined(linux):
+      when not defined(linux) and not defined(OpenBSD):
         newCTX = SSL_CTX_new(SSLv2_method())
       else:
         SSLError()
diff --git a/lib/system/sets.nim b/lib/system/sets.nim
index 043d37533..794c65cb8 100644
--- a/lib/system/sets.nim
+++ b/lib/system/sets.nim
@@ -10,7 +10,7 @@
 # set handling
 
 type
-  TNimSet = array [0..4*2048-1, int8]
+  TNimSet = array [0..4*2048-1, uint8]
 
 proc countBits32(n: int32): int {.compilerproc.} =
   var v = n
@@ -25,4 +25,4 @@ proc countBits64(n: int64): int {.compilerproc.} =
 proc cardSet(s: TNimSet, len: int): int {.compilerproc.} =
   result = 0
   for i in countup(0, len-1):
-    inc(result, countBits32(int32(ze(s[i]))))
+    inc(result, countBits32(int32(s[i])))
diff --git a/lib/windows/windows.nim b/lib/windows/windows.nim
index dd743ffa4..df6ad954b 100644
--- a/lib/windows/windows.nim
+++ b/lib/windows/windows.nim
@@ -62,7 +62,7 @@ type  # BaseTsd.h -- Type definitions for the basic sized types
 

 type  # WinDef.h -- Basic Windows Type Definitions

   # BaseTypes

-  UINT = int32
+  WINUINT* = int32

   ULONG* = int

   PULONG* = ptr int

   USHORT* = int16

@@ -137,7 +137,7 @@ type  # WinDef.h -- Basic Windows Type Definitions
 

   HFILE* = HANDLE

   HCURSOR* = HANDLE # = HICON

-  COLORREF* = int

+  COLORREF* = DWORD

   LPCOLORREF* = ptr COLORREF

 

   POINT* {.final, pure.} = object

@@ -238,7 +238,7 @@ type
   CALTYPE* = int

   CALID* = int

   CCHAR* = char

-  TCOLORREF* = int

+  TCOLORREF* = COLORREF

   WINT* = int32

   PINTEGER* = ptr int32

   PBOOL* = ptr WINBOOL

@@ -19683,7 +19683,7 @@ proc SetSysColors*(cElements: int32, lpaElements: var wINT,
     dynlib: "user32", importc: "SetSysColors".}

 proc DrawFocusRect*(hDC: HDC, lprc: var RECT): WINBOOL{.stdcall,

     dynlib: "user32", importc: "DrawFocusRect".}

-proc FillRect*(hDC: HDC, lprc: RECT, hbr: HBRUSH): int32{.stdcall,

+proc FillRect*(hDC: HDC, lprc: var RECT, hbr: HBRUSH): int32{.stdcall,

     dynlib: "user32", importc: "FillRect".}

 proc FrameRect*(hDC: HDC, lprc: var RECT, hbr: HBRUSH): int32{.stdcall,

     dynlib: "user32", importc: "FrameRect".}

@@ -22758,12 +22758,12 @@ proc LocalDiscard*(hlocMem: HLOCAL): HLOCAL =
 

 # WinGDI.h

 

-proc GetGValue*(rgb: int32): int8 =

-  result = toU8(rgb shr 8'i32)

+discard """proc GetGValue*(rgb: int32): int8 =

+  result = toU8(rgb shr 8'i32)"""

 proc RGB*(r, g, b: int): COLORREF =

   result = toU32(r) or (toU32(g) shl 8) or (toU32(b) shl 16)

 proc RGB*(r, g, b: range[0 .. 255]): COLORREF =

-  result = r or g shl 8 or b shl 16

+  result = toU32(r) or (toU32(g) shl 8) or (toU32(b) shl 16)

 

 proc PALETTERGB*(r, g, b: range[0..255]): COLORREF =

   result = 0x02000000 or RGB(r, g, b)

@@ -23481,7 +23481,7 @@ proc ListView_EnsureVisible(hwndLV: HWND, i, fPartialOK: int32): LRESULT =
                        MAKELPARAM(fPartialOK, 0))

 

 proc ListView_FindItem(wnd: HWND, iStart: int32, lvfi: var LV_FINDINFO): int32 =

-  result = SendMessage(wnd, LVM_FINDITEM, WPARAM(iStart), 
+  result = SendMessage(wnd, LVM_FINDITEM, WPARAM(iStart), 

                        cast[LPARAM](addr(lvfi))).int32

 

 proc ListView_GetBkColor(wnd: HWND): LRESULT =

diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim
index 90c398dce..bbcb2175e 100644
--- a/lib/wrappers/openssl.nim
+++ b/lib/wrappers/openssl.nim
@@ -270,7 +270,7 @@ proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.}
 
 when not defined(windows):
   proc CRYPTO_set_mem_functions(a,b,c: pointer){.cdecl, 
-    dynlib: DLLSSLName, importc.}
+    dynlib: DLLUtilName, importc.}
 
 proc CRYPTO_malloc_init*() =
   when not defined(windows):