From 5c07cbf5d3fc7cd94f593e7ff50f92dc7e66cf00 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 5 Apr 2021 08:08:51 +0300 Subject: [PATCH] ci: fix `v -cc clang-11 -cflags -Werror cmd/v` --- vlib/dl/dl_nix.c.v | 8 ++++---- vlib/os/environment.c.v | 4 ++-- vlib/os/os_nix.c.v | 26 +++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/vlib/dl/dl_nix.c.v b/vlib/dl/dl_nix.c.v index 88370e993f..059cf9dcce 100644 --- a/vlib/dl/dl_nix.c.v +++ b/vlib/dl/dl_nix.c.v @@ -7,13 +7,13 @@ pub const ( rtld_lazy = C.RTLD_LAZY ) -fn C.dlopen(filename charptr, flags int) voidptr +fn C.dlopen(filename &char, flags int) voidptr -fn C.dlsym(handle voidptr, symbol charptr) voidptr +fn C.dlsym(handle voidptr, symbol &char) voidptr fn C.dlclose(handle voidptr) int -fn C.dlerror() charptr +fn C.dlerror() &char // open loads the dynamic shared object. pub fn open(filename string, flags int) voidptr { @@ -35,5 +35,5 @@ pub fn sym(handle voidptr, symbol string) voidptr { // that occurred from a call to one of the `dl` functions, since the last // call to dlerror() pub fn dlerror() string { - return unsafe { cstring_to_vstring(byteptr(C.dlerror())) } + return unsafe { cstring_to_vstring(C.dlerror()) } } diff --git a/vlib/os/environment.c.v b/vlib/os/environment.c.v index cc21e62537..9c45f3a0bc 100644 --- a/vlib/os/environment.c.v +++ b/vlib/os/environment.c.v @@ -25,7 +25,7 @@ pub fn getenv(key string) string { return '' } // NB: C.getenv *requires* that the result be copied. - return cstring_to_vstring(&byte(s)) + return cstring_to_vstring(s) } } } @@ -99,7 +99,7 @@ pub fn environ() map[string]string { if isnil(derefed) { break } - eline := unsafe { cstring_to_vstring(&byte(derefed)) } + eline := unsafe { cstring_to_vstring(derefed) } eq_index := eline.index_byte(`=`) if eq_index > 0 { res[eline[0..eq_index]] = eline[eq_index + 1..] diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 78ff43cb97..492f163d9e 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -40,16 +40,16 @@ pub const ( struct C.utsname { mut: - sysname charptr - nodename charptr - release charptr - version charptr - machine charptr + sysname &char + nodename &char + release &char + version &char + machine &char } fn C.uname(name voidptr) int -fn C.symlink(charptr, charptr) int +fn C.symlink(&char, &char) int pub fn uname() Uname { mut u := Uname{} @@ -58,11 +58,11 @@ pub fn uname() Uname { x := malloc(int(utsize)) d := &C.utsname(x) if C.uname(d) == 0 { - u.sysname = cstring_to_vstring(byteptr(d.sysname)) - u.nodename = cstring_to_vstring(byteptr(d.nodename)) - u.release = cstring_to_vstring(byteptr(d.release)) - u.version = cstring_to_vstring(byteptr(d.version)) - u.machine = cstring_to_vstring(byteptr(d.machine)) + u.sysname = cstring_to_vstring(d.sysname) + u.nodename = cstring_to_vstring(d.nodename) + u.release = cstring_to_vstring(d.release) + u.version = cstring_to_vstring(d.version) + u.machine = cstring_to_vstring(d.machine) } free(d) } @@ -94,7 +94,7 @@ pub fn ls(path string) ?[]string { break } unsafe { - bptr := byteptr(&ent.d_name[0]) + bptr := &byte(&ent.d_name[0]) if bptr[0] == 0 || (bptr[0] == `.` && bptr[1] == 0) || (bptr[0] == `.` && bptr[1] == `.` && bptr[2] == 0) { continue @@ -278,7 +278,7 @@ pub fn debugger_present() bool { return false } -fn C.mkstemp(stemplate byteptr) int +fn C.mkstemp(stemplate &byte) int // `is_writable_folder` - `folder` exists and is writable to the process pub fn is_writable_folder(folder string) ?bool {