ObjFW  Diff

Differences From Artifact [c654a7d368]:

To Artifact [3c2f48d580]:


161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
176
161
162
163
164
165
166
167

168

169
170
171
172
173
174
175







-
+
-







	pos = [fileName rangeOfString: @"."
			      options: OF_STRING_SEARCH_BACKWARDS].location;
	if (pos == OF_NOT_FOUND || pos == 0) {
		objc_autoreleasePoolPop(pool);
		return @"";
	}

	ret = [fileName substringWithRange:
	ret = [fileName substringFromIndex: pos + 1];
	    of_range(pos + 1, fileName.length - pos - 1)];

	[ret retain];
	objc_autoreleasePoolPop(pool);
	return [ret autorelease];
}

- (OFString *)stringByDeletingLastPathComponent
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
230
231
232
233
234
235
236

237
238
239
240
241
242
243
244







-
+







	pos = [fileName rangeOfString: @"."
			      options: OF_STRING_SEARCH_BACKWARDS].location;
	if (pos == OF_NOT_FOUND || pos == 0) {
		objc_autoreleasePoolPop(pool);
		return [[self copy] autorelease];
	}

	fileName = [fileName substringWithRange: of_range(0, pos)];
	fileName = [fileName substringToIndex: pos];
	[components replaceObjectAtIndex: components.count - 1
			      withObject: fileName];

	ret = [OFString pathWithComponents: components];

	[ret retain];
	objc_autoreleasePoolPop(pool);
354
355
356
357
358
359
360
361

362
363

364
365
366
367
368
369
370
353
354
355
356
357
358
359

360
361

362
363
364
365
366
367
368
369







-
+

-
+








- (OFString *)of_URLPathToPathWithURLEncodedHost: (OFString *)URLEncodedHost
{
	OFString *path = self;

	if (path.length > 1 && [path hasSuffix: @"/"] &&
	    ![path hasSuffix: @":/"])
		path = [path substringWithRange: of_range(0, path.length - 1)];
		path = [path substringToIndex: path.length - 1];

	path = [path substringWithRange: of_range(1, path.length - 1)];
	path = [path substringFromIndex: 1];
	path = [path stringByReplacingOccurrencesOfString: @"/"
					       withString: @"\\"];

	if (URLEncodedHost != nil) {
		OFString *host = [URLEncodedHost stringByURLDecoding];

		if (path.length == 0)