add io.readChars overload (simpler, less error prone) (#16044)
* add simpler to use readChars overload * use new readChars overload * Update lib/wrappers/openssl.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: flywind <xzsflywind@gmail.com>
This commit is contained in:
parent
a1f4113705
commit
ce7caec4b3
5 changed files with 50 additions and 6 deletions
|
|
@ -760,7 +760,7 @@ proc md5_File*(file: string): string {.raises: [IOError,Exception].} =
|
|||
ctx: MD5_CTX
|
||||
|
||||
discard md5_Init(ctx)
|
||||
while(let bytes = f.readChars(buf, 0, sz); bytes > 0):
|
||||
while (let bytes = f.readChars(buf); bytes > 0):
|
||||
discard md5_Update(ctx, buf[0].addr, cast[csize_t](bytes))
|
||||
|
||||
discard md5_Final(buf[0].addr, ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue