From e564bba21556c91a5fb83688914b1f612c39f5b6 Mon Sep 17 00:00:00 2001 From: Geod24 Date: Mon, 31 Aug 2020 21:05:09 +0900 Subject: [PATCH] Trivial: Unify some spacing / style issues --- source/eventcore/drivers/posix/driver.d | 2 +- source/eventcore/drivers/posix/sockets.d | 6 +++--- source/eventcore/drivers/threadedfile.d | 4 ++-- source/eventcore/drivers/winapi/core.d | 6 +++--- source/eventcore/drivers/winapi/dns.d | 6 +++--- source/eventcore/drivers/winapi/sockets.d | 2 +- source/eventcore/internal/win32.d | 2 +- tests/issue-122-coalesced-sigchld.d | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/eventcore/drivers/posix/driver.d b/source/eventcore/drivers/posix/driver.d index c8f11ec..10c9551 100644 --- a/source/eventcore/drivers/posix/driver.d +++ b/source/eventcore/drivers/posix/driver.d @@ -126,7 +126,7 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver { } 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(leaking_handle_desc); } diff --git a/source/eventcore/drivers/posix/sockets.d b/source/eventcore/drivers/posix/sockets.d index ee27eea..4acb54f 100644 --- a/source/eventcore/drivers/posix/sockets.d +++ b/source/eventcore/drivers/posix/sockets.d @@ -64,7 +64,7 @@ version (linux) { static if (!is(typeof(TCP_USER_TIMEOUT))) enum TCP_USER_TIMEOUT = 18; } -version(OSX) { +version (OSX) { static if (__VERSION__ < 2077) { enum IP_ADD_MEMBERSHIP = 12; enum IP_MULTICAST_LOOP = 11; @@ -72,13 +72,13 @@ version(OSX) { static if (!is(typeof(ESHUTDOWN))) enum ESHUTDOWN = 58; } -version(FreeBSD) { +version (FreeBSD) { static if (__VERSION__ < 2077) { enum IP_ADD_MEMBERSHIP = 12; enum IP_MULTICAST_LOOP = 11; } 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; } version (Solaris) { diff --git a/source/eventcore/drivers/threadedfile.d b/source/eventcore/drivers/threadedfile.d index 9ea9857..5b04421 100644 --- a/source/eventcore/drivers/threadedfile.d +++ b/source/eventcore/drivers/threadedfile.d @@ -7,12 +7,12 @@ import core.atomic; import core.stdc.errno; import std.algorithm.comparison : among, min; -version(Posix){ +version (Posix) { import core.sys.posix.fcntl; import core.sys.posix.sys.stat; import core.sys.posix.unistd; } -version(Windows){ +version (Windows) { static if (__VERSION__ >= 2070) import core.sys.windows.stat; else diff --git a/source/eventcore/drivers/winapi/core.d b/source/eventcore/drivers/winapi/core.d index 26c3f45..16aa0a9 100644 --- a/source/eventcore/drivers/winapi/core.d +++ b/source/eventcore/drivers/winapi/core.d @@ -217,10 +217,10 @@ final class WinAPIEventDriverCore : EventDriverCore { /*if (ret == WAIT_OBJECT_0) { got_event = true; Win32TCPConnection[] to_remove; - foreach( fw; m_fileWriters.byKey ) - if( fw.testFileWritten() ) + foreach (fw; m_fileWriters.byKey) + if (fw.testFileWritten()) to_remove ~= fw; - foreach( fw; to_remove ) + foreach (fw; to_remove) m_fileWriters.remove(fw); }*/ diff --git a/source/eventcore/drivers/winapi/dns.d b/source/eventcore/drivers/winapi/dns.d index 5b45c1e..1071dd7 100644 --- a/source/eventcore/drivers/winapi/dns.d +++ b/source/eventcore/drivers/winapi/dns.d @@ -37,7 +37,7 @@ final class WinAPIEventDriverDNS : EventDriverDNS { return id; } - version(none){ // Windows 8+ + version (none) { // Windows 8+ LookupStatus status; status.task = Task.getThis(); status.driver = this; @@ -56,12 +56,12 @@ final class WinAPIEventDriverDNS : EventDriverDNS { 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"); - while( !status.finished ) m_core.yieldForEvent(); + while (!status.finished) m_core.yieldForEvent(); enforce(!status.error, "Failed to lookup host: "~to!string(status.error)); aif = addr_ret; addr.family = cast(ubyte)addr_ret.ai_family; - switch(addr.family){ + switch (addr.family) { 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_INET6: addr.sockAddrInet6 = *cast(sockaddr_in6*)addr_ret.ai_addr; break; diff --git a/source/eventcore/drivers/winapi/sockets.d b/source/eventcore/drivers/winapi/sockets.d index ec7e272..f205303 100644 --- a/source/eventcore/drivers/winapi/sockets.d +++ b/source/eventcore/drivers/winapi/sockets.d @@ -955,7 +955,7 @@ final class WinAPIEventDriverSockets : EventDriverSockets { LRESULT onMessage(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) { auto driver = () @trusted { return cast(WinAPIEventDriverSockets)cast(void*)GetWindowLongPtrA(wnd, GWLP_USERDATA); } (); - switch(msg){ + switch (msg) { default: break; case WM_USER_SOCKET: SOCKET sock = cast(SOCKET)wparam; diff --git a/source/eventcore/internal/win32.d b/source/eventcore/internal/win32.d index 9a4a599..5a4565a 100644 --- a/source/eventcore/internal/win32.d +++ b/source/eventcore/internal/win32.d @@ -1,6 +1,6 @@ module eventcore.internal.win32; -version(Windows): +version (Windows): public import core.sys.windows.windows; public import core.sys.windows.winsock2; diff --git a/tests/issue-122-coalesced-sigchld.d b/tests/issue-122-coalesced-sigchld.d index 625cbd4..f858f6f 100644 --- a/tests/issue-122-coalesced-sigchld.d +++ b/tests/issue-122-coalesced-sigchld.d @@ -65,7 +65,7 @@ void main(string[] args) { numProc--; try writefln("Child %s exited with %s", pid, res); - catch(Exception){} + catch (Exception) {} }); }