From 9cba3bdf78bd7fa5008235c72ef235b47eb84515 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 7 Dec 2019 17:31:07 +0300 Subject: [PATCH] windows: WideCharToMultiByte() returns an int --- vlib/builtin/cfns.v | 2 +- vlib/compiler/fn.v | 2 +- vlib/os/os.v | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vlib/builtin/cfns.v b/vlib/builtin/cfns.v index 9597520fde..60d759c6e3 100644 --- a/vlib/builtin/cfns.v +++ b/vlib/builtin/cfns.v @@ -119,7 +119,7 @@ fn C.setbuf() fn C.SymCleanup() fn C.MultiByteToWideChar() int fn C.wcslen() int -fn C.WideCharToMultiByte() byteptr +fn C.WideCharToMultiByte() int fn C._wstat() fn C._wrename() fn C._wfopen() voidptr diff --git a/vlib/compiler/fn.v b/vlib/compiler/fn.v index c9bad6e631..835e5b67d5 100644 --- a/vlib/compiler/fn.v +++ b/vlib/compiler/fn.v @@ -619,7 +619,7 @@ fn (p mut Parser) check_unused_and_mut_vars() { if var.name == '' { break } - if !var.is_used && !p.pref.is_repl && !var.is_arg && + if !var.is_used && !p.pref.is_repl && !var.is_arg && !p.pref.translated && var.name != 'tmpl_res' { p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx ) diff --git a/vlib/os/os.v b/vlib/os/os.v index 31644f9cb4..4a293ea8ac 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -480,6 +480,7 @@ pub fn sigint_to_signal_name(si int) string { /////////////////////////////// 5{ return 'SIGTRAP'} 7{ return 'SIGBUS' } + else {} } } return 'unknown' @@ -624,7 +625,7 @@ pub fn get_line() string { pub fn get_raw_line() string { $if windows { max_line_chars := 256 - buf := &byte(malloc(max_line_chars*2)) + buf := malloc(max_line_chars*2) if is_atty(0) > 0 { h_input := C.GetStdHandle(STD_INPUT_HANDLE) mut nr_chars := u32(0) @@ -632,7 +633,7 @@ pub fn get_raw_line() string { return string_from_wide2(&u16(buf), int(nr_chars)) } res := C.fgetws(&u16(buf), max_line_chars, C.stdin ) - len := int( C.wcslen(&u16(buf)) ) + len := C.wcslen(&u16(buf)) if !isnil(res) { return string_from_wide2( &u16(buf), len ) } return '' } $else {