* Optimized view filtering and sorting.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1213 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2011-04-20 15:14:02 +00:00
parent 8e15749d0c
commit ea9dc35bbe
10 changed files with 200 additions and 115 deletions
+20 -18
View File
@@ -67,32 +67,34 @@ parse_string(const char* first, const char* last, std::string* dest, bool (*deli
if (first == last)
return first;
bool quoted = parse_is_quote(*first);
if (quoted)
if (parse_is_quote(*first)) {
first++;
while (first != last) {
if (quoted) {
while (first != last) {
if (parse_is_quote(*first))
return ++first;
} else {
if (delim(*first))
return first;
}
if (parse_is_escape(*first) && ++first == last)
throw torrent::input_error("Escape character at end of input.");
if (parse_is_escape(*first) && ++first == last)
throw torrent::input_error("Escape character at end of input.");
dest->push_back(*first++);
}
dest->push_back(*first);
first++;
}
if (quoted)
throw torrent::input_error("Missing closing quote.");
return first;
} else {
while (first != last) {
if (delim(*first))
return first;
if (parse_is_escape(*first) && ++first == last)
throw torrent::input_error("Escape character at end of input.");
dest->push_back(*first++);
}
return first;
}
}
void