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

v2: fix Windows errors

This commit is contained in:
Alexey 2020-03-28 12:19:38 +03:00 committed by GitHub
parent 4541f29019
commit cedf185b41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 8 deletions

View File

@ -103,10 +103,10 @@ $if msvc {
else {
// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes
cerr := int(C.GetLastError())
if (cerr == 87) {
if cerr == 87 {
println('SymFromAddr failure: $cerr = The parameter is incorrect)')
}
else if (cerr == 487) {
else if cerr == 487 {
// probably caused because the .pdb isn't in the executable folder
println('SymFromAddr failure: $cerr = Attempt to access invalid address (Verify that you have the .pdb file in the right folder.)')
}
@ -137,4 +137,3 @@ fn print_backtrace_skipping_top_frames_nix(skipframes int) bool {
pub fn println(s string) {
print('$s\n')
}

View File

@ -337,7 +337,7 @@ fn C.FindFirstFileW() voidptr
fn C.FindFirstFile() voidptr
fn C.FindNextFile() voidptr
fn C.FindNextFile() int
fn C.FindClose()

View File

@ -49,7 +49,7 @@ fn find_windows_kit_internal(key RegKey, versions []string) ?string {
}
// We might need to manually null terminate this thing
// So just make sure that we do that
if (value[length - 1] != u16(0)) {
if value[length - 1] != u16(0) {
value[length] = u16(0)
}
return string_from_wide(value)

View File

@ -106,7 +106,7 @@ pub fn ls(path string) ?[]string {
if first_filename != '.' && first_filename != '..' {
dir_files << first_filename
}
for C.FindNextFile(h_find_files, voidptr(&find_file_data)) {
for C.FindNextFile(h_find_files, voidptr(&find_file_data)) > 0 {
filename := string_from_wide(&u16(find_file_data.cFileName))
if filename != '.' && filename != '..' {
dir_files << filename.clone()

View File

@ -12,8 +12,8 @@ struct C.tm {
tm_sec int
}
fn C._mkgmtime(&tm) time_t
fn C._mkgmtime(&C.tm) time_t
fn make_unix_time(t tm) int {
fn make_unix_time(t C.tm) int {
return int(C._mkgmtime(&t))
}