Comment: | Coding style
No functional change intended. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9da9b2b64caecd02414186086a446b06 |
User & Date: | js on 2014-04-14 00:45:58 |
Other Links: | manifest | tags |
2014-04-14
| ||
01:11 | OFString+XMLUnescaping.m: Remove code duplication check-in: f0cc196adc user: js tags: trunk | |
00:45 | Coding style check-in: 9da9b2b64c user: js tags: trunk | |
2014-04-10
| ||
00:03 | forwarding/*.S: Include config.h check-in: 9a4792a99e user: js tags: trunk | |
Modified configure.ac from [1a1e700998] to [16bc63395d].
︙ | ︙ | |||
35 36 37 38 39 40 41 | AC_ARG_WITH(wii, AS_HELP_STRING([--with-wii], [build for Wii])) AS_IF([test x"$with_wii" = x"yes"], [ AS_IF([test x"$DEVKITPRO" = x""], [ AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.]) ]) | | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | AC_ARG_WITH(wii, AS_HELP_STRING([--with-wii], [build for Wii])) 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 -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 AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map']) |
︙ | ︙ |
Modified src/OFDataArray.m from [4b9ac6b409] to [48e3ed07c1].
︙ | ︙ | |||
510 511 512 513 514 515 516 | return false; dataArray = object; if ([dataArray count] != _count || [dataArray itemSize] != _itemSize) return false; | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | return false; dataArray = object; if ([dataArray count] != _count || [dataArray itemSize] != _itemSize) return false; if (memcmp([dataArray items], _items, _count * _itemSize) != 0) return false; return true; } - (of_comparison_result_t)compare: (id <OFComparing>)object { |
︙ | ︙ |
Modified src/OFFile.m from [4ef14749f7] to [fd77a17f17].
︙ | ︙ | |||
132 133 134 135 136 137 138 | buffer); #endif } static int parseMode(const char *mode) { | | | | | | | | | | | | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | buffer); #endif } static int parseMode(const char *mode) { if (strcmp(mode, "r") == 0) return O_RDONLY; if (strcmp(mode, "rb") == 0) return O_RDONLY | O_BINARY; if (strcmp(mode, "r+") == 0) return O_RDWR; if (strcmp(mode, "rb+") == 0 || strcmp(mode, "r+b") == 0) return O_RDWR | O_BINARY; if (strcmp(mode, "w") == 0) return O_WRONLY | O_CREAT | O_TRUNC; if (strcmp(mode, "wb") == 0) return O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; if (strcmp(mode, "w+") == 0) return O_RDWR | O_CREAT | O_TRUNC; if (strcmp(mode, "wb+") == 0 || strcmp(mode, "w+b") == 0) return O_RDWR | O_CREAT | O_TRUNC | O_BINARY; if (strcmp(mode, "a") == 0) return O_WRONLY | O_CREAT | O_APPEND; if (strcmp(mode, "ab") == 0) return O_WRONLY | O_CREAT | O_APPEND | O_BINARY; if (strcmp(mode, "a+") == 0) return O_RDWR | O_CREAT | O_APPEND; if (strcmp(mode, "ab+") == 0 || strcmp(mode, "a+b") == 0) return O_RDWR | O_CREAT | O_APPEND | O_BINARY; return -1; } @implementation OFFile + (void)initialize |
︙ | ︙ | |||
350 351 352 353 354 355 356 | mode: @"r"]; @try { while ((dirent = readdir(dir)) != NULL) { void *pool = objc_autoreleasePoolPush(); OFString *file; | | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | mode: @"r"]; @try { while ((dirent = readdir(dir)) != NULL) { void *pool = objc_autoreleasePoolPush(); OFString *file; if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0) continue; file = [OFString stringWithCString: dirent->d_name encoding: encoding]; [files addObject: file]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/OFHTTPRequest.m from [cd6a2290d9] to [7522c047c2].
︙ | ︙ | |||
56 57 58 59 60 61 62 | return NULL; } of_http_request_method_t of_http_request_method_from_string(const char *string) { | | | | | | | | | | 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 | return NULL; } of_http_request_method_t of_http_request_method_from_string(const char *string) { if (strcmp(string, "OPTIONS") == 0) return OF_HTTP_REQUEST_METHOD_OPTIONS; if (strcmp(string, "GET") == 0) return OF_HTTP_REQUEST_METHOD_GET; if (strcmp(string, "HEAD") == 0) return OF_HTTP_REQUEST_METHOD_HEAD; if (strcmp(string, "POST") == 0) return OF_HTTP_REQUEST_METHOD_POST; if (strcmp(string, "PUT") == 0) return OF_HTTP_REQUEST_METHOD_PUT; if (strcmp(string, "DELETE") == 0) return OF_HTTP_REQUEST_METHOD_DELETE; if (strcmp(string, "TRACE") == 0) return OF_HTTP_REQUEST_METHOD_TRACE; if (strcmp(string, "CONNECT") == 0) return OF_HTTP_REQUEST_METHOD_CONNECT; @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest + (instancetype)request |
︙ | ︙ |
Modified src/OFIntrospection.m from [6ffe55f66b] to [9e051f7ab4].
︙ | ︙ | |||
120 121 122 123 124 125 126 | return false; if ((method->_typeEncoding == NULL && _typeEncoding != NULL) || (method->_typeEncoding != NULL && _typeEncoding == NULL)) return false; if (method->_typeEncoding != NULL && _typeEncoding != NULL && | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | return false; if ((method->_typeEncoding == NULL && _typeEncoding != NULL) || (method->_typeEncoding != NULL && _typeEncoding == NULL)) return false; if (method->_typeEncoding != NULL && _typeEncoding != NULL && strcmp(method->_typeEncoding, _typeEncoding) != 0) return false; return true; } - (uint32_t)hash { |
︙ | ︙ |
Modified src/OFMutableString.m from [33c49a61cb] to [6564d3d79b].
︙ | ︙ | |||
486 487 488 489 490 491 492 | } pool2 = objc_autoreleasePoolPush(); characters = [self characters]; for (i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | } 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)) != 0) continue; [self replaceCharactersInRange: of_range(i, searchLength) withString: replacement]; range.length -= searchLength; range.length += replacementLength; |
︙ | ︙ |
Modified src/OFMutableString_UTF8.m from [9c8e6d80a9] to [c7dede3563].
︙ | ︙ | |||
272 273 274 275 276 277 278 | } - (void)appendUTF8String: (const char*)UTF8String { size_t UTF8StringLength = strlen(UTF8String); size_t length; | | > | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | } - (void)appendUTF8String: (const char*)UTF8String { size_t UTF8StringLength = strlen(UTF8String); size_t length; if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: _s->isUTF8 = true; |
︙ | ︙ | |||
301 302 303 304 305 306 307 | } - (void)appendUTF8String: (const char*)UTF8String length: (size_t)UTF8StringLength { size_t length; | | > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | } - (void)appendUTF8String: (const char*)UTF8String length: (size_t)UTF8StringLength { size_t length; if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: _s->isUTF8 = true; |
︙ | ︙ | |||
671 672 673 674 675 676 677 | newCString = NULL; newCStringLength = 0; newLength = _s->length; last = 0; for (i = range.location; i <= range.length - searchLength; i++) { | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | newCString = NULL; newCStringLength = 0; newLength = _s->length; last = 0; for (i = range.location; i <= range.length - searchLength; i++) { if (memcmp(_s->cString + i, searchString, searchLength) != 0) continue; @try { newCString = [self resizeMemory: newCString size: newCStringLength + i - last + replacementLength + 1]; |
︙ | ︙ |
Modified src/OFString+JSONValue.m from [d042fbb026] to [848285d233].
︙ | ︙ | |||
598 599 600 601 602 603 604 | return parseArray(pointer, stop, line, depth, depthLimit); case '{': return parseDictionary(pointer, stop, line, depth, depthLimit); case 't': if (*pointer + 3 >= stop) return nil; | | | | | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | return parseArray(pointer, stop, line, depth, depthLimit); case '{': return parseDictionary(pointer, stop, line, depth, depthLimit); case 't': if (*pointer + 3 >= stop) return nil; 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) != 0) return nil; (*pointer) += 5; return [OFNumber numberWithBool: false]; case 'n': if (*pointer + 3 >= stop) return nil; if (memcmp(*pointer, "null", 4) != 0) return nil; (*pointer) += 4; return [OFNull null]; case '0': case '1': |
︙ | ︙ |
Modified src/OFString+XMLUnescaping.m from [cfdc01faaa] to [654beb3068].
︙ | ︙ | |||
104 105 106 107 108 109 110 | last = i + 1; inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; | | | > | | | > | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | last = i + 1; inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; 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) == 0) [ret appendCString: ">" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "quot", 4) == 0) [ret appendCString: "\"" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "apos", 4) == 0) [ret appendCString: "'" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 3 && memcmp(entity, "amp", 3) == 0) [ret appendCString: "&" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entity[0] == '#') { void *pool; OFString *tmp; |
︙ | ︙ | |||
205 206 207 208 209 210 211 | last = i + 1; inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; | | | > | | | > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | last = i + 1; inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; 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) == 0) [ret appendCString: ">" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "quot", 4) == 0) [ret appendCString: "\"" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "apos", 4) == 0) [ret appendCString: "'" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entityLength == 3 && memcmp(entity, "amp", 3) == 0) [ret appendCString: "&" encoding: OF_STRING_ENCODING_ASCII length: 1]; else if (entity[0] == '#') { void *pool; OFString *tmp; |
︙ | ︙ |
Modified src/OFString.m from [5c8d912349] to [3cae95280a].
︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 | pool = objc_autoreleasePoolPush(); characters = [self characters]; otherCharacters = [otherString characters]; if (memcmp(characters, otherCharacters, | | | 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | pool = objc_autoreleasePoolPush(); characters = [self characters]; otherCharacters = [otherString characters]; if (memcmp(characters, otherCharacters, length * sizeof(of_unichar_t)) != 0) { objc_autoreleasePoolPop(pool); return false; } objc_autoreleasePoolPop(pool); return true; |
︙ | ︙ | |||
1592 1593 1594 1595 1596 1597 1598 | @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (i = range.length - searchLength;; i--) { | | | | | | 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 | @try { [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)) == 0) { objc_autoreleasePoolPop(pool); return of_range(range.location + i, searchLength); } /* No match and we're at the last character */ if (i == 0) break; } } else { for (i = 0; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); return of_range(range.location + i, searchLength); } } } } @finally { |
︙ | ︙ | |||
1640 1641 1642 1643 1644 1645 1646 | pool = objc_autoreleasePoolPush(); characters = [self characters]; searchCharacters = [string characters]; for (i = 0; i <= length - searchLength; i++) { | | | | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 | pool = objc_autoreleasePoolPush(); characters = [self characters]; searchCharacters = [string characters]; for (i = 0; i <= length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); return true; } } objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
1834 1835 1836 1837 1838 1839 1840 | } - (bool)hasPrefix: (OFString*)prefix { of_unichar_t *tmp; const of_unichar_t *prefixCharacters; size_t prefixLength; | | | | | | | | | | 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | } - (bool)hasPrefix: (OFString*)prefix { of_unichar_t *tmp; const of_unichar_t *prefixCharacters; size_t prefixLength; bool hasPrefix; if ((prefixLength = [prefix length]) > [self length]) return false; tmp = [self allocMemoryWithSize: sizeof(of_unichar_t) count: prefixLength]; @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(0, prefixLength)]; prefixCharacters = [prefix characters]; hasPrefix = (memcmp(tmp, prefixCharacters, prefixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); } @finally { [self freeMemory: tmp]; } return hasPrefix; } - (bool)hasSuffix: (OFString*)suffix { of_unichar_t *tmp; const of_unichar_t *suffixCharacters; size_t length, suffixLength; bool hasSuffix; if ((suffixLength = [suffix length]) > [self length]) return false; length = [self length]; tmp = [self allocMemoryWithSize: sizeof(of_unichar_t) count: suffixLength]; @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: of_range(length - suffixLength, suffixLength)]; suffixCharacters = [suffix characters]; hasSuffix = (memcmp(tmp, suffixCharacters, suffixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); } @finally { [self freeMemory: tmp]; } return hasSuffix; } - (OFArray*)componentsSeparatedByString: (OFString*)delimiter { return [self componentsSeparatedByString: delimiter options: 0]; } |
︙ | ︙ | |||
1926 1927 1928 1929 1930 1931 1932 | objc_autoreleasePoolPop(pool); return array; } for (i = 0, last = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, | | | 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | objc_autoreleasePoolPop(pool); return array; } for (i = 0, last = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, delimiterLength * sizeof(of_unichar_t)) != 0) continue; component = [self substringWithRange: of_range(last, i - last)]; if (!skipEmpty || [component length] > 0) [array addObject: component]; i += delimiterLength - 1; |
︙ | ︙ |
Modified src/OFString_UTF8.m from [0b123dda77] to [26025dccab].
︙ | ︙ | |||
173 174 175 176 177 178 179 | length: (size_t)UTF8StringLength storage: (char*)storage { self = [super init]; @try { if (UTF8StringLength >= 3 && | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | length: (size_t)UTF8StringLength storage: (char*)storage { self = [super init]; @try { if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } _s = &_storage; _s->cString = storage; |
︙ | ︙ | |||
213 214 215 216 217 218 219 | self = [super init]; @try { size_t i, j; const of_char16_t *table; if (encoding == OF_STRING_ENCODING_UTF_8 && | | > | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | self = [super init]; @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) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; _s->cString = [self allocMemoryWithSize: cStringLength + 1]; |
︙ | ︙ | |||
342 343 344 345 346 347 348 | { self = [super init]; @try { size_t UTF8StringLength = strlen(UTF8String); if (UTF8StringLength >= 3 && | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | { self = [super init]; @try { size_t UTF8StringLength = strlen(UTF8String); if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } _s = &_storage; _s->cString = (char*)UTF8String; |
︙ | ︙ | |||
728 729 730 731 732 733 734 | if (([otherString isKindOfClass: [OFString_UTF8 class]] || [otherString isKindOfClass: [OFMutableString_UTF8 class]]) && _s->hashed && otherString->_s->hashed && _s->hash != otherString->_s->hash) return false; | | | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | if (([otherString isKindOfClass: [OFString_UTF8 class]] || [otherString isKindOfClass: [OFMutableString_UTF8 class]]) && _s->hashed && otherString->_s->hashed && _s->hash != otherString->_s->hash) return false; if (strcmp(_s->cString, [otherString UTF8String]) != 0) return false; return true; } - (of_comparison_result_t)compare: (id <OFComparing>)object { |
︙ | ︙ | |||
948 949 950 951 952 953 954 | return of_range(0, 0); if (cStringLength > rangeLength) return of_range(OF_NOT_FOUND, 0); if (options & OF_STRING_SEARCH_BACKWARDS) { for (i = rangeLength - cStringLength;; i--) { | | | | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | return of_range(0, 0); 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) == 0) { range.location += of_string_utf8_get_index( _s->cString + rangeLocation, i); range.length = [string length]; return range; } /* Did not match and we're at the last char */ 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) == 0) { range.location += of_string_utf8_get_index( _s->cString + rangeLocation, i); range.length = [string length]; return range; } } |
︙ | ︙ | |||
989 990 991 992 993 994 995 | if (cStringLength == 0) return true; if (cStringLength > _s->cStringLength) return false; for (i = 0; i <= _s->cStringLength - cStringLength; i++) | | | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | if (cStringLength == 0) return true; if (cStringLength > _s->cStringLength) return false; for (i = 0; i <= _s->cStringLength - cStringLength; i++) if (memcmp(_s->cString + i, cString, cStringLength) == 0) return true; return false; } - (OFString*)substringWithRange: (of_range_t)range { |
︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 | - (bool)hasPrefix: (OFString*)prefix { size_t cStringLength = [prefix UTF8StringLength]; if (cStringLength > _s->cStringLength) return false; | | | | | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - (bool)hasPrefix: (OFString*)prefix { size_t cStringLength = [prefix UTF8StringLength]; if (cStringLength > _s->cStringLength) return false; 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) == 0); } - (OFArray*)componentsSeparatedByString: (OFString*)delimiter options: (int)options { void *pool; OFMutableArray *array; |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | [array addObject: [[self copy] autorelease]]; objc_autoreleasePoolPop(pool); return array; } for (i = 0, last = 0; i <= _s->cStringLength - cStringLength; i++) { | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | [array addObject: [[self copy] autorelease]]; objc_autoreleasePoolPop(pool); return array; } for (i = 0, last = 0; i <= _s->cStringLength - cStringLength; i++) { if (memcmp(_s->cString + i, cString, cStringLength) != 0) continue; component = [OFString stringWithUTF8String: _s->cString + last length: i - last]; if (!skipEmpty || [component length] > 0) [array addObject: component]; |
︙ | ︙ |
Modified src/OFUDPSocket.m from [aca7fe3ad4] to [9fe4ea7a6f].
︙ | ︙ | |||
209 210 211 212 213 214 215 | sin6_1 = (struct sockaddr_in6*)&address1->address; sin6_2 = (struct sockaddr_in6*)&address2->address; 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, | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | sin6_1 = (struct sockaddr_in6*)&address1->address; sin6_2 = (struct sockaddr_in6*)&address2->address; 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)) != 0) return false; break; #endif default: @throw [OFInvalidArgumentException exception]; } |
︙ | ︙ |
Modified src/runtime/class.m from [fb4bbc3736] to [cf051d40ec].
︙ | ︙ | |||
48 49 50 51 52 53 54 | if (empty_dtable == NULL) empty_dtable = objc_sparsearray_new(); cls->dtable = empty_dtable; cls->metaclass->dtable = empty_dtable; | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | if (empty_dtable == NULL) empty_dtable = objc_sparsearray_new(); cls->dtable = empty_dtable; cls->metaclass->dtable = empty_dtable; if (strcmp(cls->name, "Protocol") != 0) classes_cnt++; } BOOL class_registerAlias_np(Class cls, const char *name) { if (classes == NULL) |
︙ | ︙ | |||
535 536 537 538 539 540 541 | objc_global_mutex_unlock(); return j; } if (classes->data[i] == NULL) continue; | | | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | objc_global_mutex_unlock(); return j; } if (classes->data[i] == NULL) continue; if (strcmp(classes->data[i]->key, "Protocol") == 0) continue; cls = (Class)classes->data[i]->obj; if (cls == Nil || (uintptr_t)cls & 1) continue; |
︙ | ︙ | |||
862 863 864 865 866 867 868 | objc_unregister_class(cls->subclass_list[0]); if (cls->info & OBJC_CLASS_INFO_LOADED) call_method(cls, "unload"); objc_hashtable_delete(classes, cls->name); | | | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | objc_unregister_class(cls->subclass_list[0]); if (cls->info & OBJC_CLASS_INFO_LOADED) call_method(cls, "unload"); objc_hashtable_delete(classes, cls->name); if (strcmp(class_getName(cls), "Protocol") != 0) classes_cnt--; unregister_class(cls); unregister_class(cls->isa); } static void |
︙ | ︙ |
Modified src/runtime/exception.m from [c587b3ed95] to [bf6c15d416].
︙ | ︙ | |||
479 480 481 482 483 484 485 | c = (uintptr_t)resolve_value(c, lsda->typestable_enc, lsda->typestable - i, lsda->typestable_base); #endif className = (const char*)c; if (className != NULL && *className != '\0' && | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | c = (uintptr_t)resolve_value(c, lsda->typestable_enc, lsda->typestable - i, lsda->typestable_base); #endif className = (const char*)c; if (className != NULL && *className != '\0' && strcmp(className, "@id") != 0) class = objc_getRequiredClass(className); else class = Nil; if (class_matches(class, e->object)) { *filtervalue = filter; return HANDLER_FOUND; |
︙ | ︙ |
Modified src/runtime/hashtable.m from [f9c1f2768d] to [f1cf7ae4d1].
︙ | ︙ | |||
45 46 47 48 49 50 51 | return hash; } bool objc_equal_string(const void *obj1, const void *obj2) { | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | return hash; } bool objc_equal_string(const void *obj1, const void *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) { struct objc_hashtable *table; |
︙ | ︙ |
Modified src/runtime/protocol.m from [66c66e6946] to [f526015ede].
︙ | ︙ | |||
29 30 31 32 33 34 35 | { return p->name; } inline bool __attribute__((gnu_inline)) protocol_isEqual(Protocol *a, Protocol *b) { | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | { return p->name; } inline bool __attribute__((gnu_inline)) protocol_isEqual(Protocol *a, Protocol *b) { return (strcmp(protocol_getName(a), protocol_getName(b)) == 0); } bool protocol_conformsToProtocol(Protocol *a, Protocol *b) { struct objc_protocol_list *pl; size_t i; |
︙ | ︙ |
Modified tests/OFStringTests.m from [8c5b4654b9] to [aef3727a76].
︙ | ︙ | |||
164 165 166 167 168 169 170 | TEST(@"+[stringWithUTF16String:]", (is = [OFString stringWithUTF16String: utf16str]) && [is isEqual: @"fööbär🀺"] && (is = [OFString stringWithUTF16String: sutf16str]) && [is isEqual: @"fööbär🀺"]) | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | TEST(@"+[stringWithUTF16String:]", (is = [OFString stringWithUTF16String: utf16str]) && [is isEqual: @"fööbär🀺"] && (is = [OFString stringWithUTF16String: sutf16str]) && [is isEqual: @"fööbär🀺"]) TEST(@"+[stringWithUTF32String:]", (is = [OFString stringWithUTF32String: ucstr]) && [is isEqual: @"fööbär🀺"] && (is = [OFString stringWithUTF32String: sucstr]) && [is isEqual: @"fööbär🀺"]) #ifdef OF_HAVE_FILES TEST(@"+[stringWithContentsOfFile:encoding]", (is = [OFString |
︙ | ︙ |