Differences From Artifact [9669ae9920]:
- File src/OFURL.m — part of check-in [cca678886f] at 2017-05-06 19:43:55 on branch trunk — Clean up a few includes (user: js, size: 9955) [annotate] [blame] [check-ins using]
To Artifact [b76d8bb1be]:
- File
src/OFURL.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 9966) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
34 35 36 37 38 39 40 | @synthesize query = _query, fragment = _fragment; + (instancetype)URL { return [[[self alloc] init] autorelease]; } | | | | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | @synthesize query = _query, fragment = _fragment; + (instancetype)URL { return [[[self alloc] init] autorelease]; } + (instancetype)URLWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } + (instancetype)URLWithString: (OFString *)string relativeToURL: (OFURL *)URL { return [[[self alloc] initWithString: string relativeToURL: URL] autorelease]; } + (instancetype)fileURLWithPath: (OFString *)path { OFURL *URL = [OFURL URL]; void *pool = objc_autoreleasePoolPush(); [URL setScheme: @"file"]; [URL setPath: [[path pathComponents] componentsJoinedByString: @"/"]]; objc_autoreleasePoolPop(pool); return URL; } - initWithString: (OFString *)string { char *UTF8String, *UTF8String2 = NULL; self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ | |||
193 194 195 196 197 198 199 | } @finally { free(UTF8String2); } return self; } | | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | } @finally { free(UTF8String2); } return self; } - initWithString: (OFString *)string relativeToURL: (OFURL *)URL { char *UTF8String, *UTF8String2 = NULL; if ([string containsString: @"://"]) return [self initWithString: string]; self = [super init]; |
︙ | ︙ | |||
267 268 269 270 271 272 273 | } @finally { free(UTF8String2); } return self; } | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | } @finally { free(UTF8String2); } return self; } - initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ | |||
380 381 382 383 384 385 386 | [copy release]; @throw e; } return copy; } | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | [copy release]; @throw e; } return copy; } - (OFString *)string { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); [ret appendFormat: @"%@://", _scheme]; if ([_scheme isEqual: @"file"]) { |
︙ | ︙ | |||
431 432 433 434 435 436 437 | objc_autoreleasePoolPop(pool); [ret makeImmutable]; return ret; } | | | | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | objc_autoreleasePoolPop(pool); [ret makeImmutable]; return ret; } - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", [self class], [self string]]; } - (OFXMLElement *)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS stringValue: [self string]]; |
︙ | ︙ |