ObjFW  Diff

Differences From Artifact [d43b0aa5cd]:

To Artifact [858181ff3a]:


1510
1511
1512
1513
1514
1515
1516
1517

1518
1519
1520
1521
1522
1523
1524
1525
1526
1527

1528
1529
1530

1531
1532
1533
1534
1535
1536

1537
1538
1539
1540
1541
1542
1543
1510
1511
1512
1513
1514
1515
1516

1517
1518
1519
1520
1521
1522
1523
1524
1525
1526

1527
1528
1529

1530
1531
1532
1533
1534
1535

1536
1537
1538
1539
1540
1541
1542
1543







-
+









-
+


-
+





-
+







	for (size_t i = 0; i < range.length; i++)
		buffer[i] = [self characterAtIndex: range.location + i];
}

- (bool)isEqual: (id)object
{
	void *pool;
	OFString *otherString;
	OFString *string;
	const of_unichar_t *characters, *otherCharacters;
	size_t length;

	if (object == self)
		return true;

	if (![object isKindOfClass: [OFString class]])
		return false;

	otherString = object;
	string = object;
	length = self.length;

	if (otherString.length != length)
	if (string.length != length)
		return false;

	pool = objc_autoreleasePoolPush();

	characters = self.characters;
	otherCharacters = otherString.characters;
	otherCharacters = string.characters;

	if (memcmp(characters, otherCharacters,
	    length * sizeof(of_unichar_t)) != 0) {
		objc_autoreleasePoolPop(pool);
		return false;
	}

1552
1553
1554
1555
1556
1557
1558
1559

1560
1561
1562
1563
1564
1565
1566

1567
1568
1569

1570
1571
1572
1573
1574


1575
1576
1577
1578
1579

1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595

1596
1597

1598
1599
1600
1601
1602
1603

1604
1605
1606
1607
1608
1609

1610
1611
1612
1613

1614
1615

1616
1617
1618
1619
1620
1621
1622
1552
1553
1554
1555
1556
1557
1558

1559
1560
1561

1562
1563
1564

1565
1566
1567

1568
1569
1570



1571
1572
1573
1574
1575
1576

1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592

1593
1594

1595
1596
1597
1598
1599
1600

1601
1602
1603
1604
1605
1606

1607
1608
1609
1610

1611
1612

1613
1614
1615
1616
1617
1618
1619
1620







-
+


-



-
+


-
+


-
-
-
+
+




-
+















-
+

-
+





-
+





-
+



-
+

-
+







}

- (id)mutableCopy
{
	return [[OFMutableString alloc] initWithString: self];
}

- (of_comparison_result_t)compare: (id <OFComparing>)object
- (of_comparison_result_t)compare: (OFString *)string
{
	void *pool;
	OFString *otherString;
	const of_unichar_t *characters, *otherCharacters;
	size_t minimumLength;

	if (object == self)
	if (string == self)
		return OF_ORDERED_SAME;

	if (![(id)object isKindOfClass: [OFString class]])
	if (![string isKindOfClass: [OFString class]])
		@throw [OFInvalidArgumentException exception];

	otherString = (OFString *)object;
	minimumLength = (self.length > otherString.length
	    ? otherString.length : self.length);
	minimumLength = (self.length > string.length
	    ? string.length : self.length);

	pool = objc_autoreleasePoolPush();

	characters = self.characters;
	otherCharacters = otherString.characters;
	otherCharacters = string.characters;

	for (size_t i = 0; i < minimumLength; i++) {
		if (characters[i] > otherCharacters[i]) {
			objc_autoreleasePoolPop(pool);
			return OF_ORDERED_DESCENDING;
		}

		if (characters[i] < otherCharacters[i]) {
			objc_autoreleasePoolPop(pool);
			return OF_ORDERED_ASCENDING;
		}
	}

	objc_autoreleasePoolPop(pool);

	if (self.length > otherString.length)
	if (self.length > string.length)
		return OF_ORDERED_DESCENDING;
	if (self.length < otherString.length)
	if (self.length < string.length)
		return OF_ORDERED_ASCENDING;

	return OF_ORDERED_SAME;
}

- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString
- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string
{
	void *pool = objc_autoreleasePoolPush();
	const of_unichar_t *characters, *otherCharacters;
	size_t length, otherLength, minimumLength;

	if (otherString == self)
	if (string == self)
		return OF_ORDERED_SAME;

	characters = self.characters;
	otherCharacters = otherString.characters;
	otherCharacters = string.characters;
	length = self.length;
	otherLength = otherString.length;
	otherLength = string.length;

	minimumLength = (length > otherLength ? otherLength : length);

	for (size_t i = 0; i < minimumLength; i++) {
		of_unichar_t c = characters[i];
		of_unichar_t oc = otherCharacters[i];