summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-11-27 23:00:12 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-11-27 23:00:12 (GMT)
commit37766cd0781218598daffeaa7fa9d1707ec14b38 (patch)
tree28f19a5eda972a7d8a4f1425983e0273716891ec
parent5e0c4463c8dc8857e9f64a1bdde9a94cd8c39c4d (diff)
parent220d13f0e83f9a70e69d95cb78711fec309e83cc (diff)
downloadQt-37766cd0781218598daffeaa7fa9d1707ec14b38.zip
Qt-37766cd0781218598daffeaa7fa9d1707ec14b38.tar.gz
Qt-37766cd0781218598daffeaa7fa9d1707ec14b38.tar.bz2
Merge branch '4.7-upstream' into 4.7-water
-rw-r--r--src/3rdparty/phonon/phonon/effectwidget.cpp2
-rw-r--r--src/3rdparty/phonon/phonon/globalconfig.cpp2
-rw-r--r--src/3rdparty/phonon/phonon/mediacontroller.cpp4
-rw-r--r--src/3rdparty/phonon/phonon/pulsesupport.cpp146
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp10
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp194
-rw-r--r--src/dbus/qdbusconnection_p.h13
-rw-r--r--src/dbus/qdbusintegrator.cpp35
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp2
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp1
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp2
-rw-r--r--src/gui/dialogs/qdialog.cpp4
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/qstyleoption.cpp4
-rw-r--r--src/gui/text/qtextformat.cpp10
-rw-r--r--src/network/socket/qlocalsocket_win.cpp4
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl_x11egl.cpp3
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp1
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp2
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp2
-rw-r--r--tests/auto/qdbusconnection/tst_qdbusconnection.cpp69
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp9
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp1
-rw-r--r--tests/auto/qsettings/tst_qsettings.cpp13
-rw-r--r--tools/shared/windows/registry.cpp3
30 files changed, 325 insertions, 229 deletions
diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp
index a2fe50f..edcbe1f 100644
--- a/src/3rdparty/phonon/phonon/effectwidget.cpp
+++ b/src/3rdparty/phonon/phonon/effectwidget.cpp
@@ -112,7 +112,7 @@ void EffectWidgetPrivate::autogenerateUi()
#endif
QWidget *control = 0;
- switch (para.type()) {
+ switch (int(para.type())) {
case QVariant::String:
{
QComboBox *cb = new QComboBox(q);
diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp
index be751ce..f83ebc4 100644
--- a/src/3rdparty/phonon/phonon/globalconfig.cpp
+++ b/src/3rdparty/phonon/phonon/globalconfig.cpp
@@ -97,7 +97,7 @@ static void filter(ObjectDescriptionType type, BackendInterface *backendIface, Q
static QList<int> sortDevicesByCategoryPriority(const GlobalConfig *config, const QSettingsGroup *backendConfig, ObjectDescriptionType type, Phonon::Category category, QList<int> &defaultList)
{
- Q_ASSERT(config);
+ Q_ASSERT(config); Q_UNUSED(config);
Q_ASSERT(backendConfig);
Q_ASSERT(type == AudioOutputDeviceType || type == AudioCaptureDeviceType);
diff --git a/src/3rdparty/phonon/phonon/mediacontroller.cpp b/src/3rdparty/phonon/phonon/mediacontroller.cpp
index 59fd5c7..37af3f7 100644
--- a/src/3rdparty/phonon/phonon/mediacontroller.cpp
+++ b/src/3rdparty/phonon/phonon/mediacontroller.cpp
@@ -76,9 +76,9 @@ MediaController::~MediaController()
MediaController::Features MediaController::supportedFeatures() const
{
if (!d || !d->media) {
- return false;
+ return Features();
}
- IFACE false;
+ IFACE Features();
Features ret;
if (iface->hasInterface(AddonInterface::AngleInterface)) {
ret |= Angles;
diff --git a/src/3rdparty/phonon/phonon/pulsesupport.cpp b/src/3rdparty/phonon/phonon/pulsesupport.cpp
index 642843f..b1ba196 100644
--- a/src/3rdparty/phonon/phonon/pulsesupport.cpp
+++ b/src/3rdparty/phonon/phonon/pulsesupport.cpp
@@ -56,7 +56,7 @@ static int debugLevel() {
static int level = -1;
if (level < 1) {
level = 0;
- QString pulseenv = qgetenv("PHONON_PULSEAUDIO_DEBUG");
+ QByteArray pulseenv = qgetenv("PHONON_PULSEAUDIO_DEBUG");
int l = pulseenv.toInt();
if (l > 0)
level = (l > 2 ? 2 : l);
@@ -71,18 +71,18 @@ static void logMessage(const QString &message, int priority, QObject *obj)
QString output;
if (obj) {
// Strip away namespace from className
- QString className(obj->metaObject()->className());
+ QByteArray className(obj->metaObject()->className());
int nameLength = className.length() - className.lastIndexOf(':') - 1;
className = className.right(nameLength);
output.sprintf("%s %s (%s %p)", message.toLatin1().constData(),
obj->objectName().toLatin1().constData(),
- className.toLatin1().constData(), obj);
+ className.constData(), obj);
}
else {
output = message;
}
if (priority <= debugLevel()) {
- qDebug() << QString("PulseSupport(%1): %2").arg(priority).arg(output);
+ qDebug() << QString::fromLatin1("PulseSupport(%1): %2").arg(priority).arg(output);
}
}
}
@@ -96,7 +96,7 @@ class AudioDevice
: pulseName(name), pulseIndex(index)
{
properties["name"] = desc;
- properties["description"] = ""; // We don't have descriptions (well we do, but we use them as the name!)
+ properties["description"] = QLatin1String(""); // We don't have descriptions (well we do, but we use them as the name!)
properties["icon"] = icon;
properties["available"] = (index != PA_INVALID_INDEX);
properties["isAdvanced"] = false; // Nothing is advanced!
@@ -158,8 +158,8 @@ static void createGenericDevices()
s_outputDevices.clear();
s_outputDevicePriorities.clear();
index = s_deviceIndexCounter++;
- s_outputDeviceIndexes.insert("sink:default", index);
- s_outputDevices.insert(index, AudioDevice("sink:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0));
+ s_outputDeviceIndexes.insert(QLatin1String("sink:default"), index);
+ s_outputDevices.insert(index, AudioDevice(QLatin1String("sink:default"), QObject::tr("PulseAudio Sound Server"), QLatin1String("audio-backend-pulseaudio"), 0));
for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) {
Phonon::Category cat = static_cast<Phonon::Category>(i);
s_outputDevicePriorities[cat].insert(0, index);
@@ -169,8 +169,8 @@ static void createGenericDevices()
s_captureDevices.clear();
s_captureDevicePriorities.clear();
index = s_deviceIndexCounter++;
- s_captureDeviceIndexes.insert("source:default", index);
- s_captureDevices.insert(index, AudioDevice("source:default", QObject::tr("PulseAudio Sound Server").toUtf8(), "audio-backend-pulseaudio", 0));
+ s_captureDeviceIndexes.insert(QLatin1String("source:default"), index);
+ s_captureDevices.insert(index, AudioDevice(QLatin1String("source:default"), QObject::tr("PulseAudio Sound Server"), QLatin1String("audio-backend-pulseaudio"), 0));
for (int i = Phonon::NoCategory; i <= Phonon::LastCategory; ++i) {
Phonon::Category cat = static_cast<Phonon::Category>(i);
s_captureDevicePriorities[cat].insert(0, index);
@@ -397,7 +397,7 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
if (pa_context_errno(c) == PA_ERR_NOENTITY)
return;
- logMessage(QString("Sink input callback failure"));
+ logMessage(QLatin1String("Sink input callback failure"));
return;
}
@@ -409,8 +409,8 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
// loop through (*i) and extract phonon->streamindex...
const char *t;
if ((t = pa_proplist_gets(i->proplist, "phonon.streamid"))) {
- logMessage(QString("Found PulseAudio stream index %1 for Phonon Output Stream %2").arg(i->index).arg(t));
- s_outputStreamIndexMap[QString(t)] = i->index;
+ logMessage(QString::fromLatin1("Found PulseAudio stream index %1 for Phonon Output Stream %2").arg(i->index).arg(QLatin1String(t)));
+ s_outputStreamIndexMap[QLatin1String(t)] = i->index;
// Find the sink's phonon index and notify whoever cares...
if (PA_INVALID_INDEX != i->sink) {
@@ -426,8 +426,8 @@ void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *us
}
if (found) {
// OK so we just emit our signal
- logMessage(QString("Letting the rest of phonon know about this"));
- s_instance->emitUsingDevice(QString(t), device);
+ logMessage(QLatin1String("Letting the rest of phonon know about this"));
+ s_instance->emitUsingDevice(QLatin1String(t), device);
}
}
}
@@ -441,7 +441,7 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
if (pa_context_errno(c) == PA_ERR_NOENTITY)
return;
- logMessage(QString("Source output callback failure"));
+ logMessage(QLatin1String("Source output callback failure"));
return;
}
@@ -453,8 +453,8 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
// loop through (*i) and extract phonon->streamindex...
const char *t;
if ((t = pa_proplist_gets(i->proplist, "phonon.streamid"))) {
- logMessage(QString("Found PulseAudio stream index %1 for Phonon Capture Stream %2").arg(i->index).arg(t));
- s_captureStreamIndexMap[QString(t)] = i->index;
+ logMessage(QString::fromLatin1("Found PulseAudio stream index %1 for Phonon Capture Stream %2").arg(i->index).arg(QLatin1String(t)));
+ s_captureStreamIndexMap[QLatin1String(t)] = i->index;
// Find the source's phonon index and notify whoever cares...
if (PA_INVALID_INDEX != i->source) {
@@ -470,8 +470,8 @@ void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, vo
}
if (found) {
// OK so we just emit our signal
- logMessage(QString("Letting the rest of phonon know about this"));
- s_instance->emitUsingDevice(QString(t), device);
+ logMessage(QLatin1String("Letting the rest of phonon know about this"));
+ s_instance->emitUsingDevice(QLatin1String(t), device);
}
}
}
@@ -486,17 +486,17 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
QString phononid = s_outputStreamIndexMap.key(index);
if (!phononid.isEmpty()) {
if (s_outputStreamIndexMap.contains(phononid)) {
- logMessage(QString("Phonon Output Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
+ logMessage(QString::fromLatin1("Phonon Output Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
s_outputStreamIndexMap[phononid] = PA_INVALID_INDEX;
} else {
- logMessage(QString("Removing Phonon Output Stream %1 (it's gone!)").arg(phononid));
+ logMessage(QString::fromLatin1("Removing Phonon Output Stream %1 (it's gone!)").arg(phononid));
s_outputStreamIndexMap.remove(phononid);
}
}
} else {
pa_operation *o;
if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, NULL))) {
- logMessage(QString("pa_context_get_sink_input_info() failed"));
+ logMessage(QLatin1String("pa_context_get_sink_input_info() failed"));
return;
}
pa_operation_unref(o);
@@ -508,17 +508,17 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
QString phononid = s_captureStreamIndexMap.key(index);
if (!phononid.isEmpty()) {
if (s_captureStreamIndexMap.contains(phononid)) {
- logMessage(QString("Phonon Capture Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
+ logMessage(QString::fromLatin1("Phonon Capture Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(phononid));
s_captureStreamIndexMap[phononid] = PA_INVALID_INDEX;
} else {
- logMessage(QString("Removing Phonon Capture Stream %1 (it's gone!)").arg(phononid));
+ logMessage(QString::fromLatin1("Removing Phonon Capture Stream %1 (it's gone!)").arg(phononid));
s_captureStreamIndexMap.remove(phononid);
}
}
} else {
pa_operation *o;
if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, NULL))) {
- logMessage(QString("pa_context_get_sink_input_info() failed"));
+ logMessage(QLatin1String("pa_context_get_sink_input_info() failed"));
return;
}
pa_operation_unref(o);
@@ -528,29 +528,27 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t
}
-static const char* statename(pa_context_state_t state)
+static QString statename(pa_context_state_t state)
{
switch (state)
{
- case PA_CONTEXT_UNCONNECTED: return "Unconnected";
- case PA_CONTEXT_CONNECTING: return "Connecting";
- case PA_CONTEXT_AUTHORIZING: return "Authorizing";
- case PA_CONTEXT_SETTING_NAME: return "Setting Name";
- case PA_CONTEXT_READY: return "Ready";
- case PA_CONTEXT_FAILED: return "Failed";
- case PA_CONTEXT_TERMINATED: return "Terminated";
+ case PA_CONTEXT_UNCONNECTED: return QLatin1String("Unconnected");
+ case PA_CONTEXT_CONNECTING: return QLatin1String("Connecting");
+ case PA_CONTEXT_AUTHORIZING: return QLatin1String("Authorizing");
+ case PA_CONTEXT_SETTING_NAME: return QLatin1String("Setting Name");
+ case PA_CONTEXT_READY: return QLatin1String("Ready");
+ case PA_CONTEXT_FAILED: return QLatin1String("Failed");
+ case PA_CONTEXT_TERMINATED: return QLatin1String("Terminated");
}
- static QString unknown;
- unknown = QString("Unknown state: %0").arg(state);
- return unknown.toAscii().constData();
+ return QString::fromLatin1("Unknown state: %0").arg(state);
}
static void context_state_callback(pa_context *c, void *)
{
Q_ASSERT(c);
- logMessage(QString("context_state_callback %1").arg(statename(pa_context_get_state(c))));
+ logMessage(QString::fromLatin1("context_state_callback %1").arg(statename(pa_context_get_state(c))));
pa_context_state_t state = pa_context_get_state(c);
if (state == PA_CONTEXT_READY) {
// We've connected to PA, so it is active
@@ -566,7 +564,7 @@ static void context_state_callback(pa_context *c, void *)
if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
(PA_SUBSCRIPTION_MASK_SINK_INPUT|
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT), NULL, NULL))) {
- logMessage(QString("pa_context_subscribe() failed"));
+ logMessage(QLatin1String("pa_context_subscribe() failed"));
return;
}
pa_operation_unref(o);
@@ -639,27 +637,27 @@ PulseSupport::PulseSupport()
{
#ifdef HAVE_PULSEAUDIO
// Initialise our map (is there a better way to do this?)
- s_roleCategoryMap["none"] = Phonon::NoCategory;
- s_roleCategoryMap["video"] = Phonon::VideoCategory;
- s_roleCategoryMap["music"] = Phonon::MusicCategory;
- s_roleCategoryMap["game"] = Phonon::GameCategory;
- s_roleCategoryMap["event"] = Phonon::NotificationCategory;
- s_roleCategoryMap["phone"] = Phonon::CommunicationCategory;
- //s_roleCategoryMap["animation"]; // No Mapping
- //s_roleCategoryMap["production"]; // No Mapping
- s_roleCategoryMap["a11y"] = Phonon::AccessibilityCategory;
+ s_roleCategoryMap[QLatin1String("none")] = Phonon::NoCategory;
+ s_roleCategoryMap[QLatin1String("video")] = Phonon::VideoCategory;
+ s_roleCategoryMap[QLatin1String("music")] = Phonon::MusicCategory;
+ s_roleCategoryMap[QLatin1String("game")] = Phonon::GameCategory;
+ s_roleCategoryMap[QLatin1String("event")] = Phonon::NotificationCategory;
+ s_roleCategoryMap[QLatin1String("phone")] = Phonon::CommunicationCategory;
+ //s_roleCategoryMap[QLatin1String("animation")]; // No Mapping
+ //s_roleCategoryMap[QLatin1String("production")]; // No Mapping
+ s_roleCategoryMap[QLatin1String("a11y")] = Phonon::AccessibilityCategory;
// To allow for easy debugging, give an easy way to disable this pulseaudio check
- QString pulseenv = qgetenv("PHONON_PULSEAUDIO_DISABLE");
+ QByteArray pulseenv = qgetenv("PHONON_PULSEAUDIO_DISABLE");
if (pulseenv.toInt()) {
- logMessage("PulseAudio support disabled: PHONON_PULSEAUDIO_DISABLE is set");
+ logMessage(QLatin1String("PulseAudio support disabled: PHONON_PULSEAUDIO_DISABLE is set"));
return;
}
// We require a glib event loop
- if (QLatin1String(QAbstractEventDispatcher::instance()->metaObject()->className())
- != "QGuiEventDispatcherGlib") {
- logMessage("Disabling PulseAudio integration for lack of GLib event loop.");
+ if (strcmp(QAbstractEventDispatcher::instance()->metaObject()->className(),
+ "QGuiEventDispatcherGlib") != 0) {
+ logMessage(QLatin1String("Disabling PulseAudio integration for lack of GLib event loop."));
return;
}
@@ -667,21 +665,21 @@ PulseSupport::PulseSupport()
// use a fully async integrated mainloop method to connect and get proper support.
pa_mainloop *p_test_mainloop;
if (!(p_test_mainloop = pa_mainloop_new())) {
- logMessage("PulseAudio support disabled: Unable to create mainloop");
+ logMessage(QLatin1String("PulseAudio support disabled: Unable to create mainloop"));
return;
}
pa_context *p_test_context;
if (!(p_test_context = pa_context_new(pa_mainloop_get_api(p_test_mainloop), "libphonon-probe"))) {
- logMessage("PulseAudio support disabled: Unable to create context");
+ logMessage(QLatin1String("PulseAudio support disabled: Unable to create context"));
pa_mainloop_free(p_test_mainloop);
return;
}
- logMessage("Probing for PulseAudio...");
+ logMessage(QLatin1String("Probing for PulseAudio..."));
// (cg) Convert to PA_CONTEXT_NOFLAGS when PulseAudio 0.9.19 is required
if (pa_context_connect(p_test_context, NULL, static_cast<pa_context_flags_t>(0), NULL) < 0) {
- logMessage(QString("PulseAudio support disabled: %1").arg(pa_strerror(pa_context_errno(p_test_context))));
+ logMessage(QString::fromLatin1("PulseAudio support disabled: %1").arg(QString::fromLocal8Bit(pa_strerror(pa_context_errno(p_test_context)))));
pa_context_disconnect(p_test_context);
pa_context_unref(p_test_context);
pa_mainloop_free(p_test_mainloop);
@@ -693,7 +691,7 @@ PulseSupport::PulseSupport()
pa_mainloop_iterate(p_test_mainloop, 1, NULL);
if (!PA_CONTEXT_IS_GOOD(pa_context_get_state(p_test_context))) {
- logMessage("PulseAudio probe complete.");
+ logMessage(QLatin1String("PulseAudio probe complete."));
break;
}
}
@@ -702,12 +700,12 @@ PulseSupport::PulseSupport()
pa_mainloop_free(p_test_mainloop);
if (!s_pulseActive) {
- logMessage("PulseAudio support is not available.");
+ logMessage(QLatin1String("PulseAudio support is not available."));
return;
}
// If we're still here, PA is available.
- logMessage("PulseAudio support enabled");
+ logMessage(QLatin1String("PulseAudio support enabled"));
// Now we connect for real using a proper main loop that we can forget
// all about processing.
@@ -856,7 +854,7 @@ static void setDevicePriority(Category category, QStringList list)
if (role.isEmpty())
return;
- logMessage(QString("Reindexing %1: %2").arg(role).arg(list.join(", ")));
+ logMessage(QString::fromLatin1("Reindexing %1: %2").arg(role).arg(list.join(QLatin1String(", "))));
char **devices;
devices = pa_xnew(char *, list.size()+1);
@@ -926,7 +924,7 @@ void PulseSupport::setStreamPropList(Category category, QString streamUuid)
if (role.isEmpty())
return;
- logMessage(QString("Setting role to %1 for streamindex %2").arg(role).arg(streamUuid));
+ logMessage(QString::fromLatin1("Setting role to %1 for streamindex %2").arg(role).arg(streamUuid));
setenv("PULSE_PROP_media.role", role.toLatin1().constData(), 1);
setenv("PULSE_PROP_phonon.streamid", streamUuid.toLatin1().constData(), 1);
#endif
@@ -952,30 +950,30 @@ bool PulseSupport::setOutputDevice(QString streamUuid, int device) {
return true;
if (!s_outputDevices.contains(device)) {
- logMessage(QString("Attempting to set Output Device for invalid device id %1.").arg(device));
+ logMessage(QString::fromLatin1("Attempting to set Output Device for invalid device id %1.").arg(device));
return false;
}
const QVariant var = s_outputDevices[device].properties["name"];
- logMessage(QString("Attempting to set Output Device to '%1' for Output Stream %2").arg(var.toString()).arg(streamUuid));
+ logMessage(QString::fromLatin1("Attempting to set Output Device to '%1' for Output Stream %2").arg(var.toString()).arg(streamUuid));
// Attempt to look up the pulse stream index.
if (s_outputStreamIndexMap.contains(streamUuid) && s_outputStreamIndexMap[streamUuid] != PA_INVALID_INDEX) {
- logMessage(QString("... Found in map. Moving now"));
+ logMessage(QLatin1String("... Found in map. Moving now"));
uint32_t pulse_device_index = s_outputDevices[device].pulseIndex;
uint32_t pulse_stream_index = s_outputStreamIndexMap[streamUuid];
- logMessage(QString("Moving Pulse Sink Input %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
+ logMessage(QString::fromLatin1("Moving Pulse Sink Input %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
/// @todo Find a way to move the stream without saving it... We don't want to pollute the stream restore db.
pa_operation* o;
if (!(o = pa_context_move_sink_input_by_index(s_context, pulse_stream_index, pulse_device_index, NULL, NULL))) {
- logMessage(QString("pa_context_move_sink_input_by_index() failed"));
+ logMessage(QLatin1String("pa_context_move_sink_input_by_index() failed"));
return false;
}
pa_operation_unref(o);
} else {
- logMessage(QString("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
+ logMessage(QLatin1String("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
}
return true;
#endif
@@ -991,30 +989,30 @@ bool PulseSupport::setCaptureDevice(QString streamUuid, int device) {
return true;
if (!s_captureDevices.contains(device)) {
- logMessage(QString("Attempting to set Capture Device for invalid device id %1.").arg(device));
+ logMessage(QString::fromLatin1("Attempting to set Capture Device for invalid device id %1.").arg(device));
return false;
}
const QVariant var = s_captureDevices[device].properties["name"];
- logMessage(QString("Attempting to set Capture Device to '%1' for Capture Stream %2").arg(var.toString()).arg(streamUuid));
+ logMessage(QString::fromLatin1("Attempting to set Capture Device to '%1' for Capture Stream %2").arg(var.toString()).arg(streamUuid));
// Attempt to look up the pulse stream index.
if (s_captureStreamIndexMap.contains(streamUuid) && s_captureStreamIndexMap[streamUuid] == PA_INVALID_INDEX) {
- logMessage(QString("... Found in map. Moving now"));
+ logMessage(QString::fromLatin1("... Found in map. Moving now"));
uint32_t pulse_device_index = s_captureDevices[device].pulseIndex;
uint32_t pulse_stream_index = s_captureStreamIndexMap[streamUuid];
- logMessage(QString("Moving Pulse Source Output %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
+ logMessage(QString::fromLatin1("Moving Pulse Source Output %1 to '%2' (Pulse Sink %3)").arg(pulse_stream_index).arg(var.toString()).arg(pulse_device_index));
/// @todo Find a way to move the stream without saving it... We don't want to pollute the stream restore db.
pa_operation* o;
if (!(o = pa_context_move_source_output_by_index(s_context, pulse_stream_index, pulse_device_index, NULL, NULL))) {
- logMessage(QString("pa_context_move_source_output_by_index() failed"));
+ logMessage(QString::fromLatin1("pa_context_move_source_output_by_index() failed"));
return false;
}
pa_operation_unref(o);
} else {
- logMessage(QString("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
+ logMessage(QString::fromLatin1("... Not found in map. We will be notified of the device when the stream appears and we can process any moves needed then"));
}
return true;
#endif
@@ -1025,7 +1023,7 @@ void PulseSupport::clearStreamCache(QString streamUuid) {
Q_UNUSED(streamUuid);
return;
#else
- logMessage(QString("Clearing stream cache for stream %1").arg(streamUuid));
+ logMessage(QString::fromLatin1("Clearing stream cache for stream %1").arg(streamUuid));
s_outputStreamIndexMap.remove(streamUuid);
s_captureStreamIndexMap.remove(streamUuid);
#endif
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 18c3c9f..1e6dcee 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -228,8 +228,14 @@ void QPollingFileSystemWatcherEngine::timeout()
dit.remove();
emit directoryChanged(path, true);
} else if (x.value() != fi) {
- x.value() = fi;
- emit directoryChanged(path, false);
+ fi.refresh();
+ if (!fi.exists()) {
+ dit.remove();
+ emit directoryChanged(path, true);
+ } else {
+ x.value() = fi;
+ emit directoryChanged(path, false);
+ }
}
}
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
index 378ad20..3664396 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp
+++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp
@@ -117,67 +117,77 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths,
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int fd;
+ {
+ QMutexLocker locker(&mutex);
+
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int fd;
#if defined(O_EVTONLY)
- fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY);
#else
- fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
+ fd = qt_safe_open(QFile::encodeName(path), O_RDONLY);
#endif
- if (fd == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: open");
- continue;
- }
+ if (fd == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: open");
+ continue;
+ }
+ if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) {
+ int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE);
+ if (fddup != -1) {
+ ::close(fd);
+ fd = fddup;
+ }
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
- QT_STATBUF st;
- if (QT_FSTAT(fd, &st) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
- ::close(fd);
- continue;
- }
- int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
- if (id < 0) {
- if (directories->contains(path)) {
+ QT_STATBUF st;
+ if (QT_FSTAT(fd, &st) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: fstat");
::close(fd);
continue;
}
- } else {
- if (files->contains(path)) {
+ int id = (S_ISDIR(st.st_mode)) ? -fd : fd;
+ if (id < 0) {
+ if (directories->contains(path)) {
+ ::close(fd);
+ continue;
+ }
+ } else {
+ if (files->contains(path)) {
+ ::close(fd);
+ continue;
+ }
+ }
+
+ struct kevent kev;
+ EV_SET(&kev,
+ fd,
+ EVFILT_VNODE,
+ EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
+ 0,
+ 0);
+ if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
+ perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
::close(fd);
continue;
}
- }
- struct kevent kev;
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_ADD | EV_ENABLE | EV_ONESHOT,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::addPaths: kevent");
- ::close(fd);
- continue;
- }
+ it.remove();
+ if (id < 0) {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
+ directories->append(path);
+ } else {
+ DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
+ files->append(path);
+ }
- it.remove();
- if (id < 0) {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path;
- directories->append(path);
- } else {
- DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path;
- files->append(path);
+ pathToID.insert(path, id);
+ idToPath.insert(id, path);
}
-
- pathToID.insert(path, id);
- idToPath.insert(id, path);
}
if (!isRunning())
@@ -192,43 +202,35 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
QStringList *files,
QStringList *directories)
{
- QMutexLocker locker(&mutex);
-
+ bool isEmpty;
QStringList p = paths;
- QMutableListIterator<QString> it(p);
- while (it.hasNext()) {
- QString path = it.next();
- int id = pathToID.take(path);
- QString x = idToPath.take(id);
- if (x.isEmpty() || x != path)
- continue;
-
- int fd = id < 0 ? -id : id;
- struct kevent kev;
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_DELETE,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::removeWatch: kevent");
- }
- ::close(fd);
+ {
+ QMutexLocker locker(&mutex);
+ if (pathToID.isEmpty())
+ return p;
+
+ QMutableListIterator<QString> it(p);
+ while (it.hasNext()) {
+ QString path = it.next();
+ int id = pathToID.take(path);
+ QString x = idToPath.take(id);
+ if (x.isEmpty() || x != path)
+ continue;
- it.remove();
- if (id < 0)
- directories->removeAll(path);
- else
- files->removeAll(path);
+ ::close(id < 0 ? -id : id);
+
+ it.remove();
+ if (id < 0)
+ directories->removeAll(path);
+ else
+ files->removeAll(path);
+ }
+ isEmpty = pathToID.isEmpty();
}
- if (pathToID.isEmpty()) {
+ if (isEmpty) {
stop();
- locker.unlock();
wait();
- locker.relock();
} else {
write(kqpipe[1], "@", 1);
}
@@ -243,19 +245,15 @@ void QKqueueFileSystemWatcherEngine::stop()
void QKqueueFileSystemWatcherEngine::run()
{
- static const struct timespec ZeroTimeout = { 0, 0 };
-
forever {
+ int r;
struct kevent kev;
DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents...";
- int r = kevent(kqfd, 0, 0, &kev, 1, 0);
+ EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0));
if (r < 0) {
perror("QKqueueFileSystemWatcherEngine: error during kevent wait");
return;
- }
-
- QMutexLocker locker(&mutex);
- do {
+ } else {
int fd = kev.ident;
DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter;
@@ -287,6 +285,8 @@ void QKqueueFileSystemWatcherEngine::run()
break;
}
} else {
+ QMutexLocker locker(&mutex);
+
int id = fd;
QString path = idToPath.value(id);
if (path.isEmpty()) {
@@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run()
path = idToPath.value(id);
if (path.isEmpty()) {
DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching";
- goto process_next_event;
+ continue;
}
}
if (kev.filter != EVFILT_VNODE) {
DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter";
- goto process_next_event;
+ continue;
}
if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) {
@@ -315,31 +315,15 @@ void QKqueueFileSystemWatcherEngine::run()
else
emit fileChanged(path, true);
} else {
- DEBUG() << path << "changed, re-enabling watch";
+ DEBUG() << path << "changed";
if (id < 0)
emit directoryChanged(path, false);
else
emit fileChanged(path, false);
-
- // renable the watch
- EV_SET(&kev,
- fd,
- EVFILT_VNODE,
- EV_ADD | EV_ENABLE | EV_ONESHOT,
- NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE,
- 0,
- 0);
- if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) {
- perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD");
- }
}
}
-
- // are there any more?
-process_next_event:
- r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout);
- } while (r > 0);
+ }
}
}
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 1bd00da..67145b8 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -203,6 +203,8 @@ public:
void disconnectRelay(const QString &service,
const QString &path, const QString &interface,
QDBusAbstractInterface *receiver, const char *signal);
+ void registerService(const QString &serviceName);
+ void unregisterService(const QString &serviceName);
bool handleMessage(const QDBusMessage &msg);
void waitForFinished(QDBusPendingCallPrivate *pcall);
@@ -247,9 +249,11 @@ public slots:
void socketWrite(int);
void objectDestroyed(QObject *o);
void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
- void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
- void registerService(const QString &serviceName);
- void unregisterService(const QString &serviceName);
+
+private slots:
+ void serviceOwnerChangedNoLock(const QString &name, const QString &oldOwner, const QString &newOwner);
+ void registerServiceNoLock(const QString &serviceName);
+ void unregisterServiceNoLock(const QString &serviceName);
signals:
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
@@ -303,6 +307,9 @@ public:
QObject *receiver, const char *signal, int minMIdx,
bool buildSignature);
static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *);
+ static bool checkReplyForDelivery(QDBusConnectionPrivate *target, QObject *object,
+ int idx, const QList<int> &metaTypes,
+ const QDBusMessage &msg);
static QDBusCallDeliveryEvent *prepareReply(QDBusConnectionPrivate *target, QObject *object,
int idx, const QList<int> &metaTypes,
const QDBusMessage &msg);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index a5d8ada..1842e5a 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -552,6 +552,9 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
(*(*list)[i])(amsg);
}
+ if (!ref)
+ return false;
+
switch (amsg.type()) {
case QDBusMessage::SignalMessage:
handleSignal(amsg);
@@ -713,6 +716,8 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
return -1;
}
+static QDBusCallDeliveryEvent * const DIRECT_DELIVERY = (QDBusCallDeliveryEvent *)1;
+
QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPrivate *target,
QObject *object, int idx,
const QList<int> &metaTypes,
@@ -736,6 +741,8 @@ QDBusCallDeliveryEvent* QDBusConnectionPrivate::prepareReply(QDBusConnectionPriv
// we can deliver
// prepare for the call
+ if (target == object)
+ return DIRECT_DELIVERY;
return new QDBusCallDeliveryEvent(QDBusConnection(target), idx, target, msg, metaTypes);
}
@@ -750,6 +757,12 @@ void QDBusConnectionPrivate::activateSignal(const QDBusConnectionPrivate::Signal
// Slots can optionally have one final parameter that is a QDBusMessage
// Slots receive read-only copies of the message (i.e., pass by value or by const-ref)
QDBusCallDeliveryEvent *call = prepareReply(this, hook.obj, hook.midx, hook.params, msg);
+ if (call == DIRECT_DELIVERY) {
+ // short-circuit delivery
+ Q_ASSERT(this == hook.obj);
+ deliverCall(this, 0, msg, hook.params, hook.midx);
+ return;
+ }
if (call)
postEventToThread(ActivateSignalAction, hook.obj, call);
}
@@ -1207,11 +1220,11 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
q_dbus_message_unref(msg);
}
-void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name,
- const QString &oldOwner, const QString &newOwner)
+void QDBusConnectionPrivate::serviceOwnerChangedNoLock(const QString &name,
+ const QString &oldOwner, const QString &newOwner)
{
Q_UNUSED(oldOwner);
- QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
+// QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
WatchedServicesHash::Iterator it = watchedServices.find(name);
if (it == watchedServices.end())
return;
@@ -1686,11 +1699,11 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
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)");
+ hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)");
Q_ASSERT(hook.midx != -1);
signalHooks.insert(QLatin1String("NameAcquired:" DBUS_INTERFACE_DBUS), hook);
- hook.midx = staticMetaObject.indexOfSlot("unregisterService(QString)");
+ hook.midx = staticMetaObject.indexOfSlot("unregisterServiceNoLock(QString)");
Q_ASSERT(hook.midx != -1);
signalHooks.insert(QLatin1String("NameLost:" DBUS_INTERFACE_DBUS), hook);
@@ -2081,7 +2094,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
// we need to watch for this service changing
connectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString)));
data.owner = getNameOwnerNoCache(hook.service);
qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
<< data.owner << ")";
@@ -2342,12 +2355,22 @@ QDBusConnectionPrivate::findMetaObject(const QString &service, const QString &pa
void QDBusConnectionPrivate::registerService(const QString &serviceName)
{
QDBusWriteLocker locker(RegisterServiceAction, this);
+ registerServiceNoLock(serviceName);
+}
+
+void QDBusConnectionPrivate::registerServiceNoLock(const QString &serviceName)
+{
serviceNames.append(serviceName);
}
void QDBusConnectionPrivate::unregisterService(const QString &serviceName)
{
QDBusWriteLocker locker(UnregisterServiceAction, this);
+ unregisterServiceNoLock(serviceName);
+}
+
+void QDBusConnectionPrivate::unregisterServiceNoLock(const QString &serviceName)
+{
serviceNames.removeAll(serviceName);
}
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 1160ed8..c646302 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -2232,6 +2232,8 @@ bool QDeclarative_isFileCaseCorrect(const QString &fileName)
if (a != c)
return false;
}
+#else
+ Q_UNUSED(fileName);
#endif
return true;
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index 0adcdbd..dd9a224 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -320,7 +320,6 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb
{
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
clear();
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index a07b1bb..380d9bc 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -684,7 +684,7 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *)
}
QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d)
-: data(d), reader(0), loading(false), redirectCount(0), requestSize(d->requestSize)
+: data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0)
{
if (finishedIndex == -1) {
finishedIndex = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()");
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index b7a0026..fbdc522 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -282,8 +282,8 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
QDialog::QDialog(QWidget *parent, const char *name, bool modal, Qt::WindowFlags f)
: QWidget(*new QDialogPrivate, parent,
f
- | QFlag(modal ? Qt::WShowModal : 0)
- | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)
+ | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0))
+ | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))
)
{
setObjectName(QString::fromAscii(name));
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 7b81761..acc8deb 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -827,7 +827,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate (i.e., this delegate) will take presedence and manage the
+ delegate (i.e., this delegate) will take precedence and manage the
intersecting cell index.
\warning You should not share the same instance of a delegate between views.
@@ -885,7 +885,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate will take presedence and manage the intersecting cell index.
+ delegate will take precedence and manage the intersecting cell index.
\warning You should not share the same instance of a delegate between views.
Doing so can cause incorrect or unintuitive editing behavior since each
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 767b5a9..7d20bbb 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1130,7 +1130,7 @@ Qt::ItemFlags QStandardItem::flags() const
meaning that the user can interact with the item; if \a enabled is false, the
user cannot interact with the item.
- This flag takes presedence over the other item flags; e.g. if an item is not
+ This flag takes precedence over the other item flags; e.g. if an item is not
enabled, it cannot be selected by the user, even if the Qt::ItemIsSelectable
flag has been set.
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index ba5d164..bd68d2a 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1390,7 +1390,7 @@ int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
{
Q_D(QPdfBaseEngine);
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
d->collate = value.toBool();
break;
@@ -1480,7 +1480,7 @@ QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const
Q_D(const QPdfBaseEngine);
QVariant ret;
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
ret = d->collate;
break;
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 3ebfab2..be8f794 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -2456,6 +2456,8 @@ QDebug operator<<(QDebug debug, QStyle::State state)
qSort(states);
debug << states.join(QLatin1String(" | "));
debug << ')';
+#else
+ Q_UNUSED(state);
#endif
return debug;
}
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 4780edf..05ca793 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -5483,6 +5483,8 @@ QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
case QStyleOption::SO_GraphicsItem:
debug << "SO_GraphicsItem"; break;
}
+#else
+ Q_UNUSED(optionType);
#endif
return debug;
}
@@ -5496,6 +5498,8 @@ QDebug operator<<(QDebug debug, const QStyleOption &option)
debug << ',' << option.state;
debug << ',' << option.rect;
debug << ')';
+#else
+ Q_UNUSED(option);
#endif
return debug;
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 46db253..fdbb680 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -265,10 +265,18 @@ private:
friend QDataStream &operator>>(QDataStream &, QTextFormat &);
};
-// this is only safe if sizeof(int) == sizeof(float)
+// this is only safe because sizeof(int) == sizeof(float)
static inline uint hash(float d)
{
+#ifdef Q_CC_GNU
+ // this is a GCC extension and isn't guaranteed to work in other compilers
+ // the reinterpret_cast below generates a strict-aliasing warning with GCC
+ union { float f; uint u; } cvt;
+ cvt.f = d;
+ return cvt.u;
+#else
return reinterpret_cast<uint&>(d);
+#endif
}
static inline uint hash(const QColor &color)
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 1e0bced..5b42578 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -322,9 +322,9 @@ bool QLocalSocketPrivate::completeAsyncRead()
// buffer. We will read the remaining data in the next call.
break;
case ERROR_PIPE_NOT_CONNECTED:
- setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
- // fall through
+ return false;
default:
+ setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
return false;
}
}
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index a3ea555..275c7be 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -716,7 +716,7 @@ QSslCertificate QSslCertificatePrivate::QSslCertificate_from_X509(X509 *x509)
static bool matchLineFeed(const QByteArray &pem, int *offset)
{
- char ch;
+ char ch = 0;
// ignore extra whitespace at the end of the line
while (*offset < pem.size() && (ch = pem.at(*offset)) == ' ')
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index ed9753e..18f1203 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2095,7 +2095,9 @@ void QGLContextPrivate::cleanup()
void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled)
{
Q_ASSERT(arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT);
+#ifdef glEnableVertexAttribArray
Q_ASSERT(glEnableVertexAttribArray);
+#endif
if (vertexAttributeArraysEnabledState[arrayIndex] && !enabled)
glDisableVertexAttribArray(arrayIndex);
@@ -2108,7 +2110,9 @@ void QGLContextPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled
void QGLContextPrivate::syncGlState()
{
+#ifdef glEnableVertexAttribArray
Q_ASSERT(glEnableVertexAttribArray);
+#endif
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) {
if (vertexAttributeArraysEnabledState[i])
glEnableVertexAttribArray(i);
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index d33ea56..75dd1b6 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -97,7 +97,6 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
XVisualInfo visualInfo;
XVisualInfo *vi;
int numVisuals;
- EGLint id = 0;
visualInfo.visualid = QEgl::getCompatibleVisualId(config);
vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals);
@@ -346,7 +345,7 @@ void QGLWidgetPrivate::recreateEglSurface()
// old surface before re-creating a new one. Note: This should not be the case as the
// surface should be deleted before the old window id.
if (glcx->d_func()->eglSurface != EGL_NO_SURFACE && (currentId != eglSurfaceWindowId)) {
- qWarning("EGL surface for deleted window %x was not destroyed", eglSurfaceWindowId);
+ qWarning("EGL surface for deleted window %x was not destroyed", uint(eglSurfaceWindowId));
glcx->d_func()->destroyEglSurfaceForDevice();
}
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index 0b94f5a..2d9f6f1 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -74,7 +74,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
// Use the same configuration as the widget we are sharing with.
ctx->setConfig(shareContext->config());
#if QGL_RENDER_TEXTURE
- EGLint value = EGL_FALSE;
if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA) == EGL_TRUE)
textureFormat = EGL_TEXTURE_RGBA;
else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB) == EGL_TRUE)
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 952a444..0545422 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -216,7 +216,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte
{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RegisterCounter"),
QVariant::fromValue(path),
QVariant::fromValue(interval));
- bool ok = true;
if(reply.error().type() == QDBusError::InvalidArgs) {
qWarning() << reply.error().message();
}
@@ -225,7 +224,6 @@ void QConnmanManagerInterface::registerCounter(const QString &path, quint32 inte
void QConnmanManagerInterface::unregisterCounter(const QString &path)
{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("UnregisterCounter"),
QVariant::fromValue(path));
- bool ok = true;
if(reply.error().type() == QDBusError::InvalidArgs) {
qWarning() << reply.error().message();
}
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index ecc78bf..fc4cf2e 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -202,7 +202,7 @@ ItemType::Ptr AtomicValue::qtToXDMType(const QXmlItem &item)
Q_ASSERT(item.isAtomicValue());
const QVariant v(item.toAtomicValue());
- switch(v.type())
+ switch(int(v.type()))
{
case QVariant::Char:
/* Fallthrough. */
diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
index 599abbd..4494d6f 100644
--- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
@@ -106,6 +106,8 @@ private slots:
void slotsWithLessParameters();
void nestedCallWithCallback();
+ void serviceRegistrationRaceCondition();
+
public:
QString serviceName() const { return "com.trolltech.Qt.Autotests.QDBusConnection"; }
bool callMethod(const QDBusConnection &conn, const QString &path);
@@ -647,6 +649,73 @@ void tst_QDBusConnection::nestedCallWithCallback()
QCOMPARE(signalsReceived, 1);
}
+class RaceConditionSignalWaiter : public QObject
+{
+ Q_OBJECT
+public:
+ int count;
+ RaceConditionSignalWaiter() : count (0) {}
+ virtual ~RaceConditionSignalWaiter() {}
+
+public slots:
+ void countUp() { ++count; emit done(); }
+signals:
+ void done();
+};
+
+void tst_QDBusConnection::serviceRegistrationRaceCondition()
+{
+ // There was a race condition in the updating of list of name owners in
+ // QtDBus. When the user connects to a signal coming from a given
+ // service, we must listen for NameOwnerChanged signals relevant to that
+ // name and update when the owner changes. However, it's possible that we
+ // receive in one chunk from the server both the NameOwnerChanged signal
+ // about the service and the signal we're interested in. Since QtDBus
+ // posts events in order to handle the incoming signals, the update
+ // happens too late.
+
+ const QString connectionName = "testConnectionName";
+ const QString serviceName = "org.example.SecondaryName";
+
+ QDBusConnection session = QDBusConnection::sessionBus();
+ QVERIFY(!session.interface()->isServiceRegistered(serviceName));
+
+ // connect to the signal:
+ RaceConditionSignalWaiter recv;
+ session.connect(serviceName, "/", "com.trolltech.TestCase", "oneSignal", &recv, SLOT(countUp()));
+
+ // create a secondary connection and register a name
+ QDBusConnection connection = QDBusConnection::connectToBus(QDBusConnection::SessionBus, connectionName);
+ QDBusConnection::disconnectFromBus(connectionName); // disconnection happens when "connection" goes out of scope
+ QVERIFY(connection.isConnected());
+ QVERIFY(connection.registerService(serviceName));
+
+ // send a signal
+ QDBusMessage msg = QDBusMessage::createSignal("/", "com.trolltech.TestCase", "oneSignal");
+ connection.send(msg);
+
+ // make a blocking call just to be sure that the buffer was flushed
+ msg = QDBusMessage::createMethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
+ "NameHasOwner");
+ msg << connectionName;
+ connection.call(msg); // ignore result
+
+ // Now here's the race condition (more info on task QTBUG-15651):
+ // the bus has most likely queued three signals for us to work on:
+ // 1) NameOwnerChanged for the connection we created above
+ // 2) NameOwnerChanged for the service we registered above
+ // 3) The "oneSignal" signal we sent
+ //
+ // We'll most likely receive all three in one go from the server. We must
+ // update the owner of serviceName before we start processing the
+ // "oneSignal" signal.
+
+ QTestEventLoop::instance().connect(&recv, SIGNAL(done()), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(recv.count, 1);
+}
+
QString MyObject::path;
QTEST_MAIN(tst_QDBusConnection)
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index a26e34d..1feaced 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -135,14 +135,11 @@ void tst_QFileSystemWatcher::basicTest()
// create watcher, forcing it to use a specific backend
QFileSystemWatcher watcher;
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
+ watcher.removePath(testFile.fileName());
watcher.addPath(testFile.fileName());
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(const QString &)));
QEventLoop eventLoop;
- connect(&watcher,
- SIGNAL(fileChanged(const QString &)),
- &eventLoop,
- SLOT(quit()));
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
@@ -278,10 +275,6 @@ void tst_QFileSystemWatcher::watchDirectory()
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(const QString &)));
QEventLoop eventLoop;
- connect(&watcher,
- SIGNAL(directoryChanged(const QString &)),
- &eventLoop,
- SLOT(quit()));
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 90416f2..9cf61f9 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -4490,6 +4490,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous()
QVERIFY(reply->isFinished()); // synchronous
manager.setProxy(QNetworkProxy());
serverThread.quit();
+ serverThread.wait(3000);
//qDebug() << reply->error() << reply->errorString();
diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp
index 0395eff..0813e28 100644
--- a/tests/auto/qsettings/tst_qsettings.cpp
+++ b/tests/auto/qsettings/tst_qsettings.cpp
@@ -51,6 +51,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QtDebug>
#include <QtCore/QString>
+#include "../../shared/util.h"
#if !defined(Q_OS_SYMBIAN)
# include <cctype>
@@ -1726,26 +1727,22 @@ void tst_QSettings::testUpdateRequestEvent()
settings1.setValue("key1", 1);
QVERIFY(QFileInfo("foo").size() == 0);
- qApp->processEvents();
- QVERIFY(QFileInfo("foo").size() > 0);
+ QTRY_VERIFY(QFileInfo("foo").size() > 0);
settings1.remove("key1");
QVERIFY(QFileInfo("foo").size() > 0);
- qApp->processEvents();
- QVERIFY(QFileInfo("foo").size() == 0);
+ QTRY_VERIFY(QFileInfo("foo").size() == 0);
settings1.setValue("key2", 2);
QVERIFY(QFileInfo("foo").size() == 0);
- qApp->processEvents();
- QVERIFY(QFileInfo("foo").size() > 0);
+ QTRY_VERIFY(QFileInfo("foo").size() > 0);
settings1.clear();
QVERIFY(QFileInfo("foo").size() > 0);
- qApp->processEvents();
- QVERIFY(QFileInfo("foo").size() == 0);
+ QTRY_VERIFY(QFileInfo("foo").size() == 0);
}
const int NumIterations = 5;
diff --git a/tools/shared/windows/registry.cpp b/tools/shared/windows/registry.cpp
index 48e9ae6..f520910 100644
--- a/tools/shared/windows/registry.cpp
+++ b/tools/shared/windows/registry.cpp
@@ -157,6 +157,9 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey)
}
RegCloseKey(handle);
+#else
+ Q_UNUSED(parentHandle);
+ Q_UNUSED(rSubkey)
#endif
return result;