introduce csize_t instead of fixing csize (#12497)
This commit is contained in:
parent
0c7b6c9c15
commit
99078d80d7
18 changed files with 101 additions and 97 deletions
|
|
@ -2271,7 +2271,9 @@ type # these work for most platforms:
|
|||
## This is the same as the type ``short`` in *C*.
|
||||
cint* {.importc: "int", nodecl.} = int32
|
||||
## This is the same as the type ``int`` in *C*.
|
||||
csize* {.importc: "size_t", nodecl.} = int
|
||||
csize* {.importc: "size_t", nodecl, deprecated: "use `csize_t` instead".} = int
|
||||
## This isn't the same as ``size_t`` in *C*. Don't use it.
|
||||
csize_t* {.importc: "size_t", nodecl.} = uint
|
||||
## This is the same as the type ``size_t`` in *C*.
|
||||
clonglong* {.importc: "long long", nodecl.} = int64
|
||||
## This is the same as the type ``long long`` in *C*.
|
||||
|
|
@ -3638,7 +3640,7 @@ when not defined(JS): #and not defined(nimscript):
|
|||
when declared(memTrackerOp):
|
||||
memTrackerOp("copyMem", dest, size)
|
||||
proc moveMem(dest, source: pointer, size: Natural) =
|
||||
c_memmove(dest, source, size)
|
||||
c_memmove(dest, source, csize_t(size))
|
||||
when declared(memTrackerOp):
|
||||
memTrackerOp("moveMem", dest, size)
|
||||
proc equalMem(a, b: pointer, size: Natural): bool =
|
||||
|
|
@ -3656,7 +3658,7 @@ when not defined(JS): #and not defined(nimscript):
|
|||
else: result = 0
|
||||
else:
|
||||
let minlen = min(x.len, y.len)
|
||||
result = int(nimCmpMem(x.cstring, y.cstring, minlen.csize))
|
||||
result = int(nimCmpMem(x.cstring, y.cstring, cast[csize_t](minlen)))
|
||||
if result == 0:
|
||||
result = x.len - y.len
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue