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

checker: restrict numeric promotions to cases where no data is lost

This commit is contained in:
Uwe Krüger
2020-05-27 05:42:48 +02:00
committed by GitHub
parent fc67046bac
commit 013fdb8a4b
81 changed files with 510 additions and 247 deletions

View File

@@ -1090,12 +1090,12 @@ pub fn real_path(fpath string) string {
mut fullpath := vcalloc(max_path_len)
mut ret := charptr(0)
$if windows {
ret = C._fullpath(fullpath, fpath.str, max_path_len)
ret = charptr(C._fullpath(fullpath, fpath.str, max_path_len))
if ret == 0 {
return fpath
}
} $else {
ret = C.realpath(fpath.str, fullpath)
ret = charptr(C.realpath(fpath.str, fullpath))
if ret == 0 {
return fpath
}
@@ -1324,7 +1324,7 @@ pub fn open(path string) ?File {
}
*/
cfile := vfopen(path, 'rb')
if cfile == 0 {
if cfile == voidptr(0) {
return error('failed to open file "$path"')
}
fd := fileno(cfile)
@@ -1361,7 +1361,7 @@ pub fn create(path string) ?File {
}
*/
cfile := vfopen(path, 'wb')
if cfile == 0 {
if cfile == voidptr(0) {
return error('failed to create file "$path"')
}
fd := fileno(cfile)