ObjFW  Diff

Differences From Artifact [c1d9e7762b]:

To Artifact [9acea0cd8c]:


1361
1362
1363
1364
1365
1366
1367







1368
1369
1370
1371
1372
1373
1374
1375
1376
1377







1378
1379
1380
1381
1382
1383
1384

1385
1386
1387
1388
1389
1390
1391
		   length: length];

	return length;
}

- (size_t)writeString: (OFString*)string
{







	size_t length = [string UTF8StringLength];

	[self writeBuffer: [string UTF8String]
		   length: length];

	return length;
}

- (size_t)writeLine: (OFString*)string
{







	size_t stringLength = [string UTF8StringLength];
	char *buffer;

	buffer = [self allocMemoryWithSize: stringLength + 1];

	@try {
		memcpy(buffer, [string UTF8String], stringLength);

		buffer[stringLength] = '\n';

		[self writeBuffer: buffer
			   length: stringLength + 1];
	} @finally {
		[self freeMemory: buffer];
	}







>
>
>
>
>
>
>
|

|







>
>
>
>
>
>
>
|





|
>







1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
		   length: length];

	return length;
}

- (size_t)writeString: (OFString*)string
{
	return [self writeString: string
		   usingEncoding: OF_STRING_ENCODING_UTF_8];
}

- (size_t)writeString: (OFString*)string
	usingEncoding: (of_string_encoding_t)encoding
{
	size_t length = [string lengthOfBytesUsingEncoding: encoding];

	[self writeBuffer: [string cStringUsingEncoding: encoding]
		   length: length];

	return length;
}

- (size_t)writeLine: (OFString*)string
{
	return [self writeLine: string
		 usingEncoding: OF_STRING_ENCODING_UTF_8];
}

- (size_t)writeLine: (OFString*)string
      usingEncoding: (of_string_encoding_t)encoding
{
	size_t stringLength = [string lengthOfBytesUsingEncoding: encoding];
	char *buffer;

	buffer = [self allocMemoryWithSize: stringLength + 1];

	@try {
		memcpy(buffer, [string cStringUsingEncoding: encoding],
		    stringLength);
		buffer[stringLength] = '\n';

		[self writeBuffer: buffer
			   length: stringLength + 1];
	} @finally {
		[self freeMemory: buffer];
	}