Change QUrlPrivate::setAuthority to return void
It used to return bool because setHost returns bool and, therefore, setAuthority could fail. However, the return value is never checked, in either parse() or QUrl::setAuthority(), because there's no error recovery. This is a small optimisation. Change-Id: I25660d66cfad64ca5b9706cc38afa0e97ba3ee0b Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: David Faure <faure@kde.org>bb10
parent
ceca141d0c
commit
9bbccf5d74
|
|
@ -709,7 +709,7 @@ bool QUrlPrivate::setScheme(const QString &value, int len)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode)
|
||||
inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode)
|
||||
{
|
||||
sectionHasError &= ~Authority;
|
||||
sectionIsPresent &= ~Authority;
|
||||
|
|
@ -719,7 +719,7 @@ bool QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::Par
|
|||
password.clear();
|
||||
host.clear();
|
||||
port = -1;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
int userInfoIndex = auth.indexOf(QLatin1Char('@'), from);
|
||||
|
|
@ -769,7 +769,7 @@ bool QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::Par
|
|||
port = -1;
|
||||
}
|
||||
|
||||
return setHost(auth, from, qMin<uint>(end, colonIndex), mode) && !(sectionHasError & Port);
|
||||
setHost(auth, from, qMin<uint>(end, colonIndex), mode);
|
||||
}
|
||||
|
||||
void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
// the "end" parameters are like STL iterators: they point to one past the last valid element
|
||||
bool setScheme(const QString &value, int len);
|
||||
bool setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode);
|
||||
void setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode);
|
||||
void setUserInfo(const QString &userInfo, int from, int end);
|
||||
void setUserName(const QString &value, int from, int end);
|
||||
void setPassword(const QString &value, int from, int end);
|
||||
|
|
|
|||
Loading…
Reference in New Issue