ObjFW  Diff

Differences From Artifact [b88d3c3e4d]:

To Artifact [fd0de86dc5]:


719
720
721
722
723
724
725



















































726
727
728
729
730
731
732
	}
	[array addObject: [OFString stringWithCString: string + last]];

	[pool release];

	return array;
}




















































- setToCString: (const char*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
	}
	[array addObject: [OFString stringWithCString: string + last]];

	[pool release];

	return array;
}

- (intmax_t)decimalValueAsInteger
{
	int i = 0;
	intmax_t num = 0;

	if (string[0] == '-')
		i++;

	for (; i < length; i++) {
		if (string[i] >= '0' && string[i] <= '9')
			num = (num * 10) + (string[i] - '0');
		else
			@throw [OFInvalidEncodingException newWithClass: isa];
	}

	if (string[0] == '-')
		num *= -1;

	return num;
}

- (intmax_t)hexadecimalValueAsInteger
{
	int i = 0;
	intmax_t num = 0;

	if (length == 0)
		return 0;

	if (length >= 2 && string[0] == '0' && string[1] == 'x')
		i = 2;
	else if (length >= 1 && (string[0] == 'x' || string[0] == '$'))
		i = 1;

	if (i == length)
		@throw [OFInvalidEncodingException newWithClass: isa];

	for (; i < length; i++) {
		if (string[i] >= '0' && string[i] <= '9')
			num = (num << 4) | (string[i] - '0');
		else if (string[i] >= 'A' && string[i] <= 'F')
			num = (num << 4) | (string[i] - 'A' + 10);
		else if (string[i] >= 'a' && string[i] <= 'f')
			num = (num << 4) | (string[i] - 'a' + 10);
		else
			@throw [OFInvalidEncodingException newWithClass: isa];
	}

	return num;
}

- setToCString: (const char*)str
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}