ObjFW  Diff

Differences From Artifact [c898202288]:

To Artifact [a9ea632fbf]:


233
234
235
236
237
238
239
240
241


242
243
244
245
246
247
248
249
250

251
252
253
254
255

256
257
258
259
260
261
262
263
264
233
234
235
236
237
238
239


240
241
242
243
244
245
246
247
248
249

250
251
252
253


254


255
256
257
258
259
260
261







-
-
+
+








-
+



-
-
+
-
-







}

- (OFString *)stringByStandardizingPath
{
	void *pool = objc_autoreleasePoolPush();
	OFArray OF_GENERIC(OFString *) *components;
	OFMutableArray OF_GENERIC(OFString *) *array;
	OFString *firstComponent, *ret;
	bool done = false, startsWithSlash, endsWithEmpty;
	OFString *ret;
	bool done = false, startsWithSlash;

	if ([self length] == 0)
		return @"";

	components = [self pathComponents];

	if ([components count] == 1) {
		objc_autoreleasePoolPop(pool);
		return self;
		return [[self copy] autorelease];
	}

	array = [[components mutableCopy] autorelease];
	firstComponent = [array firstObject];
	startsWithSlash =
	startsWithSlash = [self hasPrefix: @"/"];
	    ([firstComponent isEqual: @"/"] || [firstComponent length] == 0);
	endsWithEmpty = ([[array lastObject] length] == 0);

	if (startsWithSlash)
		[array removeObjectAtIndex: 0];

	while (!done) {
		size_t length = [array count];

288
289
290
291
292
293
294
295

296
297
298
299
300
301
302
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299







-
+







		}
	}

	if (startsWithSlash)
		[array insertObject: @""
			    atIndex: 0];

	if (endsWithEmpty)
	if ([self hasSuffix: @"/"])
		[array addObject: @""];

	ret = [[array componentsJoinedByString: @"/"] retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];