Trivial: Unify some spacing / style issues

This commit is contained in:
Geod24 2020-08-31 21:05:09 +09:00 committed by Mathias LANG
parent a462db4e04
commit e564bba215
8 changed files with 15 additions and 15 deletions

View file

@ -126,7 +126,7 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver {
} catch (Exception ex) { print("exception happened in Driver.dispose() during formatting"); } } catch (Exception ex) { print("exception happened in Driver.dispose() during formatting"); }
} }
if(leaking_handle_desc.length) { if (leaking_handle_desc.length) {
print("Warning (thread: %s): leaking eventcore driver because there are still active handles", getThreadName()); print("Warning (thread: %s): leaking eventcore driver because there are still active handles", getThreadName());
print(leaking_handle_desc); print(leaking_handle_desc);
} }

View file

@ -64,7 +64,7 @@ version (linux) {
static if (!is(typeof(TCP_USER_TIMEOUT))) static if (!is(typeof(TCP_USER_TIMEOUT)))
enum TCP_USER_TIMEOUT = 18; enum TCP_USER_TIMEOUT = 18;
} }
version(OSX) { version (OSX) {
static if (__VERSION__ < 2077) { static if (__VERSION__ < 2077) {
enum IP_ADD_MEMBERSHIP = 12; enum IP_ADD_MEMBERSHIP = 12;
enum IP_MULTICAST_LOOP = 11; enum IP_MULTICAST_LOOP = 11;
@ -72,13 +72,13 @@ version(OSX) {
static if (!is(typeof(ESHUTDOWN))) enum ESHUTDOWN = 58; static if (!is(typeof(ESHUTDOWN))) enum ESHUTDOWN = 58;
} }
version(FreeBSD) { version (FreeBSD) {
static if (__VERSION__ < 2077) { static if (__VERSION__ < 2077) {
enum IP_ADD_MEMBERSHIP = 12; enum IP_ADD_MEMBERSHIP = 12;
enum IP_MULTICAST_LOOP = 11; enum IP_MULTICAST_LOOP = 11;
} else import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; } else import core.sys.freebsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
} }
version(DragonFlyBSD) { version (DragonFlyBSD) {
import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP; import core.sys.dragonflybsd.netinet.in_ : IP_ADD_MEMBERSHIP, IP_MULTICAST_LOOP;
} }
version (Solaris) { version (Solaris) {

View file

@ -7,12 +7,12 @@ import core.atomic;
import core.stdc.errno; import core.stdc.errno;
import std.algorithm.comparison : among, min; import std.algorithm.comparison : among, min;
version(Posix){ version (Posix) {
import core.sys.posix.fcntl; import core.sys.posix.fcntl;
import core.sys.posix.sys.stat; import core.sys.posix.sys.stat;
import core.sys.posix.unistd; import core.sys.posix.unistd;
} }
version(Windows){ version (Windows) {
static if (__VERSION__ >= 2070) static if (__VERSION__ >= 2070)
import core.sys.windows.stat; import core.sys.windows.stat;
else else

View file

@ -217,10 +217,10 @@ final class WinAPIEventDriverCore : EventDriverCore {
/*if (ret == WAIT_OBJECT_0) { /*if (ret == WAIT_OBJECT_0) {
got_event = true; got_event = true;
Win32TCPConnection[] to_remove; Win32TCPConnection[] to_remove;
foreach( fw; m_fileWriters.byKey ) foreach (fw; m_fileWriters.byKey)
if( fw.testFileWritten() ) if (fw.testFileWritten())
to_remove ~= fw; to_remove ~= fw;
foreach( fw; to_remove ) foreach (fw; to_remove)
m_fileWriters.remove(fw); m_fileWriters.remove(fw);
}*/ }*/

View file

@ -37,7 +37,7 @@ final class WinAPIEventDriverDNS : EventDriverDNS {
return id; return id;
} }
version(none){ // Windows 8+ version (none) { // Windows 8+
LookupStatus status; LookupStatus status;
status.task = Task.getThis(); status.task = Task.getThis();
status.driver = this; status.driver = this;
@ -56,12 +56,12 @@ final class WinAPIEventDriverDNS : EventDriverDNS {
addr_hint.ai_protocol = IPPROTO_TCP; addr_hint.ai_protocol = IPPROTO_TCP;
enforce(GetAddrInfoExW(namew, null, NS_DNS, null, &addr_hint, &addr_ret, null, &overlapped, &onDnsResult, null) == 0, "Failed to lookup host"); enforce(GetAddrInfoExW(namew, null, NS_DNS, null, &addr_hint, &addr_ret, null, &overlapped, &onDnsResult, null) == 0, "Failed to lookup host");
while( !status.finished ) m_core.yieldForEvent(); while (!status.finished) m_core.yieldForEvent();
enforce(!status.error, "Failed to lookup host: "~to!string(status.error)); enforce(!status.error, "Failed to lookup host: "~to!string(status.error));
aif = addr_ret; aif = addr_ret;
addr.family = cast(ubyte)addr_ret.ai_family; addr.family = cast(ubyte)addr_ret.ai_family;
switch(addr.family){ switch (addr.family) {
default: assert(false, "Invalid address family returned from host lookup."); default: assert(false, "Invalid address family returned from host lookup.");
case AF_INET: addr.sockAddrInet4 = *cast(sockaddr_in*)addr_ret.ai_addr; break; case AF_INET: addr.sockAddrInet4 = *cast(sockaddr_in*)addr_ret.ai_addr; break;
case AF_INET6: addr.sockAddrInet6 = *cast(sockaddr_in6*)addr_ret.ai_addr; break; case AF_INET6: addr.sockAddrInet6 = *cast(sockaddr_in6*)addr_ret.ai_addr; break;

View file

@ -955,7 +955,7 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
LRESULT onMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) LRESULT onMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
auto driver = () @trusted { return cast(WinAPIEventDriverSockets)cast(void*)GetWindowLongPtrA(wnd, GWLP_USERDATA); } (); auto driver = () @trusted { return cast(WinAPIEventDriverSockets)cast(void*)GetWindowLongPtrA(wnd, GWLP_USERDATA); } ();
switch(msg){ switch (msg) {
default: break; default: break;
case WM_USER_SOCKET: case WM_USER_SOCKET:
SOCKET sock = cast(SOCKET)wparam; SOCKET sock = cast(SOCKET)wparam;

View file

@ -1,6 +1,6 @@
module eventcore.internal.win32; module eventcore.internal.win32;
version(Windows): version (Windows):
public import core.sys.windows.windows; public import core.sys.windows.windows;
public import core.sys.windows.winsock2; public import core.sys.windows.winsock2;

View file

@ -65,7 +65,7 @@ void main(string[] args)
{ {
numProc--; numProc--;
try writefln("Child %s exited with %s", pid, res); try writefln("Child %s exited with %s", pid, res);
catch(Exception){} catch (Exception) {}
}); });
} }