ObjFW  Diff

Differences From Artifact [a9d215ce51]:

To Artifact [c8e3c83553]:


584
585
586
587
588
589
590


591
592
593
594
595
596
597
598
599

600
601


602
603
604
605
606
607
608
609
610

611
612






613
614
615
616
617
618
619
	    length: (size_t)length
	  receiver: (const of_udp_socket_address_t *)receiver
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

#ifndef OF_WINDOWS


	if (length > SSIZE_MAX)
		@throw [OFOutOfRangeException exception];

	if (sendto(_socket, buffer, length, 0,
	    (struct sockaddr *)&receiver->address,
	    receiver->length) != (ssize_t)length)
		@throw [OFWriteFailedException
		    exceptionWithObject: self
			requestedLength: length

				  errNo: of_socket_errno()];
#else


	if (length > INT_MAX)
		@throw [OFOutOfRangeException exception];

	if (sendto(_socket, buffer, (int)length, 0,
	    (struct sockaddr *)&receiver->address,
	    receiver->length) != (int)length)
		@throw [OFWriteFailedException
		    exceptionWithObject: self
			requestedLength: length

				  errNo: of_socket_errno()];
#endif






}

- (void)cancelAsyncRequests
{
	[OFRunLoop of_cancelAsyncRequestsForObject: self];
}








>
>



|
|
<



>


>
>



|

|



>


>
>
>
>
>
>







584
585
586
587
588
589
590
591
592
593
594
595
596
597

598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
	    length: (size_t)length
	  receiver: (const of_udp_socket_address_t *)receiver
{
	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

#ifndef OF_WINDOWS
	ssize_t bytesWritten;

	if (length > SSIZE_MAX)
		@throw [OFOutOfRangeException exception];

	if ((bytesWritten = sendto(_socket, buffer, length, 0,
	    (struct sockaddr *)&receiver->address, receiver->length)) < 0)

		@throw [OFWriteFailedException
		    exceptionWithObject: self
			requestedLength: length
			   bytesWritten: 0
				  errNo: of_socket_errno()];
#else
	int bytesWritten;

	if (length > INT_MAX)
		@throw [OFOutOfRangeException exception];

	if ((bytesWritten = sendto(_socket, buffer, (int)length, 0,
	    (struct sockaddr *)&receiver->address,
	    receiver->length)) < 0)
		@throw [OFWriteFailedException
		    exceptionWithObject: self
			requestedLength: length
			   bytesWritten: 0
				  errNo: of_socket_errno()];
#endif

	if ((size_t)bytesWritten != length)
		@throw [OFWriteFailedException exceptionWithObject: self
						   requestedLength: length
						      bytesWritten: bytesWritten
							     errNo: 0];
}

- (void)cancelAsyncRequests
{
	[OFRunLoop of_cancelAsyncRequestsForObject: self];
}