Fix compilation on Windows and DMD 2.072.1.

This commit is contained in:
Sönke Ludwig 2016-12-19 16:16:22 +01:00
parent 8a365f6d07
commit cc3299fb88
3 changed files with 12 additions and 4 deletions

View file

@ -27,6 +27,9 @@ version (Windows) {
import core.sys.windows.winsock2; import core.sys.windows.winsock2;
alias sockaddr_storage = SOCKADDR_STORAGE; alias sockaddr_storage = SOCKADDR_STORAGE;
alias EAGAIN = WSAEWOULDBLOCK; alias EAGAIN = WSAEWOULDBLOCK;
enum SHUT_RDWR = SD_BOTH;
enum SHUT_RD = SD_RECEIVE;
enum SHUT_WR = SD_SEND;
extern (C) int read(int fd, void *buffer, uint count) nothrow; extern (C) int read(int fd, void *buffer, uint count) nothrow;
extern (C) int write(int fd, const(void) *buffer, uint count) nothrow; extern (C) int write(int fd, const(void) *buffer, uint count) nothrow;
extern (C) int close(int fd) nothrow @safe; extern (C) int close(int fd) nothrow @safe;

View file

@ -147,8 +147,13 @@ final class ThreadedFileEventDriver(Events : EventDriverEvents) : EventDriverFil
final override FileFD adopt(int system_file_handle) final override FileFD adopt(int system_file_handle)
{ {
version (Windows) {
// TODO: check if FD is a valid file!
} else {
auto flags = () @trusted { return fcntl(system_file_handle, F_GETFD); } (); auto flags = () @trusted { return fcntl(system_file_handle, F_GETFD); } ();
if (flags == -1) return FileFD.invalid; if (flags == -1) return FileFD.invalid;
}
if (m_files[system_file_handle].refCount > 0) return FileFD.invalid; if (m_files[system_file_handle].refCount > 0) return FileFD.invalid;
m_files[system_file_handle] = FileInfo.init; m_files[system_file_handle] = FileInfo.init;
m_files[system_file_handle].refCount = 1; m_files[system_file_handle].refCount = 1;

View file

@ -155,7 +155,7 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
assert(false, "TODO!"); assert(false, "TODO!");
} }
override void send(DatagramSocketFD socket, const(ubyte)[] buffer, IOMode mode, DatagramIOCallback on_send_finish, Address target_address = null) override void send(DatagramSocketFD socket, const(ubyte)[] buffer, IOMode mode, Address target_address, DatagramIOCallback on_send_finish)
{ {
assert(false, "TODO!"); assert(false, "TODO!");
} }
@ -198,7 +198,7 @@ final class WinAPIEventDriverFiles : EventDriverFiles {
assert(false, "TODO!"); assert(false, "TODO!");
} }
override FileFD createTemp() override FileFD adopt(int system_handle)
{ {
assert(false, "TODO!"); assert(false, "TODO!");
} }