Differences From Artifact [269af2cde7]:
- File
src/OFURL.m
— part of check-in
[c5ef582958]
at
2013-03-04 17:20:15
on branch trunk
— Replace BOOL with bool.
The only places where BOOL is left are those where they are required by
the ABI. (user: js, size: 10761) [annotate] [blame] [check-ins using]
To Artifact [a580a39551]:
- File
src/OFURL.m
— part of check-in
[3d16a30f41]
at
2013-06-22 12:12:36
on branch trunk
— Rework exceptions.
This mostly removes the argument for the class in which the exception
occurred. As backtraces were recently added for all platforms, the
passed class does not give any extra information on where the exception
occurred anymore.This also removes a few other arguments which were not too helpful. In
the past, the idea was to pass as many arguments as possible so that it
is easier to find the origin of the exception. However, as backtraces
are a much better way to find the origin, those are not useful anymore
and just make the exception more cumbersome to use. The rule is now to
only pass arguments that might help in recovering from the exception or
provide information that is otherwise not easily accessible. (user: js, size: 10507) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
57 58 59 60 61 62 63 | self = [super init]; @try { char *tmp, *tmp2; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException | | | | < | 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 85 86 87 88 | self = [super init]; @try { char *tmp, *tmp2; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; if (!strncmp(UTF8String, "file://", 7)) { _scheme = @"file"; _path = [[OFString alloc] initWithUTF8String: UTF8String + 7]; return self; } else if (!strncmp(UTF8String, "http://", 7)) { _scheme = @"http"; UTF8String += 7; } else if (!strncmp(UTF8String, "https://", 8)) { _scheme = @"https"; UTF8String += 8; } else @throw [OFInvalidFormatException exception]; if ((tmp = strchr(UTF8String, '/')) != NULL) { *tmp = '\0'; tmp++; } if ((tmp2 = strchr(UTF8String, '@')) != NULL) { |
︙ | ︙ | |||
117 118 119 120 121 122 123 | _host = [[OFString alloc] initWithUTF8String: UTF8String]; pool = objc_autoreleasePoolPush(); portString = [OFString stringWithUTF8String: tmp2]; if ([portString decimalValue] > 65535) | | < | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | _host = [[OFString alloc] initWithUTF8String: UTF8String]; pool = objc_autoreleasePoolPush(); portString = [OFString stringWithUTF8String: tmp2]; if ([portString decimalValue] > 65535) @throw [OFInvalidFormatException exception]; _port = [portString decimalValue]; if (_port == 0) _port = 80; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
195 196 197 198 199 200 201 | _host = [URL->_host copy]; _port = URL->_port; _user = [URL->_user copy]; _password = [URL->_password copy]; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException | | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | _host = [URL->_host copy]; _port = URL->_port; _user = [URL->_user copy]; _password = [URL->_password copy]; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; if ((tmp = strchr(UTF8String, '#')) != NULL) { *tmp = '\0'; _fragment = [[OFString alloc] initWithUTF8String: tmp + 1]; |
︙ | ︙ | |||
256 257 258 259 260 261 262 | - initWithSerialization: (OFXMLElement*)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) | | < < | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - initWithSerialization: (OFXMLElement*)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exception]; self = [self initWithString: [element stringValue]]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; |
︙ | ︙ | |||
372 373 374 375 376 377 378 | { OF_GETTER(_scheme, true) } - (void)setScheme: (OFString*)scheme { if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) | | < < | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | { OF_GETTER(_scheme, true) } - (void)setScheme: (OFString*)scheme { if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) @throw [OFInvalidArgumentException exception]; OF_SETTER(_scheme, scheme, true, 1) } - (OFString*)host { OF_GETTER(_host, true) |
︙ | ︙ | |||
428 429 430 431 432 433 434 | OF_GETTER(_path, true) } - (void)setPath: (OFString*)path { if (([_scheme isEqual: @"http"] || [_scheme isEqual: @"https"]) && ![path hasPrefix: @"/"]) | | < < | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | OF_GETTER(_path, true) } - (void)setPath: (OFString*)path { if (([_scheme isEqual: @"http"] || [_scheme isEqual: @"https"]) && ![path hasPrefix: @"/"]) @throw [OFInvalidArgumentException exception]; OF_SETTER(_path, path, true, 1) } - (OFString*)parameters { OF_GETTER(_parameters, true) |
︙ | ︙ |