ObjFW  Check-in [b5e3f01a59]

Overview
Comment:Fix compilation with Apple GCC 4.0.1 & 4.2.1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b5e3f01a59a4cbe197531e6cfde035c0eb50168b8695e2daa87d3e056da3c4ce
User & Date: js on 2023-08-29 12:16:10
Other Links: manifest | tags
Context
2023-08-29
12:55
ChangeLog: Fix brainfart check-in: 1171b5e2a0 user: js tags: trunk
12:37
Merge trunk into 1.0 branch check-in: ed4d7ecf9c user: js tags: 1.0
12:16
Fix compilation with Apple GCC 4.0.1 & 4.2.1 check-in: b5e3f01a59 user: js tags: trunk
12:00
configure: Fix check for net/if.h on macOS 10.5 check-in: 50cc659245 user: js tags: trunk
Changes

Modified src/OFArray.m from [c1836ceb46] to [2fdd882a05].

206
207
208
209
210
211
212
213

214
215
216


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236

237
238
239


240
241
242
243
244
245
246
206
207
208
209
210
211
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

238
239
240
241
242
243
244
245
246
247
248
249
250







-
+



+
+



















-
+



+
+







		objects[0] = firstObject;

		for (size_t i = 1; i < count; i++) {
			objects[i] = va_arg(arguments, id);
			OFEnsure(objects[i] != nil);
		}

		return [self initWithObjects: objects count: count];
		self = [self initWithObjects: objects count: count];
	} @finally {
		OFFreeMemory(objects);
	}

	return self;
}

- (instancetype)initWithArray: (OFArray *)array
{
	id *objects;
	size_t count;

	@try {
		count = array.count;
		objects = OFAllocMemory(count, sizeof(id));

		[array getObjects: objects
			  inRange: OFMakeRange(0, count)];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	@try {
		return [self initWithObjects: objects count: count];
		self = [self initWithObjects: objects count: count];
	} @finally {
		OFFreeMemory(objects);
	}

	return self;
}

#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"

Modified src/OFDictionary.m from [e134f53095] to [624c31369c].

214
215
216
217
218
219
220
221

222
223
224
225
226


227
228
229
230
231
232
233
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235







-
+





+
+







		keys = keys_.objects;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	@try {
		return [self initWithObjects: objects
		self = [self initWithObjects: objects
				     forKeys: keys
				       count: count];
	} @finally {
		objc_autoreleasePoolPop(pool);
	}

	return self;
}

- (instancetype)initWithObject: (id)object forKey: (id)key
{
	@try {
		if (key == nil || object == nil)
			@throw [OFInvalidArgumentException exception];
332
333
334
335
336
337
338
339

340
341
342
343
344
345


346
347
348
349
350
351
352
334
335
336
337
338
339
340

341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356







-
+






+
+







		OFFreeMemory(keys);

		[self release];
		@throw e;
	}

	@try {
		return [self initWithObjects: objects
		self = [self initWithObjects: objects
				     forKeys: keys
				       count: count];
	} @finally {
		OFFreeMemory(objects);
		OFFreeMemory(keys);
	}

	return self;
}

- (id)objectForKey: (id)key
{
	OF_UNRECOGNIZED_SELECTOR
}

Modified src/OFSet.m from [8d2f3f00f2] to [a482207723].

173
174
175
176
177
178
179
180

181
182
183


184
185
186
187
188
189
190
173
174
175
176
177
178
179

180
181
182
183
184
185
186
187
188
189
190
191
192







-
+



+
+







		OFFreeMemory(objects);

		[self release];
		@throw e;
	}

	@try {
		return [self initWithObjects: objects count: count];
		self = [self initWithObjects: objects count: count];
	} @finally {
		OFFreeMemory(objects);
	}

	return self;
}

- (instancetype)initWithArray: (OFArray *)array
{
	void *pool = objc_autoreleasePoolPush();
	size_t count;
	const id *objects;
254
255
256
257
258
259
260
261

262
263
264


265
266
267
268
269
270
271
256
257
258
259
260
261
262

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







-
+



+
+







		objects[0] = firstObject;

		for (size_t i = 1; i < count; i++) {
			objects[i] = va_arg(arguments, id);
			OFEnsure(objects[i] != nil);
		}

		return [self initWithObjects: objects count: count];
		self = [self initWithObjects: objects count: count];
	} @finally {
		OFFreeMemory(objects);
	}

	return self;
}

- (size_t)count
{
	OF_UNRECOGNIZED_SELECTOR
}

Modified src/platform/POSIX/OFSystemInfo+NetworkInterfaces.m from [f03657380d] to [4ddf302e5d].

66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90







-
+









-
+







		return false;

	@try {
		for (size_t i = 0; nameindex[i].if_index != 0; i++) {
			OFString *name = [OFString
			    stringWithCString: nameindex[i].if_name
				     encoding: encoding];
			OFNumber *index = [OFNumber
			OFNumber *idx = [OFNumber
			    numberWithUnsignedInt: nameindex[i].if_index];
			OFMutableDictionary *interface =
			    [ret objectForKey: name];

			if (interface == nil) {
				interface = [OFMutableDictionary dictionary];
				[ret setObject: interface forKey: name];
			}

			[interface setObject: index
			[interface setObject: idx
				      forKey: OFNetworkInterfaceIndex];
		}
	} @finally {
		if_freenameindex(nameindex);
	}

	return true;