ObjFW  Diff

Differences From Artifact [b86bf57c57]:

To Artifact [4e1d37633d]:


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
22
23
24
25
26
27
28

29
30
31
32
33
34
35







-







#include <string.h>

#import "OFConstantString.h"
#import "OFString_UTF8.h"

#import "OFInitializationFailedException.h"
#import "OFInvalidEncodingException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"

#if defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
# import <objc/runtime.h>

struct {
	struct class *isa, *super_class;
47
48
49
50
51
52
53
54
55


56
57
58
59
60
61
62


63
64
65
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


91
92
93
94
95
96
97
46
47
48
49
50
51
52


53
54
55
56
57
58
59


60
61
62
63
64
65
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
91
92
93
94
95
96







-
-
+
+





-
-
+
+





-
-
+
+





-
-
+
+






-
-
+
+




-
-
+
+








@interface OFString_const: OFString_UTF8
@end

@implementation OFString_const
+ alloc
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}


- (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)allocMemoryWithSize: (size_t)itemSize
		       count: (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
	     toNItems: (size_t)nitems
	     withSize: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{
	return self;
}

107
108
109
110
111
112
113
114
115
116





117
118
119
120
121
122
123
106
107
108
109
110
111
112



113
114
115
116
117
118
119
120
121
122
123
124







-
-
-
+
+
+
+
+








- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
	[self doesNotRecognizeSelector: _cmd];
	abort();

	/* Get rid of a stupid warning */
	[super dealloc];
}
@end

@implementation OFConstantString
+ (void)load
{
#if defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
168
169
170
171
172
173
174
175
176


177
178
179
180
181
182


183
184
185
186
187
188
189


190
191
192
193
194
195
196


197
198
199
200
201
202
203
204


205
206
207
208
209
210


211
212
213
214
215
216
217
169
170
171
172
173
174
175


176
177
178
179
180
181


182
183
184
185
186
187
188


189
190
191
192
193
194
195


196
197
198
199
200
201
202
203


204
205
206
207
208
209


210
211
212
213
214
215
216
217
218







-
-
+
+




-
-
+
+





-
-
+
+





-
-
+
+






-
-
+
+




-
-
+
+








	cString = (char*)ivars;
	object_setClass(self, [OFString_const class]);
}

+ alloc
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void*)resizeMemory: (void*)ptr
		 size: (size_t)size
		count: (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)freeMemory: (void*)ptr
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- retain
{
	return self;
}

227
228
229
230
231
232
233
234
235
236





237
238
239
240
241
242
243
228
229
230
231
232
233
234



235
236
237
238
239
240
241
242
243
244
245
246







-
-
-
+
+
+
+
+








- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
	[self doesNotRecognizeSelector: _cmd];
	abort();

	/* Get rid of a stupid warning */
	[super dealloc];
}

/*
 * In all following methods, the constant string is converted to an
 * OFString_UTF8 and the message sent again.
 */