diff options
author | Alexander Akulich <akulichalexander@gmail.com> | 2020-01-18 19:40:56 +0300 |
---|---|---|
committer | Alexander Akulich <akulichalexander@gmail.com> | 2020-01-18 22:37:09 +0300 |
commit | b4030784f02c4d94e193e241ba05b87ee4f94124 (patch) | |
tree | 4fcd90d6c954016d715b3f6d553b624ebe71a8db | |
parent | f2fb77fb12622232f49bf325d16228f8c6957175 (diff) |
Use nullptr keyword wherever it makes sense
Refactored with clang-tidy
132 files changed, 595 insertions, 595 deletions
diff --git a/TelepathyQt/Farstream/channel.cpp b/TelepathyQt/Farstream/channel.cpp index 0cd54f9e..456d9aaf 100644 --- a/TelepathyQt/Farstream/channel.cpp +++ b/TelepathyQt/Farstream/channel.cpp @@ -42,7 +42,7 @@ namespace Farstream struct TP_QT_FS_NO_EXPORT PendingChannel::Private { Private() - : mTfChannel(0) + : mTfChannel(nullptr) { } @@ -62,7 +62,7 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel) return; } - TpDBusDaemon *dbus = tp_dbus_daemon_dup(0); + TpDBusDaemon *dbus = tp_dbus_daemon_dup(nullptr); if (!dbus) { warning() << "Unable to connect to D-Bus"; setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE, @@ -90,7 +90,7 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel) } TpConnection *gconnection = tp_simple_client_factory_ensure_connection (factory, - connection->objectPath().toLatin1(), NULL, 0); + connection->objectPath().toLatin1(), nullptr, nullptr); if (!gconnection) { warning() << "Unable to construct TpConnection"; setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE, @@ -107,11 +107,11 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel) "object-path", channel->objectPath().toLatin1().constData(), NULL); g_object_unref(factory); - factory = 0; + factory = nullptr; g_object_unref(dbus); - dbus = 0; + dbus = nullptr; g_object_unref(gconnection); - gconnection = 0; + gconnection = nullptr; if (!gchannel) { warning() << "Unable to construct TpChannel"; setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE, @@ -133,7 +133,7 @@ void PendingChannel::Private::onTfChannelNewFinish(GObject *sourceObject, { PendingChannel *self = reinterpret_cast<PendingChannel *>(userData); - GError *error = NULL; + GError *error = nullptr; TfChannel *ret = tf_channel_new_finish(sourceObject, res, &error); if (error) { warning() << "Fs::PendingChannel::Private::onTfChannelNewFinish: error " << error->message; diff --git a/TelepathyQt/account-set-internal.h b/TelepathyQt/account-set-internal.h index 2f49f053..2f4bde39 100644 --- a/TelepathyQt/account-set-internal.h +++ b/TelepathyQt/account-set-internal.h @@ -58,7 +58,7 @@ class TP_QT_NO_EXPORT AccountSet::Private::AccountWrapper : public QObject Q_OBJECT public: - AccountWrapper(const AccountPtr &account, QObject *parent = 0); + AccountWrapper(const AccountPtr &account, QObject *parent = nullptr); ~AccountWrapper() override; AccountPtr account() const { return mAccount; } diff --git a/TelepathyQt/account.cpp b/TelepathyQt/account.cpp index 378469af..d109c015 100644 --- a/TelepathyQt/account.cpp +++ b/TelepathyQt/account.cpp @@ -4199,7 +4199,7 @@ void Account::Private::init() void Account::Private::introspectMain(Account::Private *self) { if (self->dispatcherContext->introspected) { - self->parent->onDispatcherIntrospected(0); + self->parent->onDispatcherIntrospected(nullptr); return; } @@ -4578,7 +4578,7 @@ void Account::onDispatcherIntrospected(Tp::PendingOperation *op) { if (!mPriv->dispatcherContext->introspected) { Tp::PendingVariant *pv = static_cast<Tp::PendingVariant *>(op); - Q_ASSERT(pv != NULL); + Q_ASSERT(pv != nullptr); // Only the first Account for a given dispatcher will enter this branch, and will // immediately make further created accounts skip the whole waiting for CD to get @@ -4729,7 +4729,7 @@ void Account::onRemoved() void Account::onConnectionBuilt(PendingOperation *op) { PendingReady *readyOp = qobject_cast<PendingReady *>(op); - Q_ASSERT(readyOp != NULL); + Q_ASSERT(readyOp != nullptr); if (op->isError()) { warning() << "Building connection" << mPriv->connObjPathQueue.head() << "failed with" << diff --git a/TelepathyQt/avatar.h b/TelepathyQt/avatar.h index 5c03a925..6d3aebd4 100644 --- a/TelepathyQt/avatar.h +++ b/TelepathyQt/avatar.h @@ -59,7 +59,7 @@ public: AvatarSpec(const AvatarSpec &other); ~AvatarSpec(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } AvatarSpec &operator=(const AvatarSpec &other); diff --git a/TelepathyQt/base-call.h b/TelepathyQt/base-call.h index 84308f25..5eba8b7d 100644 --- a/TelepathyQt/base-call.h +++ b/TelepathyQt/base-call.h @@ -75,7 +75,7 @@ public: ~BaseCallContent() override; QVariantMap immutableProperties() const override; - bool registerObject(DBusError *error = NULL); + bool registerObject(DBusError *error = nullptr); virtual QString uniqueName() const; QList<AbstractCallContentInterfacePtr> interfaces() const; diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp index 3fe66944..a1cdc013 100644 --- a/TelepathyQt/base-channel.cpp +++ b/TelepathyQt/base-channel.cpp @@ -810,10 +810,10 @@ struct TP_QT_NO_EXPORT BaseChannelFileTransferType::Private { transferredBytes(0), initialOffset(0), deviceOffset(0), - device(0), + device(nullptr), weOpenedDevice(false), - serverSocket(0), - clientSocket(0), + serverSocket(nullptr), + clientSocket(nullptr), adaptee(new BaseChannelFileTransferType::Adaptee(parent)) { contentType = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType")).toString(); @@ -1200,8 +1200,8 @@ void BaseChannelFileTransferType::doTransfer() return; } - QIODevice *input = 0; - QIODevice *output = 0; + QIODevice *input = nullptr; + QIODevice *output = nullptr; switch (mPriv->direction) { case BaseChannelFileTransferType::Outgoing: @@ -2587,7 +2587,7 @@ void BaseChannelChatStateInterface::chatStateChanged(uint contact, uint state) // The BaseChannelGroupInterface code is fully or partially generated by the TelepathyQt-Generator. struct TP_QT_NO_EXPORT BaseChannelGroupInterface::Private { Private(BaseChannelGroupInterface *parent) - : connection(0), + : connection(nullptr), selfHandle(0), adaptee(new BaseChannelGroupInterface::Adaptee(parent)) { diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h index 543f8bd8..a06f3d91 100644 --- a/TelepathyQt/base-channel.h +++ b/TelepathyQt/base-channel.h @@ -54,7 +54,7 @@ public: ~BaseChannel() override; QVariantMap immutableProperties() const override; - bool registerObject(DBusError *error = NULL); + bool registerObject(DBusError *error = nullptr); virtual QString uniqueName() const; Tp::BaseConnection *connection() const; diff --git a/TelepathyQt/base-connection-manager.h b/TelepathyQt/base-connection-manager.h index ea7087e0..e11e034f 100644 --- a/TelepathyQt/base-connection-manager.h +++ b/TelepathyQt/base-connection-manager.h @@ -79,7 +79,7 @@ public: bool hasProtocol(const QString &protocolName) const; bool addProtocol(const BaseProtocolPtr &protocol); - bool registerObject(DBusError *error = NULL); + bool registerObject(DBusError *error = nullptr); QList<BaseConnectionPtr> connections() const; diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp index 0421eaf0..af6334f9 100644 --- a/TelepathyQt/base-connection.cpp +++ b/TelepathyQt/base-connection.cpp @@ -977,7 +977,7 @@ void BaseConnectionRequestsInterface::createChannel(const QVariantMap &request, // The BaseConnectionContactsInterface code is fully or partially generated by the TelepathyQt-Generator. struct TP_QT_NO_EXPORT BaseConnectionContactsInterface::Private { Private(BaseConnectionContactsInterface *parent) - : connection(0), + : connection(nullptr), adaptee(new BaseConnectionContactsInterface::Adaptee(parent)) { } diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h index c1e87148..b359f878 100644 --- a/TelepathyQt/base-connection.h +++ b/TelepathyQt/base-connection.h @@ -107,7 +107,7 @@ public: QList<AbstractConnectionInterfacePtr> interfaces() const; AbstractConnectionInterfacePtr interface(const QString &interfaceName) const; bool plugInterface(const AbstractConnectionInterfacePtr &interface); - bool registerObject(DBusError *error = NULL); + bool registerObject(DBusError *error = nullptr); virtual QString uniqueName() const; diff --git a/TelepathyQt/base-debug.h b/TelepathyQt/base-debug.h index 9461a44f..8abd5975 100644 --- a/TelepathyQt/base-debug.h +++ b/TelepathyQt/base-debug.h @@ -59,7 +59,7 @@ public Q_SLOTS: QVariantMap immutableProperties() const override; - bool registerObject(const QString &busName, DBusError *error = NULL); + bool registerObject(const QString &busName, DBusError *error = nullptr); protected: class Adaptee; diff --git a/TelepathyQt/call-channel.cpp b/TelepathyQt/call-channel.cpp index ffe2626e..4a5cb8b0 100644 --- a/TelepathyQt/call-channel.cpp +++ b/TelepathyQt/call-channel.cpp @@ -521,11 +521,11 @@ CallMemberFlags CallChannel::remoteMemberFlags(const ContactPtr &member) const { if (!isReady(FeatureCallMembers)) { warning() << "CallChannel::remoteMemberFlags() used with FeatureCallMembers not ready"; - return (CallMemberFlags) 0; + return (CallMemberFlags) nullptr; } if (!member) { - return (CallMemberFlags) 0; + return (CallMemberFlags) nullptr; } for (CallMemberMap::const_iterator i = mPriv->callMembers.constBegin(); @@ -538,7 +538,7 @@ CallMemberFlags CallChannel::remoteMemberFlags(const ContactPtr &member) const } } - return (CallMemberFlags) 0; + return (CallMemberFlags) nullptr; } /** diff --git a/TelepathyQt/callbacks.h b/TelepathyQt/callbacks.h index 08b508a9..90d4dcd2 100644 --- a/TelepathyQt/callbacks.h +++ b/TelepathyQt/callbacks.h @@ -64,13 +64,13 @@ struct BaseFunctorCaller : public AbstractFunctorCaller struct TP_QT_EXPORT BaseCallback { - BaseCallback() : caller(0) {} + BaseCallback() : caller(nullptr) {} /* takes ownership of caller */ BaseCallback(AbstractFunctorCaller *caller) : caller(caller) {} BaseCallback(const BaseCallback &other) : caller(other.caller->clone()) {} virtual ~BaseCallback() { delete caller; } - bool isValid() const { return caller != 0; } + bool isValid() const { return caller != nullptr; } BaseCallback &operator=(const BaseCallback &other) { diff --git a/TelepathyQt/captcha.h b/TelepathyQt/captcha.h index 9f35b2ea..b04666e5 100644 --- a/TelepathyQt/captcha.h +++ b/TelepathyQt/captcha.h @@ -40,7 +40,7 @@ public: Captcha(const Captcha &other); ~Captcha(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } Captcha &operator=(const Captcha &rhs); diff --git a/TelepathyQt/channel-class-spec.cpp b/TelepathyQt/channel-class-spec.cpp index ae74b276..227ae29c 100644 --- a/TelepathyQt/channel-class-spec.cpp +++ b/TelepathyQt/channel-class-spec.cpp @@ -107,7 +107,7 @@ ChannelClassSpec::~ChannelClassSpec() bool ChannelClassSpec::isValid() const { - return mPriv.constData() != 0 && + return mPriv.constData() != nullptr && !(qdbus_cast<QString>( mPriv->props.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"))) .isEmpty()) && @@ -153,17 +153,17 @@ bool ChannelClassSpec::matches(const QVariantMap &immutableProperties) const bool ChannelClassSpec::hasProperty(const QString &qualifiedName) const { - return mPriv.constData() != 0 ? mPriv->props.contains(qualifiedName) : false; + return mPriv.constData() != nullptr ? mPriv->props.contains(qualifiedName) : false; } QVariant ChannelClassSpec::property(const QString &qualifiedName) const { - return mPriv.constData() != 0 ? mPriv->props.value(qualifiedName) : QVariant(); + return mPriv.constData() != nullptr ? mPriv->props.value(qualifiedName) : QVariant(); } void ChannelClassSpec::setProperty(const QString &qualifiedName, const QVariant &value) { - if (mPriv.constData() == 0) { + if (mPriv.constData() == nullptr) { mPriv = new Private; } @@ -172,7 +172,7 @@ void ChannelClassSpec::setProperty(const QString &qualifiedName, const QVariant void ChannelClassSpec::unsetProperty(const QString &qualifiedName) { - if (mPriv.constData() == 0) { + if (mPriv.constData() == nullptr) { // No properties set for sure, so don't have to unset any return; } @@ -182,7 +182,7 @@ void ChannelClassSpec::unsetProperty(const QString &qualifiedName) QVariantMap ChannelClassSpec::allProperties() const { - return mPriv.constData() != 0 ? mPriv->props : QVariantMap(); + return mPriv.constData() != nullptr ? mPriv->props : QVariantMap(); } ChannelClass ChannelClassSpec::bareClass() const diff --git a/TelepathyQt/channel-request.cpp b/TelepathyQt/channel-request.cpp index ab0e11c7..3189f499 100644 --- a/TelepathyQt/channel-request.cpp +++ b/TelepathyQt/channel-request.cpp @@ -153,8 +153,8 @@ void ChannelRequest::Private::introspectMain(ChannelRequest::Private *self) bool needIntrospectMainProps = false; const char *propertiesNames[] = { "Account", "UserActionTime", "PreferredHandler", "Requests", "Interfaces", - NULL }; - for (unsigned i = 0; propertiesNames[i] != NULL; ++i) { + nullptr }; + for (unsigned i = 0; propertiesNames[i] != nullptr; ++i) { key = TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String("."); key += QLatin1String(propertiesNames[i]); if (!self->immutableProperties.contains(key)) { @@ -188,7 +188,7 @@ void ChannelRequest::Private::introspectMain(ChannelRequest::Private *self) void ChannelRequest::Private::extractMainProps(const QVariantMap &props, bool lastCall) { - PendingReady *readyOp = 0; + PendingReady *readyOp = nullptr; if (props.contains(QLatin1String("Account"))) { QDBusObjectPath accountObjectPath = @@ -755,7 +755,7 @@ ChannelRequestHints &ChannelRequestHints::operator=(const ChannelRequestHints &o bool ChannelRequestHints::isValid() const { - return mPriv.constData() != 0; + return mPriv.constData() != nullptr; } bool ChannelRequestHints::hasHint(const QString &reversedDomain, const QString &localName) const diff --git a/TelepathyQt/channel.cpp b/TelepathyQt/channel.cpp index 2b7cde55..b5849f6e 100644 --- a/TelepathyQt/channel.cpp +++ b/TelepathyQt/channel.cpp @@ -266,8 +266,8 @@ Channel::Private::Private(Channel *parent, const ConnectionPtr &connection, properties(parent->interface<Client::DBus::PropertiesInterface>()), connection(connection), immutableProperties(immutableProperties), - group(0), - conference(0), + group(nullptr), + conference(nullptr), readinessHelper(parent->readinessHelper()), targetHandleType(0), targetHandle(0), @@ -277,7 +277,7 @@ Channel::Private::Private(Channel *parent, const ConnectionPtr &connection, usingMembersChangedDetailed(false), groupHaveMembers(false), buildingContacts(false), - currentGroupMembersChangedInfo(0), + currentGroupMembersChangedInfo(nullptr), groupAreHandleOwnersAvailable(false), pendingRetrieveGroupSelfContact(false), groupIsSelfHandleTracked(false), @@ -441,11 +441,11 @@ void Channel::Private::introspectMainFallbackInterfaces() void Channel::Private::introspectGroup() { - Q_ASSERT(properties != 0); + Q_ASSERT(properties != nullptr); if (!group) { group = parent->interface<Client::ChannelInterfaceGroupInterface>(); - Q_ASSERT(group != 0); + Q_ASSERT(group != nullptr); } debug() << "Introspecting Channel.Interface.Group for" << parent->objectPath(); @@ -491,7 +491,7 @@ void Channel::Private::introspectGroup() void Channel::Private::introspectGroupFallbackFlags() { - Q_ASSERT(group != 0); + Q_ASSERT(group != nullptr); debug() << "Calling Channel.Interface.Group::GetGroupFlags()"; QDBusPendingCallWatcher *watcher = @@ -503,7 +503,7 @@ void Channel::Private::introspectGroupFallbackFlags() void Channel::Private::introspectGroupFallbackMembers() { - Q_ASSERT(group != 0); + Q_ASSERT(group != nullptr); debug() << "Calling Channel.Interface.Group::GetAllMembers()"; QDBusPendingCallWatcher *watcher = @@ -515,7 +515,7 @@ void Channel::Private::introspectGroupFallbackMembers() void Channel::Private::introspectGroupFallbackLocalPendingWithInfo() { - Q_ASSERT(group != 0); + Q_ASSERT(group != nullptr); debug() << "Calling Channel.Interface.Group::GetLocalPendingMembersWithInfo()"; QDBusPendingCallWatcher *watcher = @@ -528,7 +528,7 @@ void Channel::Private::introspectGroupFallbackLocalPendingWithInfo() void Channel::Private::introspectGroupFallbackSelfHandle() { - Q_ASSERT(group != 0); + Q_ASSERT(group != nullptr); debug() << "Calling Channel.Interface.Group::GetSelfHandle()"; QDBusPendingCallWatcher *watcher = @@ -540,12 +540,12 @@ void Channel::Private::introspectGroupFallbackSelfHandle() void Channel::Private::introspectConference() { - Q_ASSERT(properties != 0); - Q_ASSERT(conference == 0); + Q_ASSERT(properties != nullptr); + Q_ASSERT(conference == nullptr); debug() << "Introspecting Conference interface"; conference = parent->interface<Client::ChannelInterfaceConferenceInterface>(); - Q_ASSERT(conference != 0); + Q_ASSERT(conference != nullptr); introspectingConference = true; @@ -1099,7 +1099,7 @@ void Channel::Private::updateContacts(const QList<ContactPtr> &contacts) } } delete currentGroupMembersChangedInfo; - currentGroupMembersChangedInfo = 0; + currentGroupMembersChangedInfo = nullptr; if (selfContactUpdated && parent->isReady(Channel::FeatureCore)) { emit parent->groupSelfContactChanged(); @@ -1236,7 +1236,7 @@ void Channel::Private::processConferenceChannelRemoved() SIGNAL(finished(Tp::PendingOperation*)), SLOT(gotConferenceChannelRemovedActorContact(Tp::PendingOperation*))); } else { - parent->gotConferenceChannelRemovedActorContact(0); + parent->gotConferenceChannelRemovedActorContact(nullptr); } } @@ -1835,7 +1835,7 @@ Channel::PendingLeave::PendingLeave(const ChannelPtr &chan, const QString &messa ChannelGroupChangeReason reason) : PendingOperation(chan) { - Q_ASSERT(chan->mPriv->group != NULL); + Q_ASSERT(chan->mPriv->group != nullptr); QDBusPendingCall call = chan->mPriv->group->RemoveMembersWithReason( diff --git a/TelepathyQt/channel.h b/TelepathyQt/channel.h index 59855606..04bd6765 100644 --- a/TelepathyQt/channel.h +++ b/TelepathyQt/channel.h @@ -111,7 +111,7 @@ public: GroupMemberChangeDetails &operator=(const GroupMemberChangeDetails &other); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } bool hasActor() const; ContactPtr actor() const; diff --git a/TelepathyQt/client-registrar-internal.h b/TelepathyQt/client-registrar-internal.h index 2866b0fc..daaf9fb5 100644 --- a/TelepathyQt/client-registrar-internal.h +++ b/TelepathyQt/client-registrar-internal.h @@ -129,7 +129,7 @@ private Q_SLOTS: private: struct InvocationData : RefCounted { - InvocationData() : readyOp(0) {} + InvocationData() : readyOp(nullptr) {} PendingOperation *readyOp; QString error, message; @@ -195,7 +195,7 @@ private Q_SLOTS: private: struct InvocationData : RefCounted { - InvocationData() : readyOp(0) {} + InvocationData() : readyOp(nullptr) {} PendingOperation *readyOp; QString error, message; @@ -285,7 +285,7 @@ private Q_SLOTS: private: struct InvocationData : RefCounted { - InvocationData() : readyOp(0) {} + InvocationData() : readyOp(nullptr) {} PendingOperation *readyOp; QString error, message; diff --git a/TelepathyQt/client-registrar.cpp b/TelepathyQt/client-registrar.cpp index e38d7d21..4f8ac3b1 100644 --- a/TelepathyQt/client-registrar.cpp +++ b/TelepathyQt/client-registrar.cpp @@ -229,7 +229,7 @@ void ClientObserverAdaptor::onReadyOpFinished(Tp::PendingOperation *op) continue; } - (*i)->readyOp = 0; + (*i)->readyOp = nullptr; if (op->isError()) { warning() << "Preparing proxies for ObserveChannels failed with" << op->errorName() @@ -332,7 +332,7 @@ void ClientApproverAdaptor::onReadyOpFinished(Tp::PendingOperation *op) continue; } - (*i)->readyOp = 0; + (*i)->readyOp = nullptr; if (op->isError()) { warning() << "Preparing proxies for AddDispatchOperation failed with" << op->errorName() @@ -490,7 +490,7 @@ void ClientHandlerAdaptor::onReadyOpFinished(Tp::PendingOperation *op) continue; } - (*i)->readyOp = 0; + (*i)->readyOp = nullptr; if (op->isError()) { warning() << "Preparing proxies for HandleChannels failed with" << op->errorName() diff --git a/TelepathyQt/connection-manager.cpp b/TelepathyQt/connection-manager.cpp index 5b7d2031..c99b9af5 100644 --- a/TelepathyQt/connection-manager.cpp +++ b/TelepathyQt/connection-manager.cpp @@ -167,7 +167,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectMain( void ConnectionManager::Private::ProtocolWrapper::introspectMainProperties() { Client::ProtocolInterface *protocol = baseInterface(); - Q_ASSERT(protocol != 0); + Q_ASSERT(protocol != nullptr); debug() << "Calling Properties::GetAll(Protocol) for" << info().name(); PendingVariantMap *pvm = protocol->requestAllProperties(); @@ -206,7 +206,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectInterfaces() void ConnectionManager::Private::ProtocolWrapper::introspectAvatars() { Client::ProtocolInterfaceAvatarsInterface *avatars = avatarsInterface(); - Q_ASSERT(avatars != 0); + Q_ASSERT(avatars != nullptr); debug() << "Calling Properties::GetAll(Protocol.Avatars) for" << info().name(); PendingVariantMap *pvm = avatars->requestAllProperties(); @@ -218,7 +218,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectAvatars() void ConnectionManager::Private::ProtocolWrapper::introspectPresence() { Client::ProtocolInterfacePresenceInterface *presence = presenceInterface(); - Q_ASSERT(presence != 0); + Q_ASSERT(presence != nullptr); debug() << "Calling Properties::GetAll(Protocol.Presence) for" << info().name(); PendingVariantMap *pvm = presence->requestAllProperties(); @@ -230,7 +230,7 @@ void ConnectionManager::Private::ProtocolWrapper::introspectPresence() void ConnectionManager::Private::ProtocolWrapper::introspectAddressing() { Client::ProtocolInterfaceAddressingInterface *addressing = addressingInterface(); - Q_ASSERT(addressing != 0); + Q_ASSERT(addressing != nullptr); debug() << "Calling Properties::GetAll(Protocol.Addressing) for" << info().name(); PendingVariantMap *pvm = addressing->requestAllProperties(); diff --git a/TelepathyQt/connection.cpp b/TelepathyQt/connection.cpp index aa744331..7e16c558 100644 --- a/TelepathyQt/connection.cpp +++ b/TelepathyQt/connection.cpp @@ -201,7 +201,7 @@ Connection::Private::Private(Connection *parent, contactFactory(contactFactory), baseInterface(new Client::ConnectionInterface(parent)), properties(parent->interface<Client::DBus::PropertiesInterface>()), - simplePresence(0), + simplePresence(nullptr), readinessHelper(parent->readinessHelper()), introspectingConnected(false), pendingStatus((uint) -1), @@ -214,12 +214,12 @@ Connection::Private::Private(Connection *parent, introspectingSelfContact(false), reintrospectSelfContactRequired(false), maxPresenceStatusMessageLength(0), - handleContext(0) + handleContext(nullptr) { accountBalance.amount = 0; accountBalance.scale = 0; - Q_ASSERT(properties != 0); + Q_ASSERT(properties != nullptr); if (chanFactory->dbusConnection().name() != parent->dbusConnection().name()) { warning() << " The D-Bus connection in the channel factory is not the proxy connection"; @@ -489,7 +489,7 @@ void Connection::Private::introspectSelfContact(Connection::Private *self) void Connection::Private::introspectSimplePresence(Connection::Private *self) { - Q_ASSERT(self->properties != 0); + Q_ASSERT(self->properties != nullptr); debug() << "Calling Properties::Get(" "Connection.I.SimplePresence.Statuses)"; @@ -1149,7 +1149,7 @@ struct TP_QT_NO_EXPORT Connection::ErrorDetails::Private : public QSharedData * Constructs a new invalid ErrorDetails instance. */ Connection::ErrorDetails::ErrorDetails() - : mPriv(0) + : mPriv(nullptr) { } diff --git a/TelepathyQt/connection.h b/TelepathyQt/connection.h index 2cd18c76..e2a2e055 100644 --- a/TelepathyQt/connection.h +++ b/TelepathyQt/connection.h @@ -103,7 +103,7 @@ public: ErrorDetails &operator=(const ErrorDetails &other); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } bool hasDebugMessage() const { diff --git a/TelepathyQt/contact-factory.cpp b/TelepathyQt/contact-factory.cpp index cd93acde..5d7253e9 100644 --- a/TelepathyQt/contact-factory.cpp +++ b/TelepathyQt/contact-factory.cpp @@ -140,7 +140,7 @@ ContactPtr ContactFactory::construct(Tp::ContactManager *manager, const Referenc */ PendingOperation *ContactFactory::prepare(const ContactPtr &contact) const { - return NULL; + return nullptr; } } diff --git a/TelepathyQt/contact-manager-roster.cpp b/TelepathyQt/contact-manager-roster.cpp index db45ca1a..70acc69d 100644 --- a/TelepathyQt/contact-manager-roster.cpp +++ b/TelepathyQt/contact-manager-roster.cpp @@ -46,8 +46,8 @@ ContactManager::Roster::Roster(ContactManager *contactManager) contactManager(contactManager), usingFallbackContactList(false), hasContactBlockingInterface(false), - introspectPendingOp(0), - introspectGroupsPendingOp(0), + introspectPendingOp(nullptr), + introspectGroupsPendingOp(nullptr), pendingContactListState((uint) -1), contactListState((uint) -1), canReportAbusive(false), @@ -198,7 +198,7 @@ PendingOperation *ContactManager::Roster::introspectGroups() } if (groupsReintrospectionRequired) { - return NULL; + return nullptr; } Q_ASSERT(!introspectGroupsPendingOp); @@ -771,7 +771,7 @@ void ContactManager::Roster::gotContactListProperties(PendingOperation *op) if (introspectPendingOp) { introspectPendingOp->setFinishedWithError( op->errorName(), op->errorMessage()); - introspectPendingOp = 0; + introspectPendingOp = nullptr; } return; } @@ -807,7 +807,7 @@ void ContactManager::Roster::gotContactListContacts(QDBusPendingCallWatcher *wat if (introspectPendingOp) { introspectPendingOp->setFinishedWithError( reply.error()); - introspectPendingOp = 0; + introspectPendingOp = nullptr; } return; } @@ -850,7 +850,7 @@ void ContactManager::Roster::gotContactListContacts(QDBusPendingCallWatcher *wat } introspectPendingOp->setFinished(); - introspectPendingOp = 0; + introspectPendingOp = nullptr; } else if (!groupsSetSuccess) { setStateSuccess(); } else { @@ -900,7 +900,7 @@ void ContactManager::Roster::onContactListStateChanged(uint state) // case the contacts will appear. Q_ASSERT(introspectPendingOp); introspectPendingOp->setFinished(); - introspectPendingOp = 0; + introspectPendingOp = nullptr; } } @@ -1270,7 +1270,7 @@ void ContactManager::Roster::onContactListChannelReady() Q_ASSERT(introspectPendingOp); introspectPendingOp->setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Roster not supported")); - introspectPendingOp = 0; + introspectPendingOp = nullptr; return; } @@ -1306,13 +1306,13 @@ void ContactManager::Roster::onContactListChannelReady() } introspectPendingOp->setFinished(); - introspectPendingOp = 0; + introspectPendingOp = nullptr; } } void ContactManager::Roster::gotContactListGroupsProperties(PendingOperation *op) { - Q_ASSERT(introspectGroupsPendingOp != NULL); + Q_ASSERT(introspectGroupsPendingOp != nullptr); if (groupsSetSuccess) { // Connect here, so we catch the following and the other failure cases @@ -1327,7 +1327,7 @@ void ContactManager::Roster::gotContactListGroupsProperties(PendingOperation *op introspectGroupsPendingOp->setFinishedWithError( op->errorName(), op->errorMessage()); - introspectGroupsPendingOp = 0; + introspectGroupsPendingOp = nullptr; return; } @@ -1354,7 +1354,7 @@ void ContactManager::Roster::onContactListContactsUpgraded(PendingOperation *op) Q_ASSERT(processingContactListChanges); processingContactListChanges = false; - Q_ASSERT(introspectGroupsPendingOp != NULL); + Q_ASSERT(introspectGroupsPendingOp != nullptr); if (op->isError()) { warning() << "Upgrading contacts with group membership failed:" << op->errorName() << '-' @@ -1362,13 +1362,13 @@ void ContactManager::Roster::onContactListContactsUpgraded(PendingOperation *op) introspectGroupsPendingOp->setFinishedWithError( op->errorName(), op->errorMessage()); - introspectGroupsPendingOp = 0; + introspectGroupsPendingOp = nullptr; processContactListChanges(); return; } introspectGroupsPendingOp->setFinished(); - introspectGroupsPendingOp = 0; + introspectGroupsPendingOp = nullptr; processContactListChanges(); } @@ -1608,7 +1608,7 @@ void ContactManager::Roster::onContactListGroupRemoved(Tp::DBusProxy *proxy, TP_QT_IFACE_CHANNEL + QLatin1String(".TargetID")).toString(); contactListGroupChannels.remove(id); removedContactListGroupChannels.append(contactListGroupChannel); - disconnect(contactListGroupChannel.data(), 0, 0, 0); + disconnect(contactListGroupChannel.data(), nullptr, nullptr, nullptr); emit contactManager->groupRemoved(id); } @@ -2068,7 +2068,7 @@ void ContactManager::Roster::checkContactListGroupsReady() setContactListGroupChannelsReady(); if (introspectGroupsPendingOp) { introspectGroupsPendingOp->setFinished(); - introspectGroupsPendingOp = 0; + introspectGroupsPendingOp = nullptr; } pendingContactListGroupChannels.clear(); } diff --git a/TelepathyQt/contact-manager.cpp b/TelepathyQt/contact-manager.cpp index dfa28bce..a876e32c 100644 --- a/TelepathyQt/contact-manager.cpp +++ b/TelepathyQt/contact-manager.cpp @@ -79,7 +79,7 @@ ContactManager::Private::Private(ContactManager *parent, Connection *connection) connection(connection), roster(new ContactManager::Roster(parent)), requestAvatarsIdle(false), - refreshInfoOp(0) + refreshInfoOp(nullptr) { } @@ -1434,7 +1434,7 @@ void ContactManager::doRefreshInfo() { PendingRefreshContactInfo *op = mPriv->refreshInfoOp; Q_ASSERT(op); - mPriv->refreshInfoOp = 0; + mPriv->refreshInfoOp = nullptr; op->refreshInfo(); } diff --git a/TelepathyQt/contact-messenger.cpp b/TelepathyQt/contact-messenger.cpp index 1f34f4bd..2c13a845 100644 --- a/TelepathyQt/contact-messenger.cpp +++ b/TelepathyQt/contact-messenger.cpp @@ -45,7 +45,7 @@ struct TP_QT_NO_EXPORT ContactMessenger::Private : parent(parent), account(account), contactIdentifier(contactIdentifier), - cdMessagesInterface(0) + cdMessagesInterface(nullptr) { } diff --git a/TelepathyQt/contact-messenger.h b/TelepathyQt/contact-messenger.h index 33fc8c57..1b01530c 100644 --- a/TelepathyQt/contact-messenger.h +++ b/TelepathyQt/contact-messenger.h @@ -55,9 +55,9 @@ public: PendingSendMessage *sendMessage(const QString &text, ChannelTextMessageType type = ChannelTextMessageTypeNormal, - MessageSendingFlags flags = 0); + MessageSendingFlags flags = nullptr); PendingSendMessage *sendMessage(const MessageContentPartList &parts, - MessageSendingFlags flags = 0); + MessageSendingFlags flags = nullptr); Q_SIGNALS: void messageSent(const Tp::Message &message, Tp::MessageSendingFlags flags, diff --git a/TelepathyQt/contact-search-channel.h b/TelepathyQt/contact-search-channel.h index cc0e1dcb..e42673f2 100644 --- a/TelepathyQt/contact-search-channel.h +++ b/TelepathyQt/contact-search-channel.h @@ -49,7 +49,7 @@ public: SearchStateChangeDetails(const SearchStateChangeDetails &other); ~SearchStateChangeDetails(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } SearchStateChangeDetails &operator=(const SearchStateChangeDetails &other); diff --git a/TelepathyQt/contact.h b/TelepathyQt/contact.h index aabddd31..654eb365 100644 --- a/TelepathyQt/contact.h +++ b/TelepathyQt/contact.h @@ -78,7 +78,7 @@ public: InfoFields(const InfoFields &other); ~InfoFields(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } InfoFields &operator=(const InfoFields &other); diff --git a/TelepathyQt/dbus-error.cpp b/TelepathyQt/dbus-error.cpp index 4964962a..587b0e11 100644 --- a/TelepathyQt/dbus-error.cpp +++ b/TelepathyQt/dbus-error.cpp @@ -51,7 +51,7 @@ struct TP_QT_NO_EXPORT DBusError::Private * Construct an empty DBusError */ DBusError::DBusError() - : mPriv(0) + : mPriv(nullptr) { } diff --git a/TelepathyQt/dbus-error.h b/TelepathyQt/dbus-error.h index dcb4afe4..4b7c0815 100644 --- a/TelepathyQt/dbus-error.h +++ b/TelepathyQt/dbus-error.h @@ -41,7 +41,7 @@ public: DBusError(const QString &name, const QString &message); ~DBusError(); - bool isValid() const { return mPriv != 0; } + bool isValid() const { return mPriv != nullptr; } bool operator==(const DBusError &other) const; bool operator!=(const DBusError &other) const; diff --git a/TelepathyQt/dbus-object.h b/TelepathyQt/dbus-object.h index 6a9cbd1d..506e6c4b 100644 --- a/TelepathyQt/dbus-object.h +++ b/TelepathyQt/dbus-object.h @@ -42,7 +42,7 @@ class TP_QT_EXPORT DBusObject : public QObject Q_DISABLE_COPY(DBusObject) public: - DBusObject(const QDBusConnection &dbusConnection, QObject *parent = 0); + DBusObject(const QDBusConnection &dbusConnection, QObject *parent = nullptr); ~DBusObject() override; QString objectPath() const; diff --git a/TelepathyQt/dbus-proxy-factory.cpp b/TelepathyQt/dbus-proxy-factory.cpp index d3d68590..55b07999 100644 --- a/TelepathyQt/dbus-proxy-factory.cpp +++ b/TelepathyQt/dbus-proxy-factory.cpp @@ -177,7 +177,7 @@ PendingReady *DBusProxyFactory::nowHaveProxy(const DBusProxyPtr &proxy) const PendingOperation *DBusProxyFactory::initialPrepare(const DBusProxyPtr &proxy) const { // Nothing we could think about needs doing - return NULL; + return nullptr; } /** @@ -194,7 +194,7 @@ PendingOperation *DBusProxyFactory::initialPrepare(const DBusProxyPtr &proxy) co PendingOperation *DBusProxyFactory::readyPrepare(const DBusProxyPtr &proxy) const { // Nothing we could think about needs doing - return NULL; + return nullptr; } /** diff --git a/TelepathyQt/dbus-proxy.cpp b/TelepathyQt/dbus-proxy.cpp index d80ce149..3f333046 100644 --- a/TelepathyQt/dbus-proxy.cpp +++ b/TelepathyQt/dbus-proxy.cpp @@ -375,7 +375,7 @@ void StatefulDBusProxy::onServiceOwnerChanged(const QString &name, const QString StatelessDBusProxy::StatelessDBusProxy(const QDBusConnection &dbusConnection, const QString &busName, const QString &objectPath, const Feature &featureCore) : DBusProxy(dbusConnection, busName, objectPath, featureCore), - mPriv(0) + mPriv(nullptr) { if (busName.startsWith(QLatin1String(":"))) { warning() << diff --git a/TelepathyQt/dbus-service.cpp b/TelepathyQt/dbus-service.cpp index 61cab851..a3ff7ac7 100644 --- a/TelepathyQt/dbus-service.cpp +++ b/TelepathyQt/dbus-service.cpp @@ -206,7 +206,7 @@ struct AbstractDBusServiceInterface::Private { Private(const QString &interfaceName) : interfaceName(interfaceName), - dbusObject(0), + dbusObject(nullptr), registered(false) { } diff --git a/TelepathyQt/debug-internal.h b/TelepathyQt/debug-internal.h index 4d28d944..00d1f769 100644 --- a/TelepathyQt/debug-internal.h +++ b/TelepathyQt/debug-internal.h @@ -33,9 +33,9 @@ namespace Tp class TP_QT_EXPORT Debug { public: - inline Debug() : debug(0) { } + inline Debug() : debug(nullptr) { } inline Debug(QtMsgType type) : type(type), debug(new QDebug(&msg)) { } - inline Debug(const Debug &a) : type(a.type), debug(a.debug ? new QDebug(&msg) : 0) + inline Debug(const Debug &a) : type(a.type), debug(a.debug ? new QDebug(&msg) : nullptr) { if (debug) { (*debug) << qPrintable(a.msg); @@ -47,7 +47,7 @@ public: if (this != &a) { type = a.type; delete debug; - debug = 0; + debug = nullptr; if (a.debug) { debug = new QDebug(&msg); diff --git a/TelepathyQt/debug.cpp b/TelepathyQt/debug.cpp index 51e4e356..1ca1c207 100644 --- a/TelepathyQt/debug.cpp +++ b/TelepathyQt/debug.cpp @@ -100,7 +100,7 @@ namespace { bool debugEnabled = false; bool warningsEnabled = true; -DebugCallback debugCallback = NULL; +DebugCallback debugCallback = nullptr; } void enableDebug(bool enable) diff --git a/TelepathyQt/fake-handler-manager-internal.cpp b/TelepathyQt/fake-handler-manager-internal.cpp index e18ab425..76fff9e1 100644 --- a/TelepathyQt/fake-handler-manager-internal.cpp +++ b/TelepathyQt/fake-handler-manager-internal.cpp @@ -86,7 +86,7 @@ void FakeHandler::onChannelDestroyed(QObject *obj) } } -FakeHandlerManager *FakeHandlerManager::mInstance = 0; +FakeHandlerManager *FakeHandlerManager::mInstance = nullptr; FakeHandlerManager *FakeHandlerManager::instance() { @@ -103,7 +103,7 @@ FakeHandlerManager::FakeHandlerManager() FakeHandlerManager::~FakeHandlerManager() { - mInstance = 0; + mInstance = nullptr; } ObjectPathList FakeHandlerManager::handledChannels(const QDBusConnection &bus) const @@ -157,7 +157,7 @@ void FakeHandlerManager::onFakeHandlerInvalidated(FakeHandler *fakeHandler) if (mFakeHandlers.isEmpty()) { // set mInstance to 0 here as we don't want instance() to return a already // deleted instance - mInstance = 0; + mInstance = nullptr; deleteLater(); } } diff --git a/TelepathyQt/feature.h b/TelepathyQt/feature.h index 07ab3a55..1c085004 100644 --- a/TelepathyQt/feature.h +++ b/TelepathyQt/feature.h @@ -46,7 +46,7 @@ public: Feature(const Feature &other); ~Feature(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } Feature &operator=(const Feature &other); diff --git a/TelepathyQt/file-transfer-channel-creation-properties.cpp b/TelepathyQt/file-transfer-channel-creation-properties.cpp index d63152cb..dd17f8a1 100644 --- a/TelepathyQt/file-transfer-channel-creation-properties.cpp +++ b/TelepathyQt/file-transfer-channel-creation-properties.cpp @@ -130,7 +130,7 @@ FileTransferChannelCreationProperties::FileTransferChannelCreationProperties( : mPriv(new Private(path, contentType)) { if (mPriv->suggestedFileName.isEmpty()) { - mPriv = QSharedDataPointer<Private>(NULL); + mPriv = QSharedDataPointer<Private>(nullptr); } } diff --git a/TelepathyQt/file-transfer-channel-creation-properties.h b/TelepathyQt/file-transfer-channel-creation-properties.h index ac72ef89..fb823023 100644 --- a/TelepathyQt/file-transfer-channel-creation-properties.h +++ b/TelepathyQt/file-transfer-channel-creation-properties.h @@ -51,7 +51,7 @@ public: const FileTransferChannelCreationProperties &other); ~FileTransferChannelCreationProperties(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } FileTransferChannelCreationProperties &operator=( const FileTransferChannelCreationProperties &other); diff --git a/TelepathyQt/incoming-file-transfer-channel.cpp b/TelepathyQt/incoming-file-transfer-channel.cpp index 4653bf5e..d7d5e635 100644 --- a/TelepathyQt/incoming-file-transfer-channel.cpp +++ b/TelepathyQt/incoming-file-transfer-channel.cpp @@ -60,8 +60,8 @@ struct TP_QT_NO_EXPORT IncomingFileTransferChannel::Private IncomingFileTransferChannel::Private::Private(IncomingFileTransferChannel *parent) : parent(parent), fileTransferInterface(parent->interface<Client::ChannelTypeFileTransferInterface>()), - output(0), - socket(0), + output(nullptr), + socket(nullptr), requestedOffset(0), pos(0), weOpenedDevice(false) diff --git a/TelepathyQt/io-device.h b/TelepathyQt/io-device.h index 60c637a6..2a4aa4a9 100644 --- a/TelepathyQt/io-device.h +++ b/TelepathyQt/io-device.h @@ -38,7 +38,7 @@ class TP_QT_EXPORT IODevice : public QIODevice { Q_OBJECT public: - explicit IODevice(QObject *parent = 0); + explicit IODevice(QObject *parent = nullptr); ~IODevice() override; bool isSequential() const override; qint64 bytesAvailable() const override; diff --git a/TelepathyQt/location-info.h b/TelepathyQt/location-info.h index 221fbed2..ae3e38f0 100644 --- a/TelepathyQt/location-info.h +++ b/TelepathyQt/location-info.h @@ -45,7 +45,7 @@ public: LocationInfo(const LocationInfo &other); virtual ~LocationInfo(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } LocationInfo &operator=(const LocationInfo &other); diff --git a/TelepathyQt/manager-file.cpp b/TelepathyQt/manager-file.cpp index f41d9550..816b90f9 100644 --- a/TelepathyQt/manager-file.cpp +++ b/TelepathyQt/manager-file.cpp @@ -351,7 +351,7 @@ ParamSpec *ManagerFile::Private::getParameter(const QString &protocol, return ¶mSpec; } } - return NULL; + return nullptr; } QStringList ManagerFile::Private::protocols() const diff --git a/TelepathyQt/message-content-part.h b/TelepathyQt/message-content-part.h index 7ad289e6..4418ef42 100644 --- a/TelepathyQt/message-content-part.h +++ b/TelepathyQt/message-content-part.h @@ -41,7 +41,7 @@ public: MessageContentPart(const MessageContentPart &other); ~MessageContentPart(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } MessageContentPart &operator=(const MessageContentPart &other); bool operator==(const MessageContentPart &other) const; diff --git a/TelepathyQt/message.cpp b/TelepathyQt/message.cpp index b8cbd1f3..2538f41c 100644 --- a/TelepathyQt/message.cpp +++ b/TelepathyQt/message.cpp @@ -101,7 +101,7 @@ struct TP_QT_NO_EXPORT Message::Private : public QSharedData Message::Private::Private(const MessagePartList &parts) : parts(parts), forceNonText(false), - sender(0) + sender(nullptr) { } diff --git a/TelepathyQt/message.h b/TelepathyQt/message.h index 22e5c295..7aa6bc2a 100644 --- a/TelepathyQt/message.h +++ b/TelepathyQt/message.h @@ -106,7 +106,7 @@ public: DeliveryDetails &operator=(const DeliveryDetails &other); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } DeliveryStatus status() const; diff --git a/TelepathyQt/optional-interface-factory.cpp b/TelepathyQt/optional-interface-factory.cpp index e512962a..541763fb 100644 --- a/TelepathyQt/optional-interface-factory.cpp +++ b/TelepathyQt/optional-interface-factory.cpp @@ -75,7 +75,7 @@ AbstractInterface *OptionalInterfaceCache::getCached(const QString &name) const if (mPriv->interfaces.contains(name)) { return mPriv->interfaces.value(name); } else { - return 0; + return nullptr; } } diff --git a/TelepathyQt/optional-interface-factory.h b/TelepathyQt/optional-interface-factory.h index fb3f1309..83a73894 100644 --- a/TelepathyQt/optional-interface-factory.h +++ b/TelepathyQt/optional-interface-factory.h @@ -101,7 +101,7 @@ public: // vexing-parse QString name( (QLatin1String(Interface::staticInterfaceName())) ); if (check == CheckInterfaceSupported && !mInterfaces.contains(name)) { - return 0; + return nullptr; } // If present or forced, delegate to OptionalInterfaceFactory @@ -111,7 +111,7 @@ public: template <typename Interface> inline Interface *interface() const { - AbstractInterface* interfaceMustBeASubclassOfAbstractInterface = static_cast<Interface *>(NULL); + AbstractInterface* interfaceMustBeASubclassOfAbstractInterface = static_cast<Interface *>(nullptr); Q_UNUSED(interfaceMustBeASubclassOfAbstractInterface); // If there is a interface cached already, return it diff --git a/TelepathyQt/outgoing-file-transfer-channel.cpp b/TelepathyQt/outgoing-file-transfer-channel.cpp index 6f12ec82..040455b6 100644 --- a/TelepathyQt/outgoing-file-transfer-channel.cpp +++ b/TelepathyQt/outgoing-file-transfer-channel.cpp @@ -62,8 +62,8 @@ struct TP_QT_NO_EXPORT OutgoingFileTransferChannel::Private OutgoingFileTransferChannel::Private::Private(OutgoingFileTransferChannel *parent) : parent(parent), fileTransferInterface(parent->interface<Client::ChannelTypeFileTransferInterface>()), - input(0), - socket(0), + input(nullptr), + socket(nullptr), pos(0), weOpenedDevice(false) { diff --git a/TelepathyQt/outgoing-stream-tube-channel-internal.h b/TelepathyQt/outgoing-stream-tube-channel-internal.h index 22438c08..157c5ebd 100644 --- a/TelepathyQt/outgoing-stream-tube-channel-internal.h +++ b/TelepathyQt/outgoing-stream-tube-channel-internal.h @@ -57,7 +57,7 @@ class TP_QT_NO_EXPORT QueuedContactFactory : public QObject Q_DISABLE_COPY(QueuedContactFactory) public: - QueuedContactFactory(ContactManagerPtr contactManager, QObject* parent = 0); + QueuedContactFactory(ContactManagerPtr contactManager, QObject* parent = nullptr); ~QueuedContactFactory() override; QUuid appendNewRequest(const UIntList &handles); diff --git a/TelepathyQt/pending-channel-request.cpp b/TelepathyQt/pending-channel-request.cpp index 9ca9078b..e51009ef 100644 --- a/TelepathyQt/pending-channel-request.cpp +++ b/TelepathyQt/pending-channel-request.cpp @@ -46,7 +46,7 @@ struct TP_QT_NO_EXPORT PendingChannelRequest::Private { Private(const QDBusConnection &dbusConnection) : dbusConnection(dbusConnection), - cancelOperation(0) + cancelOperation(nullptr) { } @@ -96,7 +96,7 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account, Client::ChannelDispatcherInterface *channelDispatcherInterface = account->dispatcherInterface(); - QDBusPendingCallWatcher *watcher = 0; + QDBusPendingCallWatcher *watcher = nullptr; if (create) { if (hints.isValid()) { if (account->supportsRequestHints()) { @@ -282,7 +282,7 @@ void PendingChannelRequest::onProceedOperationFinished(PendingOperation *op) void PendingChannelRequest::onCancelOperationFinished(PendingOperation *op) { - mPriv->cancelOperation = 0; + mPriv->cancelOperation = nullptr; if (!isFinished()) { setFinishedWithError(TP_QT_ERROR_CANCELLED, QLatin1String("ChannelRequest cancelled")); diff --git a/TelepathyQt/pending-channel.cpp b/TelepathyQt/pending-channel.cpp index 8e6db33b..95d9bb80 100644 --- a/TelepathyQt/pending-channel.cpp +++ b/TelepathyQt/pending-channel.cpp @@ -126,7 +126,7 @@ PendingChannel::PendingChannel(const ConnectionPtr &connection, const QString &e mPriv->yours = false; mPriv->handleType = 0; mPriv->handle = 0; - mPriv->notifier = 0; + mPriv->notifier = nullptr; mPriv->create = false; setFinishedWithError(errorName, errorMessage); @@ -149,7 +149,7 @@ PendingChannel::PendingChannel(const ConnectionPtr &connection, mPriv->channelType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType")).toString(); mPriv->handleType = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType")).toUInt(); mPriv->handle = request.value(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandle")).toUInt(); - mPriv->notifier = 0; + mPriv->notifier = nullptr; mPriv->create = create; Client::ConnectionInterfaceRequestsInterface *requestsInterface = @@ -187,7 +187,7 @@ PendingChannel::PendingChannel(const AccountPtr &account, account->channelFactory(), account->contactFactory()); mPriv->handler = RequestTemporaryHandler::create(account); - mPriv->notifier = 0; + mPriv->notifier = nullptr; mPriv->create = create; QString handlerName = QString(QLatin1String("TpQtRaH_%1_%2")) @@ -395,10 +395,10 @@ HandledChannelNotifier *PendingChannel::handledChannelNotifier() const { if (!isFinished()) { warning() << "PendingChannel::handledChannelNotifier called before finished, returning 0"; - return 0; + return nullptr; } else if (!isValid()) { warning() << "PendingChannel::handledChannelNotifier called when not valid, returning 0"; - return 0; + return nullptr; } if (mPriv->cr && !mPriv->notifier) { diff --git a/TelepathyQt/pending-contacts.cpp b/TelepathyQt/pending-contacts.cpp index 94ac00fe..2dd2cd9a 100644 --- a/TelepathyQt/pending-contacts.cpp +++ b/TelepathyQt/pending-contacts.cpp @@ -54,7 +54,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private satisfyingContacts(satisfyingContacts), requestType(PendingContacts::ForHandles), handles(handles), - nested(0) + nested(nullptr) { } @@ -66,7 +66,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private missingFeatures(features), requestType(type), addresses(list), - nested(0) + nested(nullptr) { if (type != PendingContacts::ForIdentifiers && type != PendingContacts::ForUris) { @@ -83,7 +83,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private requestType(PendingContacts::ForVCardAddresses), addresses(vcardAddresses), vcardField(vcardField), - nested(0) + nested(nullptr) { } @@ -95,7 +95,7 @@ struct TP_QT_NO_EXPORT PendingContacts::Private features(features), requestType(PendingContacts::Upgrade), contactsToUpgrade(contactsToUpgrade), - nested(0) + nested(nullptr) { } @@ -611,7 +611,7 @@ void PendingContacts::onNestedFinished(PendingOperation *operation) } mPriv->contacts = mPriv->nested->contacts(); - mPriv->nested = 0; + mPriv->nested = nullptr; mPriv->setFinished(); } diff --git a/TelepathyQt/presence.h b/TelepathyQt/presence.h index 0412ca83..7b97f7df 100644 --- a/TelepathyQt/presence.h +++ b/TelepathyQt/presence.h @@ -52,7 +52,7 @@ public: static Presence hidden(const QString &statusMessage = QString()); static Presence offline(const QString &statusMessage = QString()); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } Presence &operator=(const Presence &other); bool operator==(const Presence &other) const; @@ -103,7 +103,7 @@ public: static PresenceSpec unknown(SimpleStatusFlags flags = CanHaveStatusMessage); static PresenceSpec error(SimpleStatusFlags flags = CanHaveStatusMessage); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } PresenceSpec &operator=(const PresenceSpec &other); bool operator==(const PresenceSpec &other) const; diff --git a/TelepathyQt/protocol-info.cpp b/TelepathyQt/protocol-info.cpp index 7eb2fb43..a488288b 100644 --- a/TelepathyQt/protocol-info.cpp +++ b/TelepathyQt/protocol-info.cpp @@ -34,7 +34,7 @@ struct TP_QT_NO_EXPORT ProtocolInfo::Private : public QSharedData { Private() : dbusConnection(QDBusConnection::sessionBus()), // make the compiler happy - addressingIface(0) + addressingIface(nullptr) { } @@ -44,7 +44,7 @@ struct TP_QT_NO_EXPORT ProtocolInfo::Private : public QSharedData cmName(cm->name()), name(name), iconName(QString(QLatin1String("im-%1")).arg(name)), - addressingIface(0) + addressingIface(nullptr) { QString escapedProtocolName = name; escapedProtocolName.replace(QLatin1Char('-'), QLatin1Char('_')); diff --git a/TelepathyQt/protocol-info.h b/TelepathyQt/protocol-info.h index 5828b368..b442a9ba 100644 --- a/TelepathyQt/protocol-info.h +++ b/TelepathyQt/protocol-info.h @@ -50,7 +50,7 @@ public: ProtocolInfo(const ProtocolInfo &other); ~ProtocolInfo(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } ProtocolInfo &operator=(const ProtocolInfo &other); diff --git a/TelepathyQt/protocol-parameter.h b/TelepathyQt/protocol-parameter.h index e8a9f1e2..5b20428b 100644 --- a/TelepathyQt/protocol-parameter.h +++ b/TelepathyQt/protocol-parameter.h @@ -55,7 +55,7 @@ public: ProtocolParameter(const ProtocolParameter &other); ~ProtocolParameter(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } ProtocolParameter &operator=(const ProtocolParameter &other); bool operator==(const ProtocolParameter &other) const; diff --git a/TelepathyQt/readiness-helper.cpp b/TelepathyQt/readiness-helper.cpp index c39fbf78..2e545a17 100644 --- a/TelepathyQt/readiness-helper.cpp +++ b/TelepathyQt/readiness-helper.cpp @@ -63,7 +63,7 @@ struct TP_QT_NO_EXPORT ReadinessHelper::Introspectable::Private : public QShared }; ReadinessHelper::Introspectable::Introspectable() - : mPriv(new Private(QSet<uint>(), Features(), QStringList(), 0, 0, false)) + : mPriv(new Private(QSet<uint>(), Features(), QStringList(), nullptr, nullptr, false)) { } @@ -139,7 +139,7 @@ ReadinessHelper::Private::Private( const Introspectables &introspectables) : parent(parent), object(object), - proxy(0), + proxy(nullptr), currentStatus(currentStatus), introspectables(introspectables), pendingStatusChange(false), @@ -149,7 +149,7 @@ ReadinessHelper::Private::Private( i != introspectables.constEnd(); ++i) { Feature feature = i.key(); Introspectable introspectable = i.value(); - Q_ASSERT(introspectable.mPriv->introspectFunc != 0); + Q_ASSERT(introspectable.mPriv->introspectFunc != nullptr); supportedStatuses += introspectable.mPriv->makesSenseForStatuses; supportedFeatures += feature; } @@ -168,13 +168,13 @@ ReadinessHelper::Private::Private( pendingStatusChange(false), pendingStatus(-1) { - Q_ASSERT(proxy != 0); + Q_ASSERT(proxy != nullptr); for (Introspectables::const_iterator i = introspectables.constBegin(); i != introspectables.constEnd(); ++i) { Feature feature = i.key(); Introspectable introspectable = i.value(); - Q_ASSERT(introspectable.mPriv->introspectFunc != 0); + Q_ASSERT(introspectable.mPriv->introspectFunc != nullptr); supportedStatuses += introspectable.mPriv->makesSenseForStatuses; supportedFeatures += feature; } diff --git a/TelepathyQt/readiness-helper.h b/TelepathyQt/readiness-helper.h index 51336144..b2cd55b7 100644 --- a/TelepathyQt/readiness-helper.h +++ b/TelepathyQt/readiness-helper.h @@ -79,11 +79,11 @@ public: ReadinessHelper(RefCounted *object, uint currentStatus = 0, const Introspectables &introspectables = Introspectables(), - QObject *parent = 0); + QObject *parent = nullptr); ReadinessHelper(DBusProxy *proxy, uint currentStatus = 0, const Introspectables &introspectables = Introspectables(), - QObject *parent = 0); + QObject *parent = nullptr); ~ReadinessHelper() override; void addIntrospectables(const Introspectables &introspectables); @@ -100,9 +100,9 @@ public: Features missingFeatures() const; bool isReady(const Feature &feature, - QString *errorName = 0, QString *errorMessage = 0) const; + QString *errorName = nullptr, QString *errorMessage = nullptr) const; bool isReady(const Features &features, - QString *errorName = 0, QString *errorMessage = 0) const; + QString *errorName = nullptr, QString *errorMessage = nullptr) const; PendingReady *becomeReady(const Features &requestedFeatures); void setIntrospectCompleted(const Feature &feature, bool success, diff --git a/TelepathyQt/requestable-channel-class-spec.h b/TelepathyQt/requestable-channel-class-spec.h index 95eb8318..abe376dc 100644 --- a/TelepathyQt/requestable-channel-class-spec.h +++ b/TelepathyQt/requestable-channel-class-spec.h @@ -71,7 +71,7 @@ public: static RequestableChannelClassSpec dbusTube(const QString &serviceName = QString()); static RequestableChannelClassSpec streamTube(const QString &service = QString()); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } RequestableChannelClassSpec &operator=(const RequestableChannelClassSpec &other); bool operator==(const RequestableChannelClassSpec &other) const; diff --git a/TelepathyQt/shared-ptr.h b/TelepathyQt/shared-ptr.h index 2290f221..815e9c05 100644 --- a/TelepathyQt/shared-ptr.h +++ b/TelepathyQt/shared-ptr.h @@ -71,7 +71,7 @@ public: inline virtual ~RefCounted() { - sc->d = 0; + sc->d = nullptr; if (!sc->weakref.deref()) { delete sc; } @@ -98,7 +98,7 @@ class SharedPtr typedef bool (SharedPtr<T>::*UnspecifiedBoolType)() const; public: - inline SharedPtr() : d(0) { } + inline SharedPtr() : d(nullptr) { } explicit inline SharedPtr(T *d) : d(d) { if (d) { d->ref(); } } template <typename Subclass> inline SharedPtr(const SharedPtr<Subclass> &o) : d(o.data()) { if (d) { d->ref(); } } @@ -122,12 +122,12 @@ public: if (tmp > 0) { d = dynamic_cast<T*>(sc->d); - Q_ASSERT(d != NULL); + Q_ASSERT(d != nullptr); } else { - d = 0; + d = nullptr; } } else { - d = 0; + d = nullptr; } } @@ -135,7 +135,7 @@ public: { if (d && !d->deref()) { T *saved = d; - d = 0; + d = nullptr; delete saved; } } @@ -152,7 +152,7 @@ public: inline bool isNull() const { return !d; } inline bool operator!() const { return isNull(); } - operator UnspecifiedBoolType() const { return !isNull() ? &SharedPtr<T>::operator! : 0; } + operator UnspecifiedBoolType() const { return !isNull() ? &SharedPtr<T>::operator! : nullptr; } inline bool operator==(const SharedPtr<T> &o) const { return d == o.d; } inline bool operator!=(const SharedPtr<T> &o) const { return d != o.d; } @@ -216,14 +216,14 @@ class WeakPtr typedef bool (WeakPtr<T>::*UnspecifiedBoolType)() const; public: - inline WeakPtr() : sc(0) { } + inline WeakPtr() : sc(nullptr) { } explicit inline WeakPtr(T *d) { if (d) { sc = d->sc; sc->weakref.ref(); } else { - sc = 0; + sc = nullptr; } } inline WeakPtr(const WeakPtr<T> &o) : sc(o.sc) { if (sc) { sc->weakref.ref(); } } @@ -233,7 +233,7 @@ public: sc = o.d->sc; sc->weakref.ref(); } else { - sc = 0; + sc = nullptr; } } inline ~WeakPtr() @@ -245,7 +245,7 @@ public: inline bool isNull() const { return !sc || sc->strongref.fetchAndAddOrdered(0) <= 0; } inline bool operator!() const { return isNull(); } - operator UnspecifiedBoolType() const { return !isNull() ? &WeakPtr<T>::operator! : 0; } + operator UnspecifiedBoolType() const { return !isNull() ? &WeakPtr<T>::operator! : nullptr; } inline WeakPtr<T> &operator=(const WeakPtr<T> &o) { diff --git a/TelepathyQt/simple-observer.cpp b/TelepathyQt/simple-observer.cpp index e34f31c0..c8765fce 100644 --- a/TelepathyQt/simple-observer.cpp +++ b/TelepathyQt/simple-observer.cpp @@ -592,7 +592,7 @@ void SimpleObserver::onContactConstructed(Tp::PendingOperation *op) mPriv->processChannelsQueue(); // disconnect all account signals we are handling - disconnect(mPriv->account.data(), 0, this, 0); + disconnect(mPriv->account.data(), nullptr, this, nullptr); } void SimpleObserver::onNewChannels(const AccountPtr &channelsAccount, diff --git a/TelepathyQt/simple-pending-operations.h b/TelepathyQt/simple-pending-operations.h index 429825ee..0f78f8b9 100644 --- a/TelepathyQt/simple-pending-operations.h +++ b/TelepathyQt/simple-pending-operations.h @@ -94,7 +94,7 @@ public: PendingComposite(const QList<PendingOperation*> &operations, const SharedPtr<RefCounted> &object); PendingComposite(const QList<PendingOperation*> &operations, bool failOnFirstError, const SharedPtr<RefCounted> &object); - ~PendingComposite() override override; + ~PendingComposite() override ; private Q_SLOTS: TP_QT_NO_EXPORT void onOperationFinished(Tp::PendingOperation *); diff --git a/TelepathyQt/simple-stream-tube-handler.cpp b/TelepathyQt/simple-stream-tube-handler.cpp index d1ab9e00..8772d178 100644 --- a/TelepathyQt/simple-stream-tube-handler.cpp +++ b/TelepathyQt/simple-stream-tube-handler.cpp @@ -157,10 +157,10 @@ void SimpleStreamTubeHandler::handleChannels( if (invocation->tubes.isEmpty()) { warning() << "SSTH::HandleChannels got no suitable channels, admitting we're Confused"; - invocation->readyOp = 0; + invocation->readyOp = nullptr; invocation->error = TP_QT_ERROR_CONFUSED; invocation->message = QLatin1String("Got no suitable channels"); - onReadyOpFinished(0); + onReadyOpFinished(nullptr); } else { invocation->readyOp = new PendingComposite(readyOps, SharedPtr<SimpleStreamTubeHandler>(this)); connect(invocation->readyOp, @@ -175,12 +175,12 @@ void SimpleStreamTubeHandler::onReadyOpFinished(Tp::PendingOperation *op) Q_ASSERT(!op || op->isFinished()); for (QLinkedList<SharedPtr<InvocationData> >::iterator i = mInvocations.begin(); - op != 0 && i != mInvocations.end(); ++i) { + op != nullptr && i != mInvocations.end(); ++i) { if ((*i)->readyOp != op) { continue; } - (*i)->readyOp = 0; + (*i)->readyOp = nullptr; if (op->isError()) { warning() << "Preparing proxies for SSTubeHandler failed with" << op->errorName() diff --git a/TelepathyQt/simple-stream-tube-handler.h b/TelepathyQt/simple-stream-tube-handler.h index 961be367..83b0b89d 100644 --- a/TelepathyQt/simple-stream-tube-handler.h +++ b/TelepathyQt/simple-stream-tube-handler.h @@ -99,7 +99,7 @@ private: bool mMonitorConnections; struct InvocationData : RefCounted { - InvocationData() : readyOp(0) {} + InvocationData() : readyOp(nullptr) {} PendingOperation *readyOp; QString error, message; diff --git a/TelepathyQt/stream-tube-client.cpp b/TelepathyQt/stream-tube-client.cpp index 9716a346..0edd0636 100644 --- a/TelepathyQt/stream-tube-client.cpp +++ b/TelepathyQt/stream-tube-client.cpp @@ -204,7 +204,7 @@ struct TP_QT_NO_EXPORT StreamTubeClient::Private clientName(maybeClientName), isRegistered(false), acceptsAsTcp(false), acceptsAsUnix(false), - tcpGenerator(0), requireCredentials(false) + tcpGenerator(nullptr), requireCredentials(false) { if (clientName.isEmpty()) { clientName = QString::fromLatin1("TpQtSTubeClient_%1_%2") @@ -648,7 +648,7 @@ StreamTubeClient::TcpSourceAddressGenerator *StreamTubeClient::tcpGenerator() co { if (!acceptsAsTcp()) { warning() << "StreamTubeClient::tcpGenerator() used, but not accepting as TCP, returning 0"; - return 0; + return nullptr; } return mPriv->tcpGenerator; @@ -735,7 +735,7 @@ void StreamTubeClient::setToAcceptAsTcp(TcpSourceAddressGenerator *generator) */ void StreamTubeClient::setToAcceptAsUnix(bool requireCredentials) { - mPriv->tcpGenerator = 0; + mPriv->tcpGenerator = nullptr; mPriv->acceptsAsTcp = false; mPriv->acceptsAsUnix = true; mPriv->requireCredentials = requireCredentials; @@ -826,7 +826,7 @@ void StreamTubeClient::onInvokedForTube( return; } - TubeWrapper *wrapper = 0; + TubeWrapper *wrapper = nullptr; if (mPriv->acceptsAsTcp) { QPair<QHostAddress, quint16> srcAddr = @@ -865,8 +865,8 @@ void StreamTubeClient::onInvokedForTube( void StreamTubeClient::onAcceptFinished(TubeWrapper *wrapper, PendingStreamTubeConnection *conn) { - Q_ASSERT(wrapper != NULL); - Q_ASSERT(conn != NULL); + Q_ASSERT(wrapper != nullptr); + Q_ASSERT(conn != nullptr); if (!mPriv->tubes.contains(wrapper->mTube)) { debug() << "StreamTubeClient ignoring Accept result for invalidated tube" diff --git a/TelepathyQt/stream-tube-client.h b/TelepathyQt/stream-tube-client.h index 7578873e..09db4637 100644 --- a/TelepathyQt/stream-tube-client.h +++ b/TelepathyQt/stream-tube-client.h @@ -64,7 +64,7 @@ public: Tube(const Tube &other); ~Tube(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } Tube &operator=(const Tube &other); @@ -138,7 +138,7 @@ public: TcpSourceAddressGenerator *tcpGenerator() const; bool acceptsAsUnix() const; - void setToAcceptAsTcp(TcpSourceAddressGenerator *generator = 0); + void setToAcceptAsTcp(TcpSourceAddressGenerator *generator = nullptr); void setToAcceptAsUnix(bool requireCredentials = false); QList<Tube> tubes() const; diff --git a/TelepathyQt/stream-tube-server.cpp b/TelepathyQt/stream-tube-server.cpp index 66e6ac99..a4214a3c 100644 --- a/TelepathyQt/stream-tube-server.cpp +++ b/TelepathyQt/stream-tube-server.cpp @@ -300,7 +300,7 @@ struct StreamTubeServer::Private clientName(maybeClientName), isRegistered(false), exportedPort(0), - generator(0) + generator(nullptr) { if (clientName.isEmpty()) { clientName = QString::fromLatin1("TpQtSTubeServer_%1_%2") @@ -730,7 +730,7 @@ void StreamTubeServer::exportTcpSocket( mPriv->exportedAddr = address; mPriv->exportedPort = port; - mPriv->generator = 0; + mPriv->generator = nullptr; if (!parameters.isEmpty()) { mPriv->fixedGenerator.reset(new FixedParametersGenerator(parameters)); mPriv->generator = mPriv->fixedGenerator.data(); diff --git a/TelepathyQt/stream-tube-server.h b/TelepathyQt/stream-tube-server.h index 652d160e..eeb57de3 100644 --- a/TelepathyQt/stream-tube-server.h +++ b/TelepathyQt/stream-tube-server.h @@ -67,7 +67,7 @@ public: RemoteContact(const RemoteContact &other); ~RemoteContact(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } RemoteContact &operator=(const RemoteContact &other); @@ -95,7 +95,7 @@ public: Tube(const Tube &other); ~Tube(); - bool isValid() const { return mPriv.constData() != 0; } + bool isValid() const { return mPriv.constData() != nullptr; } Tube &operator=(const Tube &other); diff --git a/TelepathyQt/test-backdoors.cpp b/TelepathyQt/test-backdoors.cpp index bf4b53a8..886ebb09 100644 --- a/TelepathyQt/test-backdoors.cpp +++ b/TelepathyQt/test-backdoors.cpp @@ -29,7 +29,7 @@ namespace Tp void TestBackdoors::invalidateProxy(DBusProxy *proxy, const QString &reason, const QString &message) { - Q_ASSERT(proxy != 0); + Q_ASSERT(proxy != nullptr); Q_ASSERT(proxy->isValid()); proxy->invalidate(reason, message); diff --git a/TelepathyQt/text-channel.cpp b/TelepathyQt/text-channel.cpp index 262e7aa9..e4c2b068 100644 --- a/TelepathyQt/text-channel.cpp +++ b/TelepathyQt/text-channel.cpp @@ -123,8 +123,8 @@ TextChannel::Private::Private(TextChannel *parent) readinessHelper(parent->readinessHelper()), getAllInFlight(false), gotProperties(false), - messagePartSupport(0), - deliveryReportingSupport(0), + messagePartSupport(nullptr), + deliveryReportingSupport(nullptr), initialMessagesReceived(false) { ReadinessHelper::Introspectables introspectables; @@ -1126,7 +1126,7 @@ void TextChannel::onPendingMessagesRemoved(const UIntList &ids) void TextChannel::onTextSent(uint timestamp, uint type, const QString &text) { - emit messageSent(Message(timestamp, type, text), 0, + emit messageSent(Message(timestamp, type, text), nullptr, QLatin1String("")); } diff --git a/TelepathyQt/text-channel.h b/TelepathyQt/text-channel.h index c2b872ba..32c99918 100644 --- a/TelepathyQt/text-channel.h +++ b/TelepathyQt/text-channel.h @@ -78,10 +78,10 @@ public Q_SLOTS: PendingSendMessage *send(const QString &text, ChannelTextMessageType type = ChannelTextMessageTypeNormal, - MessageSendingFlags flags = 0); + MessageSendingFlags flags = nullptr); PendingSendMessage *send(const MessagePartList &parts, - MessageSendingFlags flags = 0); + MessageSendingFlags flags = nullptr); inline PendingOperation *inviteContacts( const QList<ContactPtr> &contacts, diff --git a/examples/accounts/account-item.h b/examples/accounts/account-item.h index 340d473e..3f179373 100644 --- a/examples/accounts/account-item.h +++ b/examples/accounts/account-item.h @@ -58,7 +58,7 @@ public: }; Q_ENUMS(Columns) - AccountItem(Tp::AccountPtr acc, QTableWidget *table, int row, QObject *parent = 0); + AccountItem(Tp::AccountPtr acc, QTableWidget *table, int row, QObject *parent = nullptr); ~AccountItem() override; int row() const { return mRow; } diff --git a/examples/accounts/accounts-window.h b/examples/accounts/accounts-window.h index 6d51f2a6..c727a570 100644 --- a/examples/accounts/accounts-window.h +++ b/examples/accounts/accounts-window.h @@ -38,7 +38,7 @@ class AccountsWindow : public QMainWindow Q_OBJECT public: - AccountsWindow(QWidget *parent = 0); + AccountsWindow(QWidget *parent = nullptr); ~AccountsWindow() override; private Q_SLOTS: diff --git a/examples/file-transfer/file-sender.cpp b/examples/file-transfer/file-sender.cpp index 50d50c21..9ffd016b 100644 --- a/examples/file-transfer/file-sender.cpp +++ b/examples/file-transfer/file-sender.cpp @@ -90,7 +90,7 @@ void FileSender::onAMReady(PendingOperation *op) } PendingReady *pr = qobject_cast<PendingReady*>(op); - Q_ASSERT(pr != NULL); + Q_ASSERT(pr != nullptr); Q_UNUSED(pr); qDebug() << "AccountManager ready"; @@ -116,7 +116,7 @@ void FileSender::onAccountReady(PendingOperation *op) } PendingReady *pr = qobject_cast<PendingReady*>(op); - Q_ASSERT(pr != NULL); + Q_ASSERT(pr != nullptr); Q_UNUSED(pr); qDebug() << "Account ready"; diff --git a/examples/protocols/cm-wrapper.h b/examples/protocols/cm-wrapper.h index ab0e5dd2..0bcbbb2b 100644 --- a/examples/protocols/cm-wrapper.h +++ b/examples/protocols/cm-wrapper.h @@ -41,7 +41,7 @@ class CMWrapper : public QObject Q_OBJECT public: - CMWrapper(const QString &cmName, QObject *parent = 0); + CMWrapper(const QString &cmName, QObject *parent = nullptr); ~CMWrapper() override; ConnectionManagerPtr cm() const; diff --git a/examples/roster/roster-item.h b/examples/roster/roster-item.h index ee8c071b..a1c01621 100644 --- a/examples/roster/roster-item.h +++ b/examples/roster/roster-item.h @@ -34,7 +34,7 @@ class RosterItem : public QObject, public QListWidgetItem public: RosterItem(const Tp::ContactPtr &contact, - QListWidget *parent = 0); + QListWidget *parent = nullptr); ~RosterItem() override; Tp::ContactPtr contact() const { return mContact; } diff --git a/examples/roster/roster-widget.cpp b/examples/roster/roster-widget.cpp index 14bce332..cd3f67a3 100644 --- a/examples/roster/roster-widget.cpp +++ b/examples/roster/roster-widget.cpp @@ -332,7 +332,7 @@ void RosterWidget::updateActions() mDenyAction->setEnabled(false); mRemoveAction->setEnabled(false); mBlockAction->setEnabled(false); - updateActions(0); + updateActions(nullptr); return; } Q_ASSERT(selectedItems.size() == 1); diff --git a/examples/roster/roster-widget.h b/examples/roster/roster-widget.h index ac2f3639..fbcf8a5f 100644 --- a/examples/roster/roster-widget.h +++ b/examples/roster/roster-widget.h @@ -46,7 +46,7 @@ class RosterWidget : public QWidget Q_OBJECT public: - RosterWidget(QWidget *parent = 0); + RosterWidget(QWidget *parent = nullptr); ~RosterWidget() override; Tp::ConnectionPtr connection() const { return mConn; } diff --git a/examples/roster/roster-window.h b/examples/roster/roster-window.h index 3a1a2e51..bf3cda0c 100644 --- a/examples/roster/roster-window.h +++ b/examples/roster/roster-window.h @@ -38,7 +38,7 @@ class RosterWindow : public QMainWindow Q_OBJECT public: - RosterWindow(const QString &accountName, QWidget *parent = 0); + RosterWindow(const QString &accountName, QWidget *parent = nullptr); ~RosterWindow() override; private Q_SLOTS: diff --git a/examples/stream-tubes/tube-initiator.cpp b/examples/stream-tubes/tube-initiator.cpp index b6454665..120449b7 100644 --- a/examples/stream-tubes/tube-initiator.cpp +++ b/examples/stream-tubes/tube-initiator.cpp @@ -104,7 +104,7 @@ void TubeInitiator::onAccountReady(Tp::PendingOperation *op) } PendingReady *ready = qobject_cast<PendingReady *>(op); - Q_ASSERT(ready != NULL); + Q_ASSERT(ready != nullptr); mAccount = AccountPtr::qObjectCast(ready->proxy()); diff --git a/tests/capabilities.cpp b/tests/capabilities.cpp index a4dd0766..a227954a 100644 --- a/tests/capabilities.cpp +++ b/tests/capabilities.cpp @@ -16,7 +16,7 @@ class TestCapabilities : public QObject Q_OBJECT public: - TestCapabilities(QObject *parent = 0); + TestCapabilities(QObject *parent = nullptr); private Q_SLOTS: void testConnCapabilities(); diff --git a/tests/channel-class-spec.cpp b/tests/channel-class-spec.cpp index 3131c40a..b8986f25 100644 --- a/tests/channel-class-spec.cpp +++ b/tests/channel-class-spec.cpp @@ -25,7 +25,7 @@ class TestChannelClassSpec : public QObject Q_OBJECT public: - TestChannelClassSpec(QObject *parent = 0); + TestChannelClassSpec(QObject *parent = nullptr); private Q_SLOTS: void testChannelClassSpecHash(); diff --git a/tests/dbus/account-connection-factory.cpp b/tests/dbus/account-connection-factory.cpp index 419d3fb3..9ce2e721 100644 --- a/tests/dbus/account-connection-factory.cpp +++ b/tests/dbus/account-connection-factory.cpp @@ -79,11 +79,11 @@ class TestAccountConnectionFactory : public Test Q_OBJECT public: - TestAccountConnectionFactory(QObject *parent = 0) + TestAccountConnectionFactory(QObject *parent = nullptr) : Test(parent), - mConn1(0), mConn2(0), - mDispatcher(0), mAccountAdaptor(0), - mReceivedHaveConnection(0), mReceivedConn(0) + mConn1(nullptr), mConn2(nullptr), + mDispatcher(nullptr), mAccountAdaptor(nullptr), + mReceivedHaveConnection(nullptr), mReceivedConn(nullptr) { } protected Q_SLOTS: @@ -155,7 +155,7 @@ void TestAccountConnectionFactory::initTestCase() g_type_init(); g_set_prgname("account-connection-factory"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn1 = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -301,10 +301,10 @@ void TestAccountConnectionFactory::testSwitch() QCOMPARE(*mReceivedConn, mConn1->objectPath()); delete mReceivedHaveConnection; - mReceivedHaveConnection = 0; + mReceivedHaveConnection = nullptr; delete mReceivedConn; - mReceivedConn = 0; + mReceivedConn = nullptr; QCOMPARE(mAccount->connection()->objectPath(), mConn1->objectPath()); QVERIFY(!mAccount->connection().isNull()); @@ -323,7 +323,7 @@ void TestAccountConnectionFactory::testSwitch() QCOMPARE(*mReceivedConn, mConn2->objectPath()); delete mReceivedConn; - mReceivedConn = 0; + mReceivedConn = nullptr; // connectionChanged() should have been emitted as it is a new connection QVERIFY(mReceivedHaveConnection); @@ -407,22 +407,22 @@ void TestAccountConnectionFactory::cleanup() if (mReceivedHaveConnection) { delete mReceivedHaveConnection; - mReceivedHaveConnection = 0; + mReceivedHaveConnection = nullptr; } if (mReceivedConn) { delete mReceivedConn; - mReceivedConn = 0; + mReceivedConn = nullptr; } if (mAccountAdaptor) { delete mAccountAdaptor; - mAccountAdaptor = 0; + mAccountAdaptor = nullptr; } if (mDispatcher) { delete mDispatcher; - mDispatcher = 0; + mDispatcher = nullptr; } mReceivedConns.clear(); diff --git a/tests/dbus/base-cm.cpp b/tests/dbus/base-cm.cpp index b4809db9..f22b86d3 100644 --- a/tests/dbus/base-cm.cpp +++ b/tests/dbus/base-cm.cpp @@ -17,7 +17,7 @@ class TestBaseCM : public Test { Q_OBJECT public: - TestBaseCM(QObject *parent = 0) + TestBaseCM(QObject *parent = nullptr) : Test(parent) { } diff --git a/tests/dbus/base-filetransfer.cpp b/tests/dbus/base-filetransfer.cpp index 1228fcdd..b8679429 100644 --- a/tests/dbus/base-filetransfer.cpp +++ b/tests/dbus/base-filetransfer.cpp @@ -131,7 +131,7 @@ class ClientFileTransferStateSpy : public QObject, public QList<QList<QVariant> { Q_OBJECT public: - explicit ClientFileTransferStateSpy(QObject *parent = 0) : QObject(parent), QList<QList<QVariant> >() { } + explicit ClientFileTransferStateSpy(QObject *parent = nullptr) : QObject(parent), QList<QList<QVariant> >() { } public Q_SLOTS: void trigger(Tp::FileTransferState state,Tp::FileTransferStateChangeReason reason) { @@ -360,7 +360,7 @@ class TestBaseFileTranfserChannel : public Test { Q_OBJECT public: - TestBaseFileTranfserChannel(QObject *parent = 0) + TestBaseFileTranfserChannel(QObject *parent = nullptr) : Test(parent) { } diff --git a/tests/dbus/base-protocol.cpp b/tests/dbus/base-protocol.cpp index 40b188cf..46d5d18e 100644 --- a/tests/dbus/base-protocol.cpp +++ b/tests/dbus/base-protocol.cpp @@ -42,7 +42,7 @@ class TestBaseProtocol : public Test { Q_OBJECT public: - TestBaseProtocol(QObject *parent = 0) + TestBaseProtocol(QObject *parent = nullptr) : Test(parent) { } diff --git a/tests/dbus/call-channel.cpp b/tests/dbus/call-channel.cpp index 0bbe1242..af4cc2a6 100644 --- a/tests/dbus/call-channel.cpp +++ b/tests/dbus/call-channel.cpp @@ -23,8 +23,8 @@ class TestCallChannel : public Test Q_OBJECT public: - TestCallChannel(QObject *parent = 0) - : Test(parent), mConn(0) + TestCallChannel(QObject *parent = nullptr) + : Test(parent), mConn(nullptr) { } protected Q_SLOTS: @@ -253,7 +253,7 @@ void TestCallChannel::initTestCase() g_type_init(); g_set_prgname("call-channel"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_CALL_CONNECTION, @@ -272,7 +272,7 @@ void TestCallChannel::init() mContentRemoved.reset(); mCallStateReason = CallStateReason(); mCallState = CallStateUnknown; - mCallFlags = (CallFlags) 0; + mCallFlags = (CallFlags) nullptr; mRemoteMemberFlags.clear(); mRemoteMembersRemoved.clear(); mLSSCReturn = (Tp::SendingState) -1; diff --git a/tests/dbus/captcha-authentication.cpp b/tests/dbus/captcha-authentication.cpp index bf352e74..23676e61 100644 --- a/tests/dbus/captcha-authentication.cpp +++ b/tests/dbus/captcha-authentication.cpp @@ -24,9 +24,9 @@ class TestCaptchaAuthentication : public Test Q_OBJECT public: - TestCaptchaAuthentication(QObject *parent = 0) + TestCaptchaAuthentication(QObject *parent = nullptr) : Test(parent), - mConn(0), mChanService(0) + mConn(nullptr), mChanService(nullptr) { } private Q_SLOTS: @@ -97,7 +97,7 @@ void TestCaptchaAuthentication::initTestCase() g_type_init(); g_set_prgname("captcha-authentication"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_SIMPLE_CONNECTION, @@ -293,9 +293,9 @@ void TestCaptchaAuthentication::cleanup() mChan.reset(); - if (mChanService != 0) { + if (mChanService != nullptr) { g_object_unref(mChanService); - mChanService = 0; + mChanService = nullptr; } mLoop->processEvents(); diff --git a/tests/dbus/chan-basics.cpp b/tests/dbus/chan-basics.cpp index a3a00dad..e9026a6d 100644 --- a/tests/dbus/chan-basics.cpp +++ b/tests/dbus/chan-basics.cpp @@ -27,8 +27,8 @@ class TestChanBasics : public Test Q_OBJECT public: - TestChanBasics(QObject *parent = 0) - : Test(parent), mConn(0), mHandle(0) + TestChanBasics(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mHandle(0) { } protected Q_SLOTS: @@ -75,7 +75,7 @@ void TestChanBasics::initTestCase() g_type_init(); g_set_prgname("chan-basics"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_ECHO_2_CONNECTION, @@ -226,7 +226,7 @@ void TestChanBasics::testFallback() TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - guint handle = tp_handle_ensure(contactRepo, "someone@localhost", 0, 0); + guint handle = tp_handle_ensure(contactRepo, "someone@localhost", nullptr, nullptr); QString textChanPath = mConn->objectPath() + QLatin1String("/Channel"); QByteArray chanPath(textChanPath.toLatin1()); diff --git a/tests/dbus/chan-conference.cpp b/tests/dbus/chan-conference.cpp index 96c6f5af..4ac77fa7 100644 --- a/tests/dbus/chan-conference.cpp +++ b/tests/dbus/chan-conference.cpp @@ -18,10 +18,10 @@ class TestConferenceChan : public Test Q_OBJECT public: - TestConferenceChan(QObject *parent = 0) + TestConferenceChan(QObject *parent = nullptr) : Test(parent), - mConn(0), mContactRepo(0), - mTextChan1Service(0), mTextChan2Service(0), mConferenceChanService(0) + mConn(nullptr), mContactRepo(nullptr), + mTextChan1Service(nullptr), mTextChan2Service(nullptr), mConferenceChanService(nullptr) { } protected Q_SLOTS: @@ -78,7 +78,7 @@ void TestConferenceChan::initTestCase() g_type_init(); g_set_prgname("chan-conference"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_ECHO_CONNECTION, @@ -90,9 +90,9 @@ void TestConferenceChan::initTestCase() // create a Channel by magic, rather than doing D-Bus round-trips for it mContactRepo = tp_base_connection_get_handles(TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - guint handle1 = tp_handle_ensure(mContactRepo, "someone1@localhost", 0, 0); - guint handle2 = tp_handle_ensure(mContactRepo, "someone2@localhost", 0, 0); - guint handle3 = tp_handle_ensure(mContactRepo, "someone3@localhost", 0, 0); + guint handle1 = tp_handle_ensure(mContactRepo, "someone1@localhost", nullptr, nullptr); + guint handle2 = tp_handle_ensure(mContactRepo, "someone2@localhost", nullptr, nullptr); + guint handle3 = tp_handle_ensure(mContactRepo, "someone3@localhost", nullptr, nullptr); QByteArray chanPath; GPtrArray *initialChannels = g_ptr_array_new(); @@ -136,7 +136,7 @@ void TestConferenceChan::initTestCase() "initial-channels", initialChannels, NULL)); - g_ptr_array_foreach(initialChannels, (GFunc) g_free, NULL); + g_ptr_array_foreach(initialChannels, (GFunc) g_free, nullptr); g_ptr_array_free(initialChannels, TRUE); } @@ -262,19 +262,19 @@ void TestConferenceChan::cleanupTestCase() QCOMPARE(mConn->disconnect(), true); delete mConn; - if (mTextChan1Service != 0) { + if (mTextChan1Service != nullptr) { g_object_unref(mTextChan1Service); - mTextChan1Service = 0; + mTextChan1Service = nullptr; } - if (mTextChan2Service != 0) { + if (mTextChan2Service != nullptr) { g_object_unref(mTextChan2Service); - mTextChan2Service = 0; + mTextChan2Service = nullptr; } - if (mConferenceChanService != 0) { + if (mConferenceChanService != nullptr) { g_object_unref(mConferenceChanService); - mConferenceChanService = 0; + mConferenceChanService = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/chan-group.cpp b/tests/dbus/chan-group.cpp index 6ccc8ad1..229ad55a 100644 --- a/tests/dbus/chan-group.cpp +++ b/tests/dbus/chan-group.cpp @@ -23,12 +23,12 @@ class TestChanGroup : public Test Q_OBJECT public: - TestChanGroup(QObject *parent = 0) - : Test(parent), mConn(0), mChanService(0), + TestChanGroup(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mChanService(nullptr), mGotGroupFlagsChanged(false), - mGroupFlags((ChannelGroupFlags) 0), - mGroupFlagsAdded((ChannelGroupFlags) 0), - mGroupFlagsRemoved((ChannelGroupFlags) 0) + mGroupFlags((ChannelGroupFlags) nullptr), + mGroupFlagsAdded((ChannelGroupFlags) nullptr), + mGroupFlagsRemoved((ChannelGroupFlags) nullptr) { } protected Q_SLOTS: @@ -129,7 +129,7 @@ void TestChanGroup::initTestCase() g_type_init(); g_set_prgname("chan-group"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_CONTACT_LIST_CONNECTION, @@ -158,9 +158,9 @@ void TestChanGroup::init() mChangedRemoved.clear(); mDetails = Channel::GroupMemberChangeDetails(); mGotGroupFlagsChanged = false; - mGroupFlags = (ChannelGroupFlags) 0; - mGroupFlagsAdded = (ChannelGroupFlags) 0; - mGroupFlagsRemoved = (ChannelGroupFlags) 0; + mGroupFlags = (ChannelGroupFlags) nullptr; + mGroupFlagsAdded = (ChannelGroupFlags) nullptr; + mGroupFlagsRemoved = (ChannelGroupFlags) nullptr; } void TestChanGroup::testCreateChannel() @@ -258,14 +258,14 @@ void TestChanGroup::commonTest(gboolean properties) "detailed", TRUE, "properties", properties, NULL)); - QVERIFY(mChanService != 0); + QVERIFY(mChanService != nullptr); TpIntSet *members = tp_intset_sized_new(mInitialMembers.length()); Q_FOREACH (uint handle, mInitialMembers) tp_intset_add(members, handle); QVERIFY(tp_group_mixin_change_members(G_OBJECT(mChanService), "be there or be []", - members, NULL, NULL, NULL, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); + members, nullptr, nullptr, nullptr, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); tp_intset_destroy(members); @@ -308,7 +308,7 @@ void TestChanGroup::commonTest(gboolean properties) TpIntSet *remove = tp_intset_new_containing(mContacts[0]->handle()[0]); QVERIFY(tp_group_mixin_change_members(G_OBJECT(mChanService), "be a []", - NULL, remove, NULL, NULL, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); + nullptr, remove, nullptr, nullptr, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); tp_intset_destroy(remove); @@ -403,13 +403,13 @@ void TestChanGroup::testLeaveWithFallback() "detailed", TRUE, "properties", TRUE, NULL)); - QVERIFY(mChanService != 0); + QVERIFY(mChanService != nullptr); TpIntSet *members = tp_intset_sized_new(1); tp_intset_add(members, mConn->client()->selfHandle()); QVERIFY(tp_group_mixin_change_members(G_OBJECT(mChanService), "be there or be []", - members, NULL, NULL, NULL, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); + members, nullptr, nullptr, nullptr, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE)); tp_intset_destroy(members); @@ -445,7 +445,7 @@ void TestChanGroup::testGroupFlagsChange() TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - guint handle = tp_handle_ensure(contactRepo, "someone@localhost", 0, 0); + guint handle = tp_handle_ensure(contactRepo, "someone@localhost", nullptr, nullptr); QString textChanPath = mConn->objectPath() + QLatin1String("/Channel"); QByteArray chanPath(textChanPath.toLatin1()); @@ -481,14 +481,14 @@ void TestChanGroup::testGroupFlagsChange() QVERIFY(textChan->groupFlags() & ChannelGroupFlagCanAdd); QVERIFY(textChan->canInviteContacts()); QCOMPARE(mGroupFlagsAdded, ChannelGroupFlagCanAdd); - QCOMPARE(mGroupFlagsRemoved, (ChannelGroupFlags) 0); + QCOMPARE(mGroupFlagsRemoved, (ChannelGroupFlags) nullptr); } void TestChanGroup::cleanup() { if (mChanService) { g_object_unref(mChanService); - mChanService = 0; + mChanService = nullptr; } // Avoid D-Bus event leak from one test case to another - I've seen this with the diff --git a/tests/dbus/cm-basics.cpp b/tests/dbus/cm-basics.cpp index c75c0de8..4f30bdf4 100644 --- a/tests/dbus/cm-basics.cpp +++ b/tests/dbus/cm-basics.cpp @@ -34,8 +34,8 @@ class TestCmBasics : public Test Q_OBJECT public: - TestCmBasics(QObject *parent = 0) - : Test(parent), mCMService(0) + TestCmBasics(QObject *parent = nullptr) + : Test(parent), mCMService(nullptr) { } protected Q_SLOTS: @@ -89,17 +89,17 @@ void TestCmBasics::initTestCase() g_type_init(); g_set_prgname("cm-basics"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mCMService = TP_BASE_CONNECTION_MANAGER(g_object_new( EXAMPLE_TYPE_ECHO_2_CONNECTION_MANAGER, - NULL)); - QVERIFY(mCMService != 0); + nullptr)); + QVERIFY(mCMService != nullptr); mCMServiceLegacy = TP_BASE_CONNECTION_MANAGER(g_object_new( TP_TESTS_TYPE_SIMPLE_CONNECTION_MANAGER, - NULL)); - QVERIFY(mCMServiceLegacy != 0); + nullptr)); + QVERIFY(mCMServiceLegacy != nullptr); QVERIFY(tp_base_connection_manager_register(mCMService)); QVERIFY(tp_base_connection_manager_register(mCMServiceLegacy)); @@ -336,12 +336,12 @@ void TestCmBasics::cleanupTestCase() { if (mCMService) { g_object_unref(mCMService); - mCMService = 0; + mCMService = nullptr; } if (mCMServiceLegacy) { g_object_unref(mCMServiceLegacy); - mCMServiceLegacy = 0; + mCMServiceLegacy = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/cm-protocol.cpp b/tests/dbus/cm-protocol.cpp index 2b291d1b..2c9a2840 100644 --- a/tests/dbus/cm-protocol.cpp +++ b/tests/dbus/cm-protocol.cpp @@ -494,9 +494,9 @@ class TestCmProtocol : public Test Q_OBJECT public: - TestCmProtocol(QObject *parent = 0) + TestCmProtocol(QObject *parent = nullptr) : Test(parent), - mCM(0) + mCM(nullptr) { } diff --git a/tests/dbus/conn-addressing.cpp b/tests/dbus/conn-addressing.cpp index 1ef1c7be..fc4b1ace 100644 --- a/tests/dbus/conn-addressing.cpp +++ b/tests/dbus/conn-addressing.cpp @@ -22,7 +22,7 @@ class TestConnAddressing : public Test Q_OBJECT public: - TestConnAddressing(QObject *parent = 0) + TestConnAddressing(QObject *parent = nullptr) : Test(parent) { } @@ -80,7 +80,7 @@ void TestConnAddressing::initTestCase() g_type_init(); g_set_prgname("conn-addressing"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_ADDRESSING_CONNECTION, diff --git a/tests/dbus/conn-basics.cpp b/tests/dbus/conn-basics.cpp index 7f8e0379..5caada37 100644 --- a/tests/dbus/conn-basics.cpp +++ b/tests/dbus/conn-basics.cpp @@ -28,8 +28,8 @@ class TestConnBasics : public Test Q_OBJECT public: - TestConnBasics(QObject *parent = 0) - : Test(parent), mConnService(0) + TestConnBasics(QObject *parent = nullptr) + : Test(parent), mConnService(nullptr) { } protected Q_SLOTS: @@ -109,7 +109,7 @@ void TestConnBasics::initTestCase() g_type_init(); g_set_prgname("conn-basics"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); } void TestConnBasics::init() @@ -118,20 +118,20 @@ void TestConnBasics::init() gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; mConnService = TP_TESTS_CONTACTS_CONNECTION(g_object_new( TP_TESTS_TYPE_CONTACTS_CONNECTION, "account", "me@example.com", "protocol", "contacts", NULL)); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService), "contacts", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName = QLatin1String(name); mConnPath = QLatin1String(connPath); @@ -285,9 +285,9 @@ void TestConnBasics::cleanup() mConn.reset(); } - if (mConnService != 0) { + if (mConnService != nullptr) { g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } cleanupImpl(); diff --git a/tests/dbus/conn-capabilities.cpp b/tests/dbus/conn-capabilities.cpp index c92903d8..4c7b55ab 100644 --- a/tests/dbus/conn-capabilities.cpp +++ b/tests/dbus/conn-capabilities.cpp @@ -16,8 +16,8 @@ class TestConnCapabilities : public Test Q_OBJECT public: - TestConnCapabilities(QObject *parent = 0) - : Test(parent), conn(0) + TestConnCapabilities(QObject *parent = nullptr) + : Test(parent), conn(nullptr) { } private Q_SLOTS: @@ -40,7 +40,7 @@ void TestConnCapabilities::initTestCase() g_type_init(); g_set_prgname("conn-capabilities"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); } void TestConnCapabilities::init() diff --git a/tests/dbus/conn-introspect-cornercases.cpp b/tests/dbus/conn-introspect-cornercases.cpp index 1f892481..de88ba8e 100644 --- a/tests/dbus/conn-introspect-cornercases.cpp +++ b/tests/dbus/conn-introspect-cornercases.cpp @@ -31,8 +31,8 @@ class TestConnIntrospectCornercases : public Test Q_OBJECT public: - TestConnIntrospectCornercases(QObject *parent = 0) - : Test(parent), mConnService(0), mNumSelfHandleChanged(0) + TestConnIntrospectCornercases(QObject *parent = nullptr) + : Test(parent), mConnService(nullptr), mNumSelfHandleChanged(0) { } protected Q_SLOTS: @@ -79,7 +79,7 @@ void TestConnIntrospectCornercases::initTestCase() g_type_init(); g_set_prgname("conn-introspect-cornercases"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); } void TestConnIntrospectCornercases::init() @@ -87,7 +87,7 @@ void TestConnIntrospectCornercases::init() initImpl(); QVERIFY(mConn.isNull()); - QVERIFY(mConnService == 0); + QVERIFY(mConnService == nullptr); QVERIFY(mStatuses.empty()); QCOMPARE(mNumSelfHandleChanged, 0); @@ -100,7 +100,7 @@ void TestConnIntrospectCornercases::testSelfHandleChangeBeforeConnecting() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsSimpleConnection *simpleConnService = TP_TESTS_SIMPLE_CONNECTION( @@ -109,22 +109,22 @@ void TestConnIntrospectCornercases::testSelfHandleChangeBeforeConnecting() "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(simpleConnService != 0); + QVERIFY(simpleConnService != nullptr); mConnService = TP_BASE_CONNECTION(simpleConnService); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(mConnService, "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); mConn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); QCOMPARE(mConn->isReady(), false); - g_free(name); name = 0; - g_free(connPath); connPath = 0; + g_free(name); name = nullptr; + g_free(connPath); connPath = nullptr; // Set the initial self handle (we're not using the conn service normally, so it doesn't do this // by itself) @@ -177,7 +177,7 @@ void TestConnIntrospectCornercases::testSelfHandleChangeWhileBuilding() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsSimpleConnection *simpleConnService = TP_TESTS_SIMPLE_CONNECTION( @@ -186,22 +186,22 @@ void TestConnIntrospectCornercases::testSelfHandleChangeWhileBuilding() "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(simpleConnService != 0); + QVERIFY(simpleConnService != nullptr); mConnService = TP_BASE_CONNECTION(simpleConnService); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(mConnService, "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); mConn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); QCOMPARE(mConn->isReady(), false); - g_free(name); name = 0; - g_free(connPath); connPath = 0; + g_free(name); name = nullptr; + g_free(connPath); connPath = nullptr; // Make the conn Connected, and with FeatureCore ready @@ -293,7 +293,7 @@ void TestConnIntrospectCornercases::testSlowpath() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsBug16307Connection *bugConnService = TP_TESTS_BUG16307_CONNECTION( @@ -302,22 +302,22 @@ void TestConnIntrospectCornercases::testSlowpath() "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(bugConnService != 0); + QVERIFY(bugConnService != nullptr); mConnService = TP_BASE_CONNECTION(bugConnService); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(mConnService, "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); mConn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); QCOMPARE(mConn->isReady(), false); - g_free(name); name = 0; - g_free(connPath); connPath = 0; + g_free(name); name = nullptr; + g_free(connPath); connPath = nullptr; PendingOperation *op = mConn->becomeReady(); QVERIFY(connect(op, @@ -337,7 +337,7 @@ void TestConnIntrospectCornercases::testStatusChange() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsSimpleConnection *simpleConnService = TP_TESTS_SIMPLE_CONNECTION( @@ -346,22 +346,22 @@ void TestConnIntrospectCornercases::testStatusChange() "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(simpleConnService != 0); + QVERIFY(simpleConnService != nullptr); mConnService = TP_BASE_CONNECTION(simpleConnService); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(mConnService, "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); mConn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); QCOMPARE(mConn->isReady(), false); - g_free(name); name = 0; - g_free(connPath); connPath = 0; + g_free(name); name = nullptr; + g_free(connPath); connPath = nullptr; // Make core ready first, because Connection has internal handling for the status changing // during core introspection, and we rather want to test the more general ReadinessHelper @@ -393,7 +393,7 @@ void TestConnIntrospectCornercases::testStatusChange() TP_HANDLE_TYPE_CONTACT); mConnService->self_handle = tp_handle_ensure(contact_repo, "me@example.com", - NULL, NULL); + nullptr, nullptr); tp_base_connection_change_status(mConnService, TP_CONNECTION_STATUS_CONNECTING, @@ -418,7 +418,7 @@ void TestConnIntrospectCornercases::testNoRoster() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsContactsNorosterConnection *connService = TP_TESTS_CONTACTS_NOROSTER_CONNECTION( @@ -427,22 +427,22 @@ void TestConnIntrospectCornercases::testNoRoster() "account", "me@example.com", "protocol", "contacts-noroster", NULL)); - QVERIFY(connService != 0); + QVERIFY(connService != nullptr); mConnService = TP_BASE_CONNECTION(connService); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(mConnService, "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); mConn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); QCOMPARE(mConn->isReady(), false); - g_free(name); name = 0; - g_free(connPath); connPath = 0; + g_free(name); name = nullptr; + g_free(connPath); connPath = nullptr; PendingOperation *op = mConn->lowlevel()->requestConnect(); QVERIFY(connect(op, @@ -464,7 +464,7 @@ void TestConnIntrospectCornercases::testNoRoster() void TestConnIntrospectCornercases::cleanup() { if (mConn) { - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); // Disconnect and wait for invalidation tp_base_connection_change_status( @@ -484,9 +484,9 @@ void TestConnIntrospectCornercases::cleanup() mConn.reset(); } - if (mConnService != 0) { + if (mConnService != nullptr) { g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } mStatuses.clear(); diff --git a/tests/dbus/conn-requests.cpp b/tests/dbus/conn-requests.cpp index f73c09c3..ec290678 100644 --- a/tests/dbus/conn-requests.cpp +++ b/tests/dbus/conn-requests.cpp @@ -22,8 +22,8 @@ class TestConnRequests : public Test Q_OBJECT public: - TestConnRequests(QObject *parent = 0) - : Test(parent), mConn(0), mHandle(0) + TestConnRequests(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mHandle(0) { } protected Q_SLOTS: @@ -85,7 +85,7 @@ void TestConnRequests::initTestCase() g_type_init(); g_set_prgname("conn-requests"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_ECHO_2_CONNECTION, diff --git a/tests/dbus/conn-roster-groups.cpp b/tests/dbus/conn-roster-groups.cpp index 7c7ed597..bc363425 100644 --- a/tests/dbus/conn-roster-groups.cpp +++ b/tests/dbus/conn-roster-groups.cpp @@ -29,8 +29,8 @@ class TestConnRosterGroups : public Test Q_OBJECT public: - TestConnRosterGroups(QObject *parent = 0) - : Test(parent), mConnService(0), + TestConnRosterGroups(QObject *parent = nullptr) + : Test(parent), mConnService(nullptr), mContactsAddedToGroup(0), mContactsRemovedFromGroup(0) { } @@ -130,7 +130,7 @@ void TestConnRosterGroups::expectConnInvalidated() void TestConnRosterGroups::expectContact(Tp::PendingOperation *op) { PendingContacts *contacts = qobject_cast<PendingContacts *>(op); - QVERIFY(contacts != 0); + QVERIFY(contacts != nullptr); QVERIFY(contacts->isValid()); QCOMPARE(contacts->contacts().length(), 1); @@ -156,14 +156,14 @@ void TestConnRosterGroups::initTestCase() g_type_init(); g_set_prgname("conn-roster-groups"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); } void TestConnRosterGroups::init() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; mConnService = EXAMPLE_CONTACT_LIST_CONNECTION(g_object_new( EXAMPLE_TYPE_CONTACT_LIST_CONNECTION, @@ -171,13 +171,13 @@ void TestConnRosterGroups::init() "simulation-delay", 0, "protocol", "example-contact-list", NULL)); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService), "foo", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName = QLatin1String(name); mConnPath = QLatin1String(connPath); @@ -824,7 +824,7 @@ void TestConnRosterGroups::cleanup() mContact.reset(); if (mConn && mConn->requestedFeatures().contains(Connection::FeatureCore)) { - QVERIFY(mConnService != NULL); + QVERIFY(mConnService != nullptr); if (TP_BASE_CONNECTION(mConnService)->status != TP_CONNECTION_STATUS_DISCONNECTED) { tp_base_connection_change_status(TP_BASE_CONNECTION(mConnService), @@ -839,9 +839,9 @@ void TestConnRosterGroups::cleanup() } mConn.reset(); - if (mConnService != 0) { + if (mConnService != nullptr) { g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } cleanupImpl(); diff --git a/tests/dbus/conn-roster-legacy.cpp b/tests/dbus/conn-roster-legacy.cpp index f62f639d..43040cc7 100644 --- a/tests/dbus/conn-roster-legacy.cpp +++ b/tests/dbus/conn-roster-legacy.cpp @@ -18,8 +18,8 @@ class TestConnRosterLegacy : public Test Q_OBJECT public: - TestConnRosterLegacy(QObject *parent = 0) - : Test(parent), mConn(0), + TestConnRosterLegacy(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mBlockingContactsFinished(false), mHowManyKnownContacts(0), mGotPresenceStateChanged(false) { } @@ -127,7 +127,7 @@ void TestConnRosterLegacy::initTestCase() g_type_init(); g_set_prgname("conn-roster-legacy"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_CONTACT_LIST_CONNECTION, diff --git a/tests/dbus/conn-roster.cpp b/tests/dbus/conn-roster.cpp index 5b998a8d..a260aee7 100644 --- a/tests/dbus/conn-roster.cpp +++ b/tests/dbus/conn-roster.cpp @@ -20,8 +20,8 @@ class TestConnRoster : public Test Q_OBJECT public: - TestConnRoster(QObject *parent = 0) - : Test(parent), mConn(0), + TestConnRoster(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mBlockingContactsFinished(false), mHowManyKnownContacts(0), mGotPresenceStateChanged(false), mGotPPR(false) { } @@ -141,7 +141,7 @@ void TestConnRoster::initTestCase() g_type_init(); g_set_prgname("conn-roster"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, ChannelFactory::create(QDBusConnection::sessionBus()), diff --git a/tests/dbus/contact-factory.cpp b/tests/dbus/contact-factory.cpp index d81bf4fe..1e0beaf7 100644 --- a/tests/dbus/contact-factory.cpp +++ b/tests/dbus/contact-factory.cpp @@ -17,8 +17,8 @@ class TestContactFactory : public Test Q_OBJECT public: - TestContactFactory(QObject *parent = 0) - : Test(parent), mConn(0) + TestContactFactory(QObject *parent = nullptr) + : Test(parent), mConn(nullptr) { } private Q_SLOTS: @@ -41,7 +41,7 @@ void TestContactFactory::initTestCase() g_type_init(); g_set_prgname("contact-factory"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, ChannelFactory::create(QDBusConnection::sessionBus()), diff --git a/tests/dbus/contact-messenger.cpp b/tests/dbus/contact-messenger.cpp index 2da59044..7f4f5a12 100644 --- a/tests/dbus/contact-messenger.cpp +++ b/tests/dbus/contact-messenger.cpp @@ -164,11 +164,11 @@ class TestContactMessenger : public Test Q_OBJECT public: - TestContactMessenger(QObject *parent = 0) + TestContactMessenger(QObject *parent = nullptr) : Test(parent), - mCDMessagesAdaptor(0), mAccountAdaptor(0), + mCDMessagesAdaptor(nullptr), mAccountAdaptor(nullptr), // service side (telepathy-glib) - mConnService(0), mBaseConnService(0), mContactRepo(0), + mConnService(nullptr), mBaseConnService(nullptr), mContactRepo(nullptr), mSendFinished(false), mGotMessageSent(false) { } @@ -289,7 +289,7 @@ void TestContactMessenger::expectPendingContactsFinished(PendingOperation *op) void TestContactMessenger::onSendFinished(Tp::PendingOperation *op) { PendingSendMessage *msg = qobject_cast<PendingSendMessage *>(op); - QVERIFY(msg != NULL); + QVERIFY(msg != nullptr); if (msg->isValid()) { qDebug() << "Send succeeded, got token" << msg->sentMessageToken(); @@ -329,7 +329,7 @@ void TestContactMessenger::initTestCase() g_type_init(); g_set_prgname("contact-messenger"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); QDBusConnection bus = QDBusConnection::sessionBus(); QString channelDispatcherBusName = TP_QT_IFACE_CHANNEL_DISPATCHER; @@ -363,19 +363,19 @@ void TestContactMessenger::initTestCase() "account", "me@example.com", "protocol", "example", NULL)); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); mBaseConnService = TP_BASE_CONNECTION(mConnService); - QVERIFY(mBaseConnService != 0); + QVERIFY(mBaseConnService != nullptr); gchar *name, *connPath; - GError *error = NULL; + GError *error = nullptr; QVERIFY(tp_base_connection_register(mBaseConnService, "example", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName = QLatin1String(name); mConnPath = QLatin1String(connPath); @@ -400,7 +400,7 @@ void TestContactMessenger::initTestCase() mContactRepo = tp_base_connection_get_handles(mBaseConnService, TP_HANDLE_TYPE_CONTACT); - guint handle = tp_handle_ensure(mContactRepo, "Ann", 0, 0); + guint handle = tp_handle_ensure(mContactRepo, "Ann", nullptr, nullptr); mMessagesChanPath = mConnPath + QLatin1String("/MessagesChannel"); QByteArray chanPath = mMessagesChanPath.toLatin1(); @@ -443,7 +443,7 @@ void TestContactMessenger::testNoSupport() mCDMessagesAdaptor->setSimulatedSendError(TP_QT_DBUS_ERROR_UNKNOWN_METHOD); PendingSendMessage *pendingSend = messenger->sendMessage(QLatin1String("Hi!")); - QVERIFY(pendingSend != NULL); + QVERIFY(pendingSend != nullptr); QVERIFY(connect(pendingSend, SIGNAL(finished(Tp::PendingOperation*)), @@ -459,7 +459,7 @@ void TestContactMessenger::testNoSupport() Message m(ChannelTextMessageTypeAction, QLatin1String("is testing!")); pendingSend = messenger->sendMessage(m.parts()); - QVERIFY(pendingSend != NULL); + QVERIFY(pendingSend != nullptr); QVERIFY(connect(pendingSend, SIGNAL(finished(Tp::PendingOperation*)), @@ -531,7 +531,7 @@ void TestContactMessenger::testReceived() QVariantMap()); } - guint handle = tp_handle_ensure(mContactRepo, "Ann", 0, 0); + guint handle = tp_handle_ensure(mContactRepo, "Ann", nullptr, nullptr); TpMessage *msg = tp_cm_message_new_text(mBaseConnService, handle, TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, "Hi!"); tp_message_mixin_take_received(G_OBJECT(mMessagesChanService), msg); @@ -571,7 +571,7 @@ void TestContactMessenger::testReceivedFromContact() QVariantMap()); } - guint handle = tp_handle_ensure(mContactRepo, "Ann", 0, 0); + guint handle = tp_handle_ensure(mContactRepo, "Ann", nullptr, nullptr); TpMessage *msg = tp_cm_message_new_text(mBaseConnService, handle, TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, "Hi!"); tp_message_mixin_take_received(G_OBJECT(mMessagesChanService), msg); @@ -613,15 +613,15 @@ void TestContactMessenger::cleanupTestCase() mChan.reset(); - if (mMessagesChanService != 0) { + if (mMessagesChanService != nullptr) { g_object_unref(mMessagesChanService); - mMessagesChanService = 0; + mMessagesChanService = nullptr; } - if (mConnService != 0) { - mBaseConnService = 0; + if (mConnService != nullptr) { + mBaseConnService = nullptr; g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/contact-search-chan.cpp b/tests/dbus/contact-search-chan.cpp index 220c416d..7bf5fe06 100644 --- a/tests/dbus/contact-search-chan.cpp +++ b/tests/dbus/contact-search-chan.cpp @@ -18,10 +18,10 @@ class TestContactSearchChan : public Test Q_OBJECT public: - TestContactSearchChan(QObject *parent = 0) + TestContactSearchChan(QObject *parent = nullptr) : Test(parent), - mConn(0), - mChan1Service(0), mChan2Service(0), mSearchReturned(false) + mConn(nullptr), + mChan1Service(nullptr), mChan2Service(nullptr), mSearchReturned(false) { } protected Q_SLOTS: @@ -103,7 +103,7 @@ void TestContactSearchChan::initTestCase() g_type_init(); g_set_prgname("contact-search-chan"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_ECHO_CONNECTION, @@ -293,14 +293,14 @@ void TestContactSearchChan::cleanupTestCase() QCOMPARE(mConn->disconnect(), true); delete mConn; - if (mChan1Service != 0) { + if (mChan1Service != nullptr) { g_object_unref(mChan1Service); - mChan1Service = 0; + mChan1Service = nullptr; } - if (mChan2Service != 0) { + if (mChan2Service != nullptr) { g_object_unref(mChan2Service); - mChan2Service = 0; + mChan2Service = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/contacts-avatar.cpp b/tests/dbus/contacts-avatar.cpp index 816a41c4..949dc037 100644 --- a/tests/dbus/contacts-avatar.cpp +++ b/tests/dbus/contacts-avatar.cpp @@ -54,8 +54,8 @@ class TestContactsAvatar : public Test Q_OBJECT public: - TestContactsAvatar(QObject *parent = 0) - : Test(parent), mConn(0), + TestContactsAvatar(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mGotAvatarRetrieved(false), mAvatarDatasChanged(0) { } @@ -109,7 +109,7 @@ void TestContactsAvatar::createContactWithFakeAvatar(const char *id) TpHandle handle; GArray *array; - handle = tp_handle_ensure(serviceRepo, id, NULL, NULL); + handle = tp_handle_ensure(serviceRepo, id, nullptr, nullptr); array = g_array_new(FALSE, FALSE, sizeof(gchar)); g_array_append_vals(array, avatarData, strlen(avatarData)); @@ -157,7 +157,7 @@ void TestContactsAvatar::initTestCase() g_type_init(); g_set_prgname("contacts-avatar"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -181,7 +181,7 @@ void TestContactsAvatar::testAvatar() Contact::FeatureAvatarData)); /* Make sure our tests does not mess up user's avatar cache */ - qsrand(time(0)); + qsrand(time(nullptr)); static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static const int DirNameLength = 6; QString dirName; @@ -232,7 +232,7 @@ void TestContactsAvatar::testRequestAvatars() Tp::UIntList handles; for (int i = 0; i < 100; ++i) { QString contactId = QLatin1String("contact") + QString::number(i); - handle = tp_handle_ensure(serviceRepo, contactId.toLatin1().constData(), NULL, NULL); + handle = tp_handle_ensure(serviceRepo, contactId.toLatin1().constData(), nullptr, nullptr); handles << handle; } Features features = Features() << Contact::FeatureAvatarToken << Contact::FeatureAvatarData; diff --git a/tests/dbus/contacts-capabilities.cpp b/tests/dbus/contacts-capabilities.cpp index 0095f85e..7e6de848 100644 --- a/tests/dbus/contacts-capabilities.cpp +++ b/tests/dbus/contacts-capabilities.cpp @@ -19,8 +19,8 @@ class TestContactsCapabilities : public Test Q_OBJECT public: - TestContactsCapabilities(QObject *parent = 0) - : Test(parent), mConn(0) + TestContactsCapabilities(QObject *parent = nullptr) + : Test(parent), mConn(nullptr) { } private Q_SLOTS: @@ -43,7 +43,7 @@ void TestContactsCapabilities::initTestCase() g_type_init(); g_set_prgname("contacts-capabilities"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -70,7 +70,7 @@ static void addTextChatClass(GPtrArray *classes, TpHandleType handle_type) TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, handle_type, NULL); - const gchar * const allowed[] = { NULL }; + const gchar * const allowed[] = { nullptr }; GValueArray *arr = tp_value_array_build(2, TP_HASH_TYPE_STRING_VARIANT_MAP, fixed, G_TYPE_STRV, allowed, @@ -83,7 +83,7 @@ static void addTextChatClass(GPtrArray *classes, TpHandleType handle_type) static GHashTable *createContactCapabilities(TpHandle *handles) { - GHashTable *capabilities = g_hash_table_new_full(NULL, NULL, NULL, + GHashTable *capabilities = g_hash_table_new_full(nullptr, nullptr, nullptr, (GDestroyNotify) freeRccList); /* Support private text chats */ @@ -119,7 +119,7 @@ void TestContactsCapabilities::testCapabilities() TpHandle handles[] = { 0, 0, 0 }; for (int i = 0; i < 3; i++) { handles[i] = tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), - NULL, NULL); + nullptr, nullptr); } GHashTable *capabilities = createContactCapabilities(handles); diff --git a/tests/dbus/contacts-client-types.cpp b/tests/dbus/contacts-client-types.cpp index 5bdc6a87..e7995663 100644 --- a/tests/dbus/contacts-client-types.cpp +++ b/tests/dbus/contacts-client-types.cpp @@ -19,8 +19,8 @@ class TestContactsClientTypes : public Test Q_OBJECT public: - TestContactsClientTypes(QObject *parent = 0) - : Test(parent), mConn(0), + TestContactsClientTypes(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mClientTypesUpdated(0) { } @@ -70,7 +70,7 @@ void TestContactsClientTypes::initTestCase() g_type_init(); g_set_prgname("contacts-client-types"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -112,8 +112,8 @@ void TestContactsClientTypes::testClientTypes() ContactPtr contactFoo = contacts[0]; ContactPtr contactBar = contacts[1]; - const gchar *clientTypes1[] = { "phone", "pc", NULL }; - const gchar *clientTypes2[] = { "web", NULL }; + const gchar *clientTypes1[] = { "phone", "pc", nullptr }; + const gchar *clientTypes2[] = { "web", nullptr }; tp_tests_contacts_connection_change_client_types(TP_TESTS_CONTACTS_CONNECTION(mConn->service()), contactFoo->handle()[0], g_strdupv((gchar**) clientTypes1)); @@ -160,7 +160,7 @@ void TestContactsClientTypes::testClientTypesAttributes() QVERIFY(contactManager->supportedFeatures().contains(Contact::FeatureClientTypes)); - const gchar *clientTypes[] = { "pc", "phone", NULL }; + const gchar *clientTypes[] = { "pc", "phone", nullptr }; tp_tests_contacts_connection_change_client_types(TP_TESTS_CONTACTS_CONNECTION(mConn->service()), 2, g_strdupv((gchar**) clientTypes)); diff --git a/tests/dbus/contacts-info.cpp b/tests/dbus/contacts-info.cpp index 4968c599..34cb14fa 100644 --- a/tests/dbus/contacts-info.cpp +++ b/tests/dbus/contacts-info.cpp @@ -19,8 +19,8 @@ class TestContactsInfo : public Test Q_OBJECT public: - TestContactsInfo(QObject *parent = 0) - : Test(parent), mConn(0), + TestContactsInfo(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mContactsInfoFieldsUpdated(0), mRefreshInfoFinished(0) { } @@ -68,7 +68,7 @@ void TestContactsInfo::initTestCase() g_type_init(); g_set_prgname("contacts-info"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -112,7 +112,7 @@ void TestContactsInfo::testInfo() TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST); { const gchar * const field_values[2] = { - "FooBar", NULL + "FooBar", nullptr }; g_ptr_array_add (info_default, tp_value_array_build (3, G_TYPE_STRING, "n", @@ -127,7 +127,7 @@ void TestContactsInfo::testInfo() TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST); { const gchar * const field_values[2] = { - "Foo", NULL + "Foo", nullptr }; g_ptr_array_add (info_1, tp_value_array_build (3, G_TYPE_STRING, "n", @@ -139,7 +139,7 @@ void TestContactsInfo::testInfo() TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST); { const gchar * const field_values[2] = { - "Bar", NULL + "Bar", nullptr }; g_ptr_array_add (info_2, tp_value_array_build (3, G_TYPE_STRING, "n", @@ -154,7 +154,7 @@ void TestContactsInfo::testInfo() for (unsigned i = 0; i < 2; i++) { handles[i] = tp_handle_ensure(serviceRepo, qPrintable(validIDs[i]), - NULL, NULL); + nullptr, nullptr); } tp_tests_contacts_connection_change_contact_info(TP_TESTS_CONTACTS_CONNECTION(mConn->service()), diff --git a/tests/dbus/contacts-location.cpp b/tests/dbus/contacts-location.cpp index c3870a97..d1c1f406 100644 --- a/tests/dbus/contacts-location.cpp +++ b/tests/dbus/contacts-location.cpp @@ -19,8 +19,8 @@ class TestContactsLocation : public Test Q_OBJECT public: - TestContactsLocation(QObject *parent = 0) - : Test(parent), mConn(0), mContactsLocationUpdated(0) + TestContactsLocation(QObject *parent = nullptr) + : Test(parent), mConn(nullptr), mContactsLocationUpdated(0) { } protected Q_SLOTS: @@ -54,7 +54,7 @@ void TestContactsLocation::initTestCase() g_type_init(); g_set_prgname("contacts-location"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -107,7 +107,7 @@ void TestContactsLocation::testLocation() for (unsigned i = 0; i < 2; i++) { handles[i] = tp_handle_ensure(serviceRepo, qPrintable(validIDs[i]), - NULL, NULL); + nullptr, nullptr); } tp_tests_contacts_connection_change_locations(TP_TESTS_CONTACTS_CONNECTION(mConn->service()), 2, @@ -123,7 +123,7 @@ void TestContactsLocation::testLocation() QCOMPARE(contact->location().country(), QLatin1String(tp_asv_get_string(locations[i], "country"))); QCOMPARE(contact->location().latitude(), - tp_asv_get_double(locations[i], "lat", NULL)); + tp_asv_get_double(locations[i], "lat", nullptr)); } g_hash_table_unref(location_1); diff --git a/tests/dbus/contacts.cpp b/tests/dbus/contacts.cpp index 9b6eef6f..09c8ad26 100644 --- a/tests/dbus/contacts.cpp +++ b/tests/dbus/contacts.cpp @@ -34,8 +34,8 @@ class TestContacts : public Test Q_OBJECT public: - TestContacts(QObject *parent = 0) - : Test(parent), mConnService(0) + TestContacts(QObject *parent = nullptr) + : Test(parent), mConnService(nullptr) { } @@ -117,24 +117,24 @@ void TestContacts::initTestCase() g_type_init(); g_set_prgname("contacts"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; mConnService = TP_TESTS_CONTACTS_CONNECTION(g_object_new( TP_TESTS_TYPE_CONTACTS_CONNECTION, "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService), "contacts", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName = QLatin1String(name); mConnPath = QLatin1String(connPath); @@ -202,7 +202,7 @@ void TestContacts::testSupport() void TestContacts::testSelfContact() { ContactPtr selfContact = mConn->selfContact(); - QVERIFY(selfContact != 0); + QVERIFY(selfContact != nullptr); QCOMPARE(selfContact->handle()[0], mConn->selfHandle()); QCOMPARE(selfContact->id(), QString(QLatin1String("me@example.com"))); @@ -247,19 +247,19 @@ void TestContacts::testForHandles() tp_base_connection_get_handles(TP_BASE_CONNECTION(mConnService), TP_HANDLE_TYPE_CONTACT); // Set up a few valid handles - handles << tp_handle_ensure(serviceRepo, "alice", NULL, NULL); + handles << tp_handle_ensure(serviceRepo, "alice", nullptr, nullptr); QVERIFY(handles[0] != 0); - handles << tp_handle_ensure(serviceRepo, "bob", NULL, NULL); + handles << tp_handle_ensure(serviceRepo, "bob", nullptr, nullptr); QVERIFY(handles[1] != 0); // Put one probably invalid one in between handles << 31337; - QVERIFY(!tp_handle_is_valid(serviceRepo, handles[2], NULL)); + QVERIFY(!tp_handle_is_valid(serviceRepo, handles[2], nullptr)); // Then another valid one - handles << tp_handle_ensure(serviceRepo, "chris", NULL, NULL); + handles << tp_handle_ensure(serviceRepo, "chris", nullptr, nullptr); QVERIFY(handles[3] != 0); // And yet another invalid one handles << 12345; - QVERIFY(!tp_handle_is_valid(serviceRepo, handles[4], NULL)); + QVERIFY(!tp_handle_is_valid(serviceRepo, handles[4], nullptr)); // Get contacts for the mixture of valid and invalid handles PendingContacts *pending = mConn->contactManager()->contactsForHandles(handles); @@ -289,7 +289,7 @@ void TestContacts::testForHandles() // Check the contact contents for (int i = 0; i < 3; i++) { - QVERIFY(mContacts[i] != NULL); + QVERIFY(mContacts[i] != nullptr); QCOMPARE(mContacts[i]->manager(), mConn->contactManager()); QCOMPARE(mContacts[i]->requestedFeatures(), Features()); QCOMPARE(mContacts[i]->actualFeatures(), Features()); @@ -306,7 +306,7 @@ void TestContacts::testForHandles() // Save the contacts, and make a new request, replacing one of the invalid handles with a valid // one QList<ContactPtr> saveContacts = mContacts; - handles[2] = tp_handle_ensure(serviceRepo, "dora", NULL, NULL); + handles[2] = tp_handle_ensure(serviceRepo, "dora", nullptr, nullptr); QVERIFY(handles[2] != 0); pending = mConn->contactManager()->contactsForHandles(handles); @@ -392,9 +392,9 @@ void TestContacts::testForIdentifiers() QCOMPARE(mContacts.size(), 3); for (int i = 0; i < mContacts.size(); i++) { - QVERIFY(mContacts[i] != NULL); + QVERIFY(mContacts[i] != nullptr); QCOMPARE(mContacts[i]->manager(), mConn->contactManager()); - QVERIFY(tp_handle_is_valid(serviceRepo, mContacts[i]->handle()[0], NULL)); + QVERIFY(tp_handle_is_valid(serviceRepo, mContacts[i]->handle()[0], nullptr)); QCOMPARE(mContacts[i]->requestedFeatures(), Features()); QCOMPARE(mContacts[i]->actualFeatures(), Features()); } @@ -462,7 +462,7 @@ void TestContacts::testFeatures() // Get test handles Tp::UIntList handles; for (int i = 0; i < 3; i++) { - handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), NULL, NULL)); + handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), nullptr, nullptr)); QVERIFY(handles[i] != 0); } @@ -574,7 +574,7 @@ void TestContacts::testFeaturesNotRequested() tp_base_connection_get_handles(TP_BASE_CONNECTION(mConnService), TP_HANDLE_TYPE_CONTACT); Tp::UIntList handles; for (int i = 0; i < 3; i++) { - handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), NULL, NULL)); + handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), nullptr, nullptr)); QVERIFY(handles[i] != 0); } @@ -637,7 +637,7 @@ void TestContacts::testUpgrade() Tp::UIntList handles; for (int i = 0; i < 3; i++) { - handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), NULL, NULL)); + handles.push_back(tp_handle_ensure(serviceRepo, ids[i].toLatin1().constData(), nullptr, nullptr)); QVERIFY(handles[i] != 0); } @@ -721,7 +721,7 @@ void TestContacts::testSelfContactFallback() { gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; TpTestsSimpleConnection *connService; connService = TP_TESTS_SIMPLE_CONNECTION(g_object_new( @@ -729,13 +729,13 @@ void TestContacts::testSelfContactFallback() "account", "me@example.com", "protocol", "simple", NULL)); - QVERIFY(connService != 0); + QVERIFY(connService != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(connService), "simple", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); ConnectionPtr conn = Connection::create(QLatin1String(name), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), @@ -753,7 +753,7 @@ void TestContacts::testSelfContactFallback() QCOMPARE(conn->isReady(features), true); ContactPtr selfContact = conn->selfContact(); - QVERIFY(selfContact != 0); + QVERIFY(selfContact != nullptr); QCOMPARE(selfContact->handle()[0], conn->selfHandle()); QCOMPARE(selfContact->id(), QString(QLatin1String("me@example.com"))); @@ -805,9 +805,9 @@ void TestContacts::cleanupTestCase() } } - if (mConnService != 0) { + if (mConnService != nullptr) { g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/dbus-proxy-factory.cpp b/tests/dbus/dbus-proxy-factory.cpp index 8596ea93..108bd081 100644 --- a/tests/dbus/dbus-proxy-factory.cpp +++ b/tests/dbus/dbus-proxy-factory.cpp @@ -33,9 +33,9 @@ class TestDBusProxyFactory : public Test Q_OBJECT public: - TestDBusProxyFactory(QObject *parent = 0) + TestDBusProxyFactory(QObject *parent = nullptr) : Test(parent), - mConnService1(0), mConnService2(0) + mConnService1(nullptr), mConnService2(nullptr) { } protected Q_SLOTS: @@ -73,24 +73,24 @@ void TestDBusProxyFactory::initTestCase() g_type_init(); g_set_prgname("dbus-proxy-factory"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; mConnService1 = TP_TESTS_CONTACTS_CONNECTION(g_object_new( TP_TESTS_TYPE_CONTACTS_CONNECTION, "account", "me1@example.com", "protocol", "simple", NULL)); - QVERIFY(mConnService1 != 0); + QVERIFY(mConnService1 != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService1), "contacts", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName1 = QLatin1String(name); mConnPath1 = QLatin1String(connPath); @@ -103,13 +103,13 @@ void TestDBusProxyFactory::initTestCase() "account", "me2@example.com", "protocol", "simple", NULL)); - QVERIFY(mConnService2 != 0); + QVERIFY(mConnService2 != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService2), "contacts", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName2 = QLatin1String(name); mConnPath2 = QLatin1String(connPath); @@ -133,14 +133,14 @@ void TestDBusProxyFactory::testCaching() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(first != NULL); + QVERIFY(first != nullptr); QVERIFY(!first->proxy().isNull()); PendingReady *same = mFactory->proxy(mConnName1, mConnPath1, ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(same != NULL); + QVERIFY(same != nullptr); QVERIFY(!same->proxy().isNull()); QCOMPARE(same->proxy().data(), first->proxy().data()); @@ -149,7 +149,7 @@ void TestDBusProxyFactory::testCaching() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(different != NULL); + QVERIFY(different != nullptr); QVERIFY(!different->proxy().isNull()); QVERIFY(different->proxy() != first->proxy()); @@ -175,7 +175,7 @@ void TestDBusProxyFactory::testCaching() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(another != NULL); + QVERIFY(another != nullptr); QVERIFY(!another->proxy().isNull()); // Should still be the same even if all the initial requests already finished @@ -192,7 +192,7 @@ void TestDBusProxyFactory::testDropRefs() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(first != NULL); + QVERIFY(first != nullptr); QVERIFY(!first->proxy().isNull()); ConnectionPtr firstProxy = ConnectionPtr::qObjectCast(first->proxy()); @@ -206,7 +206,7 @@ void TestDBusProxyFactory::testDropRefs() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(same != NULL); + QVERIFY(same != nullptr); QVERIFY(!same->proxy().isNull()); // The first one is in scope so we should've got it again @@ -230,7 +230,7 @@ void TestDBusProxyFactory::testDropRefs() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(different != NULL); + QVERIFY(different != nullptr); QVERIFY(!different->proxy().isNull()); // The first one has gone out of scope and deleted so we should've got a different one @@ -243,7 +243,7 @@ void TestDBusProxyFactory::testInvalidate() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(first != NULL); + QVERIFY(first != nullptr); QVERIFY(!first->proxy().isNull()); ConnectionPtr firstProxy = ConnectionPtr::qObjectCast(first->proxy()); @@ -257,7 +257,7 @@ void TestDBusProxyFactory::testInvalidate() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(same != NULL); + QVERIFY(same != nullptr); QVERIFY(!same->proxy().isNull()); // The first one is in scope and valid so we should've got it again @@ -283,7 +283,7 @@ void TestDBusProxyFactory::testInvalidate() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(different != NULL); + QVERIFY(different != nullptr); ConnectionPtr differentProxy = ConnectionPtr::qObjectCast(different->proxy()); QVERIFY(!differentProxy.isNull()); @@ -309,7 +309,7 @@ void TestDBusProxyFactory::testBogusService() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(bogus != NULL); + QVERIFY(bogus != nullptr); QVERIFY(!bogus->proxy().isNull()); QVERIFY(!ConnectionPtr::qObjectCast(bogus->proxy())->isValid()); @@ -319,7 +319,7 @@ void TestDBusProxyFactory::testBogusService() ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); - QVERIFY(another != NULL); + QVERIFY(another != nullptr); QVERIFY(!another->proxy().isNull()); QVERIFY(!ConnectionPtr::qObjectCast(another->proxy())->isValid()); diff --git a/tests/dbus/dbus-tube-chan.cpp b/tests/dbus/dbus-tube-chan.cpp index 03ae52c3..938aaaa6 100644 --- a/tests/dbus/dbus-tube-chan.cpp +++ b/tests/dbus/dbus-tube-chan.cpp @@ -46,9 +46,9 @@ class TestDBusTubeChan : public Test Q_OBJECT public: - TestDBusTubeChan(QObject *parent = 0) + TestDBusTubeChan(QObject *parent = nullptr) : Test(parent), - mConn(0), mChanService(0), + mConn(nullptr), mChanService(nullptr), mBusNameWasAdded(false), mBusNameWasRemoved(false), mOfferFinished(false), mAllowsOtherUsers(false) @@ -167,14 +167,14 @@ void TestDBusTubeChan::createTubeChannel(bool requested, TpHandle handle; GType type; if (withContact) { - handle = tp_handle_ensure(contactRepo, "bob", NULL, NULL); + handle = tp_handle_ensure(contactRepo, "bob", nullptr, nullptr); type = TP_TESTS_TYPE_CONTACT_DBUS_TUBE_CHANNEL; } else { - handle = tp_handle_ensure(roomRepo, "#test", NULL, NULL); + handle = tp_handle_ensure(roomRepo, "#test", nullptr, nullptr); type = TP_TESTS_TYPE_ROOM_DBUS_TUBE_CHANNEL; } - TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", NULL, NULL); + TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", nullptr, nullptr); GArray *acontrols; TpSocketAccessControl a; @@ -222,7 +222,7 @@ void TestDBusTubeChan::initTestCase() g_type_init(); g_set_prgname("dbus-tube-chan"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_SIMPLE_CONNECTION, @@ -448,7 +448,7 @@ void TestDBusTubeChan::testOfferSuccess() TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle bobHandle = tp_handle_ensure(contactRepo, "bob", NULL, NULL); + TpHandle bobHandle = tp_handle_ensure(contactRepo, "bob", nullptr, nullptr); gchar *bobService = g_strdup("org.bob.test"); tp_tests_dbus_tube_channel_peer_connected_no_stream(mChanService, bobService, bobHandle); @@ -531,7 +531,7 @@ void TestDBusTubeChan::testOutgoingBusNameMonitoring() // immediately drop it TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", NULL, NULL); + TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", nullptr, nullptr); gchar *service = g_strdup("org.not.seen.yet"); mExpectedHandle = handle; @@ -586,7 +586,7 @@ void TestDBusTubeChan::testExtractBusNameMonitoring() // Simulate a peer connection from someone TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", NULL, NULL); + TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", nullptr, nullptr); gchar *service = g_strdup("org.not.seen.yet"); mExpectedHandle = handle; @@ -717,7 +717,7 @@ void TestDBusTubeChan::testOfferCornerCases() // Simulate a peer connection from someone TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", NULL, NULL); + TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", nullptr, nullptr); gchar *service = g_strdup("org.not.seen.yet"); mExpectedHandle = handle; @@ -761,9 +761,9 @@ void TestDBusTubeChan::cleanup() mChan.reset(); - if (mChanService != 0) { + if (mChanService != nullptr) { g_object_unref(mChanService); - mChanService = 0; + mChanService = nullptr; } mLoop->processEvents(); diff --git a/tests/dbus/handles.cpp b/tests/dbus/handles.cpp index 2182da48..863e2f2b 100644 --- a/tests/dbus/handles.cpp +++ b/tests/dbus/handles.cpp @@ -20,8 +20,8 @@ class TestHandles : public Test Q_OBJECT public: - TestHandles(QObject *parent = 0) - : Test(parent), mConn(0) + TestHandles(QObject *parent = nullptr) + : Test(parent), mConn(nullptr) { } protected Q_SLOTS: @@ -57,7 +57,7 @@ void TestHandles::initTestCase() g_type_init(); g_set_prgname("handles"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_SIMPLE_CONNECTION, diff --git a/tests/dbus/properties.cpp b/tests/dbus/properties.cpp index 07fb7418..3113b4b8 100644 --- a/tests/dbus/properties.cpp +++ b/tests/dbus/properties.cpp @@ -23,8 +23,8 @@ class TestProperties : public Test Q_OBJECT public: - TestProperties(QObject *parent = 0) - : Test(parent), mConnService(0) + TestProperties(QObject *parent = nullptr) + : Test(parent), mConnService(nullptr) { } private Q_SLOTS: @@ -49,7 +49,7 @@ void TestProperties::initTestCase() g_type_init(); g_set_prgname("properties"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); } void TestProperties::init() @@ -58,20 +58,20 @@ void TestProperties::init() gchar *name; gchar *connPath; - GError *error = 0; + GError *error = nullptr; mConnService = TP_TESTS_CONTACTS_CONNECTION(g_object_new( TP_TESTS_TYPE_CONTACTS_CONNECTION, "account", "me@example.com", "protocol", "contacts", NULL)); - QVERIFY(mConnService != 0); + QVERIFY(mConnService != nullptr); QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mConnService), "contacts", &name, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(name != 0); - QVERIFY(connPath != 0); + QVERIFY(name != nullptr); + QVERIFY(connPath != nullptr); mConnName = QLatin1String(name); mConnPath = QLatin1String(connPath); @@ -101,10 +101,10 @@ void TestProperties::testPropertiesMonitoring() ); tp_svc_dbus_properties_emit_properties_changed (mConnService, - "a.random.interface", changed, NULL); + "a.random.interface", changed, nullptr); tp_svc_dbus_properties_emit_properties_changed (mConnService, - mConn->interface().toLatin1().data(), changed, NULL); + mConn->interface().toLatin1().data(), changed, nullptr); QCOMPARE(spy.count(), 0); @@ -130,11 +130,11 @@ void TestProperties::cleanup() { if (mConn) { mConn->deleteLater(); - mConn = 0; + mConn = nullptr; } - if (mConnService != 0) { + if (mConnService != nullptr) { g_object_unref(mConnService); - mConnService = 0; + mConnService = nullptr; } cleanupImpl(); } diff --git a/tests/dbus/simple-observer.cpp b/tests/dbus/simple-observer.cpp index c656b421..62c07afa 100644 --- a/tests/dbus/simple-observer.cpp +++ b/tests/dbus/simple-observer.cpp @@ -140,7 +140,7 @@ class TestSimpleObserver : public Test Q_OBJECT public: - TestSimpleObserver(QObject *parent = 0) + TestSimpleObserver(QObject *parent = nullptr) : Test(parent), mChannelsCount(0), mSMChannelsCount(0) { @@ -175,7 +175,7 @@ private: struct ConnInfo { ConnInfo() - : connService(0), baseConnService(0), contactRepo(0) + : connService(nullptr), baseConnService(nullptr), contactRepo(nullptr) { } @@ -232,7 +232,7 @@ void TestSimpleObserver::initTestCase() g_type_init(); g_set_prgname("simple-observer"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); QDBusConnection bus = QDBusConnection::sessionBus(); QString channelDispatcherBusName = TP_QT_IFACE_CHANNEL_DISPATCHER; @@ -274,20 +274,20 @@ void TestSimpleObserver::initTestCase() "account", "me@example.com", "protocol", "example", NULL)); - QVERIFY(connService != 0); + QVERIFY(connService != nullptr); TpBaseConnection *baseConnService = TP_BASE_CONNECTION(connService); - QVERIFY(baseConnService != 0); + QVERIFY(baseConnService != nullptr); gchar *connName, *connPath; - GError *error = NULL; + GError *error = nullptr; QString name(QLatin1String("example") + QString::number(i)); QVERIFY(tp_base_connection_register(baseConnService, name.toLatin1().constData(), &connName, &connPath, &error)); - QVERIFY(error == 0); + QVERIFY(error == nullptr); - QVERIFY(connName != 0); - QVERIFY(connPath != 0); + QVERIFY(connName != nullptr); + QVERIFY(connPath != nullptr); ConnectionPtr conn = Connection::create(QLatin1String(connName), QLatin1String(connPath), ChannelFactory::create(QDBusConnection::sessionBus()), ContactFactory::create()); @@ -311,7 +311,7 @@ void TestSimpleObserver::initTestCase() mConns[i].contactRepo = contactRepo; // setup channels - guint handle = tp_handle_ensure(contactRepo, mContacts[i].toLatin1().constData(), 0, 0); + guint handle = tp_handle_ensure(contactRepo, mContacts[i].toLatin1().constData(), nullptr, nullptr); QString messagesChanPath = QLatin1String(connPath) + QLatin1String("/MessagesChannel/") + QString::number(i); @@ -625,14 +625,14 @@ void TestSimpleObserver::testCrossTalk() // invalidate channels for (int i = 0; i < 2; ++i) { - if (mMessagesChanServices[i] != 0) { + if (mMessagesChanServices[i] != nullptr) { g_object_unref(mMessagesChanServices[i]); - mMessagesChanServices[i] = 0; + mMessagesChanServices[i] = nullptr; } - if (mCallableChanServices[i] != 0) { + if (mCallableChanServices[i] != nullptr) { g_object_unref(mCallableChanServices[i]); - mCallableChanServices[i] = 0; + mCallableChanServices[i] = nullptr; } } @@ -666,7 +666,7 @@ void TestSimpleObserver::cleanupTestCase() } if (mConns[i].conn->requestedFeatures().contains(Connection::FeatureCore)) { - QVERIFY(mConns[i].connService != NULL); + QVERIFY(mConns[i].connService != nullptr); if (TP_BASE_CONNECTION(mConns[i].connService)->status != TP_CONNECTION_STATUS_DISCONNECTED) { tp_base_connection_change_status(TP_BASE_CONNECTION(mConns[i].connService), @@ -684,20 +684,20 @@ void TestSimpleObserver::cleanupTestCase() mTextChans[i].reset(); mSMChans[i].reset(); - if (mMessagesChanServices[i] != 0) { + if (mMessagesChanServices[i] != nullptr) { g_object_unref(mMessagesChanServices[i]); - mMessagesChanServices[i] = 0; + mMessagesChanServices[i] = nullptr; } - if (mCallableChanServices[i] != 0) { + if (mCallableChanServices[i] != nullptr) { g_object_unref(mCallableChanServices[i]); - mCallableChanServices[i] = 0; + mCallableChanServices[i] = nullptr; } - if (mConns[i].connService != 0) { - mConns[i].baseConnService = 0; + if (mConns[i].connService != nullptr) { + mConns[i].baseConnService = nullptr; g_object_unref(mConns[i].connService); - mConns[i].connService = 0; + mConns[i].connService = nullptr; } } diff --git a/tests/dbus/stateful-proxy.cpp b/tests/dbus/stateful-proxy.cpp index 8c3d0419..805ac64d 100644 --- a/tests/dbus/stateful-proxy.cpp +++ b/tests/dbus/stateful-proxy.cpp @@ -65,7 +65,7 @@ class TestStatefulProxy : public Test Q_OBJECT public: - TestStatefulProxy(QObject *parent = 0); + TestStatefulProxy(QObject *parent = nullptr); private Q_SLOTS: void initTestCase(); @@ -110,7 +110,7 @@ QString TestStatefulProxy::objectPath() TestStatefulProxy::TestStatefulProxy(QObject *parent) : Test(parent), - mProxy(0), + mProxy(nullptr), mAdaptor(new ObjectAdaptor(this)) { } @@ -297,7 +297,7 @@ void TestStatefulProxy::cleanup() { if (mProxy) { delete mProxy; - mProxy = 0; + mProxy = nullptr; } cleanupImpl(); diff --git a/tests/dbus/stream-tube-chan.cpp b/tests/dbus/stream-tube-chan.cpp index ba6050fa..90f38eec 100644 --- a/tests/dbus/stream-tube-chan.cpp +++ b/tests/dbus/stream-tube-chan.cpp @@ -63,7 +63,7 @@ GHashTable *createSupportedSocketTypesHash(TpSocketAddressType addressType, GHashTable *ret; GArray *tab; - ret = g_hash_table_new_full(NULL, NULL, NULL, destroySocketControlList); + ret = g_hash_table_new_full(nullptr, nullptr, nullptr, destroySocketControlList); tab = g_array_sized_new(FALSE, FALSE, sizeof(TpSocketAccessControl), 1); g_array_append_val(tab, accessControl); @@ -96,10 +96,10 @@ GSocket *createTcpClientGSocket(TpSocketAddressType socketType) } /* Create socket to connect to the CM */ - GError *error = NULL; + GError *error = nullptr; GSocket *clientSocket = g_socket_new(family, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, &error); - Q_ASSERT(clientSocket != NULL); + Q_ASSERT(clientSocket != nullptr); if (socketType == TP_SOCKET_ADDRESS_TYPE_IPV4 || socketType == TP_SOCKET_ADDRESS_TYPE_IPV6) { @@ -130,9 +130,9 @@ class TestStreamTubeChan : public Test Q_OBJECT public: - TestStreamTubeChan(QObject *parent = 0) + TestStreamTubeChan(QObject *parent = nullptr) : Test(parent), - mConn(0), mChanService(0), mLocalConnectionId(-1), mRemoteConnectionId(-1), + mConn(nullptr), mChanService(nullptr), mLocalConnectionId(-1), mRemoteConnectionId(-1), mGotLocalConnection(false), mGotRemoteConnection(false), mGotSocketConnection(false), mGotConnectionClosed(false), mOfferFinished(false), mRequiresCredentials(false), mCredentialByte(0) @@ -267,14 +267,14 @@ void TestStreamTubeChan::createTubeChannel(bool requested, TpHandle handle; GType type; if (withContact) { - handle = tp_handle_ensure(contactRepo, "bob", NULL, NULL); + handle = tp_handle_ensure(contactRepo, "bob", nullptr, nullptr); type = TP_TESTS_TYPE_CONTACT_STREAM_TUBE_CHANNEL; } else { - handle = tp_handle_ensure(roomRepo, "#test", NULL, NULL); + handle = tp_handle_ensure(roomRepo, "#test", nullptr, nullptr); type = TP_TESTS_TYPE_ROOM_STREAM_TUBE_CHANNEL; } - TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", NULL, NULL); + TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", nullptr, nullptr); GHashTable *sockets = createSupportedSocketTypesHash(addressType, accessControl); @@ -309,7 +309,7 @@ void TestStreamTubeChan::initTestCase() g_type_init(); g_set_prgname("stream-tube-chan"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_SIMPLE_CONNECTION, @@ -486,7 +486,7 @@ void TestStreamTubeChan::testAcceptSuccess() bool requiresCredentials = ((contexts[i].accessControl == TP_SOCKET_ACCESS_CONTROL_CREDENTIALS) ? true : false); - GSocket *gSocket = 0; + GSocket *gSocket = nullptr; QHostAddress addr; quint16 port = 0; IncomingStreamTubeChannelPtr chan = IncomingStreamTubeChannelPtr::qObjectCast(mChan); @@ -503,8 +503,8 @@ void TestStreamTubeChan::testAcceptSuccess() // for this test. See http://bugreports.qt.nokia.com/browse/QTBUG-121 GSocketAddress *localAddr; - localAddr = g_socket_get_local_address(gSocket, NULL); - QVERIFY(localAddr != NULL); + localAddr = g_socket_get_local_address(gSocket, nullptr); + QVERIFY(localAddr != nullptr); addr = QHostAddress(QLatin1String(g_inet_address_to_string( g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(localAddr))))); port = g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS(localAddr)); @@ -542,14 +542,14 @@ void TestStreamTubeChan::testAcceptSuccess() qDebug().nospace() << "Connecting to host " << mChan->ipAddress().first << ":" << mChan->ipAddress().second; - QTcpSocket *socket = 0; + QTcpSocket *socket = nullptr; if (contexts[i].accessControl == TP_SOCKET_ACCESS_CONTROL_PORT) { GSocketAddress *remoteAddr = (GSocketAddress*) g_inet_socket_address_new( g_inet_address_new_from_string( mChan->ipAddress().first.toString().toLatin1().constData()), mChan->ipAddress().second); - g_socket_connect(gSocket, remoteAddr, NULL, NULL); + g_socket_connect(gSocket, remoteAddr, nullptr, nullptr); } else { socket = new QTcpSocket(); socket->connectToHost(mChan->ipAddress().first, mChan->ipAddress().second); @@ -652,14 +652,14 @@ void TestStreamTubeChan::testOfferSuccess() mOfferFinished = false; mGotSocketConnection = false; - QLocalServer *localServer = 0; - QTcpServer *tcpServer = 0; + QLocalServer *localServer = nullptr; + QTcpServer *tcpServer = nullptr; OutgoingStreamTubeChannelPtr chan = OutgoingStreamTubeChannelPtr::qObjectCast(mChan); QVariantMap offerParameters; offerParameters.insert(QLatin1String("mushroom"), 44); if (contexts[i].addressType == TP_SOCKET_ADDRESS_TYPE_UNIX) { localServer = new QLocalServer(this); - localServer->listen(QLatin1String(tmpnam(NULL))); + localServer->listen(QLatin1String(tmpnam(nullptr))); connect(localServer, SIGNAL(newConnection()), SLOT(onNewSocketConnection())); QVERIFY(connect(chan->offerUnixSocket(localServer, offerParameters, requiresCredentials), @@ -682,8 +682,8 @@ void TestStreamTubeChan::testOfferSuccess() QCOMPARE(mGotSocketConnection, false); // A client now connects to the tube - QLocalSocket *localSocket = 0; - QTcpSocket *tcpSocket = 0; + QLocalSocket *localSocket = nullptr; + QTcpSocket *tcpSocket = nullptr; if (contexts[i].addressType == TP_SOCKET_ADDRESS_TYPE_UNIX) { qDebug() << "Connecting to host" << localServer->fullServerName(); localSocket = new QLocalSocket(this); @@ -705,7 +705,7 @@ void TestStreamTubeChan::testOfferSuccess() } /* simulate CM when peer connects */ - GValue *connParam = 0; + GValue *connParam = nullptr; mCredentialByte = 0; switch (contexts[i].accessControl) { case TP_SOCKET_ACCESS_CONTROL_LOCALHOST: @@ -739,7 +739,7 @@ void TestStreamTubeChan::testOfferSuccess() TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle bobHandle = tp_handle_ensure(contactRepo, "bob", NULL, NULL); + TpHandle bobHandle = tp_handle_ensure(contactRepo, "bob", nullptr, nullptr); tp_tests_stream_tube_channel_peer_connected_no_stream(mChanService, connParam, bobHandle); @@ -838,7 +838,7 @@ void TestStreamTubeChan::testOutgoingConnectionMonitoring() // immediately drop it TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", NULL, NULL); + TpHandle handle = tp_handle_ensure(contactRepo, "YouHaventSeenMeYet", nullptr, nullptr); mExpectedHandle = handle; mExpectedId = QLatin1String("youhaventseenmeyet"); @@ -882,9 +882,9 @@ void TestStreamTubeChan::cleanup() mChan.reset(); - if (mChanService != 0) { + if (mChanService != nullptr) { g_object_unref(mChanService); - mChanService = 0; + mChanService = nullptr; } mLoop->processEvents(); diff --git a/tests/dbus/stream-tube-handlers.cpp b/tests/dbus/stream-tube-handlers.cpp index af39bf76..29268bb1 100644 --- a/tests/dbus/stream-tube-handlers.cpp +++ b/tests/dbus/stream-tube-handlers.cpp @@ -197,7 +197,7 @@ GHashTable *createSupportedSocketTypesHash(bool supportMonitoring, bool unixOnly GArray *tab; TpSocketAccessControl ac; - ret = g_hash_table_new_full(NULL, NULL, NULL, destroySocketControlList); + ret = g_hash_table_new_full(nullptr, nullptr, nullptr, destroySocketControlList); // Named UNIX tab = g_array_sized_new(FALSE, FALSE, sizeof(TpSocketAccessControl), 1); @@ -261,7 +261,7 @@ class TestStreamTubeHandlers : public Test Q_OBJECT public: - TestStreamTubeHandlers(QObject *parent = 0) + TestStreamTubeHandlers(QObject *parent = nullptr) : Test(parent) { } @@ -380,12 +380,12 @@ QPair<QString, QVariantMap> TestStreamTubeHandlers::createTubeChannel(bool reque TpHandle handle; GType type; if (handleType == HandleTypeContact) { - handle = tp_handle_ensure(contactRepo, "bob", NULL, NULL); + handle = tp_handle_ensure(contactRepo, "bob", nullptr, nullptr); type = TP_TESTS_TYPE_CONTACT_STREAM_TUBE_CHANNEL; chanProps.insert(TP_QT_IFACE_CHANNEL + QString::fromLatin1(".TargetID"), QString::fromLatin1("bob")); } else { - handle = tp_handle_ensure(roomRepo, "#test", NULL, NULL); + handle = tp_handle_ensure(roomRepo, "#test", nullptr, nullptr); type = TP_TESTS_TYPE_ROOM_STREAM_TUBE_CHANNEL; chanProps.insert(TP_QT_IFACE_CHANNEL + QString::fromLatin1(".TargetID"), QString::fromLatin1("#test")); @@ -393,7 +393,7 @@ QPair<QString, QVariantMap> TestStreamTubeHandlers::createTubeChannel(bool reque chanProps.insert(TP_QT_IFACE_CHANNEL + QString::fromLatin1(".TargetHandle"), handle); - TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", NULL, NULL); + TpHandle alfHandle = tp_handle_ensure(contactRepo, "alf", nullptr, nullptr); GHashTable *sockets = createSupportedSocketTypesHash(supportMonitoring, unixOnly); @@ -713,7 +713,7 @@ void TestStreamTubeHandlers::initTestCase() g_type_init(); g_set_prgname("stream-tube-handlers"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mAM = AccountManager::create(); QVERIFY(connect(mAM->becomeReady(), @@ -875,7 +875,7 @@ void TestStreamTubeHandlers::testBasicTcpExport() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(server->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1004,7 +1004,7 @@ void TestStreamTubeHandlers::testFailedExport() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(server->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); // To trigger the Offer error codepath, give it a channel which only supports Unix sockets // although we're exporting a TCP one - which is always supported in real CMs @@ -1051,7 +1051,7 @@ void TestStreamTubeHandlers::testServerConnMonitoring() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(server->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); QPair<QString, QVariantMap> chan = createTubeChannel(true, HandleTypeRoom, true); @@ -1115,7 +1115,7 @@ void TestStreamTubeHandlers::testServerConnMonitoring() TpHandleRepoIface *contactRepo = tp_base_connection_get_handles( TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - TpHandle handle = tp_handle_ensure(contactRepo, "first", NULL, NULL); + TpHandle handle = tp_handle_ensure(contactRepo, "first", nullptr, nullptr); tp_tests_stream_tube_channel_peer_connected_no_stream(mChanServices.back(), connParam, handle); @@ -1147,12 +1147,12 @@ void TestStreamTubeHandlers::testServerConnMonitoring() QVERIFY(server->tcpConnections().isEmpty()); // Fire up two new connections - handle = tp_handle_ensure(contactRepo, "second", NULL, NULL); + handle = tp_handle_ensure(contactRepo, "second", nullptr, nullptr); expectedPort = 2; dbus_g_type_struct_set(connParam, 1, expectedPort, G_MAXUINT); tp_tests_stream_tube_channel_peer_connected_no_stream(mChanServices.back(), connParam, handle); - handle = tp_handle_ensure(contactRepo, "third", NULL, NULL); + handle = tp_handle_ensure(contactRepo, "third", nullptr, nullptr); expectedPort = 3; dbus_g_type_struct_set(connParam, 1, expectedPort, G_MAXUINT); tp_tests_stream_tube_channel_peer_connected_no_stream(mChanServices.back(), connParam, handle); @@ -1226,7 +1226,7 @@ void TestStreamTubeHandlers::testSSTHErrorPaths() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(server->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); // Pass it a text channel, and with no satisfied requests QString textChanPath = mConn->objectPath() + QLatin1String("/TextChannel"); @@ -1361,7 +1361,7 @@ void TestStreamTubeHandlers::testClientBasicTcp() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1452,7 +1452,7 @@ void TestStreamTubeHandlers::testClientTcpGeneratorIgnore() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1533,7 +1533,7 @@ void TestStreamTubeHandlers::testClientTcpUnsupported() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1586,14 +1586,14 @@ void TestStreamTubeHandlers::testClientBasicUnix() QCOMPARE(client->registrar()->registeredClients().size(), 1); QVERIFY(!client->acceptsAsTcp()); QVERIFY(client->acceptsAsUnix()); - QCOMPARE(client->tcpGenerator(), static_cast<StreamTubeClient::TcpSourceAddressGenerator *>(0)); + QCOMPARE(client->tcpGenerator(), static_cast<StreamTubeClient::TcpSourceAddressGenerator *>(nullptr)); QVERIFY(!client->monitorsConnections()); QMap<QString, ClientHandlerInterface *> handlers = ourHandlers(); QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1667,14 +1667,14 @@ void TestStreamTubeHandlers::testClientUnixCredsIgnore() QVERIFY(client->isRegistered()); QVERIFY(!client->acceptsAsTcp()); QVERIFY(client->acceptsAsUnix()); - QCOMPARE(client->tcpGenerator(), static_cast<StreamTubeClient::TcpSourceAddressGenerator *>(0)); + QCOMPARE(client->tcpGenerator(), static_cast<StreamTubeClient::TcpSourceAddressGenerator *>(nullptr)); QVERIFY(!client->monitorsConnections()); QMap<QString, ClientHandlerInterface *> handlers = ourHandlers(); QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); @@ -1753,7 +1753,7 @@ void TestStreamTubeHandlers::testClientConnMonitoring() QVERIFY(!handlers.isEmpty()); ClientHandlerInterface *handler = handlers.value(client->clientName()); - QVERIFY(handler != 0); + QVERIFY(handler != nullptr); ChannelClassList filter; QVERIFY(waitForProperty(handler->requestPropertyHandlerChannelFilter(), &filter)); diff --git a/tests/dbus/streamed-media-chan.cpp b/tests/dbus/streamed-media-chan.cpp index 2e198756..34786bd2 100644 --- a/tests/dbus/streamed-media-chan.cpp +++ b/tests/dbus/streamed-media-chan.cpp @@ -23,8 +23,8 @@ class TestStreamedMediaChan : public Test Q_OBJECT public: - TestStreamedMediaChan(QObject *parent = 0) - : Test(parent), mConn(0) + TestStreamedMediaChan(QObject *parent = nullptr) + : Test(parent), mConn(nullptr) { } protected Q_SLOTS: @@ -470,7 +470,7 @@ void TestStreamedMediaChan::initTestCase() g_type_init(); g_set_prgname("streamed-media-chan"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, EXAMPLE_TYPE_CALLABLE_CONNECTION, diff --git a/tests/dbus/text-chan.cpp b/tests/dbus/text-chan.cpp index de1d9d2d..66bac7cc 100644 --- a/tests/dbus/text-chan.cpp +++ b/tests/dbus/text-chan.cpp @@ -35,10 +35,10 @@ class TestTextChan : public Test Q_OBJECT public: - TestTextChan(QObject *parent = 0) + TestTextChan(QObject *parent = nullptr) : Test(parent), - mConn(0), mContactRepo(0), - mTextChanService(0), mMessagesChanService(0), + mConn(nullptr), mContactRepo(nullptr), + mTextChanService(nullptr), mMessagesChanService(nullptr), mGotChatStateChanged(false), mChatStateChangedState((ChannelChatState) -1) { } @@ -127,7 +127,7 @@ void TestTextChan::initTestCase() g_type_init(); g_set_prgname("text-chan"); tp_debug_set_flags("all"); - dbus_g_bus_get(DBUS_BUS_STARTER, 0); + dbus_g_bus_get(DBUS_BUS_STARTER, nullptr); mConn = new TestConnHelper(this, TP_TESTS_TYPE_CONTACTS_CONNECTION, @@ -138,7 +138,7 @@ void TestTextChan::initTestCase() mContactRepo = tp_base_connection_get_handles(TP_BASE_CONNECTION(mConn->service()), TP_HANDLE_TYPE_CONTACT); - guint handle = tp_handle_ensure(mContactRepo, "someone@localhost", 0, 0); + guint handle = tp_handle_ensure(mContactRepo, "someone@localhost", nullptr, nullptr); mContact = mConn->contacts(UIntList() << handle).first(); QVERIFY(mContact); @@ -508,16 +508,16 @@ void TestTextChan::commonTest(bool withMessages) // wait for everything to settle down while (tp_text_mixin_has_pending_messages( - G_OBJECT(mTextChanService), 0) + G_OBJECT(mTextChanService), nullptr) || tp_message_mixin_has_pending_messages( - G_OBJECT(mMessagesChanService), 0)) { + G_OBJECT(mMessagesChanService), nullptr)) { QTest::qWait(1); } QVERIFY(!tp_text_mixin_has_pending_messages( - G_OBJECT(mTextChanService), 0)); + G_OBJECT(mTextChanService), nullptr)); QVERIFY(!tp_message_mixin_has_pending_messages( - G_OBJECT(mMessagesChanService), 0)); + G_OBJECT(mMessagesChanService), nullptr)); } void TestTextChan::testMessages() @@ -548,14 +548,14 @@ void TestTextChan::cleanupTestCase() QCOMPARE(mConn->disconnect(), true); delete mConn; - if (mTextChanService != 0) { + if (mTextChanService != nullptr) { g_object_unref(mTextChanService); - mTextChanService = 0; + mTextChanService = nullptr; } - if (mMessagesChanService != 0) { + if (mMessagesChanService != nullptr) { g_object_unref(mMessagesChanService); - mMessagesChanService = 0; + mMessagesChanService = nullptr; } cleanupTestCaseImpl(); diff --git a/tests/dbus/types.cpp b/tests/dbus/types.cpp index 7b2d9336..254029db 100644 --- a/tests/dbus/types.cpp +++ b/tests/dbus/types.cpp @@ -52,7 +52,7 @@ class TestTypes : public Test Q_OBJECT public: - TestTypes(QObject *parent = 0) + TestTypes(QObject *parent = nullptr) : Test(parent) { } diff --git a/tests/features.cpp b/tests/features.cpp index add8f3c1..9d87c46c 100644 --- a/tests/features.cpp +++ b/tests/features.cpp @@ -29,7 +29,7 @@ class TestFeatures : public QObject Q_OBJECT public: - TestFeatures(QObject *parent = 0); + TestFeatures(QObject *parent = nullptr); private Q_SLOTS: void testFeaturesHash(); diff --git a/tests/lib/glib-helpers/test-conn-helper.cpp b/tests/lib/glib-helpers/test-conn-helper.cpp index 05cec558..21741504 100644 --- a/tests/lib/glib-helpers/test-conn-helper.cpp +++ b/tests/lib/glib-helpers/test-conn-helper.cpp @@ -70,9 +70,9 @@ TestConnHelper::~TestConnHelper() { disconnect(); - if (mService != 0) { + if (mService != nullptr) { g_object_unref(mService); - mService = 0; + mService = nullptr; } } @@ -97,16 +97,16 @@ void TestConnHelper::init(Test *parent, mLoop = parent->mLoop; mService = g_object_new_valist(gType, firstPropertyName, varArgs); - QVERIFY(mService != 0); + QVERIFY(mService != nullptr); gchar *connBusName; gchar *connPath; - GError *error = 0; + GError *error = nullptr; QVERIFY(tp_base_connection_register(TP_BASE_CONNECTION(mService), "testcm", &connBusName, &connPath, &error)); - QVERIFY(error == 0); - QVERIFY(connBusName != 0); - QVERIFY(connPath != 0); + QVERIFY(error == nullptr); + QVERIFY(connBusName != nullptr); + QVERIFY(connPath != nullptr); mClient = Tp::Connection::create(QLatin1String(connBusName), QLatin1String(connPath), channelFactory, contactFactory); diff --git a/tests/lib/test.h b/tests/lib/test.h index 3edb4107..9930165e 100644 --- a/tests/lib/test.h +++ b/tests/lib/test.h @@ -19,7 +19,7 @@ class Test : public QObject public: - Test(QObject *parent = 0); + Test(QObject *parent = nullptr); ~Test() override; diff --git a/tests/manager-file.cpp b/tests/manager-file.cpp index 3683dc76..36f412b4 100644 --- a/tests/manager-file.cpp +++ b/tests/manager-file.cpp @@ -26,7 +26,7 @@ const ParamSpec *getParam(const ParamSpecList ¶ms, const QString &name) return ¶m; } } - return NULL; + return nullptr; } PresenceSpec getPresenceSpec(const PresenceSpecList &specs, const QString &status) @@ -46,7 +46,7 @@ class TestManagerFile : public QObject Q_OBJECT public: - TestManagerFile(QObject *parent = 0); + TestManagerFile(QObject *parent = nullptr); private Q_SLOTS: void testManagerFile(); diff --git a/tests/presence.cpp b/tests/presence.cpp index 9283513d..14d463db 100644 --- a/tests/presence.cpp +++ b/tests/presence.cpp @@ -12,7 +12,7 @@ class TestPresence : public QObject Q_OBJECT public: - TestPresence(QObject *parent = 0); + TestPresence(QObject *parent = nullptr); private Q_SLOTS: void testPresence(); diff --git a/tests/profile.cpp b/tests/profile.cpp index 155107b5..cbaf7f78 100644 --- a/tests/profile.cpp +++ b/tests/profile.cpp @@ -10,7 +10,7 @@ class TestProfile : public QObject Q_OBJECT public: - TestProfile(QObject *parent = 0); + TestProfile(QObject *parent = nullptr); private Q_SLOTS: void testProfile(); diff --git a/tests/ptr.cpp b/tests/ptr.cpp index 4707ff7f..b378b607 100644 --- a/tests/ptr.cpp +++ b/tests/ptr.cpp @@ -27,7 +27,7 @@ class Data : public QObject, public: static DataPtr create() { return DataPtr(new Data()); } - static DataPtr createNull() { return DataPtr(0); } + static DataPtr createNull() { return DataPtr(nullptr); } private: Data() {} @@ -242,7 +242,7 @@ void TestSharedPtr::testWeakPtrBoolConversion() class Thread : public QThread { public: - Thread(const DataPtr &ptr, QObject *parent = 0) : QThread(parent), mPtr(ptr) {} + Thread(const DataPtr &ptr, QObject *parent = nullptr) : QThread(parent), mPtr(ptr) {} void run() override { @@ -287,7 +287,7 @@ void TestSharedPtr::testThreadSafety() DataPtr ptr = Data::create(); WeakPtr<Data> weakPtr(ptr); Data *savedData = ptr.data(); - QVERIFY(savedData != NULL); + QVERIFY(savedData != nullptr); QVERIFY(!ptr.isNull()); QVERIFY(!weakPtr.isNull()); |