mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: warn when fixed-size ArrayInit doesn't have trailing {}. (#6137)
This commit is contained in:
@@ -89,7 +89,7 @@ pub fn cp(old, new string) ? {
|
||||
C.close(fp_from)
|
||||
return error_with_code('cp: failed to write to $new', int(fp_to))
|
||||
}
|
||||
mut buf := [1024]byte
|
||||
mut buf := [1024]byte{}
|
||||
mut count := 0
|
||||
for {
|
||||
// FIXME: use sizeof, bug: 'os__buf' undeclared
|
||||
|
||||
@@ -141,7 +141,7 @@ pub fn exec(cmd string) ?Result {
|
||||
if isnil(f) {
|
||||
return error('exec("$cmd") failed')
|
||||
}
|
||||
buf := [4096]byte
|
||||
buf := [4096]byte{}
|
||||
mut res := strings.new_builder(1024)
|
||||
for C.fgets(charptr(buf), 4096, f) != 0 {
|
||||
bufbp := byteptr(buf)
|
||||
|
||||
@@ -264,7 +264,7 @@ pub fn exec(cmd string) ?Result {
|
||||
h_std_error: child_stdout_write
|
||||
dw_flags: u32(C.STARTF_USESTDHANDLES)
|
||||
}
|
||||
command_line := [32768]u16
|
||||
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))
|
||||
if !create_process_ok {
|
||||
@@ -274,7 +274,7 @@ pub fn exec(cmd string) ?Result {
|
||||
}
|
||||
C.CloseHandle(child_stdin)
|
||||
C.CloseHandle(child_stdout_write)
|
||||
buf := [4096]byte
|
||||
buf := [4096]byte{}
|
||||
mut bytes_read := u32(0)
|
||||
mut read_data := strings.new_builder(1024)
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user