ObjFW  Check-in [aaa6195c13]

Overview
Comment:OFURL: Fix compilation with --disable-files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aaa6195c139d9521b23db3dbf3f3ddcc42afb166609d5272e371cc2f534b48ab
User & Date: js on 2020-03-01 08:17:38
Other Links: manifest | tags
Context
2020-03-01
23:07
OFURL: Add support for IPv6 / square bracket hosts check-in: a99f466e3c user: js tags: trunk
08:17
OFURL: Fix compilation with --disable-files check-in: aaa6195c13 user: js tags: trunk
2020-02-29
19:44
OFURL: Move out platform-dependent parts check-in: 09fb660d54 user: js tags: trunk
Changes

Modified src/OFURL.m from [b4c5dcf040] to [b53f774a87].

825
826
827
828
829
830
831

832

833
834
835

836
837
838
839
840
841
842
843
844

845
846
847
848
849
850
851
852
853
854
855
856

857
858
859

860
861
862
863
864
865
866
{
	return _URLEncodedPath;
}

- (OFArray *)pathComponents
{
	void *pool = objc_autoreleasePoolPush();

	bool isFile = [_URLEncodedScheme isEqual: @"file"];

	OFMutableArray *ret;
	size_t count;


	if (isFile) {
		OFString *path = [_URLEncodedPath
		    of_URLPathToPathWithURLEncodedHost: nil];
		ret = [[path.pathComponents mutableCopy] autorelease];

		if (![ret.firstObject isEqual: @"/"])
			    [ret insertObject: @"/"
				      atIndex: 0];
	} else

		ret = [[[_URLEncodedPath componentsSeparatedByString: @"/"]
		    mutableCopy] autorelease];

	count = ret.count;

	if (count > 0 && [ret.firstObject length] == 0)
		[ret replaceObjectAtIndex: 0
			       withObject: @"/"];

	for (size_t i = 0; i < count; i++) {
		OFString *component = [ret objectAtIndex: i];


		if (isFile)
			component =
			    [component of_pathComponentToURLPathComponent];


		[ret replaceObjectAtIndex: i
			       withObject: component.stringByURLDecoding];
	}

	[ret makeImmutable];
	[ret retain];







>

>



>









>












>



>







825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
{
	return _URLEncodedPath;
}

- (OFArray *)pathComponents
{
	void *pool = objc_autoreleasePoolPush();
#ifdef OF_HAVE_FILES
	bool isFile = [_URLEncodedScheme isEqual: @"file"];
#endif
	OFMutableArray *ret;
	size_t count;

#ifdef OF_HAVE_FILES
	if (isFile) {
		OFString *path = [_URLEncodedPath
		    of_URLPathToPathWithURLEncodedHost: nil];
		ret = [[path.pathComponents mutableCopy] autorelease];

		if (![ret.firstObject isEqual: @"/"])
			    [ret insertObject: @"/"
				      atIndex: 0];
	} else
#endif
		ret = [[[_URLEncodedPath componentsSeparatedByString: @"/"]
		    mutableCopy] autorelease];

	count = ret.count;

	if (count > 0 && [ret.firstObject length] == 0)
		[ret replaceObjectAtIndex: 0
			       withObject: @"/"];

	for (size_t i = 0; i < count; i++) {
		OFString *component = [ret objectAtIndex: i];

#ifdef OF_HAVE_FILES
		if (isFile)
			component =
			    [component of_pathComponentToURLPathComponent];
#endif

		[ret replaceObjectAtIndex: i
			       withObject: component.stringByURLDecoding];
	}

	[ret makeImmutable];
	[ret retain];