From d2badcdedf5c7a8799c20e4baa39bd68cdd62d1e Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 18 Sep 2020 13:40:47 +0300 Subject: [PATCH] vlib: fix more C warns on windows --- vlib/builtin/string.v | 2 +- vlib/builtin/utf8.v | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index ea9e225302..6f87442fa2 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -125,7 +125,7 @@ pub fn tos_lit(s charptr) string { pub fn (bp byteptr) vstring() string { return string{ str: bp - len: unsafe {C.strlen(bp)} + len: unsafe {C.strlen(charptr(bp))} } } diff --git a/vlib/builtin/utf8.v b/vlib/builtin/utf8.v index fefcd4d5e8..f11d349788 100644 --- a/vlib/builtin/utf8.v +++ b/vlib/builtin/utf8.v @@ -83,10 +83,10 @@ const ( pub fn (_str string) to_wide() &u16 { $if windows { - num_chars := (C.MultiByteToWideChar(cp_utf8, 0, _str.str, _str.len, 0, 0)) + num_chars := (C.MultiByteToWideChar(cp_utf8, 0, charptr(_str.str), _str.len, 0, 0)) mut wstr := &u16(malloc((num_chars + 1) * 2)) // sizeof(wchar_t) if wstr != 0 { - C.MultiByteToWideChar(cp_utf8, 0, _str.str, _str.len, wstr, num_chars) + C.MultiByteToWideChar(cp_utf8, 0, charptr(_str.str), _str.len, wstr, num_chars) unsafe { C.memset(&byte(wstr) + num_chars * 2, 0, 2) } @@ -111,7 +111,7 @@ pub fn string_from_wide2(_wstr &u16, len int) string { num_chars := C.WideCharToMultiByte(cp_utf8, 0, _wstr, len, 0, 0, 0, 0) mut str_to := malloc(num_chars + 1) if str_to != 0 { - C.WideCharToMultiByte(cp_utf8, 0, _wstr, len, str_to, num_chars, 0, 0) + C.WideCharToMultiByte(cp_utf8, 0, _wstr, len, charptr(str_to), num_chars, 0, 0) unsafe { C.memset(str_to + num_chars, 0, 1) }