Overview
Comment: | Fix compilation for Wii |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d0eab356ce08eb82ec4339d619ca9986 |
User & Date: | js 2015-09-06 15:48:17 |
Context
2015-09-14
| ||
10:59 | README-WINDOWS.md: Add a warning about MSYS2 Shell check-in: 5c033e468f user: js tags: trunk | |
2015-09-06
| ||
15:48 | Fix compilation for Wii check-in: d0eab356ce user: js tags: trunk | |
2015-08-26
| ||
09:05 | OFZIPArchive: Throw invalid format on failed seek check-in: 89d2a684d3 user: js tags: trunk | |
Changes
Changes to src/OFTCPSocket.h.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | @interface OFTCPSocket: OFStreamSocket { bool _listening; struct sockaddr *_address; socklen_t _addressLength; OFString *_SOCKS5Host; uint16_t _SOCKS5Port; } #ifdef OF_HAVE_PROPERTIES @property (readonly, getter=isListening) bool listening; @property OF_NULLABLE_PROPERTY (copy) OFString *SOCKS5Host; @property uint16_t SOCKS5Port; @property (getter=isKeepAliveEnabled) bool keepAliveEnabled; | > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | @interface OFTCPSocket: OFStreamSocket { bool _listening; struct sockaddr *_address; socklen_t _addressLength; OFString *_SOCKS5Host; uint16_t _SOCKS5Port; #ifdef __wii__ bool _keepAliveEnabled, _TCPNoDelayEnabled; #endif } #ifdef OF_HAVE_PROPERTIES @property (readonly, getter=isListening) bool listening; @property OF_NULLABLE_PROPERTY (copy) OFString *SOCKS5Host; @property uint16_t SOCKS5Port; @property (getter=isKeepAliveEnabled) bool keepAliveEnabled; |
Changes to src/OFTCPSocket.m.
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 631 632 633 634 635 636 637 | int v = enabled; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; } - (bool)isKeepAliveEnabled { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; return v; } - (void)setTCPNoDelayEnabled: (bool)enabled { int v = enabled; if (setsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; } - (bool)isTCPNoDelayEnabled { int v; socklen_t len = sizeof(v); if (getsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; return v; } @end | > > > > > > > > > > > > > > > > | 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 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | int v = enabled; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; #ifdef __wii__ _keepAliveEnabled = enabled; #endif } - (bool)isKeepAliveEnabled { #ifndef __wii__ int v; socklen_t len = sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; return v; #else return _keepAliveEnabled; #endif } - (void)setTCPNoDelayEnabled: (bool)enabled { int v = enabled; if (setsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&v, (socklen_t)sizeof(v)) != 0) @throw [OFSetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; #ifdef __wii__ _TCPNoDelayEnabled = enabled; #endif } - (bool)isTCPNoDelayEnabled { #ifndef __wii__ int v; socklen_t len = sizeof(v); if (getsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithStream: self errNo: of_socket_errno()]; return v; #else return _TCPNoDelayEnabled; #endif } @end |
Changes to src/OFThread.m.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #ifndef _WIN32 # include <unistd.h> #endif #ifdef OF_HAVE_SCHED_YIELD # include <sched.h> #endif #import "OFThread.h" #import "OFThread+Private.h" #import "OFRunLoop.h" #import "OFList.h" #import "OFDate.h" #import "OFDictionary.h" | > > > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #ifndef _WIN32 # include <unistd.h> #endif #ifdef OF_HAVE_SCHED_YIELD # include <sched.h> #endif #ifdef __wii__ # define BOOL OGC_BOOL # include <ogcsys.h> # undef BOOL #endif #import "OFThread.h" #import "OFThread+Private.h" #import "OFRunLoop.h" #import "OFList.h" #import "OFDate.h" #import "OFDictionary.h" |
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != floor(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); #elif defined(OF_NINTENDO_DS) uint64_t counter; if (timeInterval > UINT64_MAX / 60) @throw [OFOutOfRangeException exception]; counter = timeInterval * 60; | > > > > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | rqtp.tv_sec = (time_t)timeInterval; rqtp.tv_nsec = lrint((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != floor(timeInterval)) @throw [OFOutOfRangeException exception]; # ifndef __wii__ nanosleep(&rqtp, NULL); # else nanosleep(&rqtp); # endif #elif defined(OF_NINTENDO_DS) uint64_t counter; if (timeInterval > UINT64_MAX / 60) @throw [OFOutOfRangeException exception]; counter = timeInterval * 60; |
Changes to src/socket_helpers.h.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif #ifdef HAVE_NETDB_H # include <netdb.h> #endif #ifndef INVALID_SOCKET # define INVALID_SOCKET -1 #endif #ifdef HAVE_GETADDRINFO # ifndef AI_NUMERICSERV | > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif #ifdef HAVE_NETDB_H # include <netdb.h> #endif #include "socket.h" #ifndef INVALID_SOCKET # define INVALID_SOCKET -1 #endif #ifdef HAVE_GETADDRINFO # ifndef AI_NUMERICSERV |
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #ifdef __wii__ # define accept(sock, addr, addrlen) net_accept(sock, addr, addrlen) # define bind(sock, addr, addrlen) net_bind(sock, addr, addrlen) # define close(sock) net_close(sock) # define connect(sock, addr, addrlen) net_connect(sock, addr, addrlen) # define gethostbyname(name) net_gethostbyname(name) # define listen(sock, backlog) net_listen(sock, backlog) # define poll(fds, nfds, timeout) net_poll(fds, nfds, timeout) # define recv(sock, buf, len, flags) net_recv(sock, buf, len, flags) # define recvfrom(sock, buf, len, flags, addr, addrlen) \ net_recvfrom(sock, buf, len, flags, addr, addrlen) # define send(sock, buf, len, flags) net_send(sock, buf, len, flags) # define sendto(sock, buf, len, flags, addr, addrlen) \ | > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #ifdef __wii__ # define accept(sock, addr, addrlen) net_accept(sock, addr, addrlen) # define bind(sock, addr, addrlen) net_bind(sock, addr, addrlen) # define close(sock) net_close(sock) # define connect(sock, addr, addrlen) net_connect(sock, addr, addrlen) # define gethostbyname(name) net_gethostbyname(name) # define h_errno 0 # define hstrerror(err) "unknown (no hstrerror)" # define listen(sock, backlog) net_listen(sock, backlog) # define poll(fds, nfds, timeout) net_poll(fds, nfds, timeout) # define recv(sock, buf, len, flags) net_recv(sock, buf, len, flags) # define recvfrom(sock, buf, len, flags, addr, addrlen) \ net_recvfrom(sock, buf, len, flags, addr, addrlen) # define send(sock, buf, len, flags) net_send(sock, buf, len, flags) # define sendto(sock, buf, len, flags, addr, addrlen) \ |
Changes to tests/TestsAppDelegate.m.
318 319 320 321 322 323 324 | inColor: RED]; #endif } - (void)applicationDidFinishLaunching { #if defined(__wii__) && defined(OF_HAVE_FILES) | > | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | inColor: RED]; #endif } - (void)applicationDidFinishLaunching { #if defined(__wii__) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif [self objectTests]; #ifdef OF_HAVE_BLOCKS [self blockTests]; #endif [self stringTests]; |