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

cgen: fix shadowing warning (#7289)

This commit is contained in:
ka-weihe
2020-12-12 23:06:02 +01:00
committed by GitHub
parent f3aac0bc6c
commit 4d025582c0
4 changed files with 36 additions and 26 deletions

View File

@@ -33,12 +33,12 @@ pub fn setenv(name string, value string, overwrite bool) int {
format := '$name=$value'
if overwrite {
unsafe {
return C._putenv(format.str)
return C._putenv(charptr(format.str))
}
} else {
if getenv(name).len == 0 {
unsafe {
return C._putenv(format.str)
return C._putenv(charptr(format.str))
}
}
}
@@ -54,7 +54,7 @@ pub fn setenv(name string, value string, overwrite bool) int {
pub fn unsetenv(name string) int {
$if windows {
format := '${name}='
return C._putenv(format.str)
return C._putenv(charptr(format.str))
} $else {
return C.unsetenv(charptr(name.str))
}

View File

@@ -925,7 +925,7 @@ pub fn executable() string {
if is_set != 0 { // it's a windows symlink
// gets handle with GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
file := C.CreateFile(result, 0x80000000, 1, 0, 3, 0x80, 0)
if file != -1 {
if file != voidptr(-1) {
final_path := &u16(vcalloc(size))
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew
final_len := C.GetFinalPathNameByHandleW(file, final_path, size, 0)
@@ -1127,7 +1127,7 @@ pub fn real_path(fpath string) string {
mut fullpath := vcalloc(max_path_len)
mut ret := charptr(0)
$if windows {
ret = charptr(C._fullpath(fullpath, fpath.str, max_path_len))
ret = charptr(C._fullpath(charptr(fullpath), charptr(fpath.str), max_path_len))
if ret == 0 {
return fpath
}