ObjFW  Check-in [73b242894c]

Overview
Comment:-[OFStream write{Data,String}:]: Check for nil
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 73b242894c6f77d490e2f75ea03e293f6504b8ba5a22072c5a4d0aff44790cb6
User & Date: js on 2017-08-12 14:23:49
Other Links: manifest | tags
Context
2017-08-12
21:03
Add -[OFMutableArray sortUsingSelector:options:] check-in: daa11c19cb user: js tags: trunk
14:23
-[OFStream write{Data,String}:]: Check for nil check-in: 73b242894c user: js tags: trunk
2017-08-11
22:38
ofzip: Fix compilation with GCC check-in: 233e1b4284 user: js tags: trunk
Changes

Modified src/OFStream.m from [e48fbb2fa9] to [e45f32eef4].

1446
1447
1448
1449
1450
1451
1452







1453
1454
1455
1456


1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469







1470
1471
1472
1473


1474
1475
1476
1477
1478
1479
1480
#endif

	return size;
}

- (size_t)writeData: (OFData *)data
{







	size_t length = [data count] * [data itemSize];

	[self writeBuffer: [data items]
		   length: length];



	return length;
}

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

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







	size_t length = [string cStringLengthWithEncoding: encoding];

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



	return length;
}

- (size_t)writeLine: (OFString *)string
{
	return [self writeLine: string







>
>
>
>
>
>
>
|



>
>













>
>
>
>
>
>
>
|



>
>







1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
#endif

	return size;
}

- (size_t)writeData: (OFData *)data
{
	void *pool;
	size_t length;

	if (data == nil)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();
	length = [data count] * [data itemSize];

	[self writeBuffer: [data items]
		   length: length];

	objc_autoreleasePoolPop(pool);

	return length;
}

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

- (size_t)writeString: (OFString *)string
	     encoding: (of_string_encoding_t)encoding
{
	void *pool;
	size_t length;

	if (string == nil)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();
	length = [string cStringLengthWithEncoding: encoding];

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

	objc_autoreleasePoolPop(pool);

	return length;
}

- (size_t)writeLine: (OFString *)string
{
	return [self writeLine: string