summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-22 14:41:54 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-22 14:41:54 (GMT)
commitbb878bb1ee9a5272359e88d44806971e13c31486 (patch)
treeef823d980775448085d8f2130027a46cd08dafe8
parentb7ba409b0dabd382876310a6c110a96cf0e3c6bf (diff)
parent42f7c123e95c6d9f1d0ece648f61defa79627ab8 (diff)
downloadQt-bb878bb1ee9a5272359e88d44806971e13c31486.zip
Qt-bb878bb1ee9a5272359e88d44806971e13c31486.tar.gz
Qt-bb878bb1ee9a5272359e88d44806971e13c31486.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: We also don't need to watch for org.freedesktop.DBus changing owners Avoid adding match rules for NameAcquired and NameLost We don't need to add a match rule to receive messages targetted at us. Save the D-Bus's base service earlier. Pre-populate the watched services hash with org.freedesktop.DBus Quick performance optimisation: cache a QString with "org.freedesktop.DBus" XML schema internals: fix memory leak QNAM: Use QFileNetworkReply for qrc:/ URL schema Make the de-inlined isRightToLeft not get called from updateProperties Update the ICC mkspec: keep the stack aligned to 16-byte
-rw-r--r--mkspecs/linux-icc/qmake.conf2
-rw-r--r--src/corelib/tools/qstring.cpp43
-rw-r--r--src/dbus/qdbusconnection_p.h3
-rw-r--r--src/dbus/qdbusintegrator.cpp76
-rw-r--r--src/network/access/qfilenetworkreply.cpp5
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp4
-rw-r--r--src/xmlpatterns/schema/qxsdtypechecker.cpp1
7 files changed, 76 insertions, 58 deletions
diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf
index 3b26f7d..af56a9a 100644
--- a/mkspecs/linux-icc/qmake.conf
+++ b/mkspecs/linux-icc/qmake.conf
@@ -21,7 +21,7 @@ QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS =
+QMAKE_CFLAGS = -falign-stack=maintain-16-byte
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125
QMAKE_CFLAGS_WARN_OFF = -w
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3521b31..5be885b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -6941,6 +6941,27 @@ QString QString::multiArg(int numArgs, const QString **args) const
return result;
}
+static bool isStringRightToLeft(const ushort *p, const ushort *end)
+{
+ bool righttoleft = false;
+ while (p < end) {
+ switch(QChar::direction(*p))
+ {
+ case QChar::DirL:
+ goto end;
+ case QChar::DirR:
+ case QChar::DirAL:
+ righttoleft = true;
+ goto end;
+ default:
+ break;
+ }
+ ++p;
+ }
+ end:
+ return righttoleft;
+}
+
/*! \internal
*/
void QString::updateProperties() const
@@ -6957,31 +6978,13 @@ void QString::updateProperties() const
p++;
}
- d->righttoleft = isRightToLeft();
+ d->righttoleft = isStringRightToLeft(d->data, d->data + d->size);
d->clean = true;
}
bool QString::isRightToLeft() const
{
- ushort *p = d->data;
- const ushort * const end = p + d->size;
- bool righttoleft = false;
- while (p < end) {
- switch(QChar::direction(*p))
- {
- case QChar::DirL:
- goto end;
- case QChar::DirR:
- case QChar::DirAL:
- righttoleft = true;
- goto end;
- default:
- break;
- }
- ++p;
- }
- end:
- return righttoleft;
+ return isStringRightToLeft(d->data, d->data + d->size);
}
/*! \fn bool QString::isSimpleText() const
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 81af2c7..1bd00da 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -160,6 +160,9 @@ public:
struct WatchedServiceData {
WatchedServiceData() : refcount(0) {}
+ WatchedServiceData(const QString &owner, int refcount = 0)
+ : owner(owner), refcount(refcount)
+ {}
QString owner;
int refcount;
};
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 3833874..31588e7 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -71,6 +71,17 @@ QT_BEGIN_NAMESPACE
static bool isDebugging;
#define qDBusDebug if (!::isDebugging); else qDebug
+Q_GLOBAL_STATIC_WITH_ARGS(const QString, orgFreedesktopDBusString, (QLatin1String(DBUS_SERVICE_DBUS)))
+
+static inline QString dbusServiceString()
+{ return *orgFreedesktopDBusString(); }
+static inline QString dbusInterfaceString()
+{
+ // it's the same string, but just be sure
+ Q_ASSERT(*orgFreedesktopDBusString() == QLatin1String(DBUS_INTERFACE_DBUS));
+ return *orgFreedesktopDBusString();
+}
+
static inline QDebug operator<<(QDebug dbg, const QThread *th)
{
dbg.nospace() << "QThread(ptr=" << (void*)th;
@@ -962,6 +973,14 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
QDBusMetaTypeId::init();
rootNode.flags = 0;
+
+ // prepopulate watchedServices:
+ // we know that the owner of org.freedesktop.DBus is itself
+ watchedServices.insert(dbusServiceString(), WatchedServiceData(dbusServiceString(), 1));
+
+ // prepopulate matchRefCounts:
+ // we know that org.freedesktop.DBus will never change owners
+ matchRefCounts.insert("type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.freedesktop.DBus'", 1);
}
QDBusConnectionPrivate::~QDBusConnectionPrivate()
@@ -1646,43 +1665,34 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
connection = dbc;
mode = ClientMode;
+ const char *service = q_dbus_bus_get_unique_name(connection);
+ Q_ASSERT(service);
+ baseService = QString::fromUtf8(service);
+
q_dbus_connection_set_exit_on_disconnect(connection, false);
q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch,
qDBusToggleWatch, this, 0);
q_dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, this, 0);
q_dbus_connection_set_dispatch_status_function(connection, qDBusUpdateDispatchStatus, this, 0);
+ q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
- // Initialize the match rules
- // We want all messages that have us as destination
- // signals don't have destinations, but connectSignal() takes care of them
- const char *service = q_dbus_bus_get_unique_name(connection);
- if (service) {
- QVarLengthArray<char, 56> filter;
- filter.append("destination='", 13);
- filter.append(service, qstrlen(service));
- filter.append("\'\0", 2);
-
- QDBusErrorInternal error;
- q_dbus_bus_add_match(connection, filter.constData(), error);
- if (handleError(error)) {
- closeConnection();
- return;
- }
-
- baseService = QString::fromUtf8(service);
- } else {
- qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service");
- }
-
- QString busService = QLatin1String(DBUS_SERVICE_DBUS);
- connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
- this, SLOT(registerService(QString)));
- connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
- this, SLOT(unregisterService(QString)));
+ // Initialize the hooks for the NameAcquired and NameLost signals
+ // we don't use connectSignal here because we don't need the rules to be sent to the bus
+ // the bus will always send us these two signals
+ SignalHook hook;
+ hook.service = dbusServiceString();
+ hook.path.clear(); // no matching
+ hook.obj = this;
+ hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void
+ hook.midx = staticMetaObject.indexOfSlot("registerService(QString)");
+ Q_ASSERT(hook.midx != -1);
+ signalHooks.insert(QLatin1String("NameAcquired:" DBUS_INTERFACE_DBUS), hook);
- q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
+ hook.midx = staticMetaObject.indexOfSlot("unregisterService(QString)");
+ Q_ASSERT(hook.midx != -1);
+ signalHooks.insert(QLatin1String("NameLost:" DBUS_INTERFACE_DBUS), hook);
qDBusDebug() << this << ": connected successfully";
@@ -2069,8 +2079,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
if (++data.refcount == 1) {
// we need to watch for this service changing
- QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
- connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
+ connectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
data.owner = getNameOwnerNoCache(hook.service);
@@ -2149,8 +2158,7 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it)
if (sit != watchedServices.end()) {
if (--sit.value().refcount == 0) {
watchedServices.erase(sit);
- QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
- disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
+ disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
@@ -2272,8 +2280,8 @@ QString QDBusConnectionPrivate::getNameOwner(const QString& serviceName)
QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName)
{
- QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS),
- QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS),
+ QDBusMessage msg = QDBusMessage::createMethodCall(dbusServiceString(),
+ QLatin1String(DBUS_PATH_DBUS), dbusInterfaceString(),
QLatin1String("GetNameOwner"));
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << serviceName;
diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp
index 4ac9a8c..00bd29e 100644
--- a/src/network/access/qfilenetworkreply.cpp
+++ b/src/network/access/qfilenetworkreply.cpp
@@ -97,7 +97,10 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req
QString fileName = url.toLocalFile();
if (fileName.isEmpty()) {
- fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery);
+ if (url.scheme() == QLatin1String("qrc"))
+ fileName = QLatin1Char(':') + url.path();
+ else
+ fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery);
}
QFileInfo fi(fileName);
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index b35c318..a637474 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -946,10 +946,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// fast path for GET on file:// URLs
// Also if the scheme is empty we consider it a file.
- // The QNetworkAccessFileBackend will right now only be used
- // for PUT or qrc://
+ // The QNetworkAccessFileBackend will right now only be used for PUT
if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation)
&& (req.url().scheme() == QLatin1String("file")
+ || req.url().scheme() == QLatin1String("qrc")
|| req.url().scheme().isEmpty())) {
return new QFileNetworkReply(this, req, op);
}
diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp
index 4bb03f5..217932e 100644
--- a/src/xmlpatterns/schema/qxsdtypechecker.cpp
+++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp
@@ -171,6 +171,7 @@ XsdTypeChecker::XsdTypeChecker(const XsdSchemaContext::Ptr &context, const QVect
XsdTypeChecker::~XsdTypeChecker()
{
+ delete m_reflection;
}
QString XsdTypeChecker::normalizedValue(const QString &value, const XsdFacet::Hash &facets)