@@ -1,8 +1,8 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 - * Jonathan Schleifer + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 + * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -99,20 +99,23 @@ @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: ENOTCONN]; #ifndef _WIN32 - if (send(_socket, buffer, length, 0) < length) + if (length > SSIZE_MAX) + @throw [OFOutOfRangeException exception]; + + if (send(_socket, buffer, length, 0) != (ssize_t)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; #else - if (length > UINT_MAX) + if (length > INT_MAX) @throw [OFOutOfRangeException exception]; - if (send(_socket, buffer, (unsigned int)length, 0) < length) + if (send(_socket, buffer, (int)length, 0) != (int)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; #endif