@@ -3000,7 +3000,7 @@ public:
30003000 * Returns: The number of bytes actually sent, or `Socket.ERROR` on
30013001 * failure.
30023002 */
3003- ptrdiff_t send (const (void )[] buf, SocketFlags flags) @trusted
3003+ ptrdiff_t send (scope const (void )[] buf, SocketFlags flags) @trusted
30043004 {
30053005 static if (is (typeof (MSG_NOSIGNAL )))
30063006 {
@@ -3014,7 +3014,7 @@ public:
30143014 }
30153015
30163016 // / ditto
3017- ptrdiff_t send (const (void )[] buf)
3017+ ptrdiff_t send (scope const (void )[] buf)
30183018 {
30193019 return send (buf, SocketFlags.NONE );
30203020 }
@@ -3026,7 +3026,7 @@ public:
30263026 * Returns: The number of bytes actually sent, or `Socket.ERROR` on
30273027 * failure.
30283028 */
3029- ptrdiff_t sendTo (const (void )[] buf, SocketFlags flags, Address to) @trusted
3029+ ptrdiff_t sendTo (scope const (void )[] buf, SocketFlags flags, Address to) @trusted
30303030 {
30313031 static if (is (typeof (MSG_NOSIGNAL )))
30323032 {
@@ -3042,15 +3042,15 @@ public:
30423042 }
30433043
30443044 // / ditto
3045- ptrdiff_t sendTo (const (void )[] buf, Address to)
3045+ ptrdiff_t sendTo (scope const (void )[] buf, Address to)
30463046 {
30473047 return sendTo (buf, SocketFlags.NONE , to);
30483048 }
30493049
30503050
30513051 // assumes you connect()ed
30523052 // / ditto
3053- ptrdiff_t sendTo (const (void )[] buf, SocketFlags flags) @trusted
3053+ ptrdiff_t sendTo (scope const (void )[] buf, SocketFlags flags) @trusted
30543054 {
30553055 static if (is (typeof (MSG_NOSIGNAL )))
30563056 {
@@ -3065,7 +3065,7 @@ public:
30653065
30663066 // assumes you connect()ed
30673067 // / ditto
3068- ptrdiff_t sendTo (const (void )[] buf)
3068+ ptrdiff_t sendTo (scope const (void )[] buf)
30693069 {
30703070 return sendTo (buf, SocketFlags.NONE );
30713071 }
@@ -3077,7 +3077,7 @@ public:
30773077 * Returns: The number of bytes actually received, `0` if the remote side
30783078 * has closed the connection, or `Socket.ERROR` on failure.
30793079 */
3080- ptrdiff_t receive (void [] buf, SocketFlags flags) @trusted
3080+ ptrdiff_t receive (scope void [] buf, SocketFlags flags) @trusted
30813081 {
30823082 version (Windows ) // Does not use size_t
30833083 {
@@ -3094,7 +3094,7 @@ public:
30943094 }
30953095
30963096 // / ditto
3097- ptrdiff_t receive (void [] buf)
3097+ ptrdiff_t receive (scope void [] buf)
30983098 {
30993099 return receive (buf, SocketFlags.NONE );
31003100 }
@@ -3106,7 +3106,7 @@ public:
31063106 * Returns: The number of bytes actually received, `0` if the remote side
31073107 * has closed the connection, or `Socket.ERROR` on failure.
31083108 */
3109- ptrdiff_t receiveFrom (void [] buf, SocketFlags flags, ref Address from) @trusted
3109+ ptrdiff_t receiveFrom (scope void [] buf, SocketFlags flags, ref Address from) @trusted
31103110 {
31113111 if (! buf.length) // return 0 and don't think the connection closed
31123112 return 0 ;
@@ -3129,15 +3129,15 @@ public:
31293129
31303130
31313131 // / ditto
3132- ptrdiff_t receiveFrom (void [] buf, ref Address from)
3132+ ptrdiff_t receiveFrom (scope void [] buf, ref Address from)
31333133 {
31343134 return receiveFrom (buf, SocketFlags.NONE , from);
31353135 }
31363136
31373137
31383138 // assumes you connect()ed
31393139 // / ditto
3140- ptrdiff_t receiveFrom (void [] buf, SocketFlags flags) @trusted
3140+ ptrdiff_t receiveFrom (scope void [] buf, SocketFlags flags) @trusted
31413141 {
31423142 if (! buf.length) // return 0 and don't think the connection closed
31433143 return 0 ;
@@ -3158,7 +3158,7 @@ public:
31583158
31593159 // assumes you connect()ed
31603160 // / ditto
3161- ptrdiff_t receiveFrom (void [] buf)
3161+ ptrdiff_t receiveFrom (scope void [] buf)
31623162 {
31633163 return receiveFrom (buf, SocketFlags.NONE );
31643164 }
@@ -3169,7 +3169,7 @@ public:
31693169 * Returns: The number of bytes written to `result`.
31703170 * The length, in bytes, of the actual result - very different from getsockopt()
31713171 */
3172- int getOption (SocketOptionLevel level, SocketOption option, void [] result) @trusted
3172+ int getOption (SocketOptionLevel level, SocketOption option, scope void [] result) @trusted
31733173 {
31743174 socklen_t len = cast (socklen_t) result.length;
31753175 if (_SOCKET_ERROR == .getsockopt(sock, cast (int ) level, cast (int ) option, result.ptr, &len))
@@ -3217,7 +3217,7 @@ public:
32173217 }
32183218
32193219 // / Set a socket option.
3220- void setOption (SocketOptionLevel level, SocketOption option, void [] value) @trusted
3220+ void setOption (SocketOptionLevel level, SocketOption option, scope void [] value) @trusted
32213221 {
32223222 if (_SOCKET_ERROR == .setsockopt(sock, cast (int ) level,
32233223 cast (int ) option, value.ptr, cast (uint ) value.length))
@@ -3647,55 +3647,55 @@ class UdpSocket: Socket
36473647 {
36483648 checkAttributes! q{@trusted }; assert (0 );
36493649 }
3650- @trusted ptrdiff_t send(const (void )[] buf, SocketFlags flags)
3650+ @trusted ptrdiff_t send(scope const (void )[] buf, SocketFlags flags)
36513651 {
36523652 checkAttributes! q{@trusted }; assert (0 );
36533653 }
3654- @safe ptrdiff_t send(const (void )[] buf)
3654+ @safe ptrdiff_t send(scope const (void )[] buf)
36553655 {
36563656 checkAttributes! q{@safe }; assert (0 );
36573657 }
3658- @trusted ptrdiff_t sendTo(const (void )[] buf, SocketFlags flags, Address to)
3658+ @trusted ptrdiff_t sendTo(scope const (void )[] buf, SocketFlags flags, Address to)
36593659 {
36603660 checkAttributes! q{@trusted }; assert (0 );
36613661 }
3662- @safe ptrdiff_t sendTo(const (void )[] buf, Address to)
3662+ @safe ptrdiff_t sendTo(scope const (void )[] buf, Address to)
36633663 {
36643664 checkAttributes! q{@safe }; assert (0 );
36653665 }
3666- @trusted ptrdiff_t sendTo(const (void )[] buf, SocketFlags flags)
3666+ @trusted ptrdiff_t sendTo(scope const (void )[] buf, SocketFlags flags)
36673667 {
36683668 checkAttributes! q{@trusted }; assert (0 );
36693669 }
3670- @safe ptrdiff_t sendTo(const (void )[] buf)
3670+ @safe ptrdiff_t sendTo(scope const (void )[] buf)
36713671 {
36723672 checkAttributes! q{@safe }; assert (0 );
36733673 }
3674- @trusted ptrdiff_t receive(void [] buf, SocketFlags flags)
3674+ @trusted ptrdiff_t receive(scope void [] buf, SocketFlags flags)
36753675 {
36763676 checkAttributes! q{@trusted }; assert (0 );
36773677 }
3678- @safe ptrdiff_t receive(void [] buf)
3678+ @safe ptrdiff_t receive(scope void [] buf)
36793679 {
36803680 checkAttributes! q{@safe }; assert (0 );
36813681 }
3682- @trusted ptrdiff_t receiveFrom(void [] buf, SocketFlags flags, ref Address from)
3682+ @trusted ptrdiff_t receiveFrom(scope void [] buf, SocketFlags flags, ref Address from)
36833683 {
36843684 checkAttributes! q{@trusted }; assert (0 );
36853685 }
3686- @safe ptrdiff_t receiveFrom(void [] buf, ref Address from)
3686+ @safe ptrdiff_t receiveFrom(scope void [] buf, ref Address from)
36873687 {
36883688 checkAttributes! q{@safe }; assert (0 );
36893689 }
3690- @trusted ptrdiff_t receiveFrom(void [] buf, SocketFlags flags)
3690+ @trusted ptrdiff_t receiveFrom(scope void [] buf, SocketFlags flags)
36913691 {
36923692 checkAttributes! q{@trusted }; assert (0 );
36933693 }
3694- @safe ptrdiff_t receiveFrom(void [] buf)
3694+ @safe ptrdiff_t receiveFrom(scope void [] buf)
36953695 {
36963696 checkAttributes! q{@safe }; assert (0 );
36973697 }
3698- @trusted int getOption(SocketOptionLevel level, SocketOption option, void [] result)
3698+ @trusted int getOption(SocketOptionLevel level, SocketOption option, scope void [] result)
36993699 {
37003700 checkAttributes! q{@trusted }; assert (0 );
37013701 }
@@ -3711,7 +3711,7 @@ class UdpSocket: Socket
37113711 {
37123712 checkAttributes! q{@trusted };
37133713 }
3714- @trusted void setOption(SocketOptionLevel level, SocketOption option, void [] value)
3714+ @trusted void setOption(SocketOptionLevel level, SocketOption option, scope void [] value)
37153715 {
37163716 checkAttributes! q{@trusted };
37173717 }
@@ -3793,11 +3793,11 @@ Socket[2] socketPair() @trusted
37933793// /
37943794@safe unittest
37953795{
3796- immutable ubyte [] data = [1 , 2 , 3 , 4 ];
3796+ immutable ubyte [4 ] data = [1 , 2 , 3 , 4 ];
37973797 auto pair = socketPair();
37983798 scope (exit) foreach (s; pair) s.close();
37993799
3800- pair[0 ].send(data);
3800+ pair[0 ].send(data[] );
38013801
38023802 auto buf = new ubyte [data.length];
38033803 pair[1 ].receive(buf);
0 commit comments