Skip to content

Commit 6a40435

Browse files
Fix warnings about sign comparisons. The cast to unsigned is safe when result is > 0.
1 parent a8321e8 commit 6a40435

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

GCD/GCDAsyncUdpSocket.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3798,7 +3798,7 @@ - (void)setupSendTimerWithTimeout:(NSTimeInterval)timeout
37983798
dispatch_release(theSendTimer);
37993799
});
38003800

3801-
dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (timeout * NSEC_PER_SEC));
3801+
dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC));
38023802

38033803
dispatch_source_set_timer(sendTimer, tt, DISPATCH_TIME_FOREVER, 0);
38043804
dispatch_resume(sendTimer);
@@ -4006,12 +4006,12 @@ - (void)doReceive
40064006

40074007
if (result > 0)
40084008
{
4009-
if (result >= socket4FDBytesAvailable)
4009+
if ((size_t)result >= socket4FDBytesAvailable)
40104010
socket4FDBytesAvailable = 0;
40114011
else
40124012
socket4FDBytesAvailable -= result;
40134013

4014-
if (result != bufSize) {
4014+
if ((size_t)result != bufSize) {
40154015
buf = realloc(buf, result);
40164016
}
40174017

@@ -4040,12 +4040,12 @@ - (void)doReceive
40404040

40414041
if (result > 0)
40424042
{
4043-
if (result >= socket6FDBytesAvailable)
4043+
if ((size_t)result >= socket6FDBytesAvailable)
40444044
socket6FDBytesAvailable = 0;
40454045
else
40464046
socket6FDBytesAvailable -= result;
40474047

4048-
if (result != bufSize) {
4048+
if ((size_t)result != bufSize) {
40494049
buf = realloc(buf, result);
40504050
}
40514051

0 commit comments

Comments
 (0)