ObjFW  Diff

Differences From Artifact [63e98f3fd3]:

To Artifact [634c81749f]:


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
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







-
+






-
+






-
+







-
+





-
+







	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}


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

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

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

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

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

- retain
{
	return self;
}
107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121







-
+








- (void)release
{
}

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

@implementation OFConstantString
+ (void)load
145
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
161
162
163
164
165
166


167
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
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159
160
161
162
163
164
165

166
167
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







-
+













-
+
+



-
+










-
+






-
+






-
+







-
+





-
+








- (void)finishInitialization
{
	struct of_string_utf8_ivars *ivars;

	if ((ivars = malloc(sizeof(*ivars))) == NULL)
		@throw [OFOutOfMemoryException
		    exceptionWithClass: isa
		    exceptionWithClass: [self class]
			 requestedSize: sizeof(*ivars)];
	memset(ivars, 0, sizeof(*ivars));

	ivars->cString = cString;
	ivars->cStringLength = cStringLength;

	switch (of_string_check_utf8(ivars->cString, ivars->cStringLength,
	    &ivars->length)) {
	case 1:
		ivars->UTF8 = YES;
		break;
	case -1:
		free(ivars);
		@throw [OFInvalidEncodingException exceptionWithClass: isa];
		@throw [OFInvalidEncodingException
		    exceptionWithClass: [self class]];
	}

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

+ alloc
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}

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

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

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

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

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

- retain
{
	return self;
}
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
228
229
230
231
232
233
234

235
236
237
238
239
240
241
242







-
+








- (void)release
{
}

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

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