Fix unreachable code

Coverity issues 23292 and 23297.
This commit is contained in:
Jean-Marc 2015-09-12 18:05:08 +02:00
parent a22f7b7001
commit eba0bbe503

View File

@ -1074,18 +1074,20 @@ String const doSplit(String const & a, String & piece, Char delim)
size_t i = a.find(delim);
if (i == a.length() - 1) {
piece = a.substr(0, i);
} else if (i != String::npos) {
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else if (i == 0) {
piece.erase();
tmp = a.substr(i + 1);
} else if (i != String::npos) {
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else {
piece = a;
}
return tmp;
}
// FIXME: why is this specialization needed?
template<typename Char> inline
docstring const doSplit(docstring const & a, docstring & piece, Char delim)
{
@ -1093,12 +1095,12 @@ docstring const doSplit(docstring const & a, docstring & piece, Char delim)
size_t i = a.find(delim);
if (i == a.length() - 1) {
piece = a.substr(0, i);
} else if (i != docstring::npos) {
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else if (i == 0) {
piece.erase();
tmp = a.substr(i + 1);
} else if (i != docstring::npos) {
piece = a.substr(0, i);
tmp = a.substr(i + 1);
} else {
piece = a;
}