ObjFW  Check-in [12a7357722]

Overview
Comment:OFEmbeddedFileURLHandler: Add scheme check
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 12a73577220331bf3c9d9721698aa7aaf532c75c865c43be5808b7309125cde9
User & Date: js on 2022-08-07 18:23:02
Other Links: manifest | tags
Context
2022-08-07
19:56
configure: Enable threads for Nintendo Switch check-in: bef92f92b6 user: js tags: trunk
18:23
OFEmbeddedFileURLHandler: Add scheme check check-in: 12a7357722 user: js tags: trunk
16:51
Fix compiling with --disable-files check-in: fa9d22b297 user: js tags: trunk
Changes

Modified src/OFEmbeddedFileURLHandler.m from [e3697eafac] to [10ad5c2607].

72
73
74
75
76
77
78





79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
}

@implementation OFEmbeddedFileURLHandler
- (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode
{
	const char *path;






	if (![mode isEqual: @"r"])
		@throw [OFOpenItemFailedException exceptionWithURL: URL
							      mode: mode
							     errNo: EROFS];

	if (URL.host != nil || URL.port != nil || URL.user != nil ||
	    URL.password != nil || URL.query != nil || URL.fragment != nil)
		@throw [OFInvalidArgumentException exception];

	if ((path = URL.path.UTF8String) == NULL) {
		@throw [OFInvalidArgumentException exception];
	}

#ifdef OF_HAVE_THREADS
	OFEnsure(OFPlainMutexLock(&mutex) == 0);
	@try {







>
>
>
>
>





<
<
<
<







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88




89
90
91
92
93
94
95
}

@implementation OFEmbeddedFileURLHandler
- (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode
{
	const char *path;

	if (![URL.scheme isEqual: @"objfw-embedded"] || URL.host != nil ||
	    URL.port != nil || URL.user != nil || URL.password != nil ||
	    URL.query != nil || URL.fragment != nil)
		@throw [OFInvalidArgumentException exception];

	if (![mode isEqual: @"r"])
		@throw [OFOpenItemFailedException exceptionWithURL: URL
							      mode: mode
							     errNo: EROFS];





	if ((path = URL.path.UTF8String) == NULL) {
		@throw [OFInvalidArgumentException exception];
	}

#ifdef OF_HAVE_THREADS
	OFEnsure(OFPlainMutexLock(&mutex) == 0);
	@try {