ObjFW  Check-in [fcade8da38]

Overview
Comment:Make GCC 4.4 happy.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fcade8da38e63991d269f0af6fce60b4a4d0b6e16f1388bb3e1b13ffa95a6318
User & Date: js on 2012-10-21 22:12:57
Other Links: manifest | tags
Context
2012-10-21
22:13
Fix a test on DragonFlyBSD. check-in: 83618d5a08 user: js tags: trunk
22:12
Make GCC 4.4 happy. check-in: fcade8da38 user: js tags: trunk
2012-10-20
22:22
Call C++ constructors in correct order. check-in: 1dcbea2fb0 user: js tags: trunk
Changes

Modified src/OFArray.m from [94fe6e85f7] to [03e4be362e].

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
}
@end

@implementation OFArray
+ (void)initialize
{
	if (self == [OFArray class])
		object_setClass((id)&placeholder, [OFArray_placeholder class]);
}

+ alloc
{
	if (self == [OFArray class])
		return (id)&placeholder;








|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
}
@end

@implementation OFArray
+ (void)initialize
{
	if (self == [OFArray class])
		placeholder.isa = [OFArray_placeholder class];
}

+ alloc
{
	if (self == [OFArray class])
		return (id)&placeholder;

Modified src/OFBlock.m from [a204e2796b] to [6ab3d02d2d].

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{
	of_block_literal_t *block = (of_block_literal_t*)block_;

	if (object_getClass((id)block) == (Class)&_NSConcreteStackBlock) {
		of_block_literal_t *copy;

		if ((copy = malloc(block->descriptor->size)) == NULL) {
			object_setClass((id)&alloc_failed_exception,
			    [OFAllocFailedException class]);
			@throw (OFAllocFailedException*)&alloc_failed_exception;
		}
		memcpy(copy, block, block->descriptor->size);

		object_setClass((id)copy, (Class)&_NSConcreteMallocBlock);
		copy->flags++;








|
|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
{
	of_block_literal_t *block = (of_block_literal_t*)block_;

	if (object_getClass((id)block) == (Class)&_NSConcreteStackBlock) {
		of_block_literal_t *copy;

		if ((copy = malloc(block->descriptor->size)) == NULL) {
			alloc_failed_exception.isa =
			    [OFAllocFailedException class];
			@throw (OFAllocFailedException*)&alloc_failed_exception;
		}
		memcpy(copy, block, block->descriptor->size);

		object_setClass((id)copy, (Class)&_NSConcreteMallocBlock);
		copy->flags++;

263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
		break;
	case OF_BLOCK_FIELD_IS_BYREF:;
		of_block_byref_t *src = (of_block_byref_t*)src_;
		of_block_byref_t **dst = (of_block_byref_t**)dst_;

		if ((src->flags & OF_BLOCK_REFCOUNT_MASK) == 0) {
			if ((*dst = malloc(src->size)) == NULL) {
				object_setClass((id)&alloc_failed_exception,
				    [OFAllocFailedException class]);
				@throw (OFAllocFailedException*)
				    &alloc_failed_exception;
			}

			if (src->forwarding == src)
				(*dst)->forwarding = *dst;








|
|







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
		break;
	case OF_BLOCK_FIELD_IS_BYREF:;
		of_block_byref_t *src = (of_block_byref_t*)src_;
		of_block_byref_t **dst = (of_block_byref_t**)dst_;

		if ((src->flags & OF_BLOCK_REFCOUNT_MASK) == 0) {
			if ((*dst = malloc(src->size)) == NULL) {
				alloc_failed_exception.isa =
				    [OFAllocFailedException class];
				@throw (OFAllocFailedException*)
				    &alloc_failed_exception;
			}

			if (src->forwarding == src)
				(*dst)->forwarding = *dst;

Modified src/OFCountedSet.m from [3f8c1b4cf9] to [dd9c0e4002].

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
}
@end

@implementation OFCountedSet
+ (void)initialize
{
	if (self == [OFCountedSet class])
		object_setClass((id)&placeholder,
		    [OFCountedSet_placeholder class]);
}

+ alloc
{
	if (self == [OFCountedSet class])
		return (id)&placeholder;








<
|







104
105
106
107
108
109
110

111
112
113
114
115
116
117
118
}
@end

@implementation OFCountedSet
+ (void)initialize
{
	if (self == [OFCountedSet class])

		placeholder.isa = [OFCountedSet_placeholder class];
}

+ alloc
{
	if (self == [OFCountedSet class])
		return (id)&placeholder;

Modified src/OFDictionary.m from [dd1d8a52aa] to [9c777b7efa].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
}
@end

@implementation OFDictionary
+ (void)initialize
{
	if (self == [OFDictionary class])
		object_setClass((id)&placeholder,
		    [OFDictionary_placeholder class]);
}

+ alloc
{
	if (self == [OFDictionary class])
		return (id)&placeholder;








<
|







118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
}
@end

@implementation OFDictionary
+ (void)initialize
{
	if (self == [OFDictionary class])

		placeholder.isa = [OFDictionary_placeholder class];
}

+ alloc
{
	if (self == [OFDictionary class])
		return (id)&placeholder;

Modified src/OFMutableArray.m from [b32d8ba01b] to [93a257326c].

145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
}
@end

@implementation OFMutableArray
+ (void)initialize
{
	if (self == [OFMutableArray class])
		object_setClass((id)&placeholder,
		    [OFMutableArray_placeholder class]);
}

+ alloc
{
	if (self == [OFMutableArray class])
		return (id)&placeholder;








<
|







145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
}
@end

@implementation OFMutableArray
+ (void)initialize
{
	if (self == [OFMutableArray class])

		placeholder.isa = [OFMutableArray_placeholder class];
}

+ alloc
{
	if (self == [OFMutableArray class])
		return (id)&placeholder;

Modified src/OFMutableDictionary.m from [46ace486e0] to [366d9b52dc].

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
}
@end

@implementation OFMutableDictionary
+ (void)initialize
{
	if (self == [OFMutableDictionary class])
		object_setClass((id)&placeholder,
		    [OFMutableDictionary_placeholder class]);
}

+ alloc
{
	if (self == [OFMutableDictionary class])
		return (id)&placeholder;








<
|







114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
}
@end

@implementation OFMutableDictionary
+ (void)initialize
{
	if (self == [OFMutableDictionary class])

		placeholder.isa = [OFMutableDictionary_placeholder class];
}

+ alloc
{
	if (self == [OFMutableDictionary class])
		return (id)&placeholder;

Modified src/OFMutableSet.m from [3f9a210be5] to [e5b23d482d].

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
}
@end

@implementation OFMutableSet
+ (void)initialize
{
	if (self == [OFMutableSet class])
		object_setClass((id)&placeholder,
		    [OFMutableSet_placeholder class]);
}

+ alloc
{
	if (self == [OFMutableSet class])
		return (id)&placeholder;








<
|







103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
}
@end

@implementation OFMutableSet
+ (void)initialize
{
	if (self == [OFMutableSet class])

		placeholder.isa = [OFMutableSet_placeholder class];
}

+ alloc
{
	if (self == [OFMutableSet class])
		return (id)&placeholder;

Modified src/OFMutableString.m from [c4f091786b] to [5fcf1bb841].

239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
}
@end

@implementation OFMutableString
+ (void)initialize
{
	if (self == [OFMutableString class])
		object_setClass((id)&placeholder,
		    [OFMutableString_placeholder class]);
}

+ alloc
{
	if (self == [OFMutableString class])
		return (id)&placeholder;








<
|







239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
}
@end

@implementation OFMutableString
+ (void)initialize
{
	if (self == [OFMutableString class])

		placeholder.isa = [OFMutableString_placeholder class];
}

+ alloc
{
	if (self == [OFMutableString class])
		return (id)&placeholder;

Modified src/OFObject.m from [b2fb1a5ccb] to [130a752ea7].

184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
		extraAlignment = ((instanceSize + extraAlignment - 1) &
		    ~(extraAlignment - 1)) - extraAlignment;

	instance = malloc(PRE_IVAR_ALIGN + instanceSize +
	    extraAlignment + extraSize);

	if OF_UNLIKELY (instance == nil) {
		object_setClass((id)&alloc_failed_exception,
		    [OFAllocFailedException class]);
		@throw (id)&alloc_failed_exception;
	}

	((struct pre_ivar*)instance)->retainCount = 1;
	((struct pre_ivar*)instance)->firstMem = NULL;
	((struct pre_ivar*)instance)->lastMem = NULL;








<
|







184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
		extraAlignment = ((instanceSize + extraAlignment - 1) &
		    ~(extraAlignment - 1)) - extraAlignment;

	instance = malloc(PRE_IVAR_ALIGN + instanceSize +
	    extraAlignment + extraSize);

	if OF_UNLIKELY (instance == nil) {

		alloc_failed_exception.isa = [OFAllocFailedException class];
		@throw (id)&alloc_failed_exception;
	}

	((struct pre_ivar*)instance)->retainCount = 1;
	((struct pre_ivar*)instance)->firstMem = NULL;
	((struct pre_ivar*)instance)->lastMem = NULL;

Modified src/OFPlugin.m from [a25e85e2c5] to [1e21ccb1ef].

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	if ((handle = dlopen([file cStringWithEncoding:
	    OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	objc_autoreleasePoolPop(pool);

	*(void**)&initPlugin = dlsym(handle, "init_plugin");
	if (initPlugin == NULL || (plugin = initPlugin()) == nil) {
		dlclose(handle);
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
	}

	plugin->handle = handle;







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	if ((handle = dlopen([file cStringWithEncoding:
	    OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	objc_autoreleasePoolPop(pool);

	initPlugin = (OFPlugin*(*)(void))dlsym(handle, "init_plugin");
	if (initPlugin == NULL || (plugin = initPlugin()) == nil) {
		dlclose(handle);
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
	}

	plugin->handle = handle;

Modified src/OFSet.m from [ec5ebbb3c2] to [64a43ff987].

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
}
@end

@implementation OFSet
+ (void)initialize
{
	if (self == [OFSet class])
		object_setClass((id)&placeholder, [OFSet_placeholder class]);
}

+ alloc
{
	if (self == [OFSet class])
		return (id)&placeholder;








|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
}
@end

@implementation OFSet
+ (void)initialize
{
	if (self == [OFSet class])
		placeholder.isa = [OFSet_placeholder class];
}

+ alloc
{
	if (self == [OFSet class])
		return (id)&placeholder;

Modified src/OFString.m from [5e5459873a] to [5ea7b40c2a].

337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
}
@end

@implementation OFString
+ (void)initialize
{
	if (self == [OFString class])
		object_setClass((id)&placeholder, [OFString_placeholder class]);
}

+ alloc
{
	if (self == [OFString class])
		return (id)&placeholder;








|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
}
@end

@implementation OFString
+ (void)initialize
{
	if (self == [OFString class])
		placeholder.isa = [OFString_placeholder class];
}

+ alloc
{
	if (self == [OFString class])
		return (id)&placeholder;