summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-11-16 17:22:51 +0800
committerGitHub <noreply@github.com>2022-11-16 10:22:51 +0100
commit06cd15663d6aed6cbf03a265f546043c47f250d4 (patch)
tree644bcc378c2a044655df58a91058b7c73e478d06 /tests/stdlib
parent3d692d08f74e41588fa157b006e882f142bd77d4 (diff)
downloadNim-06cd15663d6aed6cbf03a265f546043c47f250d4.tar.gz
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>
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tnet_ll.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/stdlib/tnet_ll.nim b/tests/stdlib/tnet_ll.nim
index 2d340cea8..13b56dbb9 100644
--- a/tests/stdlib/tnet_ll.nim
+++ b/tests/stdlib/tnet_ll.nim
@@ -29,7 +29,7 @@ suite "inet_ntop tests":
     check: ip4.s_addr == 0x10111213'u32
 
     var buff: array[0..255, char]
-    let r = inet_ntop(AF_INET, cast[pointer](ip4.s_addr.addr), buff[0].addr, buff.len.int32)
+    let r = inet_ntop(AF_INET, cast[pointer](ip4.s_addr.addr), cast[cstring](buff[0].addr), buff.len.int32)
     let res = if r == nil: "" else: $r
     check: res == "19.18.17.16"
       
@@ -41,7 +41,7 @@ suite "inet_ntop tests":
           
     var ip6 = [0x1000'u16, 0x1001, 0x2000, 0x2001, 0x3000, 0x3001, 0x4000, 0x4001]
     var buff: array[0..255, char]
-    let r = inet_ntop(AF_INET6, cast[pointer](ip6[0].addr), buff[0].addr, buff.len.int32)
+    let r = inet_ntop(AF_INET6, cast[pointer](ip6[0].addr), cast[cstring](buff[0].addr), buff.len.int32)
     let res = if r == nil: "" else: $r
     check: not ipv6Support or res == "10:110:20:120:30:130:40:140"