ObjFW  Diff

Differences From Artifact [e24ed84b06]:

To Artifact [8a551b940b]:


190
191
192
193
194
195
196










197
198
199
200
201
202
203
	delegate = delegate_;
}

- (void)parseBuffer: (const char*)buf
	   withSize: (size_t)size
{
	size_t i, last = 0;











	for (i = 0; i < size; i++)
		lookup_table[state](self, selectors[state], buf, &i, &last);

	/* In OF_XMLPARSER_IN_TAG, there can be only spaces */
	if (size - last > 0 && state != OF_XMLPARSER_IN_TAG)
		[cache appendCStringWithoutUTF8Checking: buf + last







>
>
>
>
>
>
>
>
>
>







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	delegate = delegate_;
}

- (void)parseBuffer: (const char*)buf
	   withSize: (size_t)size
{
	size_t i, last = 0;

	if (finishedParsing) {
		for (i = 0; i < size; i++)
			if (buf[i] != ' ' && buf[i] != '\t' &&
			    buf[i] != '\n' && buf[i] != '\r')
				@throw [OFMalformedXMLException
				    newWithClass: isa];

		return;
	}

	for (i = 0; i < size; i++)
		lookup_table[state](self, selectors[state], buf, &i, &last);

	/* In OF_XMLPARSER_IN_TAG, there can be only spaces */
	if (size - last > 0 && state != OF_XMLPARSER_IN_TAG)
		[cache appendCStringWithoutUTF8Checking: buf + last
495
496
497
498
499
500
501



502
503
504
505
506
507
508
	[prefix release];
	name = prefix = nil;

	*last = *i + 1;
	state = (buf[*i] == '>'
	    ? OF_XMLPARSER_OUTSIDE_TAG
	    : OF_XMLPARSER_EXPECT_SPACE_OR_CLOSE);



}

/* Inside a tag, name found */
- (void)_parseInTagWithBuffer: (const char*)buf
			    i: (size_t*)i
			 last: (size_t*)last
{







>
>
>







505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
	[prefix release];
	name = prefix = nil;

	*last = *i + 1;
	state = (buf[*i] == '>'
	    ? OF_XMLPARSER_OUTSIDE_TAG
	    : OF_XMLPARSER_EXPECT_SPACE_OR_CLOSE);

	if ([previous count] == 0)
		finishedParsing = YES;
}

/* Inside a tag, name found */
- (void)_parseInTagWithBuffer: (const char*)buf
			    i: (size_t*)i
			 last: (size_t*)last
{
875
876
877
878
879
880
881





882
883
884
885
886
887
888
			state = OF_XMLPARSER_OUTSIDE_TAG;
		else
			level--;
	}

	*last = *i + 1;
}






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







>
>
>
>
>







888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
			state = OF_XMLPARSER_OUTSIDE_TAG;
		else
			level--;
	}

	*last = *i + 1;
}

- (BOOL)finishedParsing
{
	return finishedParsing;
}

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