fixes ptr to cstring warnings[backport] (#20848)
* fix =#13790 ptr char (+friends) should not implicitly convert to cstring * Apply suggestions from code review * first round; compiles on windows * nimPreviewSlimSystem * conversion is unsafe, cast needed * fixes more tests * fixes asyncnet * another try another error * last one * true * one more * why bugs didn't show at once * add `nimPreviewCstringConversion` switch * typo * fixes ptr to cstring warnings[backport] * add fixes Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
This commit is contained in:
parent
3d692d08f7
commit
06cd15663d
25 changed files with 50 additions and 50 deletions
|
|
@ -804,10 +804,10 @@ proc md5_File*(file: string): string {.raises: [IOError,Exception].} =
|
|||
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)
|
||||
discard md5_Final(cast[cstring](buf[0].addr), ctx)
|
||||
f.close
|
||||
|
||||
result = hexStr(addr buf)
|
||||
result = hexStr(cast[cstring](addr buf))
|
||||
|
||||
proc md5_Str*(str: string): string =
|
||||
## Generate MD5 hash for a string. Result is a 32 character
|
||||
|
|
@ -824,8 +824,8 @@ proc md5_Str*(str: string): string =
|
|||
discard md5_Update(ctx, input[i].addr, cast[csize_t](L))
|
||||
i += L
|
||||
|
||||
discard md5_Final(addr res, ctx)
|
||||
result = hexStr(addr res)
|
||||
discard md5_Final(cast[cstring](addr res), ctx)
|
||||
result = hexStr(cast[cstring](addr res))
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.pop.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue