ObjFW  Diff

Differences From Artifact [b90943c641]:

To Artifact [7793b455ee]:


775
776
777
778
779
780
781
782
783
784
785
786
787

788
789
790
791
792
793
794
795
796
797
798
799

800
801
802
803





804
805
806
807
808
809
810
811
812
813
814
815

816
817
818
819
820
821
822
823
824
825
826
827

828
829
830
831





832
833
834
835
836
837
838
775
776
777
778
779
780
781






782
783
784
785
786
787
788
789
790
791
792
793

794


795
796
797
798
799
800
801
802
803
804
805
806
807






808
809
810
811
812
813
814
815
816
817
818
819

820


821
822
823
824
825
826
827
828
829
830
831
832
833
834







-
-
-
-
-
-
+











-
+
-
-


+
+
+
+
+






-
-
-
-
-
-
+











-
+
-
-


+
+
+
+
+







{
	if (s != NULL && s->freeWhenDone != NULL)
		free(s->freeWhenDone);

	[super dealloc];
}

- (const char*)UTF8String
{
	return s->cString;
}

- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding
- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding
{
	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:
		return s->cString;
	case OF_STRING_ENCODING_ASCII:
		if (s->isUTF8)
			@throw [OFInvalidEncodingException
			    exceptionWithClass: [self class]];

		return s->cString;
	default:
		@throw [OFNotImplementedException
		return [super cStringUsingEncoding: encoding];
		    exceptionWithClass: [self class]
			      selector: _cmd];
	}
}

- (const char*)UTF8String
{
	return s->cString;
}

- (size_t)length
{
	return s->length;
}

- (size_t)UTF8StringLength
{
	return s->cStringLength;
}

- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding
- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding
{
	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:
		return s->cStringLength;
	case OF_STRING_ENCODING_ASCII:
		if (s->isUTF8)
			@throw [OFInvalidEncodingException
			    exceptionWithClass: [self class]];

		return s->cStringLength;
	default:
		@throw [OFNotImplementedException
		return [super lengthOfBytesUsingEncoding: encoding];
		    exceptionWithClass: [self class]
			      selector: _cmd];
	}
}

- (size_t)UTF8StringLength
{
	return s->cStringLength;
}

- (BOOL)isEqual: (id)object
{
	OFString_UTF8 *otherString;

	if (object == self)
		return YES;