ObjFW  Diff

Differences From Artifact [0b43a03a38]:

To Artifact [2b9f485fcd]:


728
729
730
731
732
733
734

735
736
737
738
739
740
741
{
	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];
	}








>







728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
{
	int i = 0;
	intmax_t num = 0;

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

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

757
758
759
760
761
762
763

764
765
766
767
768
769
770
		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);







>







758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
		i = 2;
	else if (length >= 1 && (string[0] == 'x' || string[0] == '$'))
		i = 1;

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

	/* FIXME: Add overflow check */
	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);