ObjFW  Check-in [9b3e9e6895]

Overview
Comment:Workaround for wrong length of OFConstStrings on PPC64 OS X.
Apple does a strange thing there: The length is only 32 bit, followed
by another 32 bit which seem to be garbage.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9b3e9e6895a2c7f2df454c4cb5ddacf96a934b2cb0de95a96ca705901e694d08
User & Date: js on 2009-04-15 20:31:42
Other Links: manifest | tags
Context
2009-04-16
17:18
Get rid of dependency on method_getSizeOfArguments. check-in: 345716d824 user: js tags: trunk
2009-04-15
20:31
Workaround for wrong length of OFConstStrings on PPC64 OS X.
Apple does a strange thing there: The length is only 32 bit, followed
by another 32 bit which seem to be garbage.
check-in: 9b3e9e6895 user: js tags: trunk
2009-04-13
16:29
OFPlugin: Properly close handle on error. check-in: 297dbbb2b1 user: js tags: trunk
Changes

Modified src/OFConstString.h from [d9f2f102aa] to [b313df5022].

18
19
20
21
22
23
24
25

26






27
28
29
30
31
32
33
#endif

/**
 * A class for storing static strings using the @"" literal.
 */
@interface OFConstString: OFObject
{
	char   *string;

	size_t length;






}

/**
 * \return The OFString as a C string
 */
- (const char*)cString;








|
>
|
>
>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#endif

/**
 * A class for storing static strings using the @"" literal.
 */
@interface OFConstString: OFObject
{
	char	     *string;
#ifdef __objc_INCLUDE_GNU
	unsigned int length;
#else
	int	     length;
#if __LP64__
	int	     _unused;
#endif
#endif
}

/**
 * \return The OFString as a C string
 */
- (const char*)cString;

Modified src/OFObject.m from [fd94d50205] to [4cc42158d1].

113
114
115
116
117
118
119
120
121

122
123

124
125
126
127
128
129
130
131
132
133
134
	if (oldimp == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];

	method->method_imp = newimp;
	return oldimp;
#else
	IMP imp = class_getMethodImplementation(class, selector);
	Method method = class_getInstanceMethod(self, selector);


	if (imp == NULL || method == NULL)

		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];

	return method_setImplementation(method, imp);
#endif
}

- init
{
	return self;
}







<
|
>

|
>



|







113
114
115
116
117
118
119

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
	if (oldimp == (IMP)0 || newimp == (IMP)0)
		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];

	method->method_imp = newimp;
	return oldimp;
#else

	Method m;
	IMP imp;

	if ((m = class_getInstanceMethod(self, selector)) == NULL ||
	    (imp = method_getImplementation(m)) == NULL)
		@throw [OFInvalidArgumentException newWithClass: self
						    andSelector: _cmd];

	return method_setImplementation(m, imp);
#endif
}

- init
{
	return self;
}
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	/* Classes containing data should reimplement this! */
	return (self == obj ? YES : NO);
}

- (uint32_t)hash
{
	/* Classes containing data should reimplement this! */
	return (uint32_t)self;
}

- addToMemoryPool: (void*)ptr
{
	void **memchunks;
	size_t memchunks_size;








|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
	/* Classes containing data should reimplement this! */
	return (self == obj ? YES : NO);
}

- (uint32_t)hash
{
	/* Classes containing data should reimplement this! */
	return (uint32_t)(intptr_t)self;
}

- addToMemoryPool: (void*)ptr
{
	void **memchunks;
	size_t memchunks_size;