aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkitsunyan2020-04-26 05:15:57 +0000
committerkitsunyan2020-04-26 05:15:57 +0000
commit138b310de4badfc765151c5d31923ad9167b3a14 (patch)
tree7f4f78ddc5d8da032264ef6a8a0a58079f922011 /src
parentdcbeb5528fab8eed5e818ac1360c142fa647490f (diff)
Fix warnings introduced in nim 1.2
Diffstat (limited to 'src')
-rw-r--r--src/args.nim2
-rw-r--r--src/utils.nim14
-rw-r--r--src/wrapper/curl.nim6
3 files changed, 11 insertions, 11 deletions
diff --git a/src/args.nim b/src/args.nim
index 87fbaf3..ba734c1 100644
--- a/src/args.nim
+++ b/src/args.nim
@@ -132,7 +132,7 @@ proc splitArgs*(params: seq[string],
else:
input
- let cycle: ParseCycle = (params.map(some) & none(string))
+ let cycle: ParseCycle = (params.map(p => some(p)) & none(string))
.foldl(buildArgs(a, b), (newSeq[ParseArgument](), false, false))
if cycle.stdinConsumed:
diff --git a/src/utils.nim b/src/utils.nim
index c329b68..bb216d3 100644
--- a/src/utils.nim
+++ b/src/utils.nim
@@ -2,10 +2,10 @@ import
hashes, options, os, posix, sequtils, strutils, sugar, tables
type
- HaltError* = object of Exception
+ HaltError* = object of CatchableError
code*: int
- CommandError* = object of Exception
+ CommandError* = object of CatchableError
color*: Option[bool]
error*: bool
@@ -211,11 +211,11 @@ proc forkWaitRedirect*(call: () -> int): tuple[output: seq[string], code: int] =
proc getgrouplist*(user: cstring, group: Gid, groups: ptr cint, ngroups: var cint): cint
{.importc, header: "<grp.h>".}
-proc setgroups*(size: csize, groups: ptr cint): cint
+proc setgroups*(size: csize_t, groups: ptr cint): cint
{.importc, header: "<grp.h>".}
proc getUser(uid: int): User =
- var pw = getpwuid(Uid(uid))
+ var pw = getpwuid(uid.Uid)
if pw == nil:
raise newException(CatchableError, "")
var groups: array[100, cint]
@@ -254,11 +254,11 @@ proc dropPrivileges*(): bool =
let user = initialUser.unsafeGet
var groups = user.groups.map(x => x.cint)
- if setgroups(user.groups.len, addr(groups[0])) < 0:
+ if setgroups(user.groups.len.csize_t, addr(groups[0])) < 0:
return false
- if setgid((Gid) user.gid) != 0:
+ if setgid(user.gid.Gid) != 0:
return false
- if setuid((Uid) user.uid) != 0:
+ if setuid(user.uid.Uid) != 0:
return false
template replaceExisting(name: string, value: string) =
diff --git a/src/wrapper/curl.nim b/src/wrapper/curl.nim
index 98d6880..9abb341 100644
--- a/src/wrapper/curl.nim
+++ b/src/wrapper/curl.nim
@@ -18,7 +18,7 @@ type
url = 10002,
writeFunction = 20011
- CurlError* = object of Exception
+ CurlError* = object of CatchableError
{.passL: "-lcurl".}
@@ -58,8 +58,8 @@ proc escape*(instance: ref CurlInstance, s: string): string =
else:
""
-proc curlWriteMemory(mem: array[csize.high, char], size: csize, nmemb: csize,
- userdata: ref CurlInstance): csize {.cdecl.} =
+proc curlWriteMemory(mem: array[csize_t.high, char], size: csize_t, nmemb: csize_t,
+ userdata: ref CurlInstance): csize_t {.cdecl.} =
let total = size * nmemb
if total > 0:
userData.data &= mem[0 .. total - 1]