ObjFW  Diff

Differences From Artifact [6492351f08]:

To Artifact [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