Comment: | Fix a few issues on LLP64 and Win64
LLP64 was mostly fast enumeration using an unsigned long for the state, Win64 was mostly Microsoft not being able to decide whether a length is |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4e59d2692f11cc20e243ed6977ac17b2 |
User & Date: | js on 2014-04-26 00:40:17 |
Other Links: | manifest | tags |
2014-04-26
| ||
00:57 | configure: Improve warning about an old compiler check-in: 216ac1450c user: js tags: trunk | |
00:40 | Fix a few issues on LLP64 and Win64 check-in: 4e59d2692f user: js tags: trunk | |
2014-04-23
| ||
18:56 | forwarding-arm-elf.S: Add #ifdef HAVE_VFP2 check-in: dc5938cee7 user: js tags: trunk | |
Modified src/OFArray.m from [ef5fe152e1] to [ff677666a5].
︙ | ︙ | |||
738 739 740 741 742 743 744 | if (range.location + range.length > [self count]) range.length = [self count] - range.location; [self getObjects: objects inRange: range]; | | > > > | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | if (range.location + range.length > [self count]) range.length = [self count] - range.location; [self getObjects: objects inRange: range]; if (range.location + range.length > ULONG_MAX) @throw [OFOutOfRangeException exception]; state->state = (unsigned long)(range.location + range.length); state->itemsPtr = objects; state->mutationsPtr = (unsigned long*)self; return (int)range.length; } - (OFEnumerator*)objectEnumerator |
︙ | ︙ |
Modified src/OFArray_adjacent.m from [0b8584dc8f] to [794a332a64].
︙ | ︙ | |||
345 346 347 348 349 350 351 | return [super countByEnumeratingWithState: state objects: objects count: count_]; if (state->state >= count) return 0; | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | return [super countByEnumeratingWithState: state objects: objects count: count_]; if (state->state >= count) return 0; state->state = (unsigned long)count; state->itemsPtr = [_array items]; state->mutationsPtr = (unsigned long*)self; return (int)count; } #ifdef OF_HAVE_BLOCKS |
︙ | ︙ |
Modified src/OFFile.m from [fd77a17f17] to [c90f56e169].
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFLinkFailedException.h" #import "OFLockFailedException.h" #import "OFMoveItemFailedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFReadFailedException.h" #import "OFRemoveItemFailedException.h" #import "OFSeekFailedException.h" #import "OFUnlockFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" | > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFLinkFailedException.h" #import "OFLockFailedException.h" #import "OFMoveItemFailedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFRemoveItemFailedException.h" #import "OFSeekFailedException.h" #import "OFUnlockFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" |
︙ | ︙ | |||
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)length { ssize_t ret; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (off_t)lowlevelSeekToOffset: (off_t)offset whence: (int)whence { off_t ret = lseek(_fd, offset, whence); | > > > > > > > > > > > > > > > > > > > > | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)length { ssize_t ret; #ifndef _WIN32 if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, (unsigned int)length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #endif if (ret == 0) _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { #ifndef _WIN32 if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if (_fd == -1 || _atEndOfStream || write(_fd, buffer, (unsigned int)length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #endif } - (off_t)lowlevelSeekToOffset: (off_t)offset whence: (int)whence { off_t ret = lseek(_fd, offset, whence); |
︙ | ︙ |
Modified src/OFKernelEventObserver.h from [e0eb637de6] to [001fd5d024].
︙ | ︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | OFMutableArray *_readObjects; OFMutableArray *_writeObjects; __unsafe_unretained id *_FDToObject; size_t _maxFD; OFMutableArray *_queue; OFDataArray *_queueInfo, *_queueFDs; id <OFKernelEventObserverDelegate> _delegate; int _cancelFD[2]; #ifndef OF_HAVE_PIPE struct sockaddr_in _cancelAddr; #endif #ifdef OF_HAVE_THREADS OFMutex *_mutex; #endif } | > > > > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | OFMutableArray *_readObjects; OFMutableArray *_writeObjects; __unsafe_unretained id *_FDToObject; size_t _maxFD; OFMutableArray *_queue; OFDataArray *_queueInfo, *_queueFDs; id <OFKernelEventObserverDelegate> _delegate; #ifndef _WIN32 int _cancelFD[2]; #else SOCKET _cancelFD[2]; #endif #ifndef OF_HAVE_PIPE struct sockaddr_in _cancelAddr; #endif #ifdef OF_HAVE_THREADS OFMutex *_mutex; #endif } |
︙ | ︙ |
Modified src/OFKernelEventObserver_select.m from [caa1fbb7ea] to [434ba010aa].
︙ | ︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | /* * We cast to int before assigning to tv_usec in order to avoid a * warning with Apple GCC on PPC. POSIX defines this as suseconds_t, * however, this is not available on Win32. As an int should always * satisfy the required range, we just cast to int. */ timeout.tv_sec = (time_t)timeInterval; timeout.tv_usec = (int)lrint((timeInterval - timeout.tv_sec) * 1000); if (select((int)_maxFD + 1, &readFDs, &writeFDs, NULL, (timeInterval != -1 ? &timeout : NULL)) < 1) return false; if (FD_ISSET(_cancelFD[0], &readFDs)) { | > > > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | /* * We cast to int before assigning to tv_usec in order to avoid a * warning with Apple GCC on PPC. POSIX defines this as suseconds_t, * however, this is not available on Win32. As an int should always * satisfy the required range, we just cast to int. */ #ifndef _WIN32 timeout.tv_sec = (time_t)timeInterval; #else timeout.tv_sec = (long)timeInterval; #endif timeout.tv_usec = (int)lrint((timeInterval - timeout.tv_sec) * 1000); if (select((int)_maxFD + 1, &readFDs, &writeFDs, NULL, (timeInterval != -1 ? &timeout : NULL)) < 1) return false; if (FD_ISSET(_cancelFD[0], &readFDs)) { |
︙ | ︙ |
Modified src/OFList.m from [3fd803b400] to [fae299202c].
︙ | ︙ | |||
12 13 14 15 16 17 18 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #include <assert.h> #import "OFList.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFArray.h" #import "OFEnumerationMutationException.h" |
︙ | ︙ | |||
381 382 383 384 385 386 387 | return element; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count { | | > > | | | | > > | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | return element; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count { of_list_object_t *listObject; int i; memcpy(&listObject, state->extra, sizeof(listObject)); state->itemsPtr = objects; state->mutationsPtr = &_mutations; if (state->state == 0) { listObject = _firstListObject; state->state = 1; } for (i = 0; i < count; i++) { if (listObject == NULL) return i; objects[i] = listObject->object; listObject = listObject->next; } memcpy(state->extra, &listObject, sizeof(listObject)); return count; } - (OFEnumerator*)objectEnumerator { return [[[OFListEnumerator alloc] |
︙ | ︙ |
Modified src/OFMutableArray_adjacent.m from [dd32892024] to [1c77ed7f95].
︙ | ︙ | |||
316 317 318 319 320 321 322 | state->mutationsPtr = &_mutations; return ret; } if (state->state >= count) return 0; | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | state->mutationsPtr = &_mutations; return ret; } if (state->state >= count) return 0; state->state = (unsigned long)count; state->itemsPtr = [_array items]; state->mutationsPtr = &_mutations; return (int)count; } - (OFEnumerator*)objectEnumerator |
︙ | ︙ |
Modified src/OFProcess.m from [69b09cd9ef] to [f1314df72d].
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #import "OFProcess.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFInitializationFailedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #ifdef _WIN32 # include <windows.h> #endif | > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #import "OFProcess.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFInitializationFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #ifdef _WIN32 # include <windows.h> #endif |
︙ | ︙ | |||
394 395 396 397 398 399 400 | ssize_t ret; #else DWORD ret; #endif #ifndef _WIN32 if (_readPipe[0] == -1 || _atEndOfStream || | | > > > > > | < > > > > > > | < > | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | ssize_t ret; #else DWORD ret; #endif #ifndef _WIN32 if (_readPipe[0] == -1 || _atEndOfStream || (ret = read(_readPipe[0], buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (_readPipe[0] == NULL || _atEndOfStream || !ReadFile(_readPipe[0], buffer, (DWORD)length, &ret, NULL)) { if (GetLastError() == ERROR_BROKEN_PIPE) { _atEndOfStream = true; return 0; } @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; } #endif if (ret == 0) _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { #ifndef _WIN32 if (_writePipe[1] == -1 || _atEndOfStream || write(_writePipe[1], buffer, length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #else DWORD ret; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (_writePipe[1] == NULL || _atEndOfStream || !WriteFile(_writePipe[1], buffer, (DWORD)length, &ret, NULL) || ret < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #endif } - (int)fileDescriptorForReading { #ifndef _WIN32 return _readPipe[0]; #else |
︙ | ︙ |
Modified src/OFStdIOStream.m from [8d9bbeeba6] to [84af7e353c].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <unistd.h> #import "OFStdIOStream.h" #import "OFDate.h" #import "OFApplication.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" #import "macros.h" OFStdIOStream *of_stdin = nil; | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <unistd.h> #import "OFStdIOStream.h" #import "OFDate.h" #import "OFApplication.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" #import "macros.h" OFStdIOStream *of_stdin = nil; |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)length { ssize_t ret; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (int)fileDescriptorForReading { return _fd; } | > > > > > > > > > > > > > > > > > > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)length { ssize_t ret; #ifndef _WIN32 if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, (unsigned int)length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #endif if (ret == 0) _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { #ifndef _WIN32 if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if (_fd == -1 || _atEndOfStream || write(_fd, buffer, (unsigned int)length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #endif } - (int)fileDescriptorForReading { return _fd; } |
︙ | ︙ |
Modified src/OFStreamSocket.m from [8ed3399f44] to [43c1e24000].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <errno.h> #import "OFStreamSocket.h" #import "OFInitializationFailedException.h" #import "OFNotConnectedException.h" #import "OFReadFailedException.h" #import "OFSetOptionFailedException.h" #import "OFWriteFailedException.h" #import "socket_helpers.h" @implementation OFStreamSocket | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <errno.h> #import "OFStreamSocket.h" #import "OFInitializationFailedException.h" #import "OFNotConnectedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSetOptionFailedException.h" #import "OFWriteFailedException.h" #import "socket_helpers.h" @implementation OFStreamSocket |
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | e = [OFReadFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } if ((ret = recv(_socket, buffer, length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; return ret; } | > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | e = [OFReadFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } #ifndef _WIN32 if ((ret = recv(_socket, buffer, length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recv(_socket, buffer, (unsigned int)length, 0)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #endif if (ret == 0) _atEndOfStream = true; return ret; } |
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | e = [OFWriteFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } if (send(_socket, buffer, length, 0) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } #ifdef _WIN32 - (void)setBlocking: (bool)enable { u_long v = enable; _blocking = enable; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithStream: self]; } #endif - (int)fileDescriptorForReading { return _socket; } - (int)fileDescriptorForWriting { return _socket; } - (void)close { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; | > > > > > > > > > > > > > > > > > > > > > > > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | e = [OFWriteFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } #ifndef _WIN32 if (send(_socket, buffer, length, 0) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #else if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if (send(_socket, buffer, (unsigned int)length, 0) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #endif } #ifdef _WIN32 - (void)setBlocking: (bool)enable { u_long v = enable; _blocking = enable; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException exceptionWithStream: self]; } #endif - (int)fileDescriptorForReading { #ifndef _WIN32 return _socket; #else if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif } - (int)fileDescriptorForWriting { #ifndef _WIN32 return _socket; #else if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif } - (void)close { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; |
︙ | ︙ |
Modified src/OFUDPSocket.m from [9fe4ea7a6f] to [473e259227].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFBindFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotConnectedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" #import "macros.h" #import "resolver.h" #import "socket_helpers.h" | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFBindFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotConnectedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" #import "macros.h" #import "resolver.h" #import "socket_helpers.h" |
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | ssize_t ret; if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; sender->length = (socklen_t)sizeof(sender->address); if ((ret = recvfrom(_socket, buffer, length, 0, (struct sockaddr*)&sender->address, &sender->length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; return ret; } - (void)asyncReceiveIntoBuffer: (void*)buffer length: (size_t)length target: (id)target | > > > > > > > > > > | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | ssize_t ret; if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; sender->length = (socklen_t)sizeof(sender->address); #ifndef _WIN32 if ((ret = recvfrom(_socket, buffer, length, 0, (struct sockaddr*)&sender->address, &sender->length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recvfrom(_socket, buffer, (int)length, 0, (struct sockaddr*)&sender->address, &sender->length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; #endif return ret; } - (void)asyncReceiveIntoBuffer: (void*)buffer length: (size_t)length target: (id)target |
︙ | ︙ | |||
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | - (void)sendBuffer: (const void*)buffer length: (size_t)length receiver: (of_udp_socket_address_t*)receiver { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; if (sendto(_socket, buffer, length, 0, (struct sockaddr*)&receiver->address, receiver->length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (void)cancelAsyncRequests { [OFRunLoop OF_cancelAsyncRequestsForObject: self]; } - (int)fileDescriptorForReading { return _socket; } - (int)fileDescriptorForWriting { return _socket; } - (void)close { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; close(_socket); _socket = INVALID_SOCKET; } @end | > > > > > > > > > > > > > > > > > > > > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | - (void)sendBuffer: (const void*)buffer length: (size_t)length receiver: (of_udp_socket_address_t*)receiver { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; #ifndef _WIN32 if (sendto(_socket, buffer, length, 0, (struct sockaddr*)&receiver->address, receiver->length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if (sendto(_socket, buffer, (int)length, 0, (struct sockaddr*)&receiver->address, receiver->length) < length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; #endif } - (void)cancelAsyncRequests { [OFRunLoop OF_cancelAsyncRequestsForObject: self]; } - (int)fileDescriptorForReading { #ifndef _WIN32 return _socket; #else if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif } - (int)fileDescriptorForWriting { #ifndef _WIN32 return _socket; #else if (_socket > INT_MAX) @throw [OFOutOfRangeException exception]; return (int)_socket; #endif } - (void)close { if (_socket == INVALID_SOCKET) @throw [OFNotConnectedException exceptionWithSocket: self]; close(_socket); _socket = INVALID_SOCKET; } @end |
Modified src/resolver.m from [d1d2c810b6] to [f9485d971c].
︙ | ︙ | |||
105 106 107 108 109 110 111 | for (retIter = ret, resultsIter = results, res = res0; res != NULL; retIter++, resultsIter++, res = res->ai_next) { resultsIter->family = res->ai_family; resultsIter->type = res->ai_socktype; resultsIter->protocol = res->ai_protocol; resultsIter->address = res->ai_addr; | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | for (retIter = ret, resultsIter = results, res = res0; res != NULL; retIter++, resultsIter++, res = res->ai_next) { resultsIter->family = res->ai_family; resultsIter->type = res->ai_socktype; resultsIter->protocol = res->ai_protocol; resultsIter->address = res->ai_addr; resultsIter->addressLength = (socklen_t)res->ai_addrlen; *retIter = resultsIter; } *retIter = NULL; ret[0]->private_ = res0; # if !defined(HAVE_THREADSAFE_GETADDRINFO) && defined(OF_HAVE_THREADS) |
︙ | ︙ |