From 06cd15663d6aed6cbf03a265f546043c47f250d4 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Wed, 16 Nov 2022 17:22:51 +0800 Subject: 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> --- lib/std/private/strimpl.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/private/strimpl.nim') diff --git a/lib/std/private/strimpl.nim b/lib/std/private/strimpl.nim index 7d19825f4..6a38cbfd2 100644 --- a/lib/std/private/strimpl.nim +++ b/lib/std/private/strimpl.nim @@ -106,7 +106,7 @@ func find*(s, sub: cstring, start: Natural = 0, last = 0): int = if sub.len > s.len - start: return -1 if sub.len == 1: return find(s, sub[0], start, last) if last == 0 and s.len > start: - let found = c_strstr(s[start].unsafeAddr, sub) + let found = c_strstr(cast[cstring](s[start].unsafeAddr), sub) if not found.isNil: result = cast[ByteAddress](found) -% cast[ByteAddress](s) else: -- cgit 1.4.1-2-gfad0