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

cgen: fix warnings (#5820)

This commit is contained in:
ka-weihe
2020-07-14 00:16:31 +02:00
committed by GitHub
parent 042add0e7f
commit df45488e09
14 changed files with 59 additions and 55 deletions

View File

@@ -3,7 +3,7 @@
// that can be found in the LICENSE file.
module os
fn C.getenv(byteptr) &char
fn C.getenv(charptr) &char
// C.GetEnvironmentStringsW & C.FreeEnvironmentStringsW are defined only on windows
fn C.GetEnvironmentStringsW() &u16
@@ -18,7 +18,7 @@ pub fn getenv(key string) string {
}
return string_from_wide(s)
} $else {
s := C.getenv(key.str)
s := C.getenv(charptr(key.str))
if s == voidptr(0) {
return ''
}
@@ -36,7 +36,7 @@ pub fn setenv(name string, value string, overwrite bool) int {
}
return -1
} $else {
return C.setenv(name.str, value.str, overwrite)
return C.setenv(charptr(name.str), charptr(value.str), overwrite)
}
}
@@ -46,7 +46,7 @@ pub fn unsetenv(name string) int {
format := '${name}='
return C._putenv(format.str)
} $else {
return C.unsetenv(name.str)
return C.unsetenv(charptr(name.str))
}
}
@@ -73,7 +73,7 @@ pub fn environ() map[string]string {
} $else {
e := &charptr(C.environ)
for i := 0; !isnil(e[i]); i++ {
eline := cstring_to_vstring(e[i])
eline := cstring_to_vstring(byteptr(e[i]))
eq_index := eline.index_byte(`=`)
if eq_index > 0 {
res[eline[0..eq_index]] = eline[eq_index + 1..]