ObjFW  Check-in [9a494f183b]

Overview
Comment:Fix build on 3DS and Wii
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9a494f183bc9c890f0a0be36e4ba61b8396a68a4a39cb99070e8a7d0f86a9953
User & Date: js on 2018-08-11 21:53:19
Other Links: manifest | tags
Context
2018-08-12
01:12
OFDNSResolver: Multiple attempts for resolving check-in: 42cb3d287c user: js tags: trunk
2018-08-11
21:53
Fix build on 3DS and Wii check-in: 9a494f183b user: js tags: trunk
21:34
.travis.yml: Re-enable 3DS, DS and Wii check-in: 7acee0909f user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [a77bbf08e1] to [b15819e802].

362
363
364
365
366
367
368

369

370
371
372
373
374
375
376
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378







+

+







#endif

- (uint16_t)bindToHost: (OFString *)host
		  port: (uint16_t)port
{
	of_resolver_result_t **results;
	const int one = 1;
#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS)
	of_socket_address_t address;
#endif

	if (_socket != INVALID_SOCKET)
		@throw [OFAlreadyConnectedException exceptionWithSocket: self];

	if (_SOCKS5Host != nil)
		@throw [OFNotImplementedException exceptionWithSelector: _cmd
								 object: self];

Modified src/OFUDPSocket.m from [1e4bb48119] to [22a70e2ff3].

328
329
330
331
332
333
334

335

336
337
338
339
340
341
342
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344







+

+







#endif
}

- (uint16_t)bindToHost: (OFString *)host
		  port: (uint16_t)port
{
	of_resolver_result_t **results;
#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS)
	of_socket_address_t address;
#endif

	results = of_resolve_host(host, port, SOCK_DGRAM);
	@try {
#if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC)
		int flags;
#endif

Modified src/socket.h from [d1393543d0] to [0b7ecc62d1].

70
71
72
73
74
75
76




77
78
79
80
81
82
83
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87







+
+
+
+







OF_ASSUME_NONNULL_BEGIN

#ifndef OF_WINDOWS
typedef int of_socket_t;
#else
typedef SOCKET of_socket_t;
#endif

#ifdef OF_WII
typedef u8 sa_family_t;
#endif

/*!
 * @enum of_socket_address_type_t socket.h ObjFW/socket.h
 */
typedef enum {
	OF_SOCKET_ADDRESS_FAMILY_UNKNOWN,
	OF_SOCKET_ADDRESS_FAMILY_IPV4,

Modified src/socket.m from [62a31a2fc1] to [83494e19e7].

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
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







-
+










-
+







	}
	if (zerosCount > maxZerosCount) {
		maxZerosStart = zerosStart;
		maxZerosCount = zerosCount;
	}

	if (maxZerosCount >= 2) {
		for (uint_fast8_t i = 0; i < maxZerosStart; i += 2) {
		for (int_fast8_t i = 0; i < maxZerosStart; i += 2) {
			[string appendFormat:
			    (first ? @"%x" : @":%x"),
			    (addrIn6->sin6_addr.s6_addr[i] << 8) |
			    addrIn6->sin6_addr.s6_addr[i + 1]];
			first = false;
		}

		[string appendString: @"::"];
		first = true;

		for (uint_fast8_t i = maxZerosStart + (maxZerosCount * 2);
		for (int_fast8_t i = maxZerosStart + (maxZerosCount * 2);
		    i < 16; i += 2) {
			[string appendFormat:
			    (first ? @"%x" : @":%x"),
			    (addrIn6->sin6_addr.s6_addr[i] << 8) |
			    addrIn6->sin6_addr.s6_addr[i + 1]];
			first = false;
		}

Modified src/socket_helpers.h from [ad26261f01] to [44ead89dcb].

83
84
85
86
87
88
89
90

91
92
93
94
95
96
83
84
85
86
87
88
89

90
91
92
93
94
95
96







-
+






# 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 select(nfds, readfds, writefds, errorfds, timeout) \
    net_select(nfds, readfds, writefds, errorfds, timeout)
# define send(sock, buf, len, flags) net_send(sock, buf, len, flags)
# define sendto(sock, buf, len, flags, addr, addrlen) \
    net_sendto(sock, buf, len, flags, addr, addrlen)
    net_sendto(sock, buf, len, flags, (struct sockaddr *)(addr), addrlen)
# define setsockopt(sock, level, name, value, len) \
    net_setsockopt(sock, level, name, value, len)
# define socket(domain, type, proto) net_socket(domain, type, proto)
typedef u32 in_addr_t;
typedef u32 nfds_t;
#endif