support CDATA in xml parser
This commit is contained in:
parent
fbbdc46e19
commit
ea04fbb22c
|
@ -1,3 +1,4 @@
|
|||
* supporr CDATA tags in xml parser
|
||||
* use a python python dictionary for settings instead of session_settings object (in python bindings)
|
||||
* optimized metadata transfer (magnet link) startup time (shaved off about 1 second)
|
||||
* optimized swarm startup time (shaved off about 1 second)
|
||||
|
|
|
@ -81,6 +81,29 @@ namespace libtorrent
|
|||
|
||||
// skip '<'
|
||||
++p;
|
||||
if (p != end && p+8 < end && string_begins_no_case("![CDATA[", p))
|
||||
{
|
||||
// CDATA. match '![CDATA['
|
||||
p += 8;
|
||||
start = p;
|
||||
while (p != end && !string_begins_no_case("]]>", p-2)) ++p;
|
||||
|
||||
// parse error
|
||||
if (p == end)
|
||||
{
|
||||
token = xml_parse_error;
|
||||
start = "unexpected end of file";
|
||||
callback(token, start, val_start);
|
||||
break;
|
||||
}
|
||||
|
||||
token = xml_string;
|
||||
char tmp = p[-2];
|
||||
p[-2] = 0;
|
||||
callback(token, start, val_start);
|
||||
p[-2] = tmp;
|
||||
continue;
|
||||
}
|
||||
|
||||
// parse the name of the tag.
|
||||
for (start = p; p != end && *p != '>' && !isspace(*p); ++p);
|
||||
|
@ -202,7 +225,6 @@ namespace libtorrent
|
|||
*i = save;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue