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:
parent
ad6adf327e
commit
9cba3bdf78
@ -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
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user