Skip to content

Commit

Permalink
Replace NULL with nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Apr 7, 2021
1 parent 8787ddf commit 38c0ff4
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion libbuteosyncfw/clientfw/SyncClientInterface.cpp
Expand Up @@ -35,7 +35,7 @@ SyncClientInterface::SyncClientInterface():
SyncClientInterface::~SyncClientInterface()
{
delete d_ptr;
d_ptr = NULL;
d_ptr = nullptr;
}

bool SyncClientInterface::startSync(const QString &aProfileId) const
Expand Down
2 changes: 1 addition & 1 deletion libbuteosyncfw/clientfw/SyncClientInterfacePrivate.cpp
Expand Up @@ -81,7 +81,7 @@ SyncClientInterfacePrivate::~SyncClientInterfacePrivate()
{
FUNCTION_CALL_TRACE;
delete iSyncDaemon;
iSyncDaemon = NULL;
iSyncDaemon = nullptr;
}

bool SyncClientInterfacePrivate::startSync(const QString &aProfileId) const
Expand Down
6 changes: 3 additions & 3 deletions libbuteosyncfw/common/Logger.cpp
Expand Up @@ -35,11 +35,11 @@ using namespace Buteo;

const int Logger::DEFAULT_INDENT_SIZE = 4;

Logger *Logger::sInstance = NULL;
Logger *Logger::sInstance = nullptr;

Logger *Logger::instance()
{
if (NULL == sInstance) {
if (nullptr == sInstance) {
createInstance();
}
return sInstance;
Expand Down Expand Up @@ -67,7 +67,7 @@ void Logger::createInstance(const QString &aLogFileName, bool aUseStdOut,
void Logger::deleteInstance()
{
delete sInstance;
sInstance = NULL;
sInstance = nullptr;
}

Logger::Logger(const QString &aLogFileName, bool aUseStdOut, int aIndentSize)
Expand Down
2 changes: 1 addition & 1 deletion libbuteosyncfw/common/NetworkManager.cpp
Expand Up @@ -227,7 +227,7 @@ void NetworkManager::disconnectSession()

m_networkSession->close();
delete m_networkSession;
m_networkSession = NULL;
m_networkSession = nullptr;
}
}

Expand Down
2 changes: 1 addition & 1 deletion libbuteosyncfw/common/TransportTracker.cpp
Expand Up @@ -52,7 +52,7 @@ TransportTracker::TransportTracker(QObject *aParent) :
if (!iUSBProxy->isValid()) {
LOG_CRITICAL("Failed to connect to USB moded D-Bus interface");
delete iUSBProxy;
iUSBProxy = NULL;
iUSBProxy = nullptr;
} else {
QObject::connect(iUSBProxy, SIGNAL(usbConnection(bool)), this,
SLOT(onUsbStateChanged(bool)));
Expand Down
32 changes: 16 additions & 16 deletions libbuteosyncfw/pluginmgr/PluginManager.cpp
Expand Up @@ -126,7 +126,7 @@ StorageChangeNotifierPlugin *PluginManager::createStorageChangeNotifier(const QS

if (!iStorageChangeNotifierMaps.contains(aStorageName)) {
LOG_CRITICAL( "Library for the storage change notifier" << aStorageName << "does not exist" );
return NULL;
return nullptr;
}

QString libraryName = iStorageChangeNotifierMaps.value(aStorageName);
Expand All @@ -149,7 +149,7 @@ StorageChangeNotifierPlugin *PluginManager::createStorageChangeNotifier(const QS
LOG_WARNING("Unable to load plugin " << libraryName << " from name " << aStorageName);
pluginLoader->unload();
delete pluginLoader;
return NULL;
return nullptr;
}

void PluginManager::destroyStorageChangeNotifier(StorageChangeNotifierPlugin *aPlugin)
Expand All @@ -175,7 +175,7 @@ StoragePlugin *PluginManager::createStorage(const QString &aPluginName)

if (!iStorageMaps.contains(aPluginName)) {
LOG_CRITICAL( "Library for the storage" << aPluginName << "does not exist" );
return NULL;
return nullptr;
}

QString libraryName = iStorageMaps.value(aPluginName);
Expand All @@ -198,7 +198,7 @@ StoragePlugin *PluginManager::createStorage(const QString &aPluginName)
LOG_WARNING("Unable to load plugin " << libraryName << " from name " << aPluginName);
pluginLoader->unload();
delete pluginLoader;
return NULL;
return nullptr;
}

void PluginManager::destroyStorage(StoragePlugin *aPlugin)
Expand Down Expand Up @@ -227,7 +227,7 @@ ClientPlugin *PluginManager::createClient(const QString &aPluginName,
if (!iClientMaps.contains(aPluginName) &&
!iOopClientMaps.contains(aPluginName)) {
LOG_CRITICAL( "Library for the client" << aPluginName << "does not exist" );
return NULL;
return nullptr;
}

if (iClientMaps.contains(aPluginName)) {
Expand All @@ -251,23 +251,23 @@ ClientPlugin *PluginManager::createClient(const QString &aPluginName,
LOG_WARNING("Unable to load plugin " << libraryName << " from name " << aPluginName);
pluginLoader->unload();
delete pluginLoader;
return NULL;
return nullptr;

} else if (iOopClientMaps.contains(aPluginName)) {
// Start the out of process plugin
const QString libraryName = iOopClientMaps.value(aPluginName);
QProcess *process = startOOPPlugin(aPluginName, aProfile.name(), libraryName);

if (process == NULL) {
if (process == nullptr) {
LOG_CRITICAL( "Could not start process" );
return NULL;
return nullptr;
}

// Create the client plugin interface to talk to the process
return new OOPClientPlugin(aPluginName, aProfile, aCbInterface, *process);
}

return NULL;
return nullptr;
}

void PluginManager::destroyClient(ClientPlugin *aPlugin)
Expand Down Expand Up @@ -306,7 +306,7 @@ ServerPlugin *PluginManager::createServer(const QString &aPluginName,
if (!iServerMaps.contains(aPluginName) &&
!iOoPServerMaps.contains(aPluginName)) {
LOG_CRITICAL( "Library for the server" << aPluginName << "does not exist" );
return NULL;
return nullptr;
}

if (iServerMaps.contains(aPluginName)) {
Expand All @@ -331,16 +331,16 @@ ServerPlugin *PluginManager::createServer(const QString &aPluginName,
LOG_WARNING("Unable to load plugin " << libraryName << " from name " << aPluginName);
pluginLoader->unload();
delete pluginLoader;
return NULL;
return nullptr;

} else if (iOoPServerMaps.contains(aPluginName)) {
// Start the Oop process plugin
const QString libraryName = iOoPServerMaps.value(aPluginName);
QProcess *process = startOOPPlugin(aPluginName, aProfile.name(), libraryName);

if (process == NULL) {
if (process == nullptr) {
LOG_CRITICAL( "Could not start server plugin process" );
return NULL;
return nullptr;
}

return new OOPServerPlugin(aPluginName,
Expand All @@ -349,7 +349,7 @@ ServerPlugin *PluginManager::createServer(const QString &aPluginName,
*process);
}

return NULL;
return nullptr;
}

void PluginManager::destroyServer(ServerPlugin *aPlugin)
Expand Down Expand Up @@ -481,15 +481,15 @@ QProcess *PluginManager::startOOPPlugin(const QString &aPluginName,
LOG_CRITICAL("Unable to start process plugin " << aPluginFilePath <<
". Error " << process->error());
delete process;
return NULL;
return nullptr;
}
}

void PluginManager::stopOOPPlugin(const QString &aPath)
{
FUNCTION_CALL_TRACE;

QProcess *process = NULL;
QProcess *process = nullptr;

iDllLock.lockForWrite();

Expand Down
6 changes: 3 additions & 3 deletions libbuteosyncfw/profile/ProfileFactory.cpp
Expand Up @@ -38,9 +38,9 @@ Profile *ProfileFactory::createProfile(const QString &aName,
const QString &aType)
{
if (aType.isEmpty())
return NULL;
return nullptr;

Profile *p = NULL;
Profile *p = nullptr;

if (aType == Profile::TYPE_SYNC) {
p = new SyncProfile(aName);
Expand All @@ -57,7 +57,7 @@ Profile *ProfileFactory::createProfile(const QString &aName,

Profile *ProfileFactory::createProfile(const QDomElement &aRoot)
{
Profile *p = NULL;
Profile *p = nullptr;

QString type = aRoot.attribute(ATTR_TYPE);
if (type == Profile::TYPE_SYNC) {
Expand Down
6 changes: 3 additions & 3 deletions libbuteosyncfw/profile/ProfileManager.cpp
Expand Up @@ -643,7 +643,7 @@ Profile *ProfileManager::profileFromXml(const QString &aProfileAsXml)
{
FUNCTION_CALL_TRACE;

Profile *profile = NULL;
Profile *profile = nullptr;
if (!aProfileAsXml.isEmpty()) {
QDomDocument doc;
QString error;
Expand Down Expand Up @@ -799,7 +799,7 @@ bool ProfileManager::removeProfile(const QString &aProfileId)
emit signalProfileChanged(aProfileId, ProfileManager::PROFILE_REMOVED, QString(""));
}
delete profile;
profile = NULL;
profile = nullptr;
}
return success;
}
Expand Down Expand Up @@ -992,7 +992,7 @@ bool ProfileManager::setSyncSchedule(QString aProfileId, QString aScheduleAsXml)
status = true;
}
delete profile;
profile = NULL;
profile = nullptr;
} else {
LOG_WARNING("Invalid Profile Supplied");
}
Expand Down
6 changes: 3 additions & 3 deletions msyncd/ClientThread.cpp
Expand Up @@ -29,9 +29,9 @@ using namespace Buteo;

ClientThread::ClientThread()
: iClientPlugin(0),
iIdentity(NULL),
iService(NULL),
iSession(NULL),
iIdentity(nullptr),
iService(nullptr),
iSession(nullptr),
iRunning(false)
{
FUNCTION_CALL_TRACE;
Expand Down
2 changes: 1 addition & 1 deletion msyncd/IPHeartBeat.cpp
Expand Up @@ -108,7 +108,7 @@ bool IPHeartBeat::setHeartBeat(const QString &aProfName, ushort aMinWaitTime, us
return true; //returing 'true' - no immediate sync request to be sent.
}

iphb_t iphbHandle = iphb_open(NULL);
iphb_t iphbHandle = iphb_open(nullptr);

if (iphbHandle == 0) {
LOG_DEBUG("iphb_open() failed.... No IP heartbeat available");
Expand Down
4 changes: 2 additions & 2 deletions msyncd/SyncQueue.cpp
Expand Up @@ -39,7 +39,7 @@ SyncSession *SyncQueue::dequeue()
{
FUNCTION_CALL_TRACE;

SyncSession *p = NULL;
SyncSession *p = nullptr;

if (!iItems.isEmpty()) {
p = iItems.dequeue();
Expand Down Expand Up @@ -67,7 +67,7 @@ SyncSession *SyncQueue::head()
{
FUNCTION_CALL_TRACE;

SyncSession *p = NULL;
SyncSession *p = nullptr;
if (!iItems.isEmpty()) {
p = iItems.head();
} // no else
Expand Down
2 changes: 1 addition & 1 deletion msyncd/SyncSession.cpp
Expand Up @@ -409,7 +409,7 @@ void SyncSession::releaseStorages()
iStorageBooker->releaseStorages(iProfile->storageBackendNames());
}

// Set storage booker to NULL. This indicates that we don't hold any
// Set storage booker to nullptr. This indicates that we don't hold any
// storage reservations.
iStorageBooker = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions msyncd/main.cpp
Expand Up @@ -79,9 +79,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
struct group *grp;
// assumes that correct groupname is same as username (e.g. nemo:nemo)
pwd = getpwuid(uid);
if (pwd != NULL) {
if (pwd != nullptr) {
grp = getgrnam(pwd->pw_name);
if (grp != NULL) {
if (grp != nullptr) {
gid_t gid = grp->gr_gid;
int ret = chown(genericCache.toLatin1().data(), uid, gid);
Q_UNUSED(ret);
Expand Down
22 changes: 11 additions & 11 deletions msyncd/synchronizer.cpp
Expand Up @@ -82,7 +82,7 @@ Synchronizer::Synchronizer(QCoreApplication *aApplication)
iAccounts(0),
iClosing(false),
iSOCEnabled(false),
iSyncUIInterface(NULL),
iSyncUIInterface(nullptr),
iBatteryInfo(new BatteryInfo)
{
iSettings = g_settings_new_with_path("com.meego.msyncd", "/com/meego/msyncd/");
Expand All @@ -98,7 +98,7 @@ Synchronizer::~Synchronizer()
{
FUNCTION_CALL_TRACE;
delete iSyncUIInterface;
iSyncUIInterface = NULL;
iSyncUIInterface = nullptr;
g_object_unref(iSettings);
delete iBatteryInfo;
}
Expand Down Expand Up @@ -553,14 +553,14 @@ bool Synchronizer::startSyncNow(SyncSession *aSession)
// Get the DBUS interface for sync-UI.
LOG_DEBUG( "sync-ui dbus interface is getting called" );
if (aSession->isScheduled() && !profile->isHidden()) {
if (iSyncUIInterface == NULL) {
if (iSyncUIInterface == nullptr) {
LOG_DEBUG( "iSyncUIInterface is Null" );
iSyncUIInterface = new QDBusInterface("com.nokia.syncui", "/org/maemo/m",
"com.nokia.MApplicationIf", QDBusConnection::sessionBus());
} else if (!iSyncUIInterface->isValid()) {
LOG_DEBUG( "iSyncUIInterface is not valid" );
delete iSyncUIInterface;
iSyncUIInterface = NULL;
iSyncUIInterface = nullptr;
iSyncUIInterface = new QDBusInterface("com.nokia.syncui", "/org/maemo/m",
"com.nokia.MApplicationIf", QDBusConnection::sessionBus());
}
Expand Down Expand Up @@ -1034,7 +1034,7 @@ StoragePlugin *Synchronizer::createStorage(const QString &aPluginName)
{
FUNCTION_CALL_TRACE;

StoragePlugin *plugin = NULL;
StoragePlugin *plugin = nullptr;
if (!aPluginName.isEmpty()) {
plugin = iPluginManager.createStorage(aPluginName);
} // no else
Expand Down Expand Up @@ -1297,14 +1297,14 @@ void Synchronizer::onNewSession(const QString &aDestination)
if (!profile->isHidden()) {
// Get the DBUS interface for sync-UI.
LOG_DEBUG( "sync-ui dbus interface is getting called" );
if (iSyncUIInterface == NULL) {
LOG_DEBUG( "iSyncUIInterface is NULL" );
if (iSyncUIInterface == nullptr) {
LOG_DEBUG( "iSyncUIInterface is nullptr" );
iSyncUIInterface = new QDBusInterface("com.nokia.syncui", "/org/maemo/m",
"com.nokia.MApplicationIf", QDBusConnection::sessionBus());
} else if (!iSyncUIInterface->isValid()) {
LOG_DEBUG( "iSyncUIInterface is not Valid()" );
delete iSyncUIInterface;
iSyncUIInterface = NULL;
iSyncUIInterface = nullptr;
iSyncUIInterface = new QDBusInterface("com.nokia.syncui", "/org/maemo/m",
"com.nokia.MApplicationIf", QDBusConnection::sessionBus());

Expand Down Expand Up @@ -1453,7 +1453,7 @@ void Synchronizer::reschedule(const QString &aProfileName)
externalSyncStatus(profile);
LOG_DEBUG("Reschdule profile" << aProfileName << profile->syncType() << profile->isEnabled());
delete profile;
profile = NULL;
profile = nullptr;
}
}

Expand Down Expand Up @@ -1742,7 +1742,7 @@ QStringList Synchronizer::allVisibleSyncProfiles()
if (profile) {
profilesAsXml.append(profile->toString());
delete profile;
profile = NULL;
profile = nullptr;
}
}
}
Expand All @@ -1761,7 +1761,7 @@ QString Synchronizer::syncProfile(const QString &aProfileId)
if (profile) {
profileAsXml.append(profile->toString());
delete profile;
profile = NULL;
profile = nullptr;
} else {

LOG_DEBUG("No profile found with aProfileId" << aProfileId);
Expand Down

0 comments on commit 38c0ff4

Please sign in to comment.