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

ci: fix self compilation on windows

This commit is contained in:
Delyan Angelov 2021-04-05 15:47:33 +03:00
parent cc8948efcf
commit 90b123c27b
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ fn C.open(&char, int, ...int) int
fn C.fdopen(fd int, mode &char) &C.FILE fn C.fdopen(fd int, mode &char) &C.FILE
fn C.CopyFile(&u32, &u32, int) int fn C.CopyFile(&u16, &u16, bool) int
// fn C.lstat(charptr, voidptr) u64 // fn C.lstat(charptr, voidptr) u64
@ -432,13 +432,13 @@ pub fn get_raw_line() string {
max_line_chars := 256 max_line_chars := 256
buf := malloc(max_line_chars * 2) buf := malloc(max_line_chars * 2)
h_input := C.GetStdHandle(C.STD_INPUT_HANDLE) h_input := C.GetStdHandle(C.STD_INPUT_HANDLE)
mut bytes_read := 0 mut bytes_read := u32(0)
if is_atty(0) > 0 { if is_atty(0) > 0 {
x := C.ReadConsole(h_input, buf, max_line_chars * 2, &bytes_read, 0) x := C.ReadConsole(h_input, buf, max_line_chars * 2, &bytes_read, 0)
if !x { if !x {
return tos(buf, 0) return tos(buf, 0)
} }
return string_from_wide2(&u16(buf), bytes_read) return string_from_wide2(&u16(buf), int(bytes_read))
} }
mut offset := 0 mut offset := 0
for { for {

View File

@ -39,14 +39,14 @@ fn find_windows_kit_internal(key RegKey, versions []string) ?string {
$if windows { $if windows {
unsafe { unsafe {
for version in versions { for version in versions {
required_bytes := 0 // TODO mut required_bytes := u32(0) // TODO mut
result := C.RegQueryValueEx(key, version.to_wide(), 0, 0, 0, &required_bytes) result := C.RegQueryValueEx(key, version.to_wide(), 0, 0, 0, &required_bytes)
length := required_bytes / 2 length := required_bytes / 2
if result != 0 { if result != 0 {
continue continue
} }
alloc_length := (required_bytes + 2) alloc_length := (required_bytes + 2)
mut value := &u16(malloc(alloc_length)) mut value := &u16(malloc(int(alloc_length)))
if isnil(value) { if isnil(value) {
continue continue
} }