Merge pull request #168 from vibe-d/32bit_compile_fix

32-bit compile fix
This commit is contained in:
Sönke Ludwig 2021-01-12 19:20:28 +01:00 committed by GitHub
commit edf9eda3ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 30 deletions

View file

@ -34,6 +34,9 @@ jobs:
- {os: windows-latest, dc: ldc-1.9.0, config: select}
- {os: windows-latest, dc: ldc-1.17.0}
- {os: ubuntu-latest, dc: ldc-1.17.0}
include:
- {os: windows-latest, dc: ldc-latest, arch: x86, config: winapi}
- {os: windows-latest, dc: dmd-latest, arch: x86_mscoff, config: winapi}
runs-on: ${{ matrix.os }}
steps:

16
dub.sdl
View file

@ -36,27 +36,15 @@ configuration "kqueue" {
}
configuration "winapi" {
platforms "windows-x86_64" "windows-x86_mscoff" "windows-ldc" "windows-gdc"
platforms "windows"
versions "EventcoreWinAPIDriver"
}
configuration "select" {
platforms "posix" "windows-x86_64" "windows-x86_mscoff"
platforms "posix" "windows"
versions "EventcoreSelectDriver"
}
configuration "winapi-optlink" {
platforms "windows-x86-dmd"
versions "EventcoreWinAPIDriver"
sourceFiles "lib/ws2_32.lib" "lib/kernel32.lib"
}
configuration "select-optlink" {
platforms "windows-x86-dmd"
versions "EventcoreSelectDriver"
sourceFiles "lib/ws2_32.lib" "lib/kernel32.lib"
}
configuration "libasync" {
dependency "libasync" version="~>0.8.2"
versions "EventcoreLibasyncDriver"

View file

@ -225,25 +225,29 @@ final class ThreadedFileEventDriver(Events : EventDriverEvents) : EventDriverFil
}
on_finish(file, IOStatus.ok, 0);
} else version (Windows) {
import core.sys.windows.windows : FILE_BEGIN, HANDLE, INVALID_HANDLE_VALUE,
LARGE_INTEGER, SetFilePointerEx, SetEndOfFile;
import core.stdc.stdio : _get_osfhandle;
version (Win64) {
import core.sys.windows.windows : FILE_BEGIN, HANDLE, INVALID_HANDLE_VALUE,
LARGE_INTEGER, SetFilePointerEx, SetEndOfFile;
import core.stdc.stdio : _get_osfhandle;
auto h = () @trusted { return cast(HANDLE)_get_osfhandle(cast(int)file); } ();
if (h == INVALID_HANDLE_VALUE) {
auto h = () @trusted { return cast(HANDLE)_get_osfhandle(cast(int)file); } ();
if (h == INVALID_HANDLE_VALUE) {
on_finish(file, IOStatus.error, 0);
return;
}
LARGE_INTEGER ls = { QuadPart: size };
if (!() @trusted { return SetFilePointerEx(h, ls, null, FILE_BEGIN); } ()) {
on_finish(file, IOStatus.error, 0);
return;
}
if (!() @trusted { return SetEndOfFile(h); } ()) {
on_finish(file, IOStatus.error, 0);
return;
}
on_finish(file, IOStatus.ok, 0);
} else {
on_finish(file, IOStatus.error, 0);
return;
}
LARGE_INTEGER ls = { QuadPart: size };
if (!() @trusted { return SetFilePointerEx(h, ls, null, FILE_BEGIN); } ()) {
on_finish(file, IOStatus.error, 0);
return;
}
if (!() @trusted { return SetEndOfFile(h); } ()) {
on_finish(file, IOStatus.error, 0);
return;
}
on_finish(file, IOStatus.ok, 0);
} else {
on_finish(file, IOStatus.error, 0);
}