fix deprecations and other warnings (#13748)

This commit is contained in:
Miran 2020-03-25 19:15:34 +01:00 • committed by GitHub
commit 5b55aa52d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 63 additions and 66 deletions

View file

@ -276,7 +276,7 @@ when defined(windows) or defined(nimdoc):
## Creates a new Dispatcher instance.
new result
result.ioPort = createIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 1)
result.handles = initSet[AsyncFD]()
result.handles = initHashSet[AsyncFD]()
result.timers.newHeapQueue()
result.callbacks = initDeque[proc () {.closure, gcsafe.}](64)
@ -398,7 +398,7 @@ when defined(windows) or defined(nimdoc):
addr bytesRet, nil, nil) == 0
proc initAll() =
let dummySock = newNativeSocket()
let dummySock = createNativeSocket()
if dummySock == INVALID_SOCKET:
raiseOSError(osLastError())
var fun: pointer = nil
@ -713,7 +713,7 @@ when defined(windows) or defined(nimdoc):
verifyPresence(socket)
var retFuture = newFuture[tuple[address: string, client: AsyncFD]]("acceptAddr")
var clientSock = newNativeSocket()
var clientSock = createNativeSocket()
if clientSock == osInvalidSocket: raiseOSError(osLastError())
const lpOutputLen = 1024
@ -1121,7 +1121,7 @@ else:
proc newDispatcher*(): owned(PDispatcher) =
new result
result.selector = newSelector[AsyncData]()
result.timers.newHeapQueue()
result.timers.clear()
result.callbacks = initDeque[proc () {.closure, gcsafe.}](InitDelayedCallbackListSize)
var gDisp{.threadvar.}: owned PDispatcher ## Global dispatcher
@ -1574,7 +1574,7 @@ proc poll*(timeout = 500) =
discard runOnce(timeout)
template createAsyncNativeSocketImpl(domain, sockType, protocol) =
let handle = newNativeSocket(domain, sockType, protocol)
let handle = createNativeSocket(domain, sockType, protocol)
if handle == osInvalidSocket:
return osInvalidSocket.AsyncFD
handle.setBlocking(false)

View file

@ -113,8 +113,8 @@ proc close*[T](s: Selector[T]) =
when defined(windows):
proc newSelectEvent*(): SelectEvent =
var ssock = newNativeSocket()
var wsock = newNativeSocket()
var ssock = createNativeSocket()
var wsock = createNativeSocket()
var rsock: SocketHandle = INVALID_SOCKET
var saddr = Sockaddr_in()

View file

@ -67,9 +67,7 @@
include "system/inclrtl"
{.deadCodeElim: on.} # dce option deprecated
import nativesockets, os, strutils, parseutils, times, sets, options,
std/monotimes
from ospaths import getEnv
import nativesockets, os, strutils, times, sets, options, std/monotimes
from ssl_certs import scanSSLCertificates
export nativesockets.Port, nativesockets.`$`, nativesockets.`==`
export Domain, SockType, Protocol
@ -603,7 +601,7 @@ when defineSsl:
if not found:
raise newException(IOError, "No SSL/TLS CA certificates found.")
result = SSLContext(context: newCTX, referencedData: initSet[int](),
result = SSLContext(context: newCTX, referencedData: initHashSet[int](),
extraInternal: new(SslContextExtraInternal))
proc getExtraInternal(ctx: SslContext): SslContextExtraInternal =

View file

@ -181,7 +181,7 @@ proc writeProfile() {.noconv.} =
var perProc = initCountTable[string]()
for i in 0..entries-1:
var dups = initSet[string]()
var dups = initHashSet[string]()
for ii in 0..high(StackTrace.lines):
let procname = profileData[i].st[ii]
if isNil(procname): break