ObjFW  Diff

Differences From Artifact [f234733150]:

To Artifact [8d104459de]:


80
81
82
83
84
85
86

87
88
89
90

91
92
93
94
95
96
97
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99







+




+







#ifdef OF_HAVE_FILES
+ (instancetype)dataArrayWithContentsOfFile: (OFString*)path
{
	return [[[self alloc] initWithContentsOfFile: path] autorelease];
}
#endif

#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS)
+ (instancetype)dataArrayWithContentsOfURL: (OFURL*)URL
{
	return [[[self alloc] initWithContentsOfURL: URL] autorelease];
}
#endif

+ (instancetype)dataArrayWithStringRepresentation: (OFString*)string
{
	return [[[self alloc]
	    initWithStringRepresentation: string] autorelease];
}

182
183
184
185
186
187
188

189
190
191
192
193
194
195
196
197
198

199
200
201
202
203


204
205
206
207
208
209
210
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200

201
202
203
204


205
206
207
208
209
210
211
212
213







+









-
+



-
-
+
+







		@throw e;
	}

	return self;
}
#endif

#if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS)
- initWithContentsOfURL: (OFURL*)URL
{
	void *pool;
	OFString *scheme;

	pool = objc_autoreleasePoolPush();

	scheme = [URL scheme];

#ifdef OF_HAVE_FILES
# ifdef OF_HAVE_FILES
	if ([scheme isEqual: @"file"])
		self = [self initWithContentsOfFile: [URL path]];
	else
#endif
#ifdef OF_HAVE_SOCKETS
# endif
# ifdef OF_HAVE_SOCKETS
	if ([scheme isEqual: @"http"] || [scheme isEqual: @"https"]) {
		self = [self init];

		@try {
			OFHTTPClient *client = [OFHTTPClient client];
			OFHTTPRequest *request = [OFHTTPRequest
			    requestWithURL: URL];
245
246
247
248
249
250
251
252

253
254
255
256
257
258

259
260
261
262
263
264
265
248
249
250
251
252
253
254

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269







-
+






+







					@throw [OFTruncatedDataException
					    exception];
		} @catch (id e) {
			[self release];
			@throw e;
		}
	} else
#endif
# endif
		@throw [OFUnsupportedProtocolException exceptionWithURL: URL];

	objc_autoreleasePoolPop(pool);

	return self;
}
#endif

- initWithStringRepresentation: (OFString*)string
{
	@try {
		const char *cString;
		size_t i, count;