From 9a4dbc25ca970febb116c8bdd8b56c12044d9573 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 2 Oct 2021 15:51:41 +0300 Subject: [PATCH] ci: fix failing conv_test.v on windows --- vlib/net/conv/conv.c.v | 8 ++++---- vlib/net/conv/conv_default.c.v | 4 ++-- vlib/net/conv/conv_test.v | 2 +- vlib/net/conv/conv_windows.c.v | 8 +++++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/vlib/net/conv/conv.c.v b/vlib/net/conv/conv.c.v index e29741a13b..067c82e6b5 100644 --- a/vlib/net/conv/conv.c.v +++ b/vlib/net/conv/conv.c.v @@ -1,21 +1,21 @@ module conv // host to net 32 (htonl) -pub fn htn32(host &u32) u32 { +pub fn htn32(host u32) u32 { return C.htonl(host) } // host to net 16 (htons) -pub fn htn16(host &u16) u16 { +pub fn htn16(host u16) u16 { return C.htons(host) } // net to host 32 (ntohl) -pub fn nth32(host &u32) u32 { +pub fn nth32(host u32) u32 { return C.ntohl(host) } // net to host 16 (ntohs) -pub fn nth16(host &u16) u16 { +pub fn nth16(host u16) u16 { return C.ntohs(host) } diff --git a/vlib/net/conv/conv_default.c.v b/vlib/net/conv/conv_default.c.v index 8e8c5829e5..dcacf5b796 100644 --- a/vlib/net/conv/conv_default.c.v +++ b/vlib/net/conv/conv_default.c.v @@ -20,7 +20,7 @@ union LongLong { } // host to net 64 (htonll) -pub fn htn64(host &u64) u64 { +pub fn htn64(host u64) u64 { mut ll := LongLong{ ll: host } @@ -33,7 +33,7 @@ pub fn htn64(host &u64) u64 { } // net to host 64 (ntohll) -pub fn nth64(net &u64) u64 { +pub fn nth64(net u64) u64 { mut ll := LongLong{ ll: net } diff --git a/vlib/net/conv/conv_test.v b/vlib/net/conv/conv_test.v index 50f9c052da..0ad2560830 100644 --- a/vlib/net/conv/conv_test.v +++ b/vlib/net/conv/conv_test.v @@ -1,6 +1,6 @@ import net.conv -fn check(f fn (a &T) T, finv fn (b &T) T, x T) { +fn check(f fn (a T) T, finv fn (b T) T, x T) { a := f(x) b := finv(a) assert b == x diff --git a/vlib/net/conv/conv_windows.c.v b/vlib/net/conv/conv_windows.c.v index 15827f7b25..eb15bae4f5 100644 --- a/vlib/net/conv/conv_windows.c.v +++ b/vlib/net/conv/conv_windows.c.v @@ -2,20 +2,22 @@ module conv #include +#flag -lws2_32 + fn C.htonll(host u64) u64 fn C.htonl(host u32) u32 fn C.htons(host u16) u16 -fn C.ntohll(net u32) u32 +fn C.ntohll(net u64) u64 fn C.ntohl(net u32) u32 fn C.ntohs(net u16) u16 // host to net 64 (htonll) -pub fn htn64(host &u64) u64 { +pub fn htn64(host u64) u64 { return C.htonll(host) } // net to host 64 (htonll) -pub fn nth64(host &u64) u64 { +pub fn nth64(host u64) u64 { return C.ntohll(host) }