vlib: fix more C warns on windows

pull/6416/head
Delyan Angelov 2020-09-18 13:40:47 +03:00
parent c1f04d8c72
commit d2badcdedf
2 changed files with 4 additions and 4 deletions

View File

@ -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))}
}
}

View File

@ -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)
}