diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-13 18:28:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-13 18:28:31 (GMT) |
commit | d012e5e808526e84507134656ca97c3884dae47b (patch) | |
tree | 9da70fead4e2b4110dee84fc1e55249ac7a81755 /src/corelib | |
parent | 0b3183427395be7dae29ba91254b00b0845b72af (diff) | |
parent | 019032c93b7397c7239ec99ec44b4923df31533b (diff) | |
download | Qt-d012e5e808526e84507134656ca97c3884dae47b.zip Qt-d012e5e808526e84507134656ca97c3884dae47b.tar.gz Qt-d012e5e808526e84507134656ca97c3884dae47b.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (25 commits)
run depend_command even if the binary has no absolute path
fix scaleFactor/totalScaleFactor in QPinchGestureRecognizer
Added velocity property to the QPanGesture.
Changed the speed property on QSwipeGesture to velocity
fix typos in comment
unbreak test
Don't add generic subdirs project twice.
Remove debug, quiet warnings.
Fix memory leaks and valgrind errors.
QStroker: Fix erroneous SvgMiterJoin behavior for parallel lines
Revert "Properly implement qobject_cast for const pointers."
Bearer management: Fix compilation with namespace.
fetch next token after class definition opening
delay next token fetching when opening namespace
don't let operator overloads confuse us
don't try to show source when no locations are given
Implement a private API for setting title widgets
Fix the bug for QSettings on Windows, to store qint32/quint32, qint64/quint64 in Windows registry.
fix CRLF
Added private API to install an x11EventFilter
...
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qsettings_win.cpp | 24 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 25 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.h | 91 |
3 files changed, 40 insertions, 100 deletions
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index de96e06..b3fe734 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -535,6 +535,15 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa break; } + case REG_QWORD: { + Q_ASSERT(data.size() == sizeof(qint64)); + qint64 i; + memcpy((char*)&i, data.constData(), sizeof(qint64)); + if (value != 0) + *value = i; + break; + } + default: qWarning("QSettings: Unknown data %d type in Windows registry", static_cast<int>(dataType)); if (value != 0) @@ -683,10 +692,19 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value) break; } - case QVariant::Int: { + case QVariant::Int: + case QVariant::UInt: { type = REG_DWORD; - int i = value.toInt(); - regValueBuff = QByteArray((const char*)&i, sizeof(int)); + qint32 i = value.toInt(); + regValueBuff = QByteArray((const char*)&i, sizeof(qint32)); + break; + } + + case QVariant::LongLong: + case QVariant::ULongLong: { + type = REG_QWORD; + qint64 i = value.toLongLong(); + regValueBuff = QByteArray((const char*)&i, sizeof(qint64)); break; } diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 74c24b5..d1fab2d 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3417,9 +3417,8 @@ QString QUrlPrivate::canonicalHost() const that->host = host.toLower(); } else { that->host = qt_ACE_do(host, NormalizeAce); - if (that->host.isNull()) - that->isHostValid = false; } + that->isHostValid = !that->host.isNull(); return that->host; } @@ -3734,6 +3733,10 @@ void QUrlPrivate::validate() const QString auth = authority(); // causes the non-encoded forms to be valid + // authority() calls canonicalHost() which sets this + if (!isHostValid) + return; + if (scheme == QLatin1String("mailto")) { if (!host.isEmpty() || port != -1 || !userName.isEmpty() || !password.isEmpty()) { that->isValid = false; @@ -3907,9 +3910,10 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const url += scheme.toLatin1(); url += ':'; } + QString savedHost = host; // pre-validation, may be invalid! QString auth = authority(); bool doFileScheme = scheme == QLatin1String("file") && encodedPath.startsWith('/'); - if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority && (!auth.isEmpty() || doFileScheme)) { + if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority && (!auth.isEmpty() || doFileScheme || !savedHost.isEmpty())) { if (doFileScheme && !encodedPath.startsWith('/')) url += '/'; url += "//"; @@ -3935,6 +3939,12 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const url += '['; url += host.toLatin1(); url += ']'; + } else if (host.isEmpty() && !savedHost.isEmpty()) { + // this case is only possible with an invalid URL + // it's here only so that we can keep the original, invalid hostname + // in encodedOriginal. + // QUrl::isValid() will return false, so toEncoded() can be anything (it's not valid) + url += savedHost.toUtf8(); } else { url += QUrl::toAce(host); } @@ -4054,7 +4064,7 @@ const QByteArray &QUrlPrivate::normalized() const QString QUrlPrivate::createErrorString() { - if (isValid) + if (isValid && isHostValid) return QString(); QString errorString(QLatin1String(QT_TRANSLATE_NOOP(QUrl, "Invalid URL \""))); @@ -4078,7 +4088,10 @@ QString QUrlPrivate::createErrorString() errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "\'")); } else { errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": ")); - errorString += QLatin1String(errorInfo._message); + if (isHostValid) + errorString += QLatin1String(errorInfo._message); + else + errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "invalid hostname")); } if (errorInfo._found) { errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ", but found \'")); @@ -4441,7 +4454,7 @@ void QUrl::setAuthority(const QString &authority) if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse(); detach(); - QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized); + QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized); d->setAuthority(authority); } diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 1b613a6..d98d1f0 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -325,95 +325,6 @@ Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QString const QMetaObject &mo, QList<void *> *list); Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo); -#if defined Q_CC_MSVC && _MSC_VER < 1300 - -template<typename T> -inline T qFindChild(const QObject *o, const QString &name, T) -{ return static_cast<T>(qt_qFindChild_helper(o, name, ((T)0)->staticMetaObject)); } - -template<typename T> -inline QList<T> qFindChildren(const QObject *o, const QString &name, T) -{ - QList<T> list; - union { - QList<T> *typedList; - QList<void *> *voidList; - } u; - u.typedList = &list; - qt_qFindChildren_helper(o, name, 0, ((T)0)->staticMetaObject, u.voidList); - return list; -} - -template<typename T> -inline T qFindChild(const QObject *o, const QString &name) -{ return qFindChild<T>(o, name, T(0)); } - -template<typename T> -inline T qFindChild(const QObject *o) -{ return qFindChild<T>(o, QString(), T(0)); } - -template<typename T> -inline QList<T> qFindChildren(const QObject *o, const QString &name) -{ return qFindChildren<T>(o, name, T(0)); } - -template<typename T> -inline QList<T> qFindChildren(const QObject *o) -{ return qFindChildren<T>(o, QString(), T(0)); } - -#ifndef QT_NO_REGEXP -template<typename T> -inline QList<T> qFindChildren(const QObject *o, const QRegExp &re, T) -{ - QList<T> list; - union { - QList<T> *typedList; - QList<void *> *voidList; - } u; - u.typedList = &list; - qt_qFindChildren_helper(o, 0, &re, ((T)0)->staticMetaObject, u.voidList); - return list; -} - -template<typename T> -inline QList<T> qFindChildren(const QObject *o, const QRegExp &re) -{ return qFindChildren<T>(o, re, T(0)); } - -#endif - -#ifdef Q_MOC_RUN -# define Q_DECLARE_INTERFACE(IFace, IId) Q_DECLARE_INTERFACE(IFace, IId) -#endif // Q_MOC_RUN - - -template <class T> inline const char * qobject_interface_iid() -{ return 0; } - -template <class T> inline T qobject_cast_helper(QObject *object, T) -{ return static_cast<T>(((T)0)->staticMetaObject.cast(object)); } - -template <class T> inline T qobject_cast_helper(const QObject *object, T) -{ return static_cast<T>(const_cast<const QObject *>(((T)0)->staticMetaObject.cast(const_cast<QObject *>(object)))); } - -template <class T> -inline T qobject_cast(QObject *object) -{ return qobject_cast_helper<T>(object, T(0)); } - -template <class T> -inline T qobject_cast(const QObject *object) -{ return qobject_cast_helper<T>(object, T(0)); } - -#ifndef Q_MOC_RUN -# define Q_DECLARE_INTERFACE(IFace, IId) \ - template <> inline const char *qobject_interface_iid<IFace *>() \ - { return IId; } \ - template <> inline IFace *qobject_cast_helper<IFace *>(QObject *object, IFace *) \ - { return (IFace *)(object ? object->qt_metacast(IId) : 0); } \ - template <> inline IFace *qobject_cast_helper<IFace *>(const QObject *object, IFace *) \ - { return (IFace *)(object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0); } -#endif // Q_MOC_RUN - -#else - template<typename T> inline T qFindChild(const QObject *o, const QString &name) { return static_cast<T>(qt_qFindChild_helper(o, name, reinterpret_cast<T>(0)->staticMetaObject)); } @@ -482,8 +393,6 @@ template <class T> inline const char * qobject_interface_iid() { return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : 0)); } #endif // Q_MOC_RUN -#endif - #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug, const QObject *); #endif |