Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -661,13 +661,17 @@ AC_CHECK_FUNC(objc_autoreleasePoolPush, [], [ AC_SUBST(RUNTIME_AUTORELEASE_M, "runtime/autorelease.m") ]) AC_CHECK_FUNC(objc_constructInstance, [], [ AC_SUBST(RUNTIME_INSTANCE_M, "runtime/instance.m") + AC_DEFINE(OF_DECLARE_CONSTRUCT_INSTANCE, 1, + [Whether to declare objc_constructInstance]) ]) AC_CHECK_FUNCS(objc_setAssociatedObject, [], [ AC_SUBST(RUNTIME_ASSOCIATION_M, "runtime/association.m") + AC_DEFINE(OF_DECLARE_SET_ASSOCIATED_OBJECT, 1, + [Whether to declare objc_setAssociatedObject]) ]) OBJCFLAGS="$old_OBJCFLAGS" ;; esac Index: src/OFDDPSocket.m ================================================================== --- src/OFDDPSocket.m +++ src/OFDDPSocket.m @@ -163,11 +163,11 @@ errNo: EAFNOSUPPORT]; } #ifdef OF_MACOS if (setsockopt(_socket, ATPROTO_NONE, DDP_STRIPHDR, &one, - sizeof(one)) != 0 || ioctl(_socket, _IOWR('a', 2, + (socklen_t)sizeof(one)) != 0 || ioctl(_socket, _IOWR('a', 2, struct ATInterfaceConfig), &config) != 0) @throw [OFBindDDPSocketFailedException exceptionWithNetwork: network node: node port: port Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -183,11 +183,11 @@ if (dataLength != 4) @throw [OFInvalidServerResponseException exception]; memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyIPv4; - address.length = sizeof(address.sockaddr.in); + address.length = (socklen_t)sizeof(address.sockaddr.in); address.sockaddr.in.sin_family = AF_INET; memcpy(&address.sockaddr.in.sin_addr.s_addr, buffer + i, 4); return [[[OFADNSResourceRecord alloc] @@ -370,11 +370,11 @@ if (dataLength != 16) @throw [OFInvalidServerResponseException exception]; memset(&address, 0, sizeof(address)); address.family = OFSocketAddressFamilyIPv6; - address.length = sizeof(address.sockaddr.in6); + address.length = (socklen_t)sizeof(address.sockaddr.in6); #ifdef AF_INET6 address.sockaddr.in6.sin6_family = AF_INET6; #else address.sockaddr.in6.sin6_family = AF_UNSPEC; Index: src/OFDatagramSocket.m ================================================================== --- src/OFDatagramSocket.m +++ src/OFDatagramSocket.m @@ -155,11 +155,11 @@ - (bool)canSendToBroadcastAddresses { #ifndef OF_WII int v; - socklen_t len = sizeof(v); + socklen_t len = (socklen_t)sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self Index: src/OFGZIPStream.m ================================================================== --- src/OFGZIPStream.m +++ src/OFGZIPStream.m @@ -247,11 +247,11 @@ size_t bytesRead = [_inflateStream readIntoBuffer: buffer length: length]; _CRC32 = _OFCRC32(_CRC32, buffer, bytesRead); - _uncompressedSize += bytesRead; + _uncompressedSize += (uint32_t)bytesRead; return bytesRead; } [_inflateStream release]; Index: src/OFLHAArchiveEntry.m ================================================================== --- src/OFLHAArchiveEntry.m +++ src/OFLHAArchiveEntry.m @@ -448,11 +448,11 @@ objc_autoreleasePoolPop(pool); break; case 2: case 3:; - uint32_t padding = 0; + size_t padding = 0; _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: date]; _CRC16 = [stream readLittleEndianInt16]; Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -1461,14 +1461,16 @@ extern void OFFreeMemory(void *_Nullable pointer); #ifdef OF_APPLE_RUNTIME extern void *_Null_unspecified objc_autoreleasePoolPush(void); extern void objc_autoreleasePoolPop(void *_Null_unspecified pool); -# ifndef __OBJC2__ +# ifdef OF_DECLARE_CONSTRUCT_INSTANCE extern id _Nullable objc_constructInstance(Class _Nullable class_, void *_Nullable bytes); extern void *_Nullable objc_destructInstance(id _Nullable object); +# endif +# ifdef OF_DECLARE_SET_ASSOCIATED_OBJECT typedef enum objc_associationPolicy { OBJC_ASSOCIATION_ASSIGN = 0, OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1, OBJC_ASSOCIATION_RETAIN = OBJC_ASSOCIATION_RETAIN_NONATOMIC | 0x300, OBJC_ASSOCIATION_COPY_NONATOMIC = 3, Index: src/OFScrypt.m ================================================================== --- src/OFScrypt.m +++ src/OFScrypt.m @@ -126,12 +126,12 @@ memcpy(tmp2 + i * 32 * blockSize, tmp, 128 * blockSize); _OFScryptBlockMix(tmp, tmp2 + i * 32 * blockSize, blockSize); } for (size_t i = 0; i < costFactor; i++) { - uint32_t j = OFFromLittleEndian32( - tmp[(2 * blockSize - 1) * 16]) & (costFactor - 1); + uint32_t j = (uint32_t)(OFFromLittleEndian32( + tmp[(2 * blockSize - 1) * 16]) & (costFactor - 1)); for (size_t k = 0; k < 32 * blockSize; k++) tmp[k] ^= tmp2[j * 32 * blockSize + k]; _OFScryptBlockMix(buffer, tmp, blockSize); Index: src/OFSequencedPacketSocket.m ================================================================== --- src/OFSequencedPacketSocket.m +++ src/OFSequencedPacketSocket.m @@ -90,11 +90,11 @@ #ifndef OF_WII - (int)of_socketError { int errNo; - socklen_t len = sizeof(errNo); + socklen_t len = (socklen_t)sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) return _OFSocketErrNo(); Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -378,11 +378,11 @@ memset(&ret, '\0', sizeof(ret)); ret.family = OFSocketAddressFamilyIPv4; #if defined(OF_WII) || defined(OF_NINTENDO_3DS) ret.length = 8; #else - ret.length = sizeof(ret.sockaddr.in); + ret.length = (socklen_t)sizeof(ret.sockaddr.in); #endif addrIn->sin_family = AF_INET; addrIn->sin_port = OFToBigEndian16(port); #ifdef OF_WII @@ -473,11 +473,11 @@ struct sockaddr_in6 *addrIn6 = &ret.sockaddr.in6; size_t doubleColon, percent; memset(&ret, '\0', sizeof(ret)); ret.family = OFSocketAddressFamilyIPv6; - ret.length = sizeof(ret.sockaddr.in6); + ret.length = (socklen_t)sizeof(ret.sockaddr.in6); #ifdef AF_INET6 addrIn6->sin6_family = AF_INET6; #else addrIn6->sin6_family = AF_UNSPEC; @@ -616,11 +616,11 @@ { OFSocketAddress ret; memset(&ret, '\0', sizeof(ret)); ret.family = OFSocketAddressFamilyIPX; - ret.length = sizeof(ret.sockaddr.ipx); + ret.length = (socklen_t)sizeof(ret.sockaddr.ipx); #ifdef AF_IPX ret.sockaddr.ipx.sipx_family = AF_IPX; #else ret.sockaddr.ipx.sipx_family = AF_UNSPEC; @@ -639,11 +639,11 @@ { OFSocketAddress ret; memset(&ret, '\0', sizeof(ret)); ret.family = OFSocketAddressFamilyAppleTalk; - ret.length = sizeof(ret.sockaddr.at); + ret.length = (socklen_t)sizeof(ret.sockaddr.at); #ifdef AF_APPLETALK ret.sockaddr.at.sat_family = AF_APPLETALK; #else ret.sockaddr.at.sat_family = AF_UNSPEC; @@ -1057,11 +1057,12 @@ socklen_t length; if (address->family != OFSocketAddressFamilyUNIX) @throw [OFInvalidArgumentException exception]; - length = address->length - offsetof(struct sockaddr_un, sun_path); + length = + address->length - (socklen_t)offsetof(struct sockaddr_un, sun_path); for (socklen_t i = 0; i < length; i++) if (address->sockaddr.un.sun_path[i] == 0) length = i; Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -216,11 +216,11 @@ #ifndef OF_WII - (int)of_socketError { int errNo; - socklen_t len = sizeof(errNo); + socklen_t len = (socklen_t)sizeof(errNo); if (getsockopt(_socket, SOL_SOCKET, SO_ERROR, (char *)&errNo, &len) != 0) return _OFSocketErrNo(); Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -439,11 +439,11 @@ } - (bool)sendsKeepAlives { int v; - socklen_t len = sizeof(v); + socklen_t len = (socklen_t)sizeof(v); if (getsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self @@ -466,11 +466,11 @@ } - (bool)canDelaySendingSegments { int v; - socklen_t len = sizeof(v); + socklen_t len = (socklen_t)sizeof(v); if (getsockopt(_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&v, &len) != 0 || len != sizeof(v)) @throw [OFGetOptionFailedException exceptionWithObject: self Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -1,8 +1,10 @@ #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_CLASSIC_MACOS +#undef OF_DECLARE_CONSTRUCT_INSTANCE +#undef OF_DECLARE_SET_ASSOCIATED_OBJECT #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_AFUNIX_H #undef OF_HAVE_APPLETALK #undef OF_HAVE_ATOMIC_BUILTINS #undef OF_HAVE_ATOMIC_OPS Index: src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m ================================================================== --- src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m +++ src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m @@ -191,11 +191,11 @@ @try { char *buffer; memset(&ifc, 0, sizeof(ifc)); ifc.ifc_buf = (void *)ifrs; - ifc.ifc_len = 128 * sizeof(struct ifreq); + ifc.ifc_len = 128 * (int)sizeof(struct ifreq); if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) return false; buffer = ifc.ifc_buf; while (buffer < (char *)ifc.ifc_buf + ifc.ifc_len) { @@ -654,11 +654,11 @@ @try { char *buffer; memset(&ifc, 0, sizeof(ifc)); ifc.ifc_buf = (void *)ifrs; - ifc.ifc_len = 128 * sizeof(struct ifreq); + ifc.ifc_len = 128 * (int)sizeof(struct ifreq); if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) return false; buffer = ifc.ifc_buf; while (buffer < (char *)ifc.ifc_buf + ifc.ifc_len) { Index: src/runtime/association.m ================================================================== --- src/runtime/association.m +++ src/runtime/association.m @@ -184,11 +184,11 @@ id objc_getAssociatedObject(id object, const void *key) { size_t slot = slotForObject(object); - id ret; + id ret = nil; #ifdef OF_HAVE_THREADS if (OFSpinlockLock(&spinlocks[slot]) != 0) OBJC_ERROR("Failed to lock spinlock!");