@@ -177,21 +177,21 @@ - (void)setPathComponents: (OFArray *)components { void *pool = objc_autoreleasePoolPush(); if (components == nil) { - [self setPath: nil]; + self.path = nil; return; } - if ([components count] == 0) + if (components.count == 0) @throw [OFInvalidFormatException exception]; - if ([[components firstObject] length] != 0) + if ([components.firstObject length] != 0) @throw [OFInvalidFormatException exception]; - [self setPath: [components componentsJoinedByString: @"/"]]; + self.path = [components componentsJoinedByString: @"/"]; objc_autoreleasePoolPop(pool); } - (void)setQuery: (OFString *)query @@ -269,33 +269,33 @@ pool = objc_autoreleasePoolPush(); array = [[[_URLEncodedPath componentsSeparatedByString: @"/"] mutableCopy] autorelease]; - if ([[array firstObject] length] != 0) + if ([array.firstObject length] != 0) @throw [OFInvalidFormatException exception]; - endsWithEmpty = ([[array lastObject] length] == 0); + endsWithEmpty = ([array.lastObject length] == 0); while (!done) { - size_t length = [array count]; + size_t length = array.count; done = true; for (size_t i = 0; i < length; i++) { - id object = [array objectAtIndex: i]; - id parent = + OFString *current = [array objectAtIndex: i]; + OFString *parent = (i > 0 ? [array objectAtIndex: i - 1] : nil); - if ([object isEqual: @"."] || [object length] == 0) { + if ([current isEqual: @"."] || current.length == 0) { [array removeObjectAtIndex: i]; done = false; break; } - if ([object isEqual: @".."] && parent != nil && + if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: of_range(i - 1, 2)]; done = false; @@ -308,11 +308,11 @@ atIndex: 0]; if (endsWithEmpty) [array addObject: @""]; path = [array componentsJoinedByString: @"/"]; - if ([path length] == 0) + if (path.length == 0) path = @"/"; [self setURLEncodedPath: path]; objc_autoreleasePoolPop(pool);