ObjFW  Check-in [aba290270b]

Overview
Comment:OFXMLParser: Correctly handle spaces in attributes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aba290270bc559310a9c482aa316cb206dbc774ee623214f19cf02678ea4efd3
User & Date: js on 2010-11-21 20:30:33
Other Links: manifest | tags
Context
2010-11-24
19:45
Documentation improvements. check-in: 0769e074eb user: js tags: trunk
2010-11-21
20:30
OFXMLParser: Correctly handle spaces in attributes. check-in: aba290270b user: js tags: trunk
13:35
Add support for building plugins to objfw-compile and objfw-config. check-in: e0b3940077 user: js tags: trunk
Changes

Modified src/OFXMLParser.m from [d8c5285da7] to [d31bdbf69b].

587
588
589
590
591
592
593

594
595
596
597
598
599
600
601
602
603
604
	if (buf[*i] != '=')
		return;

	if ((len = *i - *last) > 0)
		[cache appendCStringWithoutUTF8Checking: buf + *last
						 length: len];


	cache_c = [cache cString];
	cache_len = [cache cStringLength];

	if ((tmp = memchr(cache_c, ':', cache_len)) != NULL ) {
		attrName = [[OFString alloc] initWithCString: tmp + 1
						      length: cache_len -
							      (tmp - cache_c) -
							      1];
		attrPrefix = [[OFString alloc] initWithCString: cache_c
							length: tmp - cache_c];
	} else {







>



|







587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
	if (buf[*i] != '=')
		return;

	if ((len = *i - *last) > 0)
		[cache appendCStringWithoutUTF8Checking: buf + *last
						 length: len];

	[cache removeLeadingAndTrailingWhitespaces];
	cache_c = [cache cString];
	cache_len = [cache cStringLength];

	if ((tmp = memchr(cache_c, ':', cache_len)) != NULL) {
		attrName = [[OFString alloc] initWithCString: tmp + 1
						      length: cache_len -
							      (tmp - cache_c) -
							      1];
		attrPrefix = [[OFString alloc] initWithCString: cache_c
							length: tmp - cache_c];
	} else {
613
614
615
616
617
618
619






620
621
622
623
624
625
626
627
628
629
630
631
}

/* Expecting delimiter */
- (void)_parseExpectDelimiterWithBuffer: (const char*)buf
				      i: (size_t*)i
				   last: (size_t*)last
{






	if (buf[*i] != '\'' && buf[*i] != '"')
		@throw [OFMalformedXMLException newWithClass: isa];

	delim = buf[*i];
	*last = *i + 1;
	state = OF_XMLPARSER_IN_ATTR_VALUE;
}

/* Looking for attribute value */
- (void)_parseInAttributeValueWithBuffer: (const char*)buf
				       i: (size_t*)i
				    last: (size_t*)last







>
>
>
>
>
>




<







614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630

631
632
633
634
635
636
637
}

/* Expecting delimiter */
- (void)_parseExpectDelimiterWithBuffer: (const char*)buf
				      i: (size_t*)i
				   last: (size_t*)last
{
	*last = *i + 1;

	if (buf[*i] == ' ' || buf[*i] == '\t' || buf[*i] == '\n' ||
	    buf[*i] == '\r')
		return;

	if (buf[*i] != '\'' && buf[*i] != '"')
		@throw [OFMalformedXMLException newWithClass: isa];

	delim = buf[*i];

	state = OF_XMLPARSER_IN_ATTR_VALUE;
}

/* Looking for attribute value */
- (void)_parseInAttributeValueWithBuffer: (const char*)buf
				       i: (size_t*)i
				    last: (size_t*)last