diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-03-01 10:39:30 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-06 12:21:14 +0100 |
commit | 0aba7fbb5837c81351e7e4ba43044a8dbb37098c (patch) | |
tree | 91a13777ecdd81ef9e2ab8ff10e4a55ec30942ac | |
parent | 02c8306da6c9c738c8191b23e216602a741d73e4 (diff) |
Always initialize integer types in D-Bus demarshalling
If you tried to demarshall in a write-only QDBusArgument, the class
would print a warning, but will continue running nonetheless. So instead
just initialize everything, despite the warning.
qdbusargument.cpp:1138:30: error: ‘d’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
qdbusargument.cpp:1165:33: error: ‘s’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
qdbusargument.cpp:1301:15: error: ‘y’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
etc.
Change-Id: I6d713b4a7b7639e31f3b39bb488ad3ed3ab3fa4a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
-rw-r--r-- | src/dbus/qdbusargument.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 83a544c4e3..6157694d12 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -605,6 +605,8 @@ const QDBusArgument &QDBusArgument::operator>>(uchar &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toByte(); + else + arg = 0; return *this; } @@ -617,6 +619,8 @@ const QDBusArgument &QDBusArgument::operator>>(bool &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toBool(); + else + arg = false; return *this; } @@ -629,6 +633,8 @@ const QDBusArgument &QDBusArgument::operator>>(ushort &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toUShort(); + else + arg = 0; return *this; } @@ -641,6 +647,8 @@ const QDBusArgument &QDBusArgument::operator>>(short &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toShort(); + else + arg = 0; return *this; } @@ -653,6 +661,8 @@ const QDBusArgument &QDBusArgument::operator>>(int &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toInt(); + else + arg = 0; return *this; } @@ -665,6 +675,8 @@ const QDBusArgument &QDBusArgument::operator>>(uint &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toUInt(); + else + arg = 0; return *this; } @@ -677,6 +689,8 @@ const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toLongLong(); + else + arg = 0; return *this; } @@ -689,6 +703,8 @@ const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toULongLong(); + else + arg = 0; return *this; } @@ -701,6 +717,8 @@ const QDBusArgument &QDBusArgument::operator>>(double &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toDouble(); + else + arg = 0; return *this; } |