ObjFW  Check-in [4444a8c246]

Overview
Comment:Work around GCC bugs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4444a8c2467aa50d398e4be8a17992d3bd14f0450d588e80513d9140979dd845
User & Date: js on 2011-03-23 01:14:31
Other Links: manifest | tags
Context
2011-03-23
12:58
Make the return type of retainCount unsigned int.
This way, the OFObject protocol is compatible to NSObject.
check-in: 8de8df50e9 user: js tags: trunk
01:14
Work around GCC bugs. check-in: 4444a8c246 user: js tags: trunk
01:08
Check if -Wshorten-64-to-32 is available. check-in: 04fa3f4371 user: js tags: trunk
Changes

Modified src/OFXMLElement.m from [14f63e2483] to [ef950b210d].

228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
		str->isa = [OFString class];
		return str;
	}

	pool = [[OFAutoreleasePool alloc] init];
	def_ns = (defaultNamespace != nil
	    ? defaultNamespace
	    : (parent != nil ? parent->defaultNamespace : nil));

	if (parent != nil && parent->namespaces != nil) {
		OFEnumerator *key_enum = [namespaces keyEnumerator];
		OFEnumerator *obj_enum = [namespaces objectEnumerator];
		id key, obj;

		all_namespaces = [[parent->namespaces mutableCopy] autorelease];

		while ((key = [key_enum nextObject]) != nil &&
		    (obj = [obj_enum nextObject]) != nil)
			[all_namespaces setObject: obj
					   forKey: key];
	} else
		all_namespaces = namespaces;

	prefix = [all_namespaces objectForKey: (ns != nil ? ns : @"")];

	parent_prefix = [all_namespaces objectForKey:
		(parent != nil && parent->ns != nil ? parent->ns : @"")];

	i = 0;
	len = [name cStringLength] + 3;
	str_c = [self allocMemoryWithSize: len];

	/* Start of tag */
	str_c[i++] = '<';

	if (prefix != nil && ![ns isEqual: def_ns] &&
	    (![ns isEqual: (parent != nil ? parent->ns : nil)] ||
	    parent_prefix != nil)) {
		len += [prefix cStringLength] + 1;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {
			[self freeMemory: str_c];







|















|
>

|









|







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
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
		str->isa = [OFString class];
		return str;
	}

	pool = [[OFAutoreleasePool alloc] init];
	def_ns = (defaultNamespace != nil
	    ? defaultNamespace
	    : (parent != nil ? parent->defaultNamespace : (OFString*)nil));

	if (parent != nil && parent->namespaces != nil) {
		OFEnumerator *key_enum = [namespaces keyEnumerator];
		OFEnumerator *obj_enum = [namespaces objectEnumerator];
		id key, obj;

		all_namespaces = [[parent->namespaces mutableCopy] autorelease];

		while ((key = [key_enum nextObject]) != nil &&
		    (obj = [obj_enum nextObject]) != nil)
			[all_namespaces setObject: obj
					   forKey: key];
	} else
		all_namespaces = namespaces;

	prefix = [all_namespaces objectForKey:
	    (ns != nil ? ns : (OFString*)@"")];
	parent_prefix = [all_namespaces objectForKey:
	    (parent != nil && parent->ns != nil ? parent->ns : (OFString*)@"")];

	i = 0;
	len = [name cStringLength] + 3;
	str_c = [self allocMemoryWithSize: len];

	/* Start of tag */
	str_c[i++] = '<';

	if (prefix != nil && ![ns isEqual: def_ns] &&
	    (![ns isEqual: (parent != nil ? parent->ns : (OFString*)nil)] ||
	    parent_prefix != nil)) {
		len += [prefix cStringLength] + 1;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {
			[self freeMemory: str_c];
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
	}

	memcpy(str_c + i, [name cString], [name cStringLength]);
	i += [name cStringLength];

	/* xmlns if necessary */
	if (ns != nil && prefix == nil && ![ns isEqual: def_ns] &&
	     (![ns isEqual: (parent != nil ? parent->ns : nil)] ||
	     parent_prefix != nil)) {
		len += [ns cStringLength] + 9;

		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {







|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
	}

	memcpy(str_c + i, [name cString], [name cStringLength]);
	i += [name cStringLength];

	/* xmlns if necessary */
	if (ns != nil && prefix == nil && ![ns isEqual: def_ns] &&
	     (![ns isEqual: (parent != nil ? parent->ns : (OFString*)nil)] ||
	     parent_prefix != nil)) {
		len += [ns cStringLength] + 9;

		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {