QUrl: enable (N)RVO for gcc
Change-Id: Ie0fba08ce55a3c60a5b1565986c4280f065c7b2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
7abb90a70a
commit
2f595a0178
|
|
@ -2046,14 +2046,15 @@ void QUrl::setAuthority(const QString &authority, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::authority(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
QString result;
|
||||
if (!d)
|
||||
return result;
|
||||
|
||||
if (options == QUrl::FullyDecoded) {
|
||||
qWarning("QUrl::authority(): QUrl::FullyDecoded is not permitted in this function");
|
||||
return QString();
|
||||
return result;
|
||||
}
|
||||
|
||||
QString result;
|
||||
d->appendAuthority(result, options, QUrlPrivate::Authority);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -2119,14 +2120,15 @@ void QUrl::setUserInfo(const QString &userInfo, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::userInfo(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
QString result;
|
||||
if (!d)
|
||||
return result;
|
||||
|
||||
if (options == QUrl::FullyDecoded) {
|
||||
qWarning("QUrl::userInfo(): QUrl::FullyDecoded is not permitted in this function");
|
||||
return QString();
|
||||
return result;
|
||||
}
|
||||
|
||||
QString result;
|
||||
d->appendUserInfo(result, options, QUrlPrivate::UserInfo);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -2188,10 +2190,9 @@ void QUrl::setUserName(const QString &userName, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::userName(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendUserName(result, options);
|
||||
if (d)
|
||||
d->appendUserName(result, options);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -2281,10 +2282,9 @@ void QUrl::setPassword(const QString &password, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::password(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendPassword(result, options);
|
||||
if (d)
|
||||
d->appendPassword(result, options);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -2389,12 +2389,12 @@ void QUrl::setHost(const QString &host, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::host(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendHost(result, options);
|
||||
if (result.startsWith(QLatin1Char('[')))
|
||||
return result.mid(1, result.length() - 2);
|
||||
if (d) {
|
||||
d->appendHost(result, options);
|
||||
if (result.startsWith(QLatin1Char('[')))
|
||||
result = result.mid(1, result.length() - 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -2534,10 +2534,9 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::path(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendPath(result, options, QUrlPrivate::Path);
|
||||
if (d)
|
||||
d->appendPath(result, options, QUrlPrivate::Path);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -2977,12 +2976,12 @@ void QUrl::setQuery(const QUrlQuery &query)
|
|||
*/
|
||||
QString QUrl::query(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendQuery(result, options, QUrlPrivate::Query);
|
||||
if (d->hasQuery() && result.isNull())
|
||||
result.detach();
|
||||
if (d) {
|
||||
d->appendQuery(result, options, QUrlPrivate::Query);
|
||||
if (d->hasQuery() && result.isNull())
|
||||
result.detach();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -3050,12 +3049,12 @@ void QUrl::setFragment(const QString &fragment, ParsingMode mode)
|
|||
*/
|
||||
QString QUrl::fragment(ComponentFormattingOptions options) const
|
||||
{
|
||||
if (!d) return QString();
|
||||
|
||||
QString result;
|
||||
d->appendFragment(result, options, QUrlPrivate::Fragment);
|
||||
if (d->hasFragment() && result.isNull())
|
||||
result.detach();
|
||||
if (d) {
|
||||
d->appendFragment(result, options, QUrlPrivate::Fragment);
|
||||
if (d->hasFragment() && result.isNull())
|
||||
result.detach();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -3272,9 +3271,10 @@ QString QUrl::url(FormattingOptions options) const
|
|||
*/
|
||||
QString QUrl::toString(FormattingOptions options) const
|
||||
{
|
||||
QString url;
|
||||
if (!isValid()) {
|
||||
// also catches isEmpty()
|
||||
return QString();
|
||||
return url;
|
||||
}
|
||||
if (options == QUrl::FullyDecoded) {
|
||||
qWarning("QUrl: QUrl::FullyDecoded is not permitted when reconstructing the full URL");
|
||||
|
|
@ -3291,11 +3291,10 @@ QString QUrl::toString(FormattingOptions options) const
|
|||
&& (!d->hasQuery() || options.testFlag(QUrl::RemoveQuery))
|
||||
&& (!d->hasFragment() || options.testFlag(QUrl::RemoveFragment))
|
||||
&& isLocalFile()) {
|
||||
return d->toLocalFile(options);
|
||||
url = d->toLocalFile(options);
|
||||
return url;
|
||||
}
|
||||
|
||||
QString url;
|
||||
|
||||
// for the full URL, we consider that the reserved characters are prettier if encoded
|
||||
if (options & DecodeReserved)
|
||||
options &= ~EncodeReserved;
|
||||
|
|
@ -4036,16 +4035,17 @@ static inline void appendComponentIfPresent(QString &msg, bool present, const ch
|
|||
*/
|
||||
QString QUrl::errorString() const
|
||||
{
|
||||
QString msg;
|
||||
if (!d)
|
||||
return QString();
|
||||
return msg;
|
||||
|
||||
QString errorSource;
|
||||
int errorPosition = 0;
|
||||
QUrlPrivate::ErrorCode errorCode = d->validityError(&errorSource, &errorPosition);
|
||||
if (errorCode == QUrlPrivate::NoError)
|
||||
return QString();
|
||||
return msg;
|
||||
|
||||
QString msg = errorMessage(errorCode, errorSource, errorPosition);
|
||||
msg += errorMessage(errorCode, errorSource, errorPosition);
|
||||
msg += QLatin1String("; source was \"");
|
||||
msg += errorSource;
|
||||
msg += QLatin1String("\";");
|
||||
|
|
|
|||
Loading…
Reference in New Issue