From 007d17ce3f28dda72f26df4298bba438f76edd15 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 10 Feb 2014 17:12:25 +0100 Subject: more things case consistent --- lib/pure/asyncio.nim | 10 +++++----- lib/pure/nimprof.nim | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim index 96afc6f4f..ab09dc860 100644 --- a/lib/pure/asyncio.nim +++ b/lib/pure/asyncio.nim @@ -167,7 +167,7 @@ proc asyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, result = newAsyncSocket() result.socket = socket(domain, typ, protocol, buffered) result.proto = protocol - if result.socket == InvalidSocket: OSError(OSLastError()) + if result.socket == invalidSocket: osError(osLastError()) result.socket.setBlocking(false) proc toAsyncSocket*(sock: TSocket, state: TInfo = SockConnected): PAsyncSocket = @@ -357,7 +357,7 @@ proc acceptAddr*(server: PAsyncSocket, client: var PAsyncSocket, client.sslNeedAccept = false client.info = SockConnected - if c == InvalidSocket: SocketError(server.socket) + if c == invalidSocket: socketError(server.socket) c.setBlocking(false) # TODO: Needs to be tested. # deleg.open is set in ``toDelegate``. @@ -481,7 +481,7 @@ proc recvLine*(s: PAsyncSocket, line: var TaintedString): bool {.deprecated.} = of RecvDisconnected: result = true of RecvFail: - s.SocketError(async = true) + s.socketError(async = true) result = false {.pop.} @@ -615,11 +615,11 @@ proc poll*(d: PDispatcher, timeout: int = 500): bool = if d.hasDataBuffered(d.deleVal): hasDataBufferedCount.inc() d.handleRead(d.deleVal) - if hasDataBufferedCount > 0: return True + if hasDataBufferedCount > 0: return true if readDg.len() == 0 and writeDg.len() == 0: ## TODO: Perhaps this shouldn't return if errorDg has something? - return False + return false if select(readDg, writeDg, errorDg, timeout) != 0: for i in 0..len(d.delegates)-1: diff --git a/lib/pure/nimprof.nim b/lib/pure/nimprof.nim index 02f0366cd..3d0cc2154 100644 --- a/lib/pure/nimprof.nim +++ b/lib/pure/nimprof.nim @@ -67,7 +67,7 @@ when withThreads: proc hookAux(st: TStackTrace, costs: int) = # this is quite performance sensitive! - when withThreads: Acquire profilingLock + when withThreads: acquire profilingLock inc totalCalls var last = high(st) while last > 0 and isNil(st[last]): dec last @@ -106,7 +106,7 @@ proc hookAux(st: TStackTrace, costs: int) = h = ((5 * h) + 1) and high(profileData) inc chain maxChainLen = max(maxChainLen, chain) - when withThreads: Release profilingLock + when withThreads: release profilingLock when defined(memProfiler): const -- cgit 1.4.1-2-gfad0 From 232af9de6ca112feff39f10be79bd442ac0ec74f Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 11 Feb 2014 16:32:02 +0100 Subject: fixes #612 --- lib/wrappers/zip/zlib.nim | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/wrappers/zip/zlib.nim b/lib/wrappers/zip/zlib.nim index c4c6ac071..cd3a765c1 100644 --- a/lib/wrappers/zip/zlib.nim +++ b/lib/wrappers/zip/zlib.nim @@ -134,6 +134,7 @@ proc gzerror*(thefile: gzFile, errnum: var int32): pbytef{.cdecl, dynlib: libz, importc: "gzerror".} proc adler32*(adler: uLong, buf: pbytef, length: uInt): uLong{.cdecl, dynlib: libz, importc: "adler32".} + ## **Warning**: Adler-32 requires at least a few hundred bytes to get rolling. proc crc32*(crc: uLong, buf: pbytef, length: uInt): uLong{.cdecl, dynlib: libz, importc: "crc32".} proc deflateInitu*(strm: var TZStream, level: int32, version: cstring, -- cgit 1.4.1-2-gfad0 From 09c8a5134826ca53e145313c27cb4084528179a5 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 14 Feb 2014 15:46:30 +0100 Subject: bugfix: 'system' on windows is sane --- lib/pure/os.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/os.nim b/lib/pure/os.nim index bb70f28b6..75adb1174 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1037,7 +1037,10 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", ## the process has finished. To execute a program without having a ## shell involved, use the `execProcess` proc of the `osproc` ## module. - result = c_system(command) shr 8 + when defined(windows): + result = c_system(command) + else: + result = c_system(command) shr 8 # Environment handling cannot be put into RTL, because the ``envPairs`` # iterator depends on ``environment``. -- cgit 1.4.1-2-gfad0 From f95a8df243354767dc4fc7f907d5a5b26566b58d Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 14 Feb 2014 22:19:40 +0100 Subject: fixes #811 --- lib/pure/os.nim | 6 +++--- lib/pure/osproc.nim | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 75adb1174..89bb92f9a 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1037,10 +1037,10 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", ## the process has finished. To execute a program without having a ## shell involved, use the `execProcess` proc of the `osproc` ## module. - when defined(windows): - result = c_system(command) - else: + when defined(linux): result = c_system(command) shr 8 + else: + result = c_system(command) # Environment handling cannot be put into RTL, because the ``envPairs`` # iterator depends on ``environment``. diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 6df85bbc6..e0689c4a6 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -791,7 +791,10 @@ elif not defined(useNimRtl): proc csystem(cmd: cstring): cint {.nodecl, importc: "system".} proc execCmd(command: string): int = - result = csystem(command) shr 8 + when defined(linux) + result = csystem(command) shr 8 + else: + result = csystem(command) proc createFdSet(fd: var TFdSet, s: seq[PProcess], m: var int) = FD_ZERO(fd) -- cgit 1.4.1-2-gfad0 From cf544f6a850e2d3cf4ffe9640a57ada7aaa502dc Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 14 Feb 2014 22:37:36 +0100 Subject: fixes #811 --- lib/pure/osproc.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index e0689c4a6..9a43c0a7d 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -791,7 +791,7 @@ elif not defined(useNimRtl): proc csystem(cmd: cstring): cint {.nodecl, importc: "system".} proc execCmd(command: string): int = - when defined(linux) + when defined(linux): result = csystem(command) shr 8 else: result = csystem(command) -- cgit 1.4.1-2-gfad0