Index: src/OFColor.m ================================================================== --- src/OFColor.m +++ src/OFColor.m @@ -42,26 +42,26 @@ of_once(&onceControl, initPredefinedColor_##name); \ \ return name##Color; \ } -PREDEFINED_COLOR(black, 0.00, 0.00, 0.00) -PREDEFINED_COLOR(silver, 0.75, 0.75, 0.75) -PREDEFINED_COLOR(grey, 0.50, 0.50, 0.50) -PREDEFINED_COLOR(white, 1.00, 1.00, 1.00) -PREDEFINED_COLOR(maroon, 0.50, 0.00, 0.00) -PREDEFINED_COLOR(red, 1.00, 0.00, 0.00) -PREDEFINED_COLOR(purple, 0.50, 0.00, 0.50) -PREDEFINED_COLOR(fuchsia, 1.00, 0.00, 1.00) -PREDEFINED_COLOR(green, 0.00, 0.50, 0.00) -PREDEFINED_COLOR(lime, 0.00, 1.00, 0.00) -PREDEFINED_COLOR(olive, 0.50, 0.50, 0.00) -PREDEFINED_COLOR(yellow, 1.00, 1.00, 0.00) -PREDEFINED_COLOR(navy, 0.00, 0.00, 0.50) -PREDEFINED_COLOR(blue, 0.00, 0.00, 1.00) -PREDEFINED_COLOR(teal, 0.00, 0.50, 0.50) -PREDEFINED_COLOR(aqua, 0.00, 1.00, 1.00) +PREDEFINED_COLOR(black, 0.00f, 0.00f, 0.00f) +PREDEFINED_COLOR(silver, 0.75f, 0.75f, 0.75f) +PREDEFINED_COLOR(grey, 0.50f, 0.50f, 0.50f) +PREDEFINED_COLOR(white, 1.00f, 1.00f, 1.00f) +PREDEFINED_COLOR(maroon, 0.50f, 0.00f, 0.00f) +PREDEFINED_COLOR(red, 1.00f, 0.00f, 0.00f) +PREDEFINED_COLOR(purple, 0.50f, 0.00f, 0.50f) +PREDEFINED_COLOR(fuchsia, 1.00f, 0.00f, 1.00f) +PREDEFINED_COLOR(green, 0.00f, 0.50f, 0.00f) +PREDEFINED_COLOR(lime, 0.00f, 1.00f, 0.00f) +PREDEFINED_COLOR(olive, 0.50f, 0.50f, 0.00f) +PREDEFINED_COLOR(yellow, 1.00f, 1.00f, 0.00f) +PREDEFINED_COLOR(navy, 0.00f, 0.00f, 0.50f) +PREDEFINED_COLOR(blue, 0.00f, 0.00f, 1.00f) +PREDEFINED_COLOR(teal, 0.00f, 0.50f, 0.50f) +PREDEFINED_COLOR(aqua, 0.00f, 1.00f, 1.00f) + (instancetype)colorWithRed: (float)red green: (float)green blue: (float)blue alpha: (float)alpha Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -70,11 +70,11 @@ #ifndef OF_WII static OFString * domainFromHostname(void) { char hostname[256]; - OFString *domain; + OFString *domain, *ret; if (gethostname(hostname, 256) != 0) return nil; domain = [OFString stringWithCString: hostname @@ -93,13 +93,15 @@ size_t pos = [domain rangeOfString: @"."].location; if (pos == OF_NOT_FOUND) return nil; - return [domain substringWithRange: + ret = [domain substringWithRange: of_range(pos + 1, domain.length - pos - 1)]; } + + return ret; } #endif @implementation OFDNSResolverSettings - (void)dealloc Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -468,11 +468,12 @@ - (OFData *)messagePackRepresentation { void *pool = objc_autoreleasePoolPush(); int64_t seconds = (int64_t)_seconds; - uint32_t nanoseconds = (_seconds - trunc(_seconds)) * 1000000000; + uint32_t nanoseconds = + (uint32_t)((_seconds - trunc(_seconds)) * 1000000000); OFData *ret; if (seconds >= 0 && seconds < 0x400000000) { if (seconds <= UINT32_MAX && nanoseconds == 0) { uint32_t seconds32 = (uint32_t)seconds; Index: src/OFKqueueKernelEventObserver.m ================================================================== --- src/OFKqueueKernelEventObserver.m +++ src/OFKqueueKernelEventObserver.m @@ -163,11 +163,11 @@ if ([self of_processReadBuffers]) return; timeout.tv_sec = (time_t)timeInterval; - timeout.tv_nsec = (timeInterval - timeout.tv_sec) * 1000000000; + timeout.tv_nsec = (long)((timeInterval - timeout.tv_sec) * 1000000000); events = kevent(_kernelQueue, NULL, 0, eventList, EVENTLIST_SIZE, (timeInterval != -1 ? &timeout : NULL)); if (events < 0) Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -884,11 +884,11 @@ data = [OFMutableData dataWithItems: &type count: 1]; } else if (*_typeEncoding == 'f') { uint8_t type = 0xCA; - float tmp = OF_BSWAP_FLOAT_IF_LE(_value.float_); + float tmp = OF_BSWAP_FLOAT_IF_LE((float)_value.float_); data = [OFMutableData dataWithItemSize: 1 capacity: 5]; [data addItem: &type]; Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -295,49 +295,57 @@ * * @brief The protocol which all root classes implement. */ @protocol OFObject /*! - * @brief The class of the object. - */ -# ifndef __cplusplus -@property (readonly, nonatomic) Class class; -# else -@property (readonly, nonatomic, getter=class) Class class_; -# endif - -/*! - * @brief The superclass of the object. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; - -/*! - * @brief A 32 bit hash for the object. + * @brief Returns the class of the object. + * + * @return The class of the object + */ +- (Class)class; + +/*! + * @brief Returns the superclass of the object. + * + * @return The superclass of the object + */ +- (nullable Class)superclass; + +/*! + * @brief Returns a 32 bit hash for the object. * * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * @warning If you reimplement this, you also need to reimplement @ref isEqual: * to behave in a way compatible to your reimplementation of this * method! - */ -@property (readonly, nonatomic) uint32_t hash; - -/*! - * @brief The retain count. - */ -@property (readonly, nonatomic) unsigned int retainCount; - -/*! - * @brief Whether the object is a proxy object. - */ -@property (readonly, nonatomic) bool isProxy; - -/*! - * @brief Whether the object allows weak references. - */ -@property (readonly, nonatomic) bool allowsWeakReference; + * + * @return A 32 bit hash for the object + */ +- (uint32_t)hash; + +/*! + * @brief Returns the retain count. + * + * @return The retain count + */ +- (unsigned int)retainCount; + +/*! + * @brief Returns whether the object is a proxy object. + * + * @return Whether the object is a proxy object + */ +- (bool)isProxy; + +/*! + * @brief Returns whether the object allows weak references. + * + * @return Whether the object allows weak references + */ +- (bool)allowsWeakReference; /*! * @brief Returns a boolean whether the object of the specified kind. * * @param class_ The class whose kind is checked @@ -529,10 +537,21 @@ @property (class, readonly, nonatomic) OFString *className; @property (class, readonly, nullable, nonatomic) Class superclass; @property (class, readonly, nonatomic) OFString *description; # endif +# ifdef __cplusplus +@property (readonly, nonatomic) Class class; +# else +@property (readonly, nonatomic, getter=class) Class class_; +#endif +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; +@property (readonly, nonatomic) uint32_t hash; +@property (readonly, nonatomic) unsigned int retainCount; +@property (readonly, nonatomic) bool isProxy; +@property (readonly, nonatomic) bool allowsWeakReference; + /*! * @brief The name of the object's class. */ @property (readonly, nonatomic) OFString *className; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -834,29 +834,37 @@ } - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String freeWhenDone: (bool)freeWhenDone { + id ret; + @try { - return [self initWithUTF8String: UTF8String]; + ret = [self initWithUTF8String: UTF8String]; } @finally { if (freeWhenDone) free(UTF8String); } + + return ret; } - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String length: (size_t)UTF8StringLength freeWhenDone: (bool)freeWhenDone { + id ret; + @try { - return [self initWithUTF8String: UTF8String - length: UTF8StringLength]; + ret = [self initWithUTF8String: UTF8String + length: UTF8StringLength]; } @finally { if (freeWhenDone) free(UTF8String); } + + return ret; } - (instancetype)initWithCString: (const char *)cString encoding: (of_string_encoding_t)encoding { Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -148,13 +148,14 @@ #if defined(OF_IOS) || defined(OF_MACOS) # ifdef OF_HAVE_FILES void *pool = objc_autoreleasePoolPush(); @try { - OFDictionary *propertyList = [OFString stringWithContentsOfFile: - @"/System/Library/CoreServices/SystemVersion.plist"] - .objectByParsingPropertyList; + OFDictionary *propertyList = [[OFString + stringWithContentsOfFile: @"/System/Library/CoreServices/" + @"SystemVersion.plist"] + objectByParsingPropertyList]; operatingSystemVersion = [[propertyList objectForKey: @"ProductVersion"] copy]; } @finally { objc_autoreleasePoolPop(pool); Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -254,11 +254,11 @@ svcSleepThread((int64_t)(timeInterval * 1000000000)); #elif defined(HAVE_NANOSLEEP) struct timespec rqtp; rqtp.tv_sec = (time_t)timeInterval; - rqtp.tv_nsec = (timeInterval - rqtp.tv_sec) * 1000000000; + rqtp.tv_nsec = (long)((timeInterval - rqtp.tv_sec) * 1000000000); if (rqtp.tv_sec != trunc(timeInterval)) @throw [OFOutOfRangeException exception]; nanosleep(&rqtp, NULL); Index: src/OFURLHandler.m ================================================================== --- src/OFURLHandler.m +++ src/OFURLHandler.m @@ -80,31 +80,35 @@ [handlers setObject: handler forKey: scheme]; } @finally { [handler release]; } - - return true; #ifdef OF_HAVE_THREADS } @finally { [mutex unlock]; } #endif + + return true; } + (OF_KINDOF(OFURLHandler *))handlerForURL: (OFURL *)URL { + OF_KINDOF(OFURLHandler *) handler; + #ifdef OF_HAVE_THREADS [mutex lock]; @try { #endif - return [handlers objectForKey: URL.scheme]; + handler = [handlers objectForKey: URL.scheme]; #ifdef OF_HAVE_THREADS } @finally { [mutex unlock]; } #endif + + return handler; } - (instancetype)init { OF_INVALID_INIT_METHOD Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -166,10 +166,11 @@ - (bool)isEqual: (id)object { const char *objCType; size_t size; void *value, *otherValue; + bool ret; if (object == self) return true; if (![object isKindOfClass: [OFValue class]]) @@ -196,15 +197,17 @@ [self getValue: value size: size]; [object getValue: otherValue size: size]; - return (memcmp(value, otherValue, size) == 0); + ret = (memcmp(value, otherValue, size) == 0); } @finally { free(value); free(otherValue); } + + return ret; } - (uint32_t)hash { size_t size = of_sizeof_type_encoding(self.objCType); Index: src/platform/posix/condition.m ================================================================== --- src/platform/posix/condition.m +++ src/platform/posix/condition.m @@ -48,15 +48,15 @@ of_time_interval_t timeout) { struct timespec ts; ts.tv_sec = (time_t)timeout; - ts.tv_nsec = (timeout - ts.tv_sec) * 1000000000; + ts.tv_nsec = (long)((timeout - ts.tv_sec) * 1000000000); return (pthread_cond_timedwait(condition, mutex, &ts) == 0); } bool of_condition_free(of_condition_t *condition) { return (pthread_cond_destroy(condition) == 0); } Index: src/socket.m ================================================================== --- src/socket.m +++ src/socket.m @@ -42,11 +42,11 @@ # import "mutex.h" # else # import "tlskey.h" # endif #endif -#include "once.h" +#import "once.h" #ifdef OF_AMIGAOS # include #endif @@ -388,11 +388,11 @@ number = component.unsignedLongLongValue; if (number > UINT8_MAX) @throw [OFInvalidFormatException exception]; - addr = (addr << 8) | (number & 0xFF); + addr = (addr << 8) | ((uint32_t)number & 0xFF); } addrIn->sin_addr.s_addr = OF_BSWAP32_IF_LE(addr); objc_autoreleasePoolPop(pool); @@ -499,15 +499,19 @@ } of_socket_address_t of_socket_address_parse_ip(OFString *IP, uint16_t port) { + of_socket_address_t ret; + @try { - return of_socket_address_parse_ipv6(IP, port); + ret = of_socket_address_parse_ipv6(IP, port); } @catch (OFInvalidFormatException *e) { - return of_socket_address_parse_ipv4(IP, port); + ret = of_socket_address_parse_ipv4(IP, port); } + + return ret; } of_socket_address_t of_socket_address_ipx(const unsigned char node[IPX_NODE_LEN], uint32_t network, uint16_t port)