Skip to content

Commit

Permalink
Remove pointless repeating comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Apr 7, 2021
1 parent 9923286 commit 31913de
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 102 deletions.
10 changes: 5 additions & 5 deletions libbuteosyncfw/common/Logger.cpp
Expand Up @@ -85,7 +85,7 @@ Logger::Logger(const QString &aLogFileName, bool aUseStdOut, int aIndentSize)
if (aUseStdOut) {
// Create a stream for writing log messages to standard output.
iStdOutStream = new QTextStream(stdout);
} // no else
}

iStdErrStream = new QTextStream(stderr);

Expand All @@ -97,8 +97,8 @@ Logger::Logger(const QString &aLogFileName, bool aUseStdOut, int aIndentSize)
dir.mkpath(fileInfo.absolutePath());
if (iFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
iFileStream = new QTextStream(&iFile);
} // no else
} // no else
}
}
}

Logger::~Logger()
Expand Down Expand Up @@ -126,7 +126,7 @@ bool Logger::setLogLevel(int aLevel)
}
enable(iLevels);
retVal = true;
} // no else
}
return retVal;
}

Expand Down Expand Up @@ -231,5 +231,5 @@ void Logger::write(int aLevel, const char *aMsg)
if (QtFatalMsg == aLevel) {
// Exit on fatal message.
abort();
} // no else
}
}
26 changes: 13 additions & 13 deletions libbuteosyncfw/profile/Profile.cpp
Expand Up @@ -85,7 +85,7 @@ Profile::Profile(const QDomElement &aRoot)
Profile *subProfile = pf.createProfile(prof);
if (subProfile != 0) {
d_ptr->iSubProfiles.append(subProfile);
} // no else
}
}
}

Expand Down Expand Up @@ -154,7 +154,7 @@ QMap<QString, QString> Profile::allNonStorageKeys() const
foreach (Profile *p, d_ptr->iSubProfiles) {
if (p != 0 && p->type() != Profile::TYPE_STORAGE) {
keys.unite(p->allKeys());
} // no else
}
}

keys.unite(allKeys());
Expand Down Expand Up @@ -259,7 +259,7 @@ QList<const ProfileField *> Profile::visibleFields() const
(f->visible() == ProfileField::VISIBLE_USER &&
!d_ptr->iMergedKeys.contains(f->name()))) {
visibleFields.append(f);
} // no else
}
}

return visibleFields;
Expand Down Expand Up @@ -300,14 +300,14 @@ QDomElement Profile::toXml(QDomDocument &aDoc, bool aLocalOnly) const
foreach (field, d_ptr->iMergedFields) {
root.appendChild(field->toXml(aDoc));
}
} // no else
}

// Set sub-profiles.
foreach (Profile *p, d_ptr->iSubProfiles) {
if (!p->d_ptr->iMerged || !p->d_ptr->iLocalKeys.isEmpty() ||
!p->d_ptr->iLocalFields.isEmpty()) {
root.appendChild(p->toXml(aDoc, aLocalOnly));
} // no else
}
}

return root;
Expand Down Expand Up @@ -375,7 +375,7 @@ QStringList Profile::subProfileNames(const QString &aType) const
foreach (Profile *p, d_ptr->iSubProfiles) {
if (!checkType || aType == p->type()) {
names.append(p->name());
} // no else
}
}

return names;
Expand All @@ -388,7 +388,7 @@ Profile *Profile::subProfile(const QString &aName,
foreach (Profile *p, d_ptr->iSubProfiles) {
if (aName == p->name() && (!checkType || aType == p->type())) {
return p;
} // no else
}
}

return 0;
Expand All @@ -401,7 +401,7 @@ const Profile *Profile::subProfile(const QString &aName,
foreach (Profile *p, d_ptr->iSubProfiles) {
if (aName == p->name() && (!checkType || aType == p->type())) {
return p;
} // no else
}
}

return 0;
Expand All @@ -418,7 +418,7 @@ const Profile *Profile::subProfileByKeyValue(const QString &aKey,
(aValue.compare(p->key(aKey), Qt::CaseInsensitive) == 0) &&
(!aEnabledOnly || p->isEnabled())) {
return p;
} // no else
}
}

return 0;
Expand Down Expand Up @@ -449,8 +449,8 @@ void Profile::merge(const Profile &aSource)
if (target != 0) {
target->d_ptr->iMerged = true;
d_ptr->iSubProfiles.append(target);
} // no else
} // no else
}
}

if (target != 0) {
// Merge keys. Allow multiple keys with the same name.
Expand All @@ -463,9 +463,9 @@ void Profile::merge(const Profile &aSource)
foreach (const ProfileField *f, sourceFields) {
if (0 == target->field(f->name())) {
target->d_ptr->iMergedFields.append(new ProfileField(*f));
} // no else
}
}
} // no else
}

// Merge sub-profiles.
foreach (Profile *p, aSource.d_ptr->iSubProfiles) {
Expand Down
6 changes: 3 additions & 3 deletions libbuteosyncfw/profile/ProfileField.cpp
Expand Up @@ -118,8 +118,8 @@ ProfileField::ProfileField(const QDomElement &aRoot)
if (d_ptr->iType == TYPE_BOOLEAN) {
d_ptr->iOptions.append(BOOLEAN_TRUE);
d_ptr->iOptions.append(BOOLEAN_FALSE);
} // no else
} // no else
}
}
}

ProfileField::ProfileField(const ProfileField &aSource)
Expand Down Expand Up @@ -192,7 +192,7 @@ QDomElement ProfileField::toXml(QDomDocument &aDoc) const
e.appendChild(t);
root.appendChild(e);
}
} // no else
}

return root;
}
Expand Down
29 changes: 13 additions & 16 deletions libbuteosyncfw/profile/ProfileManager.cpp
Expand Up @@ -100,8 +100,6 @@ class ProfileManagerPrivate

// Secondary path for profiles.
QString iSecondaryPath;


};

}
Expand All @@ -113,13 +111,12 @@ ProfileManagerPrivate::ProfileManagerPrivate(const QString &aPrimaryPath,
: iPrimaryPath(aPrimaryPath),
iSecondaryPath(aSecondaryPath)
{

if (iPrimaryPath.endsWith(QDir::separator())) {
iPrimaryPath.chop(1);
} // no else
}
if (iSecondaryPath.endsWith(QDir::separator())) {
iSecondaryPath.chop(1);
} // no else
}

LOG_DEBUG("Primary profile path set to" << iPrimaryPath);
LOG_DEBUG("Secondary profile path set to" << iSecondaryPath);
Expand Down Expand Up @@ -156,22 +153,22 @@ SyncLog *ProfileManagerPrivate::loadLog(const QString &aProfileName)

if (!QFile::exists(fileName)) {
return 0;
} // no else
}

QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
LOG_WARNING("Failed to open sync log file for reading:"
<< file.fileName());
return 0;
} // no else
}

QDomDocument doc;
if (!doc.setContent(&file)) {
file.close();
LOG_WARNING("Failed to parse XML from sync log file:"
<< file.fileName());
return 0;
} // no else
}
file.close();

return new SyncLog(doc.documentElement());
Expand Down Expand Up @@ -331,9 +328,9 @@ SyncProfile *ProfileManager::syncProfile(const QString &aName)
SyncLog *log = d_ptr->loadLog(aName);
if (0 == log) {
log = new SyncLog(aName);
} // no else
}
syncProfile->setLog(log);
} // no else
}
} else {
LOG_DEBUG("did not find a valid sync profile with the given name:" << aName);
if (p != 0) {
Expand Down Expand Up @@ -388,7 +385,7 @@ QList<SyncProfile *> ProfileManager::allSyncProfiles()
SyncProfile *p = syncProfile(name);
if (p != 0) {
profiles.append(p);
} // no else
}
}

return profiles;
Expand Down Expand Up @@ -454,8 +451,8 @@ QList<SyncProfile *> ProfileManager::getSyncProfilesByData(
delete profile;
profile = 0;
continue; // Not a match, continue with next profile.
} // no else
} // no else
}
}

// Match, add profile to the list to be returned.
matchingProfiles.append(profile);
Expand Down Expand Up @@ -861,7 +858,7 @@ void ProfileManager::expand(Profile &aProfile)
aProfile.type() );
}
sub->setLoaded(true);
} // no else
}
}

// Load/merge may have created new sub-profile entries. Those need
Expand All @@ -888,7 +885,7 @@ bool ProfileManager::saveLog(const SyncLog &aLog)
LOG_WARNING("Failed to open sync log file for writing:"
<< file.fileName());
return false;
} // no else
}

QDomDocument doc;
QDomProcessingInstruction xmlHeading =
Expand All @@ -900,7 +897,7 @@ bool ProfileManager::saveLog(const SyncLog &aLog)
if (root.isNull()) {
LOG_WARNING("Failed to convert sync log to XML");
return false;
} // no else
}

doc.appendChild(root);

Expand Down
2 changes: 1 addition & 1 deletion libbuteosyncfw/profile/SyncLog.cpp
Expand Up @@ -193,7 +193,7 @@ void SyncLog::addResults(const SyncResults &aResults)
if (d_ptr->iResults.size() >= MAXLOGENTRIES) {
// The list is sorted so that the oldest item is in the beginning
delete d_ptr->iResults.takeFirst();
} // no else
}

d_ptr->iResults.append(new SyncResults(aResults));

Expand Down

0 comments on commit 31913de

Please sign in to comment.