Add `scope` to Socket derived functions

This commit is contained in:
Dennis Korpel 2022-07-05 10:53:57 +02:00
parent 047f937bb9
commit 257103befc
2 changed files with 17 additions and 17 deletions

18
cgi.d
View File

@ -4446,7 +4446,7 @@ private class PseudoblockingOverlappedSocket : Socket {
WSABUF[1] buffer; WSABUF[1] buffer;
OVERLAPPED overlapped; OVERLAPPED overlapped;
override ptrdiff_t send(const(void)[] buf, SocketFlags flags) @trusted { override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) @trusted {
overlapped = overlapped.init; overlapped = overlapped.init;
buffer[0].len = cast(DWORD) buf.length; buffer[0].len = cast(DWORD) buf.length;
buffer[0].buf = cast(CHAR*) buf.ptr; buffer[0].buf = cast(CHAR*) buf.ptr;
@ -4461,7 +4461,7 @@ private class PseudoblockingOverlappedSocket : Socket {
Fiber.yield(); Fiber.yield();
return lastAnswer; return lastAnswer;
} }
override ptrdiff_t receive(void[] buf, SocketFlags flags) @trusted { override ptrdiff_t receive(scope void[] buf, SocketFlags flags) @trusted {
overlapped = overlapped.init; overlapped = overlapped.init;
buffer[0].len = cast(DWORD) buf.length; buffer[0].len = cast(DWORD) buf.length;
buffer[0].buf = cast(CHAR*) buf.ptr; buffer[0].buf = cast(CHAR*) buf.ptr;
@ -4482,16 +4482,16 @@ private class PseudoblockingOverlappedSocket : Socket {
} }
// I might go back and implement these for udp things. // I might go back and implement these for udp things.
override ptrdiff_t receiveFrom(void[] buf, SocketFlags flags, ref Address from) @trusted { override ptrdiff_t receiveFrom(scope void[] buf, SocketFlags flags, ref Address from) @trusted {
assert(0); assert(0);
} }
override ptrdiff_t receiveFrom(void[] buf, SocketFlags flags) @trusted { override ptrdiff_t receiveFrom(scope void[] buf, SocketFlags flags) @trusted {
assert(0); assert(0);
} }
override ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags, Address to) @trusted { override ptrdiff_t sendTo(scope const(void)[] buf, SocketFlags flags, Address to) @trusted {
assert(0); assert(0);
} }
override ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags) @trusted { override ptrdiff_t sendTo(scope const(void)[] buf, SocketFlags flags) @trusted {
assert(0); assert(0);
} }
@ -5117,13 +5117,13 @@ private class FakeSocketForStdin : Socket {
private bool closed; private bool closed;
override ptrdiff_t receive(void[] buffer, std.socket.SocketFlags) @trusted { override ptrdiff_t receive(scope void[] buffer, std.socket.SocketFlags) @trusted {
if(closed) if(closed)
throw new Exception("Closed"); throw new Exception("Closed");
return stdin.rawRead(buffer).length; return stdin.rawRead(buffer).length;
} }
override ptrdiff_t send(const void[] buffer, std.socket.SocketFlags) @trusted { override ptrdiff_t send(const scope void[] buffer, std.socket.SocketFlags) @trusted {
if(closed) if(closed)
throw new Exception("Closed"); throw new Exception("Closed");
stdout.rawWrite(buffer); stdout.rawWrite(buffer);
@ -5138,7 +5138,7 @@ private class FakeSocketForStdin : Socket {
// FIXME // FIXME
} }
override void setOption(SocketOptionLevel, SocketOption, void[]) {} override void setOption(SocketOptionLevel, SocketOption, scope void[]) {}
override void setOption(SocketOptionLevel, SocketOption, Duration) {} override void setOption(SocketOptionLevel, SocketOption, Duration) {}
override @property @trusted Address remoteAddress() { return null; } override @property @trusted Address remoteAddress() { return null; }

View File

@ -187,28 +187,28 @@ class FiberSocket : Socket {
} }
/// Yielding override of the Phobos interface /// Yielding override of the Phobos interface
override ptrdiff_t send(const(void)[] buf, SocketFlags flags) { override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) {
return magic( () { return super.send(buf, flags); }, PendingOperation.write); return magic( () { return super.send(buf, flags); }, PendingOperation.write);
} }
/// ditto /// ditto
override ptrdiff_t receive(void[] buf, SocketFlags flags) { override ptrdiff_t receive(scope void[] buf, SocketFlags flags) {
return magic( () { return super.receive(buf, flags); }, PendingOperation.read); return magic( () { return super.receive(buf, flags); }, PendingOperation.read);
} }
/// ditto /// ditto
override ptrdiff_t receiveFrom(void[] buf, SocketFlags flags, ref Address from) @trusted { override ptrdiff_t receiveFrom(scope void[] buf, SocketFlags flags, ref Address from) @trusted {
return magic( () { return super.receiveFrom(buf, flags, from); }, PendingOperation.read); return magic( () { return super.receiveFrom(buf, flags, from); }, PendingOperation.read);
} }
/// ditto /// ditto
override ptrdiff_t receiveFrom(void[] buf, SocketFlags flags) @trusted { override ptrdiff_t receiveFrom(scope void[] buf, SocketFlags flags) @trusted {
return magic( () { return super.receiveFrom(buf, flags); }, PendingOperation.read); return magic( () { return super.receiveFrom(buf, flags); }, PendingOperation.read);
} }
/// ditto /// ditto
override ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags, Address to) @trusted { override ptrdiff_t sendTo(scope const(void)[] buf, SocketFlags flags, Address to) @trusted {
return magic( () { return super.sendTo(buf, flags, to); }, PendingOperation.write); return magic( () { return super.sendTo(buf, flags, to); }, PendingOperation.write);
} }
/// ditto /// ditto
override ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags) @trusted { override ptrdiff_t sendTo(scope const(void)[] buf, SocketFlags flags) @trusted {
return magic( () { return super.sendTo(buf, flags); }, PendingOperation.write); return magic( () { return super.sendTo(buf, flags); }, PendingOperation.write);
} }