ObjFW  Check-in [d05c370a94]

Overview
Comment:OFEmbeddedFileURLHandler: Fix wrong #endif
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d05c370a94f7f46ccba7a7c84ff799c947a3e1ca2faf178590b2f41d11c2f639
User & Date: js on 2022-08-02 00:39:59
Other Links: manifest | tags
Context
2022-08-02
20:34
Add initial Wii U support check-in: 545c9c48bb user: js tags: trunk
00:39
OFEmbeddedFileURLHandler: Fix wrong #endif check-in: d05c370a94 user: js tags: trunk
00:09
objfw-embed: Make it work without GNU coreutils check-in: 2d2b1616f2 user: js tags: trunk
Changes

Modified src/OFEmbeddedFileURLHandler.m from [6492351f08] to [e3697eafac].

81
82
83
84
85
86
87
88
89

90
91
92
93

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
							      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 {

		for (size_t i = 0; i < numEmbeddedFiles; i++) {
			if (strcmp(embeddedFiles[i].name, path) != 0)
				continue;

			return [OFMemoryStream
			    streamWithMemoryAddress: (void *)
							 embeddedFiles[i].bytes
					       size: embeddedFiles[i].size
					   writable: false];
		}
#endif
#ifdef OF_HAVE_THREADS
	} @finally {
		OFEnsure(OFPlainMutexUnlock(&mutex) == 0);
	}
#endif

	@throw [OFOpenItemFailedException exceptionWithURL: URL
						      mode: mode
						     errNo: ENOENT];
}
@end







|

>




>










<











81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
115
116
							      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 {
#endif
		for (size_t i = 0; i < numEmbeddedFiles; i++) {
			if (strcmp(embeddedFiles[i].name, path) != 0)
				continue;

			return [OFMemoryStream
			    streamWithMemoryAddress: (void *)
							 embeddedFiles[i].bytes
					       size: embeddedFiles[i].size
					   writable: false];
		}

#ifdef OF_HAVE_THREADS
	} @finally {
		OFEnsure(OFPlainMutexUnlock(&mutex) == 0);
	}
#endif

	@throw [OFOpenItemFailedException exceptionWithURL: URL
						      mode: mode
						     errNo: ENOENT];
}
@end