Compare commits

...

2 commits

Author SHA1 Message Date
ee7
8cb8720b56 Fix error with styleCheck
Before this commit, running `nim c --styleCheck:error` on a file
that imports the `uuids` package would produce an error on Windows.

`WINBOOL` is defined here:
52cf728001/lib/windows/winlean.nim (L33)

Fixes: #5
2021-01-15 17:07:13 +07:00
Giovanni
c5039c1cc6 fixed nimble check and compatibility with new nim compiler (strings can't be nil) 2018-09-05 15:00:33 +07:00
4 changed files with 6 additions and 9 deletions

2
.gitignore vendored
View file

@ -1,5 +1,3 @@
**/uuids
.vscode/.browse.*
nimsuggest.log

View file

@ -1,6 +1,6 @@
import strutils, hashes
import isaac
import urandom
import uuids/urandom
type
UUID* = object
@ -20,7 +20,7 @@ template toHex(s: string, start: Natural,
if n == 0 and x < 0: n = -1
proc uuidsParseHexInt(s: string, maxLen: int): int64 =
if s.isNil or s.len == 0:
if s.len == 0:
raise newException(ValueError, "UUID part is empty")
if s.len > maxLen or s.len > sizeof(result) * 2:
raise newException(ValueError, "UUID part is longer than expected")

View file

@ -1,10 +1,9 @@
[Package]
name: "uuids"
version: "0.1.9"
version: "0.1.11"
author: "Xored Software, Inc."
description: "UUID library"
license: "MIT"
srcDir: "src"
[Deps]
requires: "isaac >= 0.1.3"

View file

@ -16,16 +16,16 @@ when defined(windows):
proc CryptAcquireContext(
phProv: ptr HCRYPTPROV, pszContainer: WideCString,
pszProvider: WideCString, dwProvType: DWORD, dwFlags: DWORD
): WinBool {.importc: "CryptAcquireContextW".}
): WINBOOL {.importc: "CryptAcquireContextW".}
else:
proc CryptAcquireContext(
phProv: ptr HCRYPTPROV, pszContainer: cstring, pszProvider: cstring,
dwProvType: DWORD, dwFlags: DWORD
): WinBool {.importc: "CryptAcquireContextA".}
): WINBOOL {.importc: "CryptAcquireContextA".}
proc CryptGenRandom(
hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: pointer
): WinBool {.importc: "CryptGenRandom".}
): WINBOOL {.importc: "CryptGenRandom".}
{.pop.}