diff --git a/vlib/os/file_test.v b/vlib/os/file_test.v index 4403f7f603..4e8616a966 100644 --- a/vlib/os/file_test.v +++ b/vlib/os/file_test.v @@ -66,7 +66,8 @@ fn test_write_struct() ? { f.write_struct(another_point) ? f.close() x := os.read_file(tfile) ? - y := unsafe { byteptr(memdup(&another_point, size_of_point)).vstring_with_len(size_of_point) } + pcopy := unsafe { &byte(memdup(&another_point, size_of_point)) } + y := unsafe { pcopy.vstring_with_len(size_of_point) } assert x == y $if debug { eprintln(x.bytes()) @@ -120,7 +121,8 @@ fn test_write_raw() ? { f.write_raw(another_point) ? f.close() x := os.read_file(tfile) ? - y := unsafe { byteptr(memdup(&another_point, size_of_point)).vstring_with_len(size_of_point) } + pcopy := unsafe { &byte(memdup(&another_point, size_of_point)) } + y := unsafe { pcopy.vstring_with_len(size_of_point) } assert x == y $if debug { eprintln(x.bytes()) diff --git a/vlib/os/os_android.c.v b/vlib/os/os_android.c.v index acca881023..30825ea89e 100644 --- a/vlib/os/os_android.c.v +++ b/vlib/os/os_android.c.v @@ -10,7 +10,7 @@ struct C.ANativeActivity { assetManager voidptr } -fn C.AAssetManager_open(&C.AAssetManager, charptr, int) &C.AAsset +fn C.AAssetManager_open(&C.AAssetManager, &char, int) &C.AAsset fn C.AAsset_getLength(&C.AAsset) int diff --git a/vlib/os/os_windows.c.v b/vlib/os/os_windows.c.v index a7573eeca7..5b190383b6 100644 --- a/vlib/os/os_windows.c.v +++ b/vlib/os/os_windows.c.v @@ -64,7 +64,7 @@ mut: dw_flags u32 w_show_window u16 cb_reserved2 u16 - lp_reserved2 byteptr + lp_reserved2 &byte h_std_input voidptr h_std_output voidptr h_std_error voidptr @@ -77,7 +77,7 @@ mut: b_inherit_handle bool } -fn init_os_args_wide(argc int, argv &byteptr) []string { +fn init_os_args_wide(argc int, argv &&byte) []string { mut args_ := []string{} for i in 0 .. argc { args_ << unsafe { string_from_wide(&u16(argv[i])) } @@ -258,6 +258,7 @@ pub fn execute(cmd string) Result { } proc_info := ProcessInformation{} start_info := StartupInfo{ + lp_reserved2: 0 lp_reserved: 0 lp_desktop: 0 lp_title: 0 diff --git a/vlib/os/process_windows.c.v b/vlib/os/process_windows.c.v index 47f359de78..bcdf971cf3 100644 --- a/vlib/os/process_windows.c.v +++ b/vlib/os/process_windows.c.v @@ -3,13 +3,13 @@ module os import strings fn C.GenerateConsoleCtrlEvent(event u32, pgid u32) bool -fn C.GetModuleHandleA(name charptr) HMODULE -fn C.GetProcAddress(handle voidptr, procname byteptr) voidptr +fn C.GetModuleHandleA(name &char) HMODULE +fn C.GetProcAddress(handle voidptr, procname &byte) voidptr fn C.TerminateProcess(process HANDLE, exit_code u32) bool type FN_NTSuspendResume = fn (voidptr) -fn ntdll_fn(name charptr) FN_NTSuspendResume { +fn ntdll_fn(name &char) FN_NTSuspendResume { ntdll := C.GetModuleHandleA(c'NTDLL') if ntdll == 0 { return FN_NTSuspendResume(0) @@ -66,6 +66,7 @@ fn (mut p Process) win_spawn_process() int { } p.wdata = voidptr(wdata) mut start_info := StartupInfo{ + lp_reserved2: 0 lp_reserved: 0 lp_desktop: 0 lp_title: 0 diff --git a/vlib/strings/builder.js.v b/vlib/strings/builder.js.v index 7b224c48ef..e445804f75 100644 --- a/vlib/strings/builder.js.v +++ b/vlib/strings/builder.js.v @@ -37,7 +37,8 @@ pub fn (mut b Builder) writeln(s string) { } pub fn (b Builder) str() string { - return unsafe { byteptr(b.buf.data).vstring_with_len(b.len) } + x := &byte(b.buf.data) + return unsafe { x.vstring_with_len(b.len) } } pub fn (mut b Builder) cut(n int) { diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index e91574067e..0e1657e54f 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -1605,7 +1605,8 @@ pub fn (node Node) position() token.Position { StructField { return node.pos.extend(node.type_pos) } - MatchBranch, SelectBranch, EnumField, ConstField, StructInitField, GlobalField, CallArg { + MatchBranch, SelectBranch, EnumField, ConstField, StructInitField, GlobalField, CallArg + { return node.pos } IfBranch { diff --git a/vlib/v/tests/type_voidptr_test.v b/vlib/v/tests/type_voidptr_test.v index 265e7f647a..2ea5765828 100644 --- a/vlib/v/tests/type_voidptr_test.v +++ b/vlib/v/tests/type_voidptr_test.v @@ -1,7 +1,7 @@ [unsafe] fn memcpy(mut dest voidptr, src voidptr, len u32) voidptr { - mut d := byteptr(dest) - s := byteptr(src) + mut d := unsafe { &byte(dest) } + s := unsafe { &byte(src) } mut l := len for l > 0 { l--