mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: fix more C warns on windows
This commit is contained in:
parent
c1f04d8c72
commit
d2badcdedf
@ -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))}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user