Change QUrlPrivate::setAuthority to return void
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 20 Sep 2012 13:59:46 +0000 (15:59 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 2 Oct 2012 20:34:42 +0000 (22:34 +0200)
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>
src/corelib/io/qurl.cpp
src/corelib/io/qurl_p.h

index e78d810..4cedb84 100644 (file)
@@ -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)
index 12ab0c7..780fb38 100644 (file)
@@ -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);