ObjFW  Check-in [4f49f55859]

Overview
Comment:Add a few missing casts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4f49f558593ddf7fce7320aefd6e5072dd58112a221cc19719e93b507e35b619
User & Date: js on 2018-08-05 20:00:03
Other Links: manifest | tags
Context
2018-08-06
22:34
socket.m: Replace inet_{ntop,pton} with own impl check-in: ab9810ef69 user: js tags: trunk
2018-08-05
20:00
Add a few missing casts check-in: 4f49f55859 user: js tags: trunk
19:31
OFDNSResolver: Do not close the sockets check-in: 97ccd4a3e4 user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [61b4b17037] to [e5ab8ac35c].

610
611
612
613
614
615
616
617

618
619
620
621
622
623
624
610
611
612
613
614
615
616

617
618
619
620
621
622
623
624







-
+








	if (_socket == INVALID_SOCKET)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_address == NULL)
		@throw [OFInvalidArgumentException exception];

	if (_addressLength > sizeof(address.address))
	if (_addressLength > (socklen_t)sizeof(address.address))
		@throw [OFOutOfRangeException exception];

	memset(&address, '\0', sizeof(address));
	memcpy(&address.address, _address, _addressLength);
	address.length = _addressLength;

	return of_socket_address_ip_string(&address, NULL);

Modified src/socket.h from [2892632dc8] to [f9393485f9].

46
47
48
49
50
51
52
53

54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
46
47
48
49
50
51
52

53
54
55

56
57
58
59
60
61
62
63

64
65






66
67
68
69
70
71
72

73
74
75
76
77
78
79
80







-
+


-
+







-


-
-
-
-
-
-







-
+







# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif

/*! @file */

#ifdef OF_AMIGAOS
#if defined(OF_AMIGAOS) && defined(OF_MORPHOS_IXEMUL)
struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	sa_family_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif

#ifdef OF_MORPHOS
typedef long socklen_t;
#endif

#ifdef OF_MORPHOS_IXEMUL
typedef int socklen_t;

struct sockaddr_storage {
	uint8_t ss_len;
	uint8_t ss_family;
	char ss_data[2 + sizeof(struct in_addr) + 8];
};
#endif

#ifdef OF_WII
# include <network.h>

struct sockaddr_storage {
	u8 ss_len;
	u8 ss_family;
	sa_family_t ss_family;
	u8 ss_data[14];
};
#endif

#ifdef OF_PSP
# include <stdint.h>

Modified src/socket.m from [93c697cb3c] to [06c3fc8fe2].

313
314
315
316
317
318
319
320
321


322
323
324
325
326
327
328
313
314
315
316
317
318
319


320
321
322
323
324
325
326
327
328







-
-
+
+







			return false;
		if (addrIn1->sin_addr.s_addr != addrIn2->sin_addr.s_addr)
			return false;

		break;
#ifdef OF_HAVE_IPV6
	case AF_INET6:
		if (address1->length < sizeof(struct sockaddr_in6) ||
		    address2->length < sizeof(struct sockaddr_in6))
		if (address1->length < (socklen_t)sizeof(struct sockaddr_in6) ||
		    address2->length < (socklen_t)sizeof(struct sockaddr_in6))
			@throw [OFInvalidArgumentException exception];

		addrIn6_1 = (struct sockaddr_in6 *)&address1->address;
		addrIn6_2 = (struct sockaddr_in6 *)&address2->address;

		if (addrIn6_1->sin6_port != addrIn6_2->sin6_port)
			return false;
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
366
367
368
369
370
371
372

373
374
375
376
377
378
379
380







-
+








		hash += (addrIn->sin_port << 1);
		hash ^= addrIn->sin_addr.s_addr;

		break;
#ifdef OF_HAVE_IPV6
	case AF_INET6:
		if (address->length < sizeof(struct sockaddr_in6))
		if (address->length < (socklen_t)sizeof(struct sockaddr_in6))
			@throw [OFInvalidArgumentException exception];

		addrIn6 = (struct sockaddr_in6 *)&address->address;

		hash += (addrIn6->sin6_port << 1);

		OF_HASH_INIT(subhash);