ObjFW  Check-in [fa952c4c48]

Overview
Comment:socket.m: Clean up #ifdefs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fa952c4c48ab51c91c7f2fa638a5c7867c2f723805a6de5be9d0c981371ea2df
User & Date: js on 2018-08-27 23:21:31
Other Links: manifest | tags
Context
2018-09-05
20:27
configure: Only use -lnetwork on Haiku check-in: fd6a6cbafd user: js tags: trunk
2018-08-27
23:21
socket.m: Clean up #ifdefs check-in: fa952c4c48 user: js tags: trunk
22:48
Improve objfw-config flags check-in: cddfc2ed56 user: js tags: trunk
Changes

Modified src/socket.m from [6e3f77394d] to [72b93f58cf].

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
	struct sockaddr_in6 *addrIn6_1, *addrIn6_2;

	if (address1->family != address2->family)
		return false;

	switch (address1->family) {
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS)
		if (address1->length < (socklen_t)sizeof(struct sockaddr_in) ||
		    address2->length < (socklen_t)sizeof(struct sockaddr_in))
			@throw [OFInvalidArgumentException exception];
#else
		if (address1->length < 8 || address2->length < 8)
			@throw [OFInvalidArgumentException exception];
#endif







|







401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
	struct sockaddr_in6 *addrIn6_1, *addrIn6_2;

	if (address1->family != address2->family)
		return false;

	switch (address1->family) {
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
#ifndef OF_WII
		if (address1->length < (socklen_t)sizeof(struct sockaddr_in) ||
		    address2->length < (socklen_t)sizeof(struct sockaddr_in))
			@throw [OFInvalidArgumentException exception];
#else
		if (address1->length < 8 || address2->length < 8)
			@throw [OFInvalidArgumentException exception];
#endif
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
	uint32_t hash;

	OF_HASH_INIT(hash);
	OF_HASH_ADD(hash, address->family);

	switch (address->family) {
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS)
		if (address->length < (socklen_t)sizeof(struct sockaddr_in))
			@throw [OFInvalidArgumentException exception];
#else
		if (address->length < 8)
			@throw [OFInvalidArgumentException exception];
#endif








|







452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
	uint32_t hash;

	OF_HASH_INIT(hash);
	OF_HASH_ADD(hash, address->family);

	switch (address->family) {
	case OF_SOCKET_ADDRESS_FAMILY_IPV4:
#ifndef OF_WII
		if (address->length < (socklen_t)sizeof(struct sockaddr_in))
			@throw [OFInvalidArgumentException exception];
#else
		if (address->length < 8)
			@throw [OFInvalidArgumentException exception];
#endif