ObjFW  Diff

Differences From Artifact [3c7d0ee24e]:

To Artifact [881fc1c877]:


132
133
134
135
136
137
138
139
140
141
142





143
144
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
132
133
134
135
136
137
138




139
140
141
142
143

144
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







-
-
-
-
+
+
+
+
+
-








-
-
-
+
+
+
+

-
+







-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+
-







{
	return [[[OFString alloc] initWithFormat: fmt
				andArguments: args] autorelease];
}

- init
{
	if ((self = [super init])) {
		length = 0;
		string = NULL;
		is_utf8 = NO;
	[super init];

	length = 0;
	string = NULL;
	is_utf8 = NO;
	}

	return self;
}

- initWithCString: (const char*)str
{
	Class c;

	if ((self = [super init])) {
		if (str != NULL) {
			length = strlen(str);
	self = [super init];

	if (str != NULL) {
		length = strlen(str);

			switch (check_utf8(str, length)) {
		switch (check_utf8(str, length)) {
			case 1:
				is_utf8 = YES;
				break;
			case -1:
				c = isa;
				[super free];
				@throw [OFInvalidEncodingException
				    newWithClass: c];
			}
					newWithClass: c];
		}

			@try {
				string = [self getMemWithSize: length + 1];
			} @catch (OFException *e) {
				[self free];
				@throw e;
			}
			memcpy(string, str, length + 1);
		@try {
			string = [self getMemWithSize: length + 1];
		} @catch (OFException *e) {
			[self free];
			@throw e;
		}
		memcpy(string, str, length + 1);
		}
	}

	return self;
}

- initWithFormat: (const char*)fmt, ...
{
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
219
220
221
222
223

224
225
226
227
228
229





230
231
232
233
234
235
236
237
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
219
220
221
222

223
224





225
226
227
228
229

230
231
232
233
234
235
236







-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+
-
-
-
+
+

-
+








-
+

-
-
-
-
-
+
+
+
+
+
-








- initWithFormat: (const char*)fmt
    andArguments: (va_list)args
{
	int t;
	Class c;

	if ((self = [super init])) {
		if (fmt == NULL) {
			c = isa;
			[super free];
			@throw [OFInvalidFormatException newWithClass: c];
		}
	self = [super init];

	if (fmt == NULL) {
		c = isa;
		[super free];
		@throw [OFInvalidFormatException newWithClass: c];
	}

		if ((t = vasprintf(&string, fmt, args)) == -1) {
			c = isa;
			[super free];
			@throw [OFInitializationFailedException
	if ((t = vasprintf(&string, fmt, args)) == -1) {
		c = isa;
		[super free];
		@throw [OFInitializationFailedException newWithClass: c];
			    newWithClass: c];
		}
		length = t;
	}
	length = t;

		switch (check_utf8(string, length)) {
	switch (check_utf8(string, length)) {
		case 1:
			is_utf8 = YES;
			break;
		case -1:
			free(string);
			c = isa;
			[super free];
			@throw [OFInvalidEncodingException newWithClass: c];
		}
	}

		@try {
			[self addToMemoryPool: string];
		} @catch (OFException *e) {
			free(string);
			@throw e;
	@try {
		[self addToMemoryPool: string];
	} @catch (OFException *e) {
		free(string);
		@throw e;
		}
	}

	return self;
}

- (const char*)cString
{