ObjFW  Check-in [0166740a39]

Overview
Comment:We can't use isUTF8 here as it might be an OFConstString.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0166740a39b1cc0c41427fb26ef1bb9290f9b73736627e9fba776cc852a6c1cb
User & Date: js on 2010-04-30 12:56:57
Other Links: manifest | tags
Context
2010-04-30
13:07
OFNumber API improvement. check-in: e4344e3c5e user: js tags: trunk
12:56
We can't use isUTF8 here as it might be an OFConstString. check-in: 0166740a39 user: js tags: trunk
2010-04-23
14:02
Add a warning to OFStream documentation. check-in: 83b2a5d5d7 user: js tags: trunk
Changes

Modified src/OFXMLParser.m from [3568485abb] to [e53641c3ce].

508
509
510
511
512
513
514



515




516
517
518
519
520
521
522
523
524
525
526
527
	size_t i, last;
	BOOL in_entity;
	OFMutableString *ret;

	last = 0;
	in_entity = NO;
	ret = [OFMutableString string];



	((OFString*)ret)->isUTF8 = isUTF8;





	for (i = 0; i < length; i++) {
		if (!in_entity && string[i] == '&') {
			[ret appendCStringWithoutUTF8Checking: string + last
						    length: i - last];

			last = i + 1;
			in_entity = YES;
		} else if (in_entity && string[i] == ';') {
			char *entity = string + last;
			size_t len = i - last;








>
>
>
|
>
>
>
>




|







508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
	size_t i, last;
	BOOL in_entity;
	OFMutableString *ret;

	last = 0;
	in_entity = NO;
	ret = [OFMutableString string];

	switch (of_string_check_utf8(string, length)) {
	case 1:
		((OFString*)ret)->isUTF8 = YES;
		break;
	case -1:
		@throw [OFInvalidEncodingException newWithClass: isa];
	}

	for (i = 0; i < length; i++) {
		if (!in_entity && string[i] == '&') {
			[ret appendCStringWithoutUTF8Checking: string + last
						       length: i - last];

			last = i + 1;
			in_entity = YES;
		} else if (in_entity && string[i] == ';') {
			char *entity = string + last;
			size_t len = i - last;