ObjFW  Diff

Differences From Artifact [686f9660a5]:

To Artifact [bafad23096]:


90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110


111
112
113
114
115
116
117
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
118







-
+












-
+
+







		@selector(_parseInCloseTagNameWithBuffer:i:last:),
		@selector(_parseInTagWithBuffer:i:last:),
		@selector(_parseInAttributeNameWithBuffer:i:last:),
		@selector(_parseExpectDelimiterWithBuffer:i:last:),
		@selector(_parseInAttributeValueWithBuffer:i:last:),
		@selector(_parseExpectCloseWithBuffer:i:last:),
		@selector(_parseExpectSpaceOrCloseWithBuffer:i:last:),
		@selector(_parseInCDATAOrCommentWithBuffer:i:last:),
		@selector(_parseInExclamationMarkWithBuffer:i:last:),
		@selector(_parseInCDATAOpening1WithBuffer:i:last:),
		@selector(_parseInCDATAOpening2WithBuffer:i:last:),
		@selector(_parseInCDATAOpening3WithBuffer:i:last:),
		@selector(_parseInCDATAOpening4WithBuffer:i:last:),
		@selector(_parseInCDATAOpening5WithBuffer:i:last:),
		@selector(_parseInCDATAOpening6WithBuffer:i:last:),
		@selector(_parseInCDATA1WithBuffer:i:last:),
		@selector(_parseInCDATA2WithBuffer:i:last:),
		@selector(_parseInCDATA3WithBuffer:i:last:),
		@selector(_parseInCommentOpeningWithBuffer:i:last:),
		@selector(_parseInComment1WithBuffer:i:last:),
		@selector(_parseInComment2WithBuffer:i:last:),
		@selector(_parseInComment3WithBuffer:i:last:)
		@selector(_parseInComment3WithBuffer:i:last:),
		@selector(_parseInDoctypeWithBuffer:i:last:),
	};
	memcpy(selectors, sels, sizeof(sels));

	for (i = 0; i < OF_XMLPARSER_NUM_STATES; i++) {
		if (![self instancesRespondToSelector: selectors[i]])
			@throw [OFInitializationFailedException
			    newWithClass: self];
332
333
334
335
336
337
338
339

340
341
342
343
344
345
346
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347







-
+







			break;
		case '/':
			*last = *i + 1;
			state = OF_XMLPARSER_IN_CLOSE_TAG_NAME;
			break;
		case '!':
			*last = *i + 1;
			state = OF_XMLPARSER_IN_CDATA_OR_COMMENT;
			state = OF_XMLPARSER_IN_EXCLAMATIONMARK;
			break;
		default:
			state = OF_XMLPARSER_IN_TAG_NAME;
			(*i)--;
			break;
	}
}
711
712
713
714
715
716
717
718
719
720
721




722
723
724
725
726



727

728
729
730
731
732
733
734
712
713
714
715
716
717
718




719
720
721
722
723
724
725
726
727
728
729
730

731
732
733
734
735
736
737
738







-
-
-
-
+
+
+
+





+
+
+
-
+







	if (buf[*i] == '>') {
		*last = *i + 1;
		state = OF_XMLPARSER_OUTSIDE_TAG;
	} else if (buf[*i] != ' ' && buf[*i] != '\n' && buf[*i] != '\r')
		@throw [OFMalformedXMLException newWithClass: isa];
}

/* CDATA or comment */
- (void)_parseInCDATAOrCommentWithBuffer: (const char*)buf
				       i: (size_t*)i
				    last: (size_t*)last
/* In <! */
- (void)_parseInExclamationMarkWithBuffer: (const char*)buf
					i: (size_t*)i
				     last: (size_t*)last
{
	if (buf[*i] == '-')
		state = OF_XMLPARSER_IN_COMMENT_OPENING;
	else if (buf[*i] == '[')
		state = OF_XMLPARSER_IN_CDATA_OPENING_1;
	else if (buf[*i] == 'D') {
		state = OF_XMLPARSER_IN_DOCTYPE;
		level = 0;
	else
	} else
		@throw [OFMalformedXMLException newWithClass: isa];

	*last = *i + 1;
}

/* CDATA */
- (void)_parseInCDATAOpening1WithBuffer: (const char*)buf
925
926
927
928
929
930
931























932
933
934
935
936
937
938
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







	[pool release];

	[cache setToCString: ""];

	*last = *i + 1;
	state = OF_XMLPARSER_OUTSIDE_TAG;
}

/* In <!DOCTYPE ...> */
- (void)_parseInDoctypeWithBuffer: (const char*)buf
				i: (size_t*)i
			     last: (size_t*)last
{
	if ((level < 6 && buf[*i] != "OCTYPE"[level]) ||
	    (level == 6 && buf[*i] != ' ' && buf[*i] != '\t' &&
	    buf[*i] != '\n' && buf[*i] != '\r'))
		@throw [OFMalformedXMLException newWithClass: isa];

	if (level < 7 || buf[*i] == '<')
		level++;

	if (buf[*i] == '>') {
		if (level == 7)
			state = OF_XMLPARSER_OUTSIDE_TAG;
		else
			level--;
	}

	*last = *i + 1;
}

-	   (OFString*)string: (OFString*)string
  containsUnknownEntityNamed: (OFString*)entity
{
#ifdef OF_HAVE_BLOCKS
	if (unknownEntityHandler != NULL)
		return unknownEntityHandler(self, entity);