1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

windows: WideCharToMultiByte() returns an int

This commit is contained in:
Alexander Medvednikov 2019-12-07 17:31:07 +03:00
parent ad6adf327e
commit 9cba3bdf78
3 changed files with 5 additions and 4 deletions

View File

@ -119,7 +119,7 @@ fn C.setbuf()
fn C.SymCleanup() fn C.SymCleanup()
fn C.MultiByteToWideChar() int fn C.MultiByteToWideChar() int
fn C.wcslen() int fn C.wcslen() int
fn C.WideCharToMultiByte() byteptr fn C.WideCharToMultiByte() int
fn C._wstat() fn C._wstat()
fn C._wrename() fn C._wrename()
fn C._wfopen() voidptr fn C._wfopen() voidptr

View File

@ -619,7 +619,7 @@ fn (p mut Parser) check_unused_and_mut_vars() {
if var.name == '' { if var.name == '' {
break 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.pref.translated && var.name != 'tmpl_res'
{ {
p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx ) p.production_error_with_token_index('`$var.name` declared and not used', var.token_idx )

View File

@ -480,6 +480,7 @@ pub fn sigint_to_signal_name(si int) string {
/////////////////////////////// ///////////////////////////////
5{ return 'SIGTRAP'} 5{ return 'SIGTRAP'}
7{ return 'SIGBUS' } 7{ return 'SIGBUS' }
else {}
} }
} }
return 'unknown' return 'unknown'
@ -624,7 +625,7 @@ pub fn get_line() string {
pub fn get_raw_line() string { pub fn get_raw_line() string {
$if windows { $if windows {
max_line_chars := 256 max_line_chars := 256
buf := &byte(malloc(max_line_chars*2)) buf := malloc(max_line_chars*2)
if is_atty(0) > 0 { if is_atty(0) > 0 {
h_input := C.GetStdHandle(STD_INPUT_HANDLE) h_input := C.GetStdHandle(STD_INPUT_HANDLE)
mut nr_chars := u32(0) mut nr_chars := u32(0)
@ -632,7 +633,7 @@ pub fn get_raw_line() string {
return string_from_wide2(&u16(buf), int(nr_chars)) return string_from_wide2(&u16(buf), int(nr_chars))
} }
res := C.fgetws(&u16(buf), max_line_chars, C.stdin ) 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 ) } if !isnil(res) { return string_from_wide2( &u16(buf), len ) }
return '' return ''
} $else { } $else {