ObjFW  Diff

Differences From Artifact [bf7091f2d8]:

To Artifact [e268178a8e]:


244
245
246
247
248
249
250
251

252

253
254
255




256
257
258



259
260
261
262
263







264
265
266
267
268
269
270
244
245
246
247
248
249
250

251
252
253



254
255
256
257
258


259
260
261
262




263
264
265
266
267
268
269
270
271
272
273
274
275
276







-
+

+
-
-
-
+
+
+
+

-
-
+
+
+

-
-
-
-
+
+
+
+
+
+
+







		stream = [URLHandler openItemAtURL: URL
					      mode: @"r"];

		_itemSize = 1;
		_count = 0;

		pageSize = [OFSystemInfo pageSize];
		buffer = [self allocMemoryWithSize: pageSize];
		buffer = of_malloc(1, pageSize);

		@try {
		while (!stream.atEndOfStream) {
			size_t length = [stream readIntoBuffer: buffer
							length: pageSize];
			while (!stream.atEndOfStream) {
				size_t length = [stream
				    readIntoBuffer: buffer
					    length: pageSize];

			if (SIZE_MAX - _count < length)
				@throw [OFOutOfRangeException exception];
				if (SIZE_MAX - _count < length)
					@throw [OFOutOfRangeException
					    exception];

			_items = [self resizeMemory: _items
					       size: _count + length];
			memcpy(_items + _count, buffer, length);
			_count += length;
				_items = [self resizeMemory: _items
						       size: _count + length];
				memcpy(_items + _count, buffer, length);
				_count += length;
			}
		} @finally {
			of_free(buffer);
		}

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}