Comment: | Always prefix functions with the type |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | new-naming-convention |
Files: | files | file ages | folders |
SHA3-256: |
eb0cfa6ff9bbec71125bb4fdd1ba0615 |
User & Date: | js on 2021-04-17 14:13:56 |
Other Links: | branch diff | manifest | tags |
2021-04-17
| ||
14:19 | of_offset_t -> OFFileOffset check-in: e69db838d9 user: js tags: new-naming-convention | |
14:13 | Always prefix functions with the type check-in: eb0cfa6ff9 user: js tags: new-naming-convention | |
14:05 | Minor fixes for last commit check-in: c45a108585 user: js tags: new-naming-convention | |
Modified generators/unicode/TableGenerator.m from [a801b746a9] to [15b00187cf].
︙ | ︙ | |||
133 134 135 136 137 138 139 | OFArray *decomposed = [[components objectAtIndex: 5] componentsSeparatedByString: @" "]; bool compat = false; OFMutableString *string; if ([decomposed.firstObject hasPrefix: @"<"]) { decomposed = [decomposed objectsInRange: | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | OFArray *decomposed = [[components objectAtIndex: 5] componentsSeparatedByString: @" "]; bool compat = false; OFMutableString *string; if ([decomposed.firstObject hasPrefix: @"<"]) { decomposed = [decomposed objectsInRange: OFRangeMake(1, decomposed.count - 1)]; compat = true; } string = [OFMutableString string]; for (OFString *character in decomposed) { OFUnichar unichar = (OFUnichar)[character |
︙ | ︙ |
Modified src/OFArray.m from [6fa2c5536f] to [a47e5750f8].
︙ | ︙ | |||
236 237 238 239 240 241 242 | - (id const *)objects { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | - (id const *)objects { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { [self getObjects: buffer inRange: OFRangeMake(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true] items]; } @catch (id e) { free(buffer); |
︙ | ︙ | |||
741 742 743 744 745 746 747 | return new; } - (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count { | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | return new; } - (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count { OFRange range = OFRangeMake(state->state, count); if (range.length > SIZE_MAX - range.location) @throw [OFOutOfRangeException exception]; if (range.location + range.length > self.count) range.length = self.count - range.location; |
︙ | ︙ |
Modified src/OFDNSResolverSettings.m from [711318f6b6] to [10c8382b79].
︙ | ︙ | |||
171 172 173 174 175 176 177 | static OFArray OF_GENERIC(OFString *) * parseNetStackArray(OFString *string) { if (![string hasPrefix: @"["] || ![string hasSuffix: @"]"]) return nil; | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | static OFArray OF_GENERIC(OFString *) * parseNetStackArray(OFString *string) { if (![string hasPrefix: @"["] || ![string hasSuffix: @"]"]) return nil; string = [string substringWithRange: OFRangeMake(1, string.length - 2)]; return [string componentsSeparatedByString: @"|"]; } #endif @implementation OFDNSResolverSettings - (void)dealloc |
︙ | ︙ | |||
275 276 277 278 279 280 281 | options: OFStringSkipEmptyComponents]; if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | options: OFStringSkipEmptyComponents]; if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: OFRangeMake(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; if (addresses == nil) { addresses = [OFMutableArray array]; |
︙ | ︙ | |||
378 379 380 381 382 383 384 | if (components.count < 2) { objc_autoreleasePoolPop(pool2); continue; } option = components.firstObject; arguments = [components objectsInRange: | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | if (components.count < 2) { objc_autoreleasePoolPop(pool2); continue; } option = components.firstObject; arguments = [components objectsInRange: OFRangeMake(1, components.count - 1)]; if ([option isEqual: @"nameserver"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; } |
︙ | ︙ | |||
477 478 479 480 481 482 483 | OFArray *hosts; if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: | | | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | OFArray *hosts; if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: OFRangeMake(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; if (addresses == nil) { addresses = [OFMutableArray array]; |
︙ | ︙ |
Modified src/OFData.m from [98780c8b8b] to [1ddf45efe0].
︙ | ︙ | |||
554 555 556 557 558 559 560 | range.location + range.length > _count) @throw [OFOutOfRangeException exception]; if (data == nil || data.itemSize != _itemSize) @throw [OFInvalidArgumentException exception]; if ((searchLength = data.count) == 0) | | | | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | range.location + range.length > _count) @throw [OFOutOfRangeException exception]; if (data == nil || data.itemSize != _itemSize) @throw [OFInvalidArgumentException exception]; if ((searchLength = data.count) == 0) return OFRangeMake(0, 0); if (searchLength > range.length) return OFRangeMake(OFNotFound, 0); search = data.items; if (options & OFDataSearchBackwards) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) return OFRangeMake(i, searchLength); /* No match and we're at the last item */ if (i == 0) break; } } else { for (size_t i = range.location; i <= range.length - searchLength; i++) if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) return OFRangeMake(i, searchLength); } return OFRangeMake(OFNotFound, 0); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"w"]; @try { |
︙ | ︙ |
Modified src/OFHTTPClient.m from [4234996a26] to [91e757df2d].
︙ | ︙ | |||
456 457 458 459 460 461 462 | return false; } if (![line hasPrefix: @"HTTP/"] || line.length < 9 || [line characterAtIndex: 8] != ' ') @throw [OFInvalidServerReplyException exception]; | | | | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | return false; } if (![line hasPrefix: @"HTTP/"] || line.length < 9 || [line characterAtIndex: 8] != ' ') @throw [OFInvalidServerReplyException exception]; _version = [[line substringWithRange: OFRangeMake(5, 3)] copy]; if (![_version isEqual: @"1.0"] && ![_version isEqual: @"1.1"]) @throw [OFUnsupportedVersionException exceptionWithVersion: _version]; status = [line substringWithRange: OFRangeMake(9, 3)].longLongValue; if (status < 0 || status > 599) @throw [OFInvalidServerReplyException exception]; _status = (short)status; return true; |
︙ | ︙ |
Modified src/OFHTTPCookie.m from [c34a9bfc99] to [2df5054718].
︙ | ︙ | |||
91 92 93 94 95 96 97 | last = i; i--; } break; case STATE_NAME: if (characters[i] == '=') { name = [string substringWithRange: | | | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 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 | last = i; i--; } break; case STATE_NAME: if (characters[i] == '=') { name = [string substringWithRange: OFRangeMake(last, i - last)]; state = STATE_EXPECT_VALUE; } break; case STATE_EXPECT_VALUE: if (characters[i] == '"') { state = STATE_QUOTED_VALUE; last = i + 1; } else { state = STATE_VALUE; last = i; } i--; break; case STATE_VALUE: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: OFRangeMake(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; state = (characters[i] == ';' ? STATE_PRE_ATTR_NAME : STATE_PRE_NAME); } break; case STATE_QUOTED_VALUE: if (characters[i] == '"') { value = [string substringWithRange: OFRangeMake(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; state = STATE_POST_QUOTED_VALUE; } |
︙ | ︙ | |||
151 152 153 154 155 156 157 | last = i; i--; } break; case STATE_ATTR_NAME: if (characters[i] == '=') { name = [string substringWithRange: | | | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | last = i; i--; } break; case STATE_ATTR_NAME: if (characters[i] == '=') { name = [string substringWithRange: OFRangeMake(last, i - last)]; state = STATE_ATTR_VALUE; last = i + 1; } else if (characters[i] == ';' || characters[i] == ',') { name = [string substringWithRange: OFRangeMake(last, i - last)]; handleAttribute(ret.lastObject, name, nil); state = (characters[i] == ';' ? STATE_PRE_ATTR_NAME : STATE_PRE_NAME); } break; case STATE_ATTR_VALUE: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: OFRangeMake(last, i - last)]; /* * Expires often contains a comma, even though * the comma is used as a separator for * concatenating headers as per RFC 2616, * meaning RFC 6265 contradicts RFC 2616. * Solve this by special casing this. |
︙ | ︙ | |||
211 212 213 214 215 216 217 | break; case STATE_NAME: case STATE_QUOTED_VALUE: @throw [OFInvalidFormatException exception]; break; case STATE_VALUE: value = [string substringWithRange: | | | | | 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 242 243 244 245 246 | break; case STATE_NAME: case STATE_QUOTED_VALUE: @throw [OFInvalidFormatException exception]; break; case STATE_VALUE: value = [string substringWithRange: OFRangeMake(last, length - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; break; /* We end up here if the cookie is just foo= */ case STATE_EXPECT_VALUE: [ret addObject: [OFHTTPCookie cookieWithName: name value: @"" domain: domain]]; break; case STATE_ATTR_NAME: if (last != length) { name = [string substringWithRange: OFRangeMake(last, length - last)]; handleAttribute(ret.lastObject, name, nil); } break; case STATE_ATTR_VALUE: value = [string substringWithRange: OFRangeMake(last, length - last)]; handleAttribute(ret.lastObject, name, value); break; } objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/OFHTTPResponse.m from [b9c77a409c] to [94b8fa5885].
︙ | ︙ | |||
211 212 213 214 215 216 217 | value = value.stringByDeletingTrailingWhitespaces; if ([name isEqual: @"charset"]) charset = value; } @try { | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | value = value.stringByDeletingTrailingWhitespaces; if ([name isEqual: @"charset"]) charset = value; } @try { ret = OFStringEncodingParseName(charset); } @catch (OFInvalidArgumentException *e) { ret = OFStringEncodingAutodetect; } return ret; } |
︙ | ︙ |
Modified src/OFHTTPServer.m from [372c0e044a] to [c6a414493d].
︙ | ︙ | |||
350 351 352 353 354 355 356 | { OFString *method; OFMutableString *path; size_t pos; @try { OFString *version = [line | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | { OFString *method; OFMutableString *path; size_t pos; @try { OFString *version = [line substringWithRange: OFRangeMake(line.length - 9, 9)]; OFUnichar tmp; if (![version hasPrefix: @" HTTP/1."]) return [self sendErrorAndClose: 505]; tmp = [version characterAtIndex: 8]; if (tmp < '0' || tmp > '9') |
︙ | ︙ | |||
377 378 379 380 381 382 383 | @try { _method = of_http_request_method_from_string(method); } @catch (OFInvalidArgumentException *e) { return [self sendErrorAndClose: 405]; } @try { | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | @try { _method = of_http_request_method_from_string(method); } @catch (OFInvalidArgumentException *e) { return [self sendErrorAndClose: 405]; } @try { OFRange range = OFRangeMake(pos + 1, line.length - pos - 10); path = [[[line substringWithRange: range] mutableCopy] autorelease]; } @catch (OFOutOfRangeException *e) { return [self sendErrorAndClose: 400]; } |
︙ | ︙ |
Modified src/OFINICategory.m from [d8e2a6f10b] to [4bd3d1b960].
︙ | ︙ | |||
70 71 72 73 74 75 76 | unescapeString(OFString *string) { OFMutableString *mutableString; if (![string hasPrefix: @"\""] || ![string hasSuffix: @"\""]) return string; | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | unescapeString(OFString *string) { OFMutableString *mutableString; if (![string hasPrefix: @"\""] || ![string hasSuffix: @"\""]) return string; string = [string substringWithRange: OFRangeMake(1, string.length - 2)]; mutableString = [[string mutableCopy] autorelease]; [mutableString replaceOccurrencesOfString: @"\\f" withString: @"\f"]; [mutableString replaceOccurrencesOfString: @"\\r" withString: @"\r"]; [mutableString replaceOccurrencesOfString: @"\\n" withString: @"\n"]; [mutableString replaceOccurrencesOfString: @"\\\"" withString: @"\""]; [mutableString replaceOccurrencesOfString: @"\\\\" withString: @"\\"]; |
︙ | ︙ |
Modified src/OFINIFile.m from [0891d21917] to [dc7dcfa84c].
︙ | ︙ | |||
135 136 137 138 139 140 141 | if ([line hasPrefix: @"["]) { OFString *categoryName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | if ([line hasPrefix: @"["]) { OFString *categoryName; if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: OFRangeMake(1, line.length - 2)]; category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) @throw [OFInvalidFormatException exception]; |
︙ | ︙ |
Modified src/OFLocale.m from [d90d567f44] to [3ac9452a5e].
︙ | ︙ | |||
55 56 57 58 59 60 61 | /* Encoding */ if ((tmp = strrchr(locale, '.')) != NULL) { *tmp++ = '\0'; @try { if (encoding != NULL) | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* Encoding */ if ((tmp = strrchr(locale, '.')) != NULL) { *tmp++ = '\0'; @try { if (encoding != NULL) *encoding = OFStringEncodingParseName( [OFString stringWithCString: tmp encoding: enc]); } @catch (OFInvalidArgumentException *e) { } } /* Territory */ |
︙ | ︙ |
Modified src/OFMutableArray.m from [680aac7358] to [bf8e9eeb86].
︙ | ︙ | |||
376 377 378 379 380 381 382 | return; [self removeObjectAtIndex: count - 1]; } - (void)removeAllObjects { | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | return; [self removeObjectAtIndex: count - 1]; } - (void)removeAllObjects { [self removeObjectsInRange: OFRangeMake(0, self.count)]; } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (OFArrayReplaceBlock)block { [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { |
︙ | ︙ |
Modified src/OFMutableData.m from [641dd5b634] to [464180ac39].
︙ | ︙ | |||
240 241 242 243 244 245 246 | memset(_items + _count * _itemSize, '\0', count * _itemSize); _count += count; } - (void)removeItemAtIndex: (size_t)idx { | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | memset(_items + _count * _itemSize, '\0', count * _itemSize); _count += count; } - (void)removeItemAtIndex: (size_t)idx { [self removeItemsInRange: OFRangeMake(idx, 1)]; } - (void)removeItemsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; |
︙ | ︙ |
Modified src/OFMutableString.m from [440135bc21] to [07b8bb5a1a].
︙ | ︙ | |||
285 286 287 288 289 290 291 | #endif - (void)setCharacter: (OFUnichar)character atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithCharacters: &character length: 1]; | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | #endif - (void)setCharacter: (OFUnichar)character atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithCharacters: &character length: 1]; [self replaceCharactersInRange: OFRangeMake(idx, 1) withString: string]; objc_autoreleasePoolPop(pool); } - (void)appendString: (OFString *)string { [self insertString: string atIndex: self.length]; } |
︙ | ︙ | |||
427 428 429 430 431 432 433 | { convert(self, of_ascii_toupper, of_ascii_tolower); } #endif - (void)insertString: (OFString *)string atIndex: (size_t)idx { | | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | { convert(self, of_ascii_toupper, of_ascii_tolower); } #endif - (void)insertString: (OFString *)string atIndex: (size_t)idx { [self replaceCharactersInRange: OFRangeMake(idx, 0) withString: string]; } - (void)deleteCharactersInRange: (OFRange)range { [self replaceCharactersInRange: range withString: @""]; } - (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { OF_UNRECOGNIZED_SELECTOR } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement { [self replaceOccurrencesOfString: string withString: replacement options: 0 range: OFRangeMake(0, self.length)]; } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options range: (OFRange)range { |
︙ | ︙ | |||
481 482 483 484 485 486 487 | characters = self.characters; for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) != 0) continue; | | | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | characters = self.characters; for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) != 0) continue; [self replaceCharactersInRange: OFRangeMake(i, searchLength) withString: replacement]; range.length -= searchLength; range.length += replacementLength; i += replacementLength - 1; |
︙ | ︙ | |||
513 514 515 516 517 518 519 | if (!of_ascii_isspace(c)) break; } objc_autoreleasePoolPop(pool); | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | if (!of_ascii_isspace(c)) break; } objc_autoreleasePoolPop(pool); [self deleteCharactersInRange: OFRangeMake(0, i)]; } - (void)deleteTrailingWhitespaces { void *pool; const OFUnichar *characters, *p; size_t length, d; |
︙ | ︙ | |||
540 541 542 543 544 545 546 | break; d++; } objc_autoreleasePoolPop(pool); | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | break; d++; } objc_autoreleasePoolPop(pool); [self deleteCharactersInRange: OFRangeMake(length - d, d)]; } - (void)deleteEnclosingWhitespaces { [self deleteLeadingWhitespaces]; [self deleteTrailingWhitespaces]; } |
︙ | ︙ |
Modified src/OFMutableURL.m from [6cfd3507ce] to [baeb186c19].
︙ | ︙ | |||
86 87 88 89 90 91 92 | - (void)setURLEncodedHost: (OFString *)URLEncodedHost { OFString *old; if ([URLEncodedHost hasPrefix: @"["] && [URLEncodedHost hasSuffix: @"]"]) { if (!of_url_is_ipv6_host([URLEncodedHost substringWithRange: | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - (void)setURLEncodedHost: (OFString *)URLEncodedHost { OFString *old; if ([URLEncodedHost hasPrefix: @"["] && [URLEncodedHost hasSuffix: @"]"]) { if (!of_url_is_ipv6_host([URLEncodedHost substringWithRange: OFRangeMake(1, URLEncodedHost.length - 2)])) @throw [OFInvalidFormatException exception]; } else if (URLEncodedHost != nil) of_url_verify_escaped(URLEncodedHost, [OFCharacterSet URLHostAllowedCharacterSet]); old = _URLEncodedHost; _URLEncodedHost = [URLEncodedHost copy]; |
︙ | ︙ | |||
400 401 402 403 404 405 406 | done = false; break; } if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | done = false; break; } if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: OFRangeMake(i - 1, 2)]; done = false; break; } } } |
︙ | ︙ |
Modified src/OFObject.h from [972f5ad44c] to [36c6bafde9].
︙ | ︙ | |||
107 108 109 110 111 112 113 | * @brief Creates a new OFRange. * * @param start The starting index of the range * @param length The length of the range * @return An OFRangeith the specified start and length */ static OF_INLINE OFRange OF_CONST_FUNC | | | | 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 | * @brief Creates a new OFRange. * * @param start The starting index of the range * @param length The length of the range * @return An OFRangeith the specified start and length */ static OF_INLINE OFRange OF_CONST_FUNC OFRangeMake(size_t start, size_t length) { OFRange range = { start, length }; return range; } /** * @brief Returns whether the two ranges are equal. * * @param range1 The first range for the comparison * @param range2 The second range for the comparison * @return Whether the two ranges are equal */ static OF_INLINE bool OFRangeEqual(OFRange range1, OFRange range2) { if (range1.location != range2.location) return false; if (range1.length != range2.length) return false; |
︙ | ︙ | |||
159 160 161 162 163 164 165 | * @brief Creates a new OFPoint. * * @param x The x coordinate of the point * @param y The x coordinate of the point * @return An OFPoint with the specified coordinates */ static OF_INLINE OFPoint OF_CONST_FUNC | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | * @brief Creates a new OFPoint. * * @param x The x coordinate of the point * @param y The x coordinate of the point * @return An OFPoint with the specified coordinates */ static OF_INLINE OFPoint OF_CONST_FUNC OFPointMake(float x, float y) { OFPoint point = { x, y }; return point; } /** * @brief Returns whether the two points are equal. * * @param point1 The first point for the comparison * @param point2 The second point for the comparison * @return Whether the two points are equal */ static OF_INLINE bool OFPointEqual(OFPoint point1, OFPoint point2) { if (point1.x != point2.x) return false; if (point1.y != point2.y) return false; |
︙ | ︙ | |||
206 207 208 209 210 211 212 | * @brief Creates a new OFSize. * * @param width The width of the size * @param height The height of the size * @return An OFSize with the specified width and height */ static OF_INLINE OFSize OF_CONST_FUNC | | | | 206 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 | * @brief Creates a new OFSize. * * @param width The width of the size * @param height The height of the size * @return An OFSize with the specified width and height */ static OF_INLINE OFSize OF_CONST_FUNC OFSizeMake(float width, float height) { OFSize size = { width, height }; return size; } /** * @brief Returns whether the two sizes are equal. * * @param size1 The first size for the comparison * @param size2 The second size for the comparison * @return Whether the two sizes are equal */ static OF_INLINE bool OFSizeEqual(OFSize size1, OFSize size2) { if (size1.width != size2.width) return false; if (size1.height != size2.height) return false; |
︙ | ︙ | |||
255 256 257 258 259 260 261 | * @param x The x coordinate of the top left corner of the rectangle * @param y The y coordinate of the top left corner of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle * @return An OFRect with the specified origin and size */ static OF_INLINE OFRect OF_CONST_FUNC | | | | | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | * @param x The x coordinate of the top left corner of the rectangle * @param y The y coordinate of the top left corner of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle * @return An OFRect with the specified origin and size */ static OF_INLINE OFRect OF_CONST_FUNC OFRectMake(float x, float y, float width, float height) { OFRect rect = { OFPointMake(x, y), OFSizeMake(width, height) }; return rect; } /** * @brief Returns whether the two rectangles are equal. * * @param rect1 The first rectangle for the comparison * @param rect2 The second rectangle for the comparison * @return Whether the two rectangles are equal */ static OF_INLINE bool OFRectEqual(OFRect rect1, OFRect rect2) { if (!OFPointEqual(rect1.origin, rect2.origin)) return false; if (!OFSizeEqual(rect1.size, rect2.size)) return false; return true; } static const size_t OFNotFound = SIZE_MAX; |
︙ | ︙ |
Modified src/OFOptionsParser.m from [f1ad10653b] to [ca8fd292f0].
︙ | ︙ | |||
195 196 197 198 199 200 201 | OFNotFound) _argument = [[argument substringFromIndex: pos + 1] copy]; else pos = argument.length; _lastLongOption = [[argument substringWithRange: | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | OFNotFound) _argument = [[argument substringFromIndex: pos + 1] copy]; else pos = argument.length; _lastLongOption = [[argument substringWithRange: OFRangeMake(2, pos - 2)] copy]; objc_autoreleasePoolPop(pool); option = [_longOptions objectForKey: _lastLongOption]; if (option == NULL) return '?'; |
︙ | ︙ | |||
267 268 269 270 271 272 273 | return '?'; } - (OFArray *)remainingArguments { return [_arguments objectsInRange: | | | 267 268 269 270 271 272 273 274 275 276 | return '?'; } - (OFArray *)remainingArguments { return [_arguments objectsInRange: OFRangeMake(_index, _arguments.count - _index)]; } @end |
Modified src/OFString.h from [c20eafef33] to [7a23f6e323].
︙ | ︙ | |||
1277 1278 1279 1280 1281 1282 1283 | * * Throws @ref OFInvalidArgumentException if the specified name is not a valid * encoding name. * * @param name The name to parse as a string encoding * @return The OFStringEncoding for the specified name */ | | | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | * * Throws @ref OFInvalidArgumentException if the specified name is not a valid * encoding name. * * @param name The name to parse as a string encoding * @return The OFStringEncoding for the specified name */ extern OFStringEncoding OFStringEncodingParseName(OFString *name); /** * @brief Returns the name of the specified OFStringEncoding. * * @param encoding The encoding for which to return the name * @return The name of the specified OFStringEncoding */ |
︙ | ︙ |
Modified src/OFString.m from [8bdf1a14a9] to [d072a99f4c].
︙ | ︙ | |||
142 143 144 145 146 147 148 | void _reference_to_OFConstantString(void) { [OFConstantString class]; } OFStringEncoding | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | void _reference_to_OFConstantString(void) { [OFConstantString class]; } OFStringEncoding OFStringEncodingParseName(OFString *string) { void *pool = objc_autoreleasePoolPush(); OFStringEncoding encoding; string = string.lowercaseString; if ([string isEqual: @"utf8"] || [string isEqual: @"utf-8"]) |
︙ | ︙ | |||
1798 1799 1800 1801 1802 1803 1804 | return data; } - (OFRange)rangeOfString: (OFString *)string { return [self rangeOfString: string options: 0 | | | | | | | | | | | 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 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 | return data; } - (OFRange)rangeOfString: (OFString *)string { return [self rangeOfString: string options: 0 range: OFRangeMake(0, self.length)]; } - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options { return [self rangeOfString: string options: options range: OFRangeMake(0, self.length)]; } - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options range: (OFRange)range { void *pool; const OFUnichar *searchCharacters; OFUnichar *characters; size_t searchLength; if ((searchLength = string.length) == 0) return OFRangeMake(0, 0); if (searchLength > range.length) return OFRangeMake(OFNotFound, 0); if (range.length > SIZE_MAX / sizeof(OFUnichar)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; characters = of_alloc(range.length, sizeof(OFUnichar)); @try { [self getCharacters: characters inRange: range]; if (options & OFStringSearchBackwards) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); return OFRangeMake(range.location + i, searchLength); } /* No match and we're at the last character */ if (i == 0) break; } } else { for (size_t i = 0; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); return OFRangeMake(range.location + i, searchLength); } } } } @finally { free(characters); } objc_autoreleasePoolPop(pool); return OFRangeMake(OFNotFound, 0); } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet { return [self indexOfCharacterFromSet: characterSet options: 0 range: OFRangeMake(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options { return [self indexOfCharacterFromSet: characterSet options: options range: OFRangeMake(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options range: (OFRange)range { bool (*characterIsMember)(id, SEL, OFUnichar) = |
︙ | ︙ | |||
1959 1960 1961 1962 1963 1964 1965 | objc_autoreleasePoolPop(pool); return false; } - (OFString *)substringFromIndex: (size_t)idx { | | | | 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | objc_autoreleasePoolPop(pool); return false; } - (OFString *)substringFromIndex: (size_t)idx { return [self substringWithRange: OFRangeMake(idx, self.length - idx)]; } - (OFString *)substringToIndex: (size_t)idx { return [self substringWithRange: OFRangeMake(0, idx)]; } - (OFString *)substringWithRange: (OFRange)range { void *pool; OFString *ret; |
︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | if ((prefixLength = prefix.length) > self.length) return false; tmp = of_alloc(prefixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); | | | 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 | if ((prefixLength = prefix.length) > self.length) return false; tmp = of_alloc(prefixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: OFRangeMake(0, prefixLength)]; hasPrefix = (memcmp(tmp, prefix.characters, prefixLength * sizeof(OFUnichar)) == 0); objc_autoreleasePoolPop(pool); } @finally { free(tmp); |
︙ | ︙ | |||
2140 2141 2142 2143 2144 2145 2146 | length = self.length; tmp = of_alloc(suffixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp | | | 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 | length = self.length; tmp = of_alloc(suffixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp inRange: OFRangeMake(length - suffixLength, suffixLength)]; suffixCharacters = suffix.characters; hasSuffix = (memcmp(tmp, suffixCharacters, suffixLength * sizeof(OFUnichar)) == 0); objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
2200 2201 2202 2203 2204 2205 2206 | last = 0; for (size_t i = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, delimiterLength * sizeof(OFUnichar)) != 0) continue; component = [self substringWithRange: | | | | 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 | last = 0; for (size_t i = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, delimiterLength * sizeof(OFUnichar)) != 0) continue; component = [self substringWithRange: OFRangeMake(last, i - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; i += delimiterLength - 1; last = i + 1; } component = [self substringWithRange: OFRangeMake(last, length - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; [array makeImmutable]; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
2245 2246 2247 2248 2249 2250 2251 | last = 0; for (size_t i = 0; i < length; i++) { if (characterIsMember(characterSet, @selector(characterIsMember:), characters[i])) { if (!skipEmpty || i != last) { OFString *component = [self substringWithRange: | | | | 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 | last = 0; for (size_t i = 0; i < length; i++) { if (characterIsMember(characterSet, @selector(characterIsMember:), characters[i])) { if (!skipEmpty || i != last) { OFString *component = [self substringWithRange: OFRangeMake(last, i - last)]; [array addObject: component]; } last = i + 1; } } if (!skipEmpty || length != last) { OFString *component = [self substringWithRange: OFRangeMake(last, length - last)]; [array addObject: component]; } [array makeImmutable]; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
2527 2528 2529 2530 2531 2532 2533 | - (const OFUnichar *)characters { size_t length = self.length; OFUnichar *buffer; buffer = of_alloc(length, sizeof(OFUnichar)); @try { | | | 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 | - (const OFUnichar *)characters { size_t length = self.length; OFUnichar *buffer; buffer = of_alloc(length, sizeof(OFUnichar)); @try { [self getCharacters: buffer inRange: OFRangeMake(0, length)]; return [[OFData dataWithItemsNoCopy: buffer count: length itemSize: sizeof(OFUnichar) freeWhenDone: true] items]; } @catch (id e) { free(buffer); |
︙ | ︙ | |||
2628 2629 2630 2631 2632 2633 2634 | - (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { size_t length = self.length; OFChar32 *buffer; buffer = of_alloc(length + 1, sizeof(OFChar32)); @try { | | | 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 | - (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { size_t length = self.length; OFChar32 *buffer; buffer = of_alloc(length + 1, sizeof(OFChar32)); @try { [self getCharacters: buffer inRange: OFRangeMake(0, length)]; buffer[length] = 0; if (byteOrder != OFByteOrderNative) for (size_t i = 0; i < length; i++) buffer[i] = OF_BSWAP32(buffer[i]); return [[OFData dataWithItemsNoCopy: buffer |
︙ | ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | continue; } if (characters[i] == '\n' || characters[i] == '\r') { void *pool2 = objc_autoreleasePoolPush(); block([self substringWithRange: | | | | 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 | continue; } if (characters[i] == '\n' || characters[i] == '\r') { void *pool2 = objc_autoreleasePoolPush(); block([self substringWithRange: OFRangeMake(last, i - last)], &stop); last = i + 1; objc_autoreleasePoolPop(pool2); } lastCarriageReturn = (characters[i] == '\r'); } if (!stop) block([self substringWithRange: OFRangeMake(last, i - last)], &stop); objc_autoreleasePoolPop(pool); } #endif @end |
Modified src/OFSystemInfo.m from [014dd1b2fc] to [28c48fc0d9].
︙ | ︙ | |||
386 387 388 389 390 391 392 | OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; | | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: OFRangeMake(0, 1)]; [path prependString: home]; } [path makeImmutable]; return path; # elif defined(OF_WINDOWS) |
︙ | ︙ | |||
478 479 480 481 482 483 484 | OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; [path deleteCharactersInRange: OFRangeMake(0, 1)]; [path prependString: home]; } [path appendString: @"/Preferences"]; [path makeImmutable]; return path; |
︙ | ︙ |
Modified src/OFURL.m from [67b8d12e14] to [31de543f61].
︙ | ︙ | |||
875 876 877 878 879 880 881 | } - (OFString *)host { if ([_URLEncodedHost hasPrefix: @"["] && [_URLEncodedHost hasSuffix: @"]"]) { OFString *host = [_URLEncodedHost substringWithRange: | | | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | } - (OFString *)host { if ([_URLEncodedHost hasPrefix: @"["] && [_URLEncodedHost hasSuffix: @"]"]) { OFString *host = [_URLEncodedHost substringWithRange: OFRangeMake(1, _URLEncodedHost.length - 2)]; if (!of_url_is_ipv6_host(host)) @throw [OFInvalidArgumentException exception]; return host; } |
︙ | ︙ |
Modified src/OFUTF8String.m from [325d0971b0] to [15625b331d].
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | _s->cStringLength - rangeLocation); } else { rangeLocation = range.location; rangeLength = range.length; } if (cStringLength == 0) | | | | | | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 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 1048 | _s->cStringLength - rangeLocation); } else { rangeLocation = range.location; rangeLength = range.length; } if (cStringLength == 0) return OFRangeMake(0, 0); if (cStringLength > rangeLength) return OFRangeMake(OFNotFound, 0); if (options & OFStringSearchBackwards) { for (size_t 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 OFRangeMake(OFNotFound, 0); } } else { for (size_t 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; } } } return OFRangeMake(OFNotFound, 0); } - (bool)containsString: (OFString *)string { const char *cString = string.UTF8String; size_t cStringLength = string.UTF8StringLength; |
︙ | ︙ |
Modified src/OFXMLParser.m from [0ad1be565e] to [d9e7407eb2].
︙ | ︙ | |||
446 447 448 449 450 451 452 | hasVersion = true; } if ([attribute isEqual: @"encoding"]) { @try { self->_encoding = | | | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | hasVersion = true; } if ([attribute isEqual: @"encoding"]) { @try { self->_encoding = OFStringEncodingParseName(value); } @catch (OFInvalidArgumentException *e) { @throw [OFInvalidEncodingException exception]; } } last = i + 1; |
︙ | ︙ |
Modified src/OFZIPArchive.m from [57930654e1] to [a439791082].
︙ | ︙ | |||
664 665 666 667 668 669 670 | ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFRangeMake(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) _compressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); |
︙ | ︙ |
Modified src/OFZIPArchiveEntry.m from [7b9fab9725] to [4136550749].
︙ | ︙ | |||
253 254 255 256 257 258 259 | ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = | | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = OFRangeMake(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) _compressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); |
︙ | ︙ |
Modified src/platform/amiga/OFString+PathAdditions.m from [52b79caac6] to [3fc44c52a7].
︙ | ︙ | |||
151 152 153 154 155 156 157 | } objc_autoreleasePoolPop(pool); return @""; } components = [components objectsInRange: | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | } objc_autoreleasePoolPop(pool); return @""; } components = [components objectsInRange: OFRangeMake(0, components.count - 1)]; ret = [OFString pathWithComponents: components]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } |
︙ | ︙ | |||
231 232 233 234 235 236 237 | done = false; break; } if ([component isEqual: @"/"] && parent != nil && ![parent isEqual: @"/"]) { [array removeObjectsInRange: | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | done = false; break; } if ([component isEqual: @"/"] && parent != nil && ![parent isEqual: @"/"]) { [array removeObjectsInRange: OFRangeMake(i - 1, 2)]; done = false; break; } } } |
︙ | ︙ |
Modified src/platform/libfat/OFString+PathAdditions.m from [cf135b33f9] to [2f244634b3].
︙ | ︙ | |||
277 278 279 280 281 282 283 | done = false; break; } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | done = false; break; } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: OFRangeMake(i - 1, 2)]; done = false; break; } } } |
︙ | ︙ |
Modified src/platform/posix/OFString+PathAdditions.m from [721ad2b22b] to [27ce85898f].
︙ | ︙ | |||
273 274 275 276 277 278 279 | done = false; break; } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: | | | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | done = false; break; } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: OFRangeMake(i - 1, 2)]; done = false; break; } } } |
︙ | ︙ |
Modified src/platform/windows/OFString+PathAdditions.m from [257fbc0423] to [adef09bc0d].
︙ | ︙ | |||
199 200 201 202 203 204 205 | } objc_autoreleasePoolPop(pool); return @"."; } components = [components objectsInRange: | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | } objc_autoreleasePoolPop(pool); return @"."; } components = [components objectsInRange: OFRangeMake(0, components.count - 1)]; ret = [OFString pathWithComponents: components]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } |
︙ | ︙ | |||
284 285 286 287 288 289 290 | if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."] && ![parent hasSuffix: @":"] && ![parent hasSuffix: @":\\"] && ![parent hasSuffix: @"://"] && (![parent hasPrefix: @"\\"] || i != 1)) { [array removeObjectsInRange: | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."] && ![parent hasSuffix: @":"] && ![parent hasSuffix: @":\\"] && ![parent hasSuffix: @"://"] && (![parent hasPrefix: @"\\"] || i != 1)) { [array removeObjectsInRange: OFRangeMake(i - 1, 2)]; done = false; break; } } } |
︙ | ︙ | |||
335 336 337 338 339 340 341 | if (components.count < 2) @throw [OFInvalidFormatException exception]; *URLEncodedHost = [[components objectAtIndex: 1] stringByURLEncodingWithAllowedCharacters: [OFCharacterSet URLHostAllowedCharacterSet]]; path = [OFString pathWithComponents: [components | | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | if (components.count < 2) @throw [OFInvalidFormatException exception]; *URLEncodedHost = [[components objectAtIndex: 1] stringByURLEncodingWithAllowedCharacters: [OFCharacterSet URLHostAllowedCharacterSet]]; path = [OFString pathWithComponents: [components objectsInRange: OFRangeMake(2, components.count - 2)]]; } path = [path stringByReplacingOccurrencesOfString: @"\\" withString: @"/"]; path = [path stringByPrependingString: @"/"]; return path; |
︙ | ︙ |
Modified tests/OFArrayTests.m from [6905bf8867] to [f58673a4b1].
︙ | ︙ | |||
178 179 180 181 182 183 184 | TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1) TEST(@"-[indexOfObjectIdenticalTo:]", [a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1) TEST(@"-[objectsInRange:]", | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1) TEST(@"-[indexOfObjectIdenticalTo:]", [a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1) TEST(@"-[objectsInRange:]", [[a[0] objectsInRange: OFRangeMake(1, 2)] isEqual: [arrayClass arrayWithObjects: c_ary[1], c_ary[2], nil]]) TEST(@"-[replaceObject:withObject:]", R([m[0] replaceObject: c_ary[1] withObject: c_ary[0]]) && [[m[0] objectAtIndex: 0] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 1] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 2] isEqual: c_ary[2]]) |
︙ | ︙ | |||
211 212 213 214 215 216 217 | m[1] = [[a[0] mutableCopy] autorelease]; TEST(@"-[removeObjectAtIndex:]", R([m[1] removeObjectAtIndex: 1]) && m[1].count == 2 && [[m[1] objectAtIndex: 1] isEqual: c_ary[2]]) m[1] = [[a[0] mutableCopy] autorelease]; TEST(@"-[removeObjectsInRange:]", | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | m[1] = [[a[0] mutableCopy] autorelease]; TEST(@"-[removeObjectAtIndex:]", R([m[1] removeObjectAtIndex: 1]) && m[1].count == 2 && [[m[1] objectAtIndex: 1] isEqual: c_ary[2]]) m[1] = [[a[0] mutableCopy] autorelease]; TEST(@"-[removeObjectsInRange:]", R([m[1] removeObjectsInRange: OFRangeMake(0, 2)]) && m[1].count == 1 && [[m[1] objectAtIndex: 0] isEqual: c_ary[2]]) m[1] = [[a[0] mutableCopy] autorelease]; [m[1] addObject: @"qux"]; [m[1] addObject: @"last"]; TEST(@"-[reverse]", R([m[1] reverse]) && [m[1] isEqual: [arrayClass arrayWithObjects: |
︙ | ︙ | |||
244 245 246 247 248 249 250 | @"z", @"Foo", @"Baz", @"Bar", @"0", nil]]) EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: a[0].count]) EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]", OFOutOfRangeException, [m[0] removeObjectsInRange: | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | @"z", @"Foo", @"Baz", @"Bar", @"0", nil]]) EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: a[0].count]) EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]", OFOutOfRangeException, [m[0] removeObjectsInRange: OFRangeMake(0, m[0].count + 1)]) TEST(@"-[componentsJoinedByString:]", (a[1] = [arrayClass arrayWithObjects: @"", @"a", @"b", @"c", nil]) && [[a[1] componentsJoinedByString: @" "] isEqual: @" a b c"] && (a[1] = [arrayClass arrayWithObject: @"foo"]) && [[a[1] componentsJoinedByString: @" "] isEqual: @"foo"]) |
︙ | ︙ |
Modified tests/OFCharacterSetTests.m from [ee18bcb821] to [f4f81f5355].
︙ | ︙ | |||
71 72 73 74 75 76 77 | } TEST(@"-[characterIsMember:]", ok); module = @"OFRangeCharacterSet"; TEST(@"+[characterSetWithRange:]", (cs = [OFCharacterSet | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | } TEST(@"-[characterIsMember:]", ok); module = @"OFRangeCharacterSet"; TEST(@"+[characterSetWithRange:]", (cs = [OFCharacterSet characterSetWithRange: OFRangeMake('0', 10)]) && [cs isKindOfClass: [OFRangeCharacterSet class]]) ok = true; for (OFUnichar c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { if (![cs characterIsMember: c]) ok = false; |
︙ | ︙ |
Modified tests/OFDataTests.m from [c6fec11f60] to [b220c88d1e].
︙ | ︙ | |||
72 73 74 75 76 77 78 | mutable = [OFMutableData dataWithItems: "abcdef" count: 6]; TEST(@"-[removeLastItem]", R([mutable removeLastItem]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) TEST(@"-[removeItemsInRange:]", | | | | | | | | | | | | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 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 169 170 171 172 173 174 175 176 177 178 | mutable = [OFMutableData dataWithItems: "abcdef" count: 6]; TEST(@"-[removeLastItem]", R([mutable removeLastItem]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) TEST(@"-[removeItemsInRange:]", R([mutable removeItemsInRange: OFRangeMake(1, 2)]) && mutable.count == 3 && memcmp(mutable.items, "ade", 3) == 0) TEST(@"-[insertItems:atIndex:count:]", R([mutable insertItems: "bc" atIndex: 1 count: 2]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) immutable = [OFData dataWithItems: "aaabaccdacaabb" count: 7 itemSize: 2]; range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 range: OFRangeMake(0, 7)]; TEST(@"-[rangeOfData:options:range:] #1", range.location == 0 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OFDataSearchBackwards range: OFRangeMake(0, 7)]; TEST(@"-[rangeOfData:options:range:] #2", range.location == 5 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "ac" count: 1 itemSize: 2] options: 0 range: OFRangeMake(0, 7)]; TEST(@"-[rangeOfData:options:range:] #3", range.location == 2 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aabb" count: 2 itemSize: 2] options: 0 range: OFRangeMake(0, 7)]; TEST(@"-[rangeOfData:options:range:] #4", range.location == 5 && range.length == 2) TEST(@"-[rangeOfData:options:range:] #5", R(range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 range: OFRangeMake(1, 6)]) && range.location == 5 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OFDataSearchBackwards range: OFRangeMake(0, 5)]; TEST(@"-[rangeOfData:options:range:] #6", range.location == 0 && range.length == 1) EXPECT_EXCEPTION( @"-[rangeOfData:options:range:] failing on different itemSize", OFInvalidArgumentException, [immutable rangeOfData: [OFData dataWithItems: "aaa" count: 1 itemSize: 3] options: 0 range: OFRangeMake(0, 1)]) EXPECT_EXCEPTION( @"-[rangeOfData:options:range:] failing on out of range", OFOutOfRangeException, [immutable rangeOfData: [OFData dataWithItems: "" count: 0 itemSize: 2] options: 0 range: OFRangeMake(8, 1)]) TEST(@"-[subdataWithRange:]", [[immutable subdataWithRange: OFRangeMake(2, 4)] isEqual: [OFData dataWithItems: "accdacaa" count: 4 itemSize: 2]] && [[mutable subdataWithRange: OFRangeMake(2, 3)] isEqual: [OFData dataWithItems: "cde" count: 3]]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #1", OFOutOfRangeException, [immutable subdataWithRange: OFRangeMake(7, 1)]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #2", OFOutOfRangeException, [mutable subdataWithRange: OFRangeMake(6, 1)]) TEST(@"-[stringByMD5Hashing]", [mutable.stringByMD5Hashing isEqual: @"ab56b4d92b40713acc5af89985d4b786"]) TEST(@"-[stringByRIPEMD160Hashing]", [mutable.stringByRIPEMD160Hashing isEqual: @"973398b6e6c6cfa6b5e6a5173f195ce3274bf828"]) |
︙ | ︙ | |||
212 213 214 215 216 217 218 | OFOutOfRangeException, [mutable itemAtIndex: mutable.count]) EXPECT_EXCEPTION(@"Detect out of range in -[addItems:count:]", OFOutOfRangeException, [mutable addItems: raw[0] count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | OFOutOfRangeException, [mutable itemAtIndex: mutable.count]) EXPECT_EXCEPTION(@"Detect out of range in -[addItems:count:]", OFOutOfRangeException, [mutable addItems: raw[0] count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, [mutable removeItemsInRange: OFRangeMake(mutable.count, 1)]) free(raw[0]); free(raw[1]); objc_autoreleasePoolPop(pool); } @end |
Modified tests/OFStringTests.m from [4dd338b89d] to [5086f0db86].
︙ | ︙ | |||
496 497 498 499 500 501 502 | options: OFStringSearchBackwards].location == 0 && [C(@"𝄞öö") rangeOfString: @"x" options: OFStringSearchBackwards].location == OFNotFound) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, | | | | | | | | | | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | options: OFStringSearchBackwards].location == 0 && [C(@"𝄞öö") rangeOfString: @"x" options: OFStringSearchBackwards].location == OFNotFound) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: OFRangeMake(3, 1)]) cs = [OFCharacterSet characterSetWithCharactersInString: @"cđ"]; TEST(@"-[indexOfCharacterFromSet:]", [C(@"abcđabcđe") indexOfCharacterFromSet: cs] == 2 && [C(@"abcđabcđë") indexOfCharacterFromSet: cs options: OFStringSearchBackwards] == 7 && [C(@"abcđabcđë") indexOfCharacterFromSet: cs options: 0 range: OFRangeMake(4, 4)] == 6 && [C(@"abcđabcđëf") indexOfCharacterFromSet: cs options: 0 range: OFRangeMake(8, 2)] == OFNotFound) EXPECT_EXCEPTION( @"Detect out of range in -[indexOfCharacterFromSet:options:range:]", OFOutOfRangeException, [C(@"𝄞öö") indexOfCharacterFromSet: cs options: 0 range: OFRangeMake(3, 1)]) TEST(@"-[substringWithRange:]", [[C(@"𝄞öö") substringWithRange: OFRangeMake(1, 1)] isEqual: @"ö"] && [[C(@"𝄞öö") substringWithRange: OFRangeMake(3, 0)] isEqual: @""]) EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #1", OFOutOfRangeException, [C(@"𝄞öö") substringWithRange: OFRangeMake(2, 2)]) EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2", OFOutOfRangeException, [C(@"𝄞öö") substringWithRange: OFRangeMake(4, 0)]) TEST(@"-[stringByAppendingString:]", [[C(@"foo") stringByAppendingString: @"bar"] isEqual: @"foobar"]) TEST(@"-[stringByPrependingString:]", [[C(@"foo") stringByPrependingString: @"bar"] isEqual: @"barfoo"]) |
︙ | ︙ | |||
1264 1265 1266 1267 1268 1269 1270 | [s[0] isEqual: @"abcde"] && R([s[0] setCharacter: 0x20AC atIndex: 3]) && [s[0] isEqual: @"abc€e"] && R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && | | | | | | | | | | | | 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | [s[0] isEqual: @"abcde"] && R([s[0] setCharacter: 0x20AC atIndex: 3]) && [s[0] isEqual: @"abc€e"] && R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && R([s[0] deleteCharactersInRange: OFRangeMake(1, 3)]) && [s[0] isEqual: @"𝄞bä€"] && R([s[0] deleteCharactersInRange: OFRangeMake(0, 4)]) && [s[0] isEqual: @""]) TEST(@"-[replaceCharactersInRange:withString:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && R([s[0] replaceCharactersInRange: OFRangeMake(1, 3) withString: @"äöüß"]) && [s[0] isEqual: @"𝄞äöüßbä€"] && R([s[0] replaceCharactersInRange: OFRangeMake(4, 2) withString: @"b"]) && [s[0] isEqual: @"𝄞äöübä€"] && R([s[0] replaceCharactersInRange: OFRangeMake(0, 7) withString: @""]) && [s[0] isEqual: @""]) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1", OFOutOfRangeException, { s[0] = [mutableStringClass stringWithString: @"𝄞öö"]; [s[0] deleteCharactersInRange: OFRangeMake(2, 2)]; }) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #2", OFOutOfRangeException, [s[0] deleteCharactersInRange: OFRangeMake(4, 0)]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #1", OFOutOfRangeException, [s[0] replaceCharactersInRange: OFRangeMake(2, 2) withString: @""]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #2", OFOutOfRangeException, [s[0] replaceCharactersInRange: OFRangeMake(4, 0) withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (s[0] = [mutableStringClass stringWithString: @"asd fo asd fofo asd"]) && R([s[0] replaceOccurrencesOfString: @"fo" withString: @"foo"]) && [s[0] isEqual: @"asd foo asd foofoo asd"] && (s[0] = [mutableStringClass stringWithString: @"XX"]) && R([s[0] replaceOccurrencesOfString: @"X" withString: @"XX"]) && [s[0] isEqual: @"XXXX"]) TEST(@"-[replaceOccurrencesOfString:withString:options:range:]", (s[0] = [mutableStringClass stringWithString: @"foofoobarfoobarfoo"]) && R([s[0] replaceOccurrencesOfString: @"oo" withString: @"óò" options: 0 range: OFRangeMake(2, 15)]) && [s[0] isEqual: @"foofóòbarfóòbarfoo"]) TEST(@"-[deleteLeadingWhitespaces]", (s[0] = [mutableStringClass stringWithString: whitespace[0]]) && R([s[0] deleteLeadingWhitespaces]) && [s[0] isEqual: @"asd \t \t\t\r\n"] && (s[0] = [mutableStringClass stringWithString: whitespace[1]]) && |
︙ | ︙ |
Modified tests/OFValueTests.m from [8235c5a687] to [f7da5ac296].
︙ | ︙ | |||
21 22 23 24 25 26 27 | static OFString *module = @"OFValue"; @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); | | | | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | static OFString *module = @"OFValue"; @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); OFRange range = OFRangeMake(1, 64), range2; OFPoint point = OFPointMake(1.5f, 3.0f), point2; OFSize size = OFSizeMake(4.5f, 5.0f), size2; OFRect rect = OFRectMake(1.5f, 3.0f, 4.5f, 6.0f), rect2; OFValue *value; void *pointer = &value; TEST(@"+[valueWithBytes:objCType:]", (value = [OFValue valueWithBytes: &range objCType: @encode(OFRange)])) TEST(@"-[objCType]", strcmp(value.objCType, @encode(OFRange)) == 0) TEST(@"-[getValue:size:]", R([value getValue: &range2 size: sizeof(OFRange)]) && OFRangeEqual(range2, range)) EXPECT_EXCEPTION(@"-[getValue:size:] with wrong size throws", OFOutOfRangeException, [value getValue: &range size: sizeof(OFRange) - 1]) TEST(@"+[valueWithPointer:]", (value = [OFValue valueWithPointer: pointer])) |
︙ | ︙ | |||
72 73 74 75 76 77 78 | [[OFValue valueWithBytes: "a" objCType: @encode(char)] nonretainedObjectValue]) TEST(@"+[valueWithRange:]", (value = [OFValue valueWithRange: range])) TEST(@"-[rangeValue]", | | | | | | | | | | | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 139 140 141 142 143 144 145 146 147 148 149 150 151 | [[OFValue valueWithBytes: "a" objCType: @encode(char)] nonretainedObjectValue]) TEST(@"+[valueWithRange:]", (value = [OFValue valueWithRange: range])) TEST(@"-[rangeValue]", OFRangeEqual(value.rangeValue, range) && (value = [OFValue valueWithBytes: &range objCType: @encode(OFRange)]) && OFRangeEqual(value.rangeValue, range)) TEST(@"-[getValue:size:] for OFRangeValue", (value = [OFValue valueWithRange: range]) && R([value getValue: &range2 size: sizeof(range2)]) && OFRangeEqual(range2, range)) EXPECT_EXCEPTION(@"-[rangeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] rangeValue]) TEST(@"+[valueWithPoint:]", (value = [OFValue valueWithPoint: point])) TEST(@"-[pointValue]", OFPointEqual(value.pointValue, point) && (value = [OFValue valueWithBytes: &point objCType: @encode(OFPoint)]) && OFPointEqual(value.pointValue, point)) TEST(@"-[getValue:size:] for OFPointValue", (value = [OFValue valueWithPoint: point]) && R([value getValue: &point2 size: sizeof(point2)]) && OFPointEqual(point2, point)) EXPECT_EXCEPTION(@"-[pointValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] pointValue]) TEST(@"+[valueWithSize:]", (value = [OFValue valueWithSize: size])) TEST(@"-[sizeValue]", OFSizeEqual(value.sizeValue, size) && (value = [OFValue valueWithBytes: &size objCType: @encode(OFSize)]) && OFSizeEqual(value.sizeValue, size)) TEST(@"-[getValue:size:] for OFSizeValue", (value = [OFValue valueWithSize: size]) && R([value getValue: &size2 size: sizeof(size2)]) && OFSizeEqual(size2, size)) EXPECT_EXCEPTION(@"-[sizeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] sizeValue]) TEST(@"+[valueWithRect:]", (value = [OFValue valueWithRect: rect])) TEST(@"-[rectValue]", OFRectEqual(value.rectValue, rect) && (value = [OFValue valueWithBytes: &rect objCType: @encode(OFRect)]) && OFRectEqual(value.rectValue, rect)) TEST(@"-[getValue:size:] for OFRectValue", (value = [OFValue valueWithRect: rect]) && R([value getValue: &rect2 size: sizeof(rect2)]) && OFRectEqual(rect2, rect)) EXPECT_EXCEPTION(@"-[rectValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] rectValue]) TEST(@"-[isEqual:]", [[OFValue valueWithRect: rect] |
︙ | ︙ |
Modified tests/terminal/TerminalTests.m from [75c2b20fdf] to [8181966586].
︙ | ︙ | |||
88 89 90 91 92 93 94 | [of_stdout eraseLine]; [of_stdout writeString: @"World!"]; [OFThread sleepForTimeInterval: 2]; [of_stdout clear]; [OFThread sleepForTimeInterval: 2]; | | | | | | | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | [of_stdout eraseLine]; [of_stdout writeString: @"World!"]; [OFThread sleepForTimeInterval: 2]; [of_stdout clear]; [OFThread sleepForTimeInterval: 2]; [of_stdout setCursorPosition: OFPointMake(5, 3)]; [of_stdout writeString: @"Text at (5, 3)"]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(-2, 0)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(2, 0)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(0, -2)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(0, 2)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(1, 1)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setRelativeCursorPosition: OFPointMake(-1, -1)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setCursorColumn: 2]; [OFThread sleepForTimeInterval: 2]; [of_stdout reset]; [OFApplication terminate]; } @end |
Modified utils/ofarc/OFArc.m from [f6c3dc0d49] to [cd177e69a6].
︙ | ︙ | |||
292 293 294 295 296 297 298 | [OFApplication terminateWithStatus: 1]; break; } } @try { if (encodingString != nil) | | | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | [OFApplication terminateWithStatus: 1]; break; } } @try { if (encodingString != nil) encoding = OFStringEncodingParseName(encodingString); } @catch (OFInvalidArgumentException *e) { [of_stderr writeLine: OF_LOCALIZED( @"invalid_encoding", @"%[prog]: Invalid encoding: %[encoding]", @"prog", [OFApplication programName], @"encoding", encodingString)]; [OFApplication terminateWithStatus: 1]; } remainingArguments = optionsParser.remainingArguments; switch (mode) { case 'a': case 'c': if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: OFRangeMake(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: (mode == 'a' ? @"rwc" : @"wc")]; for (OFString *path in files) |
︙ | ︙ | |||
369 370 371 372 373 374 375 | permissions: @"r"]; sandbox.allowsUnveil = false; [OFApplication of_activateSandbox: sandbox]; #endif files = [remainingArguments objectsInRange: | | | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | permissions: @"r"]; sandbox.allowsUnveil = false; [OFApplication of_activateSandbox: sandbox]; #endif files = [remainingArguments objectsInRange: OFRangeMake(1, remainingArguments.count - 1)]; archive = [self openArchiveWithPath: remainingArguments.firstObject type: type mode: mode encoding: encoding]; [archive printFiles: files]; break; case 'x': if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: OFRangeMake(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"]; if (files.count > 0) |
︙ | ︙ |