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

checker: fixed array cannot implicitly convert to fooptr (again) (#9302)

This commit is contained in:
Nick Treleaven
2021-03-15 13:55:07 +00:00
committed by GitHub
parent 9d168895ed
commit 446631ceb5
15 changed files with 58 additions and 32 deletions

View File

@@ -163,11 +163,11 @@ pub fn cp(src string, dst string) ? {
for {
// FIXME: use sizeof, bug: 'os__buf' undeclared
// count = C.read(fp_from, buf, sizeof(buf))
count = C.read(fp_from, buf, 1024)
count = C.read(fp_from, &buf[0], 1024)
if count == 0 {
break
}
if C.write(fp_to, buf, count) < 0 {
if C.write(fp_to, &buf[0], count) < 0 {
return error_with_code('cp: failed to write to $dst', int(-1))
}
}

View File

@@ -268,8 +268,8 @@ pub fn execute(cmd string) Result {
}
command_line := [32768]u16{}
C.ExpandEnvironmentStringsW(cmd.to_wide(), voidptr(&command_line), 32768)
create_process_ok := C.CreateProcessW(0, command_line, 0, 0, C.TRUE, 0, 0, 0, voidptr(&start_info),
voidptr(&proc_info))
create_process_ok := C.CreateProcessW(0, &command_line[0], 0, 0, C.TRUE, 0, 0, 0,
voidptr(&start_info), voidptr(&proc_info))
if !create_process_ok {
error_num := int(C.GetLastError())
error_msg := get_error_msg(error_num)
@@ -286,7 +286,8 @@ pub fn execute(cmd string) Result {
for {
mut result := false
unsafe {
result = C.ReadFile(child_stdout_read, buf, 1000, voidptr(&bytes_read), 0)
result = C.ReadFile(child_stdout_read, &buf[0], 1000, voidptr(&bytes_read),
0)
read_data.write_bytes(&buf[0], int(bytes_read))
}
if result == false || int(bytes_read) == 0 {