Compile fixes.

This commit is contained in:
Sönke Ludwig 2017-03-10 20:07:04 +01:00
parent 1edfc88e63
commit ed8b33786b
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -273,7 +273,7 @@ struct NetworkAddress {
case AddressFamily.UNIX: case AddressFamily.UNIX:
this.family = AddressFamily.UNIX; this.family = AddressFamily.UNIX;
assert(addr.nameLen >= sockaddr_un.sizeof); assert(addr.nameLen >= sockaddr_un.sizeof);
this.sockAddrUnix = *cast(sockaddr_un*)addr.name; *this.sockAddrUnix = *cast(sockaddr_un*)addr.name;
break; break;
} }
} }
@ -378,10 +378,11 @@ struct NetworkAddress {
version (Posix) { version (Posix) {
case AddressFamily.UNIX: case AddressFamily.UNIX:
import std.traits : hasMember; import std.traits : hasMember;
import std.string : fromStringz;
static if (hasMember!(sockaddr_un, "sun_len")) static if (hasMember!(sockaddr_un, "sun_len"))
sink.formattedWrite("%s",() @trusted { return cast(char[])addr_unix.sun_path[0..addr_unix.sun_len]; } ()); sink(() @trusted { return cast(char[])addr_unix.sun_path[0..addr_unix.sun_len]; } ());
else else
sink.formattedWrite("%s",() @trusted { return (cast(char*)addr_unix.sun_path.ptr).fromStringz; } ()); sink(() @trusted { return (cast(char*)addr_unix.sun_path.ptr).fromStringz; } ());
break; break;
} }
} }