Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -37,12 +37,12 @@ AS_IF([test x"$with_wii" = x"yes"], [ AS_IF([test x"$DEVKITPRO" = x""], [ AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.]) ]) - OBJCFLAGS="$OBJCFLAGS -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float" - CPPFLAGS="$CPPFLAGS -I$DEVKITPRO/libogc/include" + OBJCFLAGS="$OBJCFLAGS -mrvl -mcpu=750 -meabi -mhard-float" + CPPFLAGS="$CPPFLAGS -DGEKKO -I$DEVKITPRO/libogc/include" LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float" LIBS="$LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc" TESTS_LIBS="$TESTS_LIBS -lwiiuse -lbte" enable_shared="no" enable_threads="no" # TODO Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -512,11 +512,11 @@ dataArray = object; if ([dataArray count] != _count || [dataArray itemSize] != _itemSize) return false; - if (memcmp([dataArray items], _items, _count * _itemSize)) + if (memcmp([dataArray items], _items, _count * _itemSize) != 0) return false; return true; } Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -134,33 +134,33 @@ } static int parseMode(const char *mode) { - if (!strcmp(mode, "r")) + if (strcmp(mode, "r") == 0) return O_RDONLY; - if (!strcmp(mode, "rb")) + if (strcmp(mode, "rb") == 0) return O_RDONLY | O_BINARY; - if (!strcmp(mode, "r+")) + if (strcmp(mode, "r+") == 0) return O_RDWR; - if (!strcmp(mode, "rb+") || !strcmp(mode, "r+b")) + if (strcmp(mode, "rb+") == 0 || strcmp(mode, "r+b") == 0) return O_RDWR | O_BINARY; - if (!strcmp(mode, "w")) + if (strcmp(mode, "w") == 0) return O_WRONLY | O_CREAT | O_TRUNC; - if (!strcmp(mode, "wb")) + if (strcmp(mode, "wb") == 0) return O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; - if (!strcmp(mode, "w+")) + if (strcmp(mode, "w+") == 0) return O_RDWR | O_CREAT | O_TRUNC; - if (!strcmp(mode, "wb+") || !strcmp(mode, "w+b")) + if (strcmp(mode, "wb+") == 0 || strcmp(mode, "w+b") == 0) return O_RDWR | O_CREAT | O_TRUNC | O_BINARY; - if (!strcmp(mode, "a")) + if (strcmp(mode, "a") == 0) return O_WRONLY | O_CREAT | O_APPEND; - if (!strcmp(mode, "ab")) + if (strcmp(mode, "ab") == 0) return O_WRONLY | O_CREAT | O_APPEND | O_BINARY; - if (!strcmp(mode, "a+")) + if (strcmp(mode, "a+") == 0) return O_RDWR | O_CREAT | O_APPEND; - if (!strcmp(mode, "ab+") || !strcmp(mode, "a+b")) + if (strcmp(mode, "ab+") == 0 || strcmp(mode, "a+b") == 0) return O_RDWR | O_CREAT | O_APPEND | O_BINARY; return -1; } @@ -352,12 +352,12 @@ @try { while ((dirent = readdir(dir)) != NULL) { void *pool = objc_autoreleasePoolPush(); OFString *file; - if (!strcmp(dirent->d_name, ".") || - !strcmp(dirent->d_name, "..")) + if (strcmp(dirent->d_name, ".") == 0 || + strcmp(dirent->d_name, "..") == 0) continue; file = [OFString stringWithCString: dirent->d_name encoding: encoding]; [files addObject: file]; Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -58,25 +58,25 @@ } of_http_request_method_t of_http_request_method_from_string(const char *string) { - if (!strcmp(string, "OPTIONS")) + if (strcmp(string, "OPTIONS") == 0) return OF_HTTP_REQUEST_METHOD_OPTIONS; - if (!strcmp(string, "GET")) + if (strcmp(string, "GET") == 0) return OF_HTTP_REQUEST_METHOD_GET; - if (!strcmp(string, "HEAD")) + if (strcmp(string, "HEAD") == 0) return OF_HTTP_REQUEST_METHOD_HEAD; - if (!strcmp(string, "POST")) + if (strcmp(string, "POST") == 0) return OF_HTTP_REQUEST_METHOD_POST; - if (!strcmp(string, "PUT")) + if (strcmp(string, "PUT") == 0) return OF_HTTP_REQUEST_METHOD_PUT; - if (!strcmp(string, "DELETE")) + if (strcmp(string, "DELETE") == 0) return OF_HTTP_REQUEST_METHOD_DELETE; - if (!strcmp(string, "TRACE")) + if (strcmp(string, "TRACE") == 0) return OF_HTTP_REQUEST_METHOD_TRACE; - if (!strcmp(string, "CONNECT")) + if (strcmp(string, "CONNECT") == 0) return OF_HTTP_REQUEST_METHOD_CONNECT; @throw [OFInvalidFormatException exception]; } Index: src/OFIntrospection.m ================================================================== --- src/OFIntrospection.m +++ src/OFIntrospection.m @@ -122,11 +122,11 @@ if ((method->_typeEncoding == NULL && _typeEncoding != NULL) || (method->_typeEncoding != NULL && _typeEncoding == NULL)) return false; if (method->_typeEncoding != NULL && _typeEncoding != NULL && - strcmp(method->_typeEncoding, _typeEncoding)) + strcmp(method->_typeEncoding, _typeEncoding) != 0) return false; return true; } Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -488,11 +488,11 @@ pool2 = objc_autoreleasePoolPush(); characters = [self characters]; for (i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t))) + searchLength * sizeof(of_unichar_t)) != 0) continue; [self replaceCharactersInRange: of_range(i, searchLength) withString: replacement]; Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -274,11 +274,12 @@ - (void)appendUTF8String: (const char*)UTF8String { size_t UTF8StringLength = strlen(UTF8String); size_t length; - if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { + if (UTF8StringLength >= 3 && + memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { @@ -303,11 +304,12 @@ - (void)appendUTF8String: (const char*)UTF8String length: (size_t)UTF8StringLength { size_t length; - if (UTF8StringLength >= 3 && !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { + if (UTF8StringLength >= 3 && + memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { @@ -673,11 +675,11 @@ newCStringLength = 0; newLength = _s->length; last = 0; for (i = range.location; i <= range.length - searchLength; i++) { - if (memcmp(_s->cString + i, searchString, searchLength)) + if (memcmp(_s->cString + i, searchString, searchLength) != 0) continue; @try { newCString = [self resizeMemory: newCString Index: src/OFString+JSONValue.m ================================================================== --- src/OFString+JSONValue.m +++ src/OFString+JSONValue.m @@ -600,31 +600,31 @@ return parseDictionary(pointer, stop, line, depth, depthLimit); case 't': if (*pointer + 3 >= stop) return nil; - if (memcmp(*pointer, "true", 4)) + if (memcmp(*pointer, "true", 4) != 0) return nil; (*pointer) += 4; return [OFNumber numberWithBool: true]; case 'f': if (*pointer + 4 >= stop) return nil; - if (memcmp(*pointer, "false", 5)) + if (memcmp(*pointer, "false", 5) != 0) return nil; (*pointer) += 5; return [OFNumber numberWithBool: false]; case 'n': if (*pointer + 3 >= stop) return nil; - if (memcmp(*pointer, "null", 4)) + if (memcmp(*pointer, "null", 4) != 0) return nil; (*pointer) += 4; return [OFNull null]; Index: src/OFString+XMLUnescaping.m ================================================================== --- src/OFString+XMLUnescaping.m +++ src/OFString+XMLUnescaping.m @@ -106,29 +106,31 @@ inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; - if (entityLength == 2 && !memcmp(entity, "lt", 2)) + if (entityLength == 2 && memcmp(entity, "lt", 2) == 0) [ret appendCString: "<" encoding: OF_STRING_ENCODING_ASCII length: 1]; - else if (entityLength == 2 && !memcmp(entity, "gt", 2)) + else if (entityLength == 2 && + memcmp(entity, "gt", 2) == 0) [ret appendCString: ">" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && - !memcmp(entity, "quot", 4)) + memcmp(entity, "quot", 4) == 0) [ret appendCString: "\"" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && - !memcmp(entity, "apos", 4)) + memcmp(entity, "apos", 4) == 0) [ret appendCString: "'" encoding: OF_STRING_ENCODING_ASCII length: 1]; - else if (entityLength == 3 && !memcmp(entity, "amp", 3)) + else if (entityLength == 3 && + memcmp(entity, "amp", 3) == 0) [ret appendCString: "&" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entity[0] == '#') { void *pool; @@ -207,29 +209,31 @@ inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; - if (entityLength == 2 && !memcmp(entity, "lt", 2)) + if (entityLength == 2 && memcmp(entity, "lt", 2) == 0) [ret appendCString: "<" encoding: OF_STRING_ENCODING_ASCII length: 1]; - else if (entityLength == 2 && !memcmp(entity, "gt", 2)) + else if (entityLength == 2 && + memcmp(entity, "gt", 2) == 0) [ret appendCString: ">" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && - !memcmp(entity, "quot", 4)) + memcmp(entity, "quot", 4) == 0) [ret appendCString: "\"" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && - !memcmp(entity, "apos", 4)) + memcmp(entity, "apos", 4) == 0) [ret appendCString: "'" encoding: OF_STRING_ENCODING_ASCII length: 1]; - else if (entityLength == 3 && !memcmp(entity, "amp", 3)) + else if (entityLength == 3 && + memcmp(entity, "amp", 3) == 0) [ret appendCString: "&" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entity[0] == '#') { void *pool; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1265,11 +1265,11 @@ characters = [self characters]; otherCharacters = [otherString characters]; if (memcmp(characters, otherCharacters, - length * sizeof(of_unichar_t))) { + length * sizeof(of_unichar_t)) != 0) { objc_autoreleasePoolPop(pool); return false; } objc_autoreleasePoolPop(pool); @@ -1594,12 +1594,12 @@ [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (i = range.length - searchLength;; i--) { - if (!memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t))) { + if (memcmp(characters + i, searchCharacters, + searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); return of_range(range.location + i, searchLength); } @@ -1607,12 +1607,12 @@ if (i == 0) break; } } else { for (i = 0; i <= range.length - searchLength; i++) { - if (!memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t))) { + if (memcmp(characters + i, searchCharacters, + searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); return of_range(range.location + i, searchLength); } } @@ -1642,12 +1642,12 @@ characters = [self characters]; searchCharacters = [string characters]; for (i = 0; i <= length - searchLength; i++) { - if (!memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t))) { + if (memcmp(characters + i, searchCharacters, + searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); return true; } } @@ -1836,11 +1836,11 @@ - (bool)hasPrefix: (OFString*)prefix { of_unichar_t *tmp; const of_unichar_t *prefixCharacters; size_t prefixLength; - int compare; + bool hasPrefix; if ((prefixLength = [prefix length]) > [self length]) return false; tmp = [self allocMemoryWithSize: sizeof(of_unichar_t) @@ -1850,27 +1850,27 @@ [self getCharacters: tmp inRange: of_range(0, prefixLength)]; prefixCharacters = [prefix characters]; - compare = memcmp(tmp, prefixCharacters, - prefixLength * sizeof(of_unichar_t)); + hasPrefix = (memcmp(tmp, prefixCharacters, + prefixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); } @finally { [self freeMemory: tmp]; } - return !compare; + return hasPrefix; } - (bool)hasSuffix: (OFString*)suffix { of_unichar_t *tmp; const of_unichar_t *suffixCharacters; size_t length, suffixLength; - int compare; + bool hasSuffix; if ((suffixLength = [suffix length]) > [self length]) return false; length = [self length]; @@ -1883,19 +1883,19 @@ [self getCharacters: tmp inRange: of_range(length - suffixLength, suffixLength)]; suffixCharacters = [suffix characters]; - compare = memcmp(tmp, suffixCharacters, - suffixLength * sizeof(of_unichar_t)); + hasSuffix = (memcmp(tmp, suffixCharacters, + suffixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); } @finally { [self freeMemory: tmp]; } - return !compare; + return hasSuffix; } - (OFArray*)componentsSeparatedByString: (OFString*)delimiter { return [self componentsSeparatedByString: delimiter @@ -1928,11 +1928,11 @@ return array; } for (i = 0, last = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, - delimiterLength * sizeof(of_unichar_t))) + delimiterLength * sizeof(of_unichar_t)) != 0) continue; component = [self substringWithRange: of_range(last, i - last)]; if (!skipEmpty || [component length] > 0) [array addObject: component]; Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -175,11 +175,11 @@ { self = [super init]; @try { if (UTF8StringLength >= 3 && - !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { + memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } _s = &_storage; @@ -215,11 +215,12 @@ @try { size_t i, j; const of_char16_t *table; if (encoding == OF_STRING_ENCODING_UTF_8 && - cStringLength >= 3 && !memcmp(cString, "\xEF\xBB\xBF", 3)) { + cStringLength >= 3 && + memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; @@ -344,11 +345,11 @@ @try { size_t UTF8StringLength = strlen(UTF8String); if (UTF8StringLength >= 3 && - !memcmp(UTF8String, "\xEF\xBB\xBF", 3)) { + memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } _s = &_storage; @@ -730,11 +731,11 @@ [otherString isKindOfClass: [OFMutableString_UTF8 class]]) && _s->hashed && otherString->_s->hashed && _s->hash != otherString->_s->hash) return false; - if (strcmp(_s->cString, [otherString UTF8String])) + if (strcmp(_s->cString, [otherString UTF8String]) != 0) return false; return true; } @@ -950,12 +951,12 @@ if (cStringLength > rangeLength) return of_range(OF_NOT_FOUND, 0); if (options & OF_STRING_SEARCH_BACKWARDS) { for (i = rangeLength - cStringLength;; i--) { - if (!memcmp(_s->cString + rangeLocation + i, cString, - cStringLength)) { + if (memcmp(_s->cString + rangeLocation + i, cString, + cStringLength) == 0) { range.location += of_string_utf8_get_index( _s->cString + rangeLocation, i); range.length = [string length]; return range; @@ -965,12 +966,12 @@ if (i == 0) return of_range(OF_NOT_FOUND, 0); } } else { for (i = 0; i <= rangeLength - cStringLength; i++) { - if (!memcmp(_s->cString + rangeLocation + i, cString, - cStringLength)) { + if (memcmp(_s->cString + rangeLocation + i, cString, + cStringLength) == 0) { range.location += of_string_utf8_get_index( _s->cString + rangeLocation, i); range.length = [string length]; return range; @@ -991,11 +992,11 @@ if (cStringLength > _s->cStringLength) return false; for (i = 0; i <= _s->cStringLength - cStringLength; i++) - if (!memcmp(_s->cString + i, cString, cStringLength)) + if (memcmp(_s->cString + i, cString, cStringLength) == 0) return true; return false; } @@ -1023,22 +1024,22 @@ size_t cStringLength = [prefix UTF8StringLength]; if (cStringLength > _s->cStringLength) return false; - return !memcmp(_s->cString, [prefix UTF8String], cStringLength); + return (memcmp(_s->cString, [prefix UTF8String], cStringLength) == 0); } - (bool)hasSuffix: (OFString*)suffix { size_t cStringLength = [suffix UTF8StringLength]; if (cStringLength > _s->cStringLength) return false; - return !memcmp(_s->cString + (_s->cStringLength - cStringLength), - [suffix UTF8String], cStringLength); + return (memcmp(_s->cString + (_s->cStringLength - cStringLength), + [suffix UTF8String], cStringLength) == 0); } - (OFArray*)componentsSeparatedByString: (OFString*)delimiter options: (int)options { @@ -1059,11 +1060,11 @@ return array; } for (i = 0, last = 0; i <= _s->cStringLength - cStringLength; i++) { - if (memcmp(_s->cString + i, cString, cStringLength)) + if (memcmp(_s->cString + i, cString, cStringLength) != 0) continue; component = [OFString stringWithUTF8String: _s->cString + last length: i - last]; if (!skipEmpty || [component length] > 0) Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -211,11 +211,11 @@ if (sin6_1->sin6_port != sin6_2->sin6_port) return false; if (memcmp(sin6_1->sin6_addr.s6_addr, sin6_2->sin6_addr.s6_addr, - sizeof(sin6_1->sin6_addr.s6_addr))) + sizeof(sin6_1->sin6_addr.s6_addr)) != 0) return false; break; #endif default: Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -50,11 +50,11 @@ empty_dtable = objc_sparsearray_new(); cls->dtable = empty_dtable; cls->metaclass->dtable = empty_dtable; - if (strcmp(cls->name, "Protocol")) + if (strcmp(cls->name, "Protocol") != 0) classes_cnt++; } BOOL class_registerAlias_np(Class cls, const char *name) @@ -537,11 +537,11 @@ } if (classes->data[i] == NULL) continue; - if (!strcmp(classes->data[i]->key, "Protocol")) + if (strcmp(classes->data[i]->key, "Protocol") == 0) continue; cls = (Class)classes->data[i]->obj; if (cls == Nil || (uintptr_t)cls & 1) @@ -864,11 +864,11 @@ if (cls->info & OBJC_CLASS_INFO_LOADED) call_method(cls, "unload"); objc_hashtable_delete(classes, cls->name); - if (strcmp(class_getName(cls), "Protocol")) + if (strcmp(class_getName(cls), "Protocol") != 0) classes_cnt--; unregister_class(cls); unregister_class(cls->isa); } Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -481,11 +481,11 @@ #endif className = (const char*)c; if (className != NULL && *className != '\0' && - strcmp(className, "@id")) + strcmp(className, "@id") != 0) class = objc_getRequiredClass(className); else class = Nil; if (class_matches(class, e->object)) { Index: src/runtime/hashtable.m ================================================================== --- src/runtime/hashtable.m +++ src/runtime/hashtable.m @@ -47,11 +47,11 @@ } bool objc_equal_string(const void *obj1, const void *obj2) { - return !strcmp(obj1, obj2); + return (strcmp(obj1, obj2) == 0); } struct objc_hashtable* objc_hashtable_new(uint32_t (*hash)(const void*), bool (*equal)(const void*, const void*), uint32_t size) Index: src/runtime/protocol.m ================================================================== --- src/runtime/protocol.m +++ src/runtime/protocol.m @@ -31,11 +31,11 @@ } inline bool __attribute__((gnu_inline)) protocol_isEqual(Protocol *a, Protocol *b) { - return !strcmp(protocol_getName(a), protocol_getName(b)); + return (strcmp(protocol_getName(a), protocol_getName(b)) == 0); } bool protocol_conformsToProtocol(Protocol *a, Protocol *b) { Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -166,11 +166,11 @@ (is = [OFString stringWithUTF16String: utf16str]) && [is isEqual: @"fööbär🀺"] && (is = [OFString stringWithUTF16String: sutf16str]) && [is isEqual: @"fööbär🀺"]) - TEST(@"+[stringWithUTF32String::]", + TEST(@"+[stringWithUTF32String:]", (is = [OFString stringWithUTF32String: ucstr]) && [is isEqual: @"fööbär🀺"] && (is = [OFString stringWithUTF32String: sucstr]) && [is isEqual: @"fööbär🀺"])