ObjFW  Diff

Differences From Artifact [5faa6d539b]:

To Artifact [65dd22d751]:


177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
				if (bytes == 0)
					@throw [OFInvalidEncodingException
					    exceptionWithClass: isa];

				s->cStringLength += bytes - 1;
				s->cString = [self
				    resizeMemory: s->cString
					  toSize: s->cStringLength + 1];

				memcpy(s->cString + j, buffer, bytes);
				j += bytes;
			}

			s->cString[s->cStringLength] = 0;








|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
				if (bytes == 0)
					@throw [OFInvalidEncodingException
					    exceptionWithClass: isa];

				s->cStringLength += bytes - 1;
				s->cString = [self
				    resizeMemory: s->cString
					    size: s->cStringLength + 1];

				memcpy(s->cString + j, buffer, bytes);
				j += bytes;
			}

			s->cString[s->cStringLength] = 0;

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

			if (characterBytes == 0)
				@throw [OFInvalidEncodingException
				    exceptionWithClass: isa];

			s->cStringLength += characterBytes - 1;
			s->cString = [self resizeMemory: s->cString
						 toSize: s->cStringLength + 1];

			memcpy(s->cString + j, buffer, characterBytes);
			j += characterBytes;
		}

		s->cString[s->cStringLength] = 0;
	} @catch (id e) {







|







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

			if (characterBytes == 0)
				@throw [OFInvalidEncodingException
				    exceptionWithClass: isa];

			s->cStringLength += characterBytes - 1;
			s->cString = [self resizeMemory: s->cString
						   size: s->cStringLength + 1];

			memcpy(s->cString + j, buffer, characterBytes);
			j += characterBytes;
		}

		s->cString[s->cStringLength] = 0;
	} @catch (id e) {
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
			}
		}

		s->cString[j] = '\0';

		@try {
			s->cString = [self resizeMemory: s->cString
						 toSize: s->cStringLength + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}







|







338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
			}
		}

		s->cString[j] = '\0';

		@try {
			s->cString = [self resizeMemory: s->cString
						   size: s->cStringLength + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
			}
		}

		s->cString[j] = '\0';

		@try {
			s->cString = [self resizeMemory: s->cString
						 toSize: s->cStringLength + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}







|







446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
			}
		}

		s->cString[j] = '\0';

		@try {
			s->cString = [self resizeMemory: s->cString
						   size: s->cStringLength + 1];
		} @catch (OFOutOfMemoryException *e) {
			/* We don't care, as we only tried to make it smaller */
		}
	} @catch (id e) {
		[self release];
		@throw e;
	}
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105

- (const of_unichar_t*)unicodeString
{
	OFObject *object = [[[OFObject alloc] init] autorelease];
	of_unichar_t *ret;
	size_t i, j;

	ret = [object allocMemoryWithItemSize: sizeof(of_unichar_t)
					count: s->length + 1];

	i = 0;
	j = 0;

	while (i < s->cStringLength) {
		of_unichar_t c;
		size_t cLen;







|
|







1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105

- (const of_unichar_t*)unicodeString
{
	OFObject *object = [[[OFObject alloc] init] autorelease];
	of_unichar_t *ret;
	size_t i, j;

	ret = [object allocMemoryWithSize: sizeof(of_unichar_t)
				    count: s->length + 1];

	i = 0;
	j = 0;

	while (i < s->cStringLength) {
		of_unichar_t c;
		size_t cLen;