Commit cd7fdf7a authored by Friedemann Kleint's avatar Friedemann Kleint

Fix Krazy-warnings in ClearCase-plugin.

- non-const ref iterator
- values or keys iteration

Change-Id: If04abcafbeb8d5d143097ae66589b6f18bd7e28d
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 07ea5346
......@@ -872,6 +872,8 @@ void ClearCasePlugin::rmdir(const QString &path)
void ClearCasePlugin::diffActivity()
{
typedef QMap<QString, QStringPair>::Iterator FileVerIt;
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
if (ClearCase::Constants::debug)
......@@ -920,8 +922,9 @@ void ClearCasePlugin::diffActivity()
rmdir(QDir::tempPath() + QLatin1String("/ccdiff/") + activity);
QDir(QDir::tempPath()).rmpath(QLatin1String("ccdiff/") + activity);
m_diffPrefix = activity;
foreach (const QString &file, filever.keys()) {
QStringPair pair(filever.value(file));
const FileVerIt fend = filever.end();
for (FileVerIt it = filever.begin(); it != fend; ++it) {
QStringPair &pair(it.value());
if (pair.first.contains(QLatin1String("CHECKEDOUT")))
pair.first = ccGetPredecessor(pair.first.left(pair.first.indexOf(QLatin1String("@@"))));
result += diffExternal(pair.first, pair.second, true);
......@@ -1466,7 +1469,7 @@ bool ClearCasePlugin::vcsCheckIn(const QString &messageFile, const QStringList &
args << QLatin1String("-ptime");
args << files;
QList<FCBPointer> blockers;
foreach (QString fileName, files) {
foreach (const QString &fileName, files) {
FCBPointer fcb(new Core::FileChangeBlocker(QFileInfo(m_checkInView, fileName).canonicalFilePath()));
blockers.append(fcb);
}
......@@ -1648,7 +1651,7 @@ QList<QStringPair> ClearCasePlugin::ccGetActivities() const
args << QLatin1String("-fmt") << QLatin1String("%n\\t%[headline]p\\n");
const QString response = runCleartoolSync(currentState().topLevel(), args);
QStringList acts = response.split(QLatin1Char('\n'), QString::SkipEmptyParts);
foreach (QString activity, acts) {
foreach (const QString &activity, acts) {
QStringList act = activity.split(QLatin1Char('\t'));
if (act.size() >= 2)
{
......
......@@ -103,6 +103,8 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
void ClearCaseSettings::toSettings(QSettings *settings) const
{
typedef QHash<QString, int>::ConstIterator FilesConstIt;
settings->beginGroup(QLatin1String(groupC));
settings->setValue(QLatin1String(commandKeyC), ccCommand);
settings->setValue(QLatin1String(autoCheckOutKeyC), autoCheckOut);
......@@ -121,8 +123,9 @@ void ClearCaseSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(disableIndexerKeyC), disableIndexer);
settings->setValue(QLatin1String(indexOnlyVOBsC), indexOnlyVOBs);
settings->beginGroup(QLatin1String(totalFilesKeyC));
foreach (const QString &view, totalFiles.keys())
settings->setValue(view, totalFiles[view]);
const FilesConstIt fcend = totalFiles.constEnd();
for (FilesConstIt it = totalFiles.constBegin(); it != fcend; ++it)
settings->setValue(it.key(), it.value());
settings->endGroup();
settings->endGroup();
}
......
......@@ -75,12 +75,12 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
if (hot) {
// find all files whose permissions changed OR hijacked files
// (might have become checked out)
foreach (const QString &file, m_statusMap->keys()) {
bool permChanged =
m_statusMap->value(file).permissions != QFileInfo(topLevel, file).permissions();
if (permChanged || m_statusMap->value(file).status == FileStatus::Hijacked) {
files.append(file);
(*m_statusMap)[file].status = FileStatus::Unknown;
const StatusMap::Iterator send = m_statusMap->end();
for (StatusMap::Iterator it = m_statusMap->begin(); it != send; ++it) {
const bool permChanged = it.value().permissions != QFileInfo(topLevel, it.key()).permissions();
if (permChanged || it.value().status == FileStatus::Hijacked) {
files.append(it.key());
it.value().status = FileStatus::Unknown;
++total;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment