ObjFW  Diff

Differences From Artifact [600171252e]:

To Artifact [1aae4ffc35]:


608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625

626
627
628

629
630
631
632
633
634




635
636
637
638

639
640
641

642
643
644
645


646
647
648
649
650
651
652
653
608
609
610
611
612
613
614

615
616
617
618
619
620
621
622


623



624

625




626
627
628
629

630


631



632

633


634
635

636
637
638
639
640
641
642







-








-
-
+
-
-
-
+
-

-
-
-
-
+
+
+
+
-

-
-
+
-
-
-
+
-

-
-
+
+
-







	str_len = [str cStringLength];

	i = j = 0;

	while (i < length && j < str_len) {
		of_unichar_t c1, c2;
		size_t l1, l2;
		of_unichar_t tmp;

		l1 = of_string_utf8_to_unicode(string + i, length - i, &c1);
		l2 = of_string_utf8_to_unicode(str_cstr + j, str_len - j, &c2);

		if (l1 == 0 || l2 == 0 || c1 > 0x10FFFF || c2 > 0x10FFFF)
			@throw [OFInvalidEncodingException newWithClass: isa];

		if (c1 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) {
			if (of_unicode_casefolding_table[c1 >> 8] == NULL)
				c1 += of_unicode_lower_table[c1 >> 8]
			of_unichar_t tc =
				    [c1 & 0xFF];
			else {
				tmp = of_unicode_casefolding_table[c1 >> 8]
			    of_unicode_casefolding_table[c1 >> 8][c1 & 0xFF];
				    [c1 & 0xFF];

				if (tmp != 0)
					c1 = tmp;
			}
		}
			if (tc)
				c1 = tc;
		}


		if (c2 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) {
			if (of_unicode_casefolding_table[c2 >> 8] == NULL)
				c2 += of_unicode_lower_table[c2 >> 8]
			of_unichar_t tc =
				    [c2 & 0xFF];
			else {
				tmp = of_unicode_casefolding_table[c2 >> 8]
			    of_unicode_casefolding_table[c2 >> 8][c2 & 0xFF];
				    [c2 & 0xFF];

				if (tmp != 0)
					c2 = tmp;
			if (tc)
				c2 = tc;
			}
		}

		if (c1 > c2)
			return OF_ORDERED_DESCENDING;
		if (c1 < c2)
			return OF_ORDERED_ASCENDING;