fix some windows cast warnings
parent
c019dd6f98
commit
49f960aea5
|
@ -407,7 +407,7 @@ fn posix_wait4_to_exit_status(waitret int) (int,bool) {
|
||||||
|
|
||||||
fn vpclose(f voidptr) int {
|
fn vpclose(f voidptr) int {
|
||||||
$if windows {
|
$if windows {
|
||||||
return int( C._pclose(f) )
|
return C._pclose(f)
|
||||||
}
|
}
|
||||||
$else {
|
$else {
|
||||||
ret , _ := posix_wait4_to_exit_status(C.pclose(f))
|
ret , _ := posix_wait4_to_exit_status(C.pclose(f))
|
||||||
|
@ -779,7 +779,7 @@ pub fn executable() string {
|
||||||
$if windows {
|
$if windows {
|
||||||
max := 512
|
max := 512
|
||||||
mut result := &u16(calloc(max*2)) // MAX_PATH * sizeof(wchar_t)
|
mut result := &u16(calloc(max*2)) // MAX_PATH * sizeof(wchar_t)
|
||||||
len := int(C.GetModuleFileName( 0, result, max ))
|
len := C.GetModuleFileName( 0, result, max )
|
||||||
return string_from_wide2(result, len)
|
return string_from_wide2(result, len)
|
||||||
}
|
}
|
||||||
$if macos {
|
$if macos {
|
||||||
|
|
|
@ -78,7 +78,7 @@ fn init_os_args(argc int, argv &byteptr) []string {
|
||||||
mut args := []string
|
mut args := []string
|
||||||
mut args_list := &voidptr(0)
|
mut args_list := &voidptr(0)
|
||||||
mut args_count := 0
|
mut args_count := 0
|
||||||
args_list = &voidptr(C.CommandLineToArgvW(C.GetCommandLine(), &args_count))
|
args_list = C.CommandLineToArgvW(C.GetCommandLine(), &args_count)
|
||||||
for i := 0; i < args_count; i++ {
|
for i := 0; i < args_count; i++ {
|
||||||
args << string_from_wide(&u16(args_list[i]))
|
args << string_from_wide(&u16(args_list[i]))
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ pub fn get_file_handle(path string) HANDLE {
|
||||||
// get_module_filename retrieves the fully qualified path for the file that contains the specified module.
|
// get_module_filename retrieves the fully qualified path for the file that contains the specified module.
|
||||||
// The module must have been loaded by the current process.
|
// The module must have been loaded by the current process.
|
||||||
pub fn get_module_filename(handle HANDLE) ?string {
|
pub fn get_module_filename(handle HANDLE) ?string {
|
||||||
mut sz := int(4096) // Optimized length
|
mut sz := 4096 // Optimized length
|
||||||
mut buf := &u16(malloc(4096))
|
mut buf := &u16(malloc(4096))
|
||||||
for {
|
for {
|
||||||
status := int(C.GetModuleFileNameW(handle, voidptr(&buf), sz))
|
status := int(C.GetModuleFileNameW(handle, voidptr(&buf), sz))
|
||||||
|
|
Loading…
Reference in New Issue