Updated AStyle to version 2.05.1

Tweaked runastyle.bat a little bit.
This commit is contained in:
PKEuS 2015-12-17 15:40:54 +01:00
parent bc6ae499dc
commit 8f22e4924c
20 changed files with 84 additions and 84 deletions

View File

@ -232,7 +232,7 @@ static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString n
else if (name == "size") else if (name == "size")
xmlWriter.writeAttribute("templateParameter", QString::number(extra)); xmlWriter.writeAttribute("templateParameter", QString::number(extra));
} }
foreach(const CppcheckLibraryData::Container::Function &function, functions) { foreach (const CppcheckLibraryData::Container::Function &function, functions) {
xmlWriter.writeStartElement("function"); xmlWriter.writeStartElement("function");
xmlWriter.writeAttribute("name", function.name); xmlWriter.writeAttribute("name", function.name);
if (!function.action.isEmpty()) if (!function.action.isEmpty())
@ -275,7 +275,7 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
comments = comments.mid(1); comments = comments.mid(1);
while (comments.endsWith("\n")) while (comments.endsWith("\n"))
comments.chop(1); comments.chop(1);
foreach(const QString &comment, comments.split('\n')) { foreach (const QString &comment, comments.split('\n')) {
if (comment.length() >= 1) if (comment.length() >= 1)
xmlWriter.writeComment(comment); xmlWriter.writeComment(comment);
} }
@ -294,7 +294,7 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
if (function.leakignore) if (function.leakignore)
xmlWriter.writeEmptyElement("leak-ignore"); xmlWriter.writeEmptyElement("leak-ignore");
// Argument info.. // Argument info..
foreach(const CppcheckLibraryData::Function::Arg &arg, function.args) { foreach (const CppcheckLibraryData::Function::Arg &arg, function.args) {
if (arg.formatstr) { if (arg.formatstr) {
xmlWriter.writeStartElement("formatstr"); xmlWriter.writeStartElement("formatstr");
if (!function.formatstr.scan.isNull()) if (!function.formatstr.scan.isNull())
@ -323,7 +323,7 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
if (!arg.valid.isEmpty()) if (!arg.valid.isEmpty())
xmlWriter.writeTextElement("valid",arg.valid); xmlWriter.writeTextElement("valid",arg.valid);
foreach(const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) { foreach (const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) {
xmlWriter.writeStartElement("minsize"); xmlWriter.writeStartElement("minsize");
xmlWriter.writeAttribute("type", minsize.type); xmlWriter.writeAttribute("type", minsize.type);
xmlWriter.writeAttribute("arg", minsize.arg); xmlWriter.writeAttribute("arg", minsize.arg);
@ -359,16 +359,16 @@ static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData
static void writeMemoryResource(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::MemoryResource &mr) static void writeMemoryResource(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::MemoryResource &mr)
{ {
xmlWriter.writeStartElement(mr.type); xmlWriter.writeStartElement(mr.type);
foreach(const CppcheckLibraryData::MemoryResource::Alloc &alloc, mr.alloc) { foreach (const CppcheckLibraryData::MemoryResource::Alloc &alloc, mr.alloc) {
xmlWriter.writeStartElement("alloc"); xmlWriter.writeStartElement("alloc");
xmlWriter.writeAttribute("init", alloc.init ? "true" : "false"); xmlWriter.writeAttribute("init", alloc.init ? "true" : "false");
xmlWriter.writeCharacters(alloc.name); xmlWriter.writeCharacters(alloc.name);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
} }
foreach(const QString &dealloc, mr.dealloc) { foreach (const QString &dealloc, mr.dealloc) {
xmlWriter.writeTextElement("dealloc", dealloc); xmlWriter.writeTextElement("dealloc", dealloc);
} }
foreach(const QString &use, mr.use) { foreach (const QString &use, mr.use) {
xmlWriter.writeTextElement("use", use); xmlWriter.writeTextElement("use", use);
} }
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
@ -384,26 +384,26 @@ QString CppcheckLibraryData::toString() const
xmlWriter.writeStartElement("def"); xmlWriter.writeStartElement("def");
xmlWriter.writeAttribute("format","2"); xmlWriter.writeAttribute("format","2");
foreach(const Define &define, defines) { foreach (const Define &define, defines) {
xmlWriter.writeStartElement("define"); xmlWriter.writeStartElement("define");
xmlWriter.writeAttribute("name", define.name); xmlWriter.writeAttribute("name", define.name);
xmlWriter.writeAttribute("value", define.value); xmlWriter.writeAttribute("value", define.value);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
} }
foreach(const Function &function, functions) { foreach (const Function &function, functions) {
writeFunction(xmlWriter, function); writeFunction(xmlWriter, function);
} }
foreach(const MemoryResource &mr, memoryresource) { foreach (const MemoryResource &mr, memoryresource) {
writeMemoryResource(xmlWriter, mr); writeMemoryResource(xmlWriter, mr);
} }
foreach(const Container &container, containers) { foreach (const Container &container, containers) {
writeContainer(xmlWriter, container); writeContainer(xmlWriter, container);
} }
foreach(const PodType &podtype, podtypes) { foreach (const PodType &podtype, podtypes) {
xmlWriter.writeStartElement("podtype"); xmlWriter.writeStartElement("podtype");
xmlWriter.writeAttribute("name", podtype.name); xmlWriter.writeAttribute("name", podtype.name);
if (!podtype.sign.isEmpty()) if (!podtype.sign.isEmpty())

View File

@ -68,7 +68,7 @@ void FileList::AddDirectory(const QString &directory, bool recursive)
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = dir.entryInfoList(); QFileInfoList list = dir.entryInfoList();
QFileInfo item; QFileInfo item;
foreach(item, list) { foreach (item, list) {
const QString path = item.canonicalFilePath(); const QString path = item.canonicalFilePath();
AddDirectory(path, recursive); AddDirectory(path, recursive);
} }
@ -78,7 +78,7 @@ void FileList::AddDirectory(const QString &directory, bool recursive)
void FileList::AddPathList(const QStringList &paths) void FileList::AddPathList(const QStringList &paths)
{ {
QString path; QString path;
foreach(path, paths) { foreach (path, paths) {
QFileInfo inf(path); QFileInfo inf(path);
if (inf.isFile()) if (inf.isFile())
AddFile(path); AddFile(path);
@ -91,7 +91,7 @@ QStringList FileList::GetFileList() const
{ {
if (mExcludedPaths.empty()) { if (mExcludedPaths.empty()) {
QStringList names; QStringList names;
foreach(QFileInfo item, mFileList) { foreach (QFileInfo item, mFileList) {
QString name = QDir::fromNativeSeparators(item.canonicalFilePath()); QString name = QDir::fromNativeSeparators(item.canonicalFilePath());
names << name; names << name;
} }
@ -109,7 +109,7 @@ void FileList::AddExcludeList(const QStringList &paths)
QStringList FileList::ApplyExcludeList() const QStringList FileList::ApplyExcludeList() const
{ {
QStringList paths; QStringList paths;
foreach(QFileInfo item, mFileList) { foreach (QFileInfo item, mFileList) {
QString name = QDir::fromNativeSeparators(item.canonicalFilePath()); QString name = QDir::fromNativeSeparators(item.canonicalFilePath());
if (!Match(name)) if (!Match(name))
paths << name; paths << name;

View File

@ -262,11 +262,11 @@ void LibraryDialog::filterFunctions(QString filter)
QList<QListWidgetItem *> allItems = ui->functions->findItems(QString(), Qt::MatchContains); QList<QListWidgetItem *> allItems = ui->functions->findItems(QString(), Qt::MatchContains);
if (filter.isEmpty()) { if (filter.isEmpty()) {
foreach(QListWidgetItem *item, allItems) { foreach (QListWidgetItem *item, allItems) {
item->setHidden(false); item->setHidden(false);
} }
} else { } else {
foreach(QListWidgetItem *item, allItems) { foreach (QListWidgetItem *item, allItems) {
item->setHidden(!item->text().startsWith(filter)); item->setHidden(!item->text().startsWith(filter));
} }
} }
@ -323,7 +323,7 @@ QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
s += "\n format string: " + QString(arg.formatstr ? "true" : "false"); s += "\n format string: " + QString(arg.formatstr ? "true" : "false");
s += "\n strz: " + QString(arg.strz ? "true" : "false"); s += "\n strz: " + QString(arg.strz ? "true" : "false");
s += "\n valid: " + QString(arg.valid.isEmpty() ? "any" : arg.valid); s += "\n valid: " + QString(arg.valid.isEmpty() ? "any" : arg.valid);
foreach(const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) { foreach (const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) {
s += "\n minsize: " + minsize.type + " " + minsize.arg + " " + minsize.arg2; s += "\n minsize: " + minsize.type + " " + minsize.arg + " " + minsize.arg2;
} }
return s; return s;
@ -332,7 +332,7 @@ QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function) void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function)
{ {
ui->arguments->clear(); ui->arguments->clear();
foreach(const CppcheckLibraryData::Function::Arg &arg, function.args) { foreach (const CppcheckLibraryData::Function::Arg &arg, function.args) {
ui->arguments->addItem(getArgText(arg)); ui->arguments->addItem(getArgText(arg));
} }
} }

View File

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app); QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
// Set data dir.. // Set data dir..
foreach(const QString arg, app.arguments()) { foreach (const QString arg, app.arguments()) {
if (arg.startsWith("--data-dir=")) { if (arg.startsWith("--data-dir=")) {
settings->setValue("DATADIR", arg.mid(11)); settings->setValue("DATADIR", arg.mid(11));
return 0; return 0;

View File

@ -530,7 +530,7 @@ void MainWindow::CheckDirectory()
void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result) void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result)
{ {
QString dir; QString dir;
foreach(dir, includeDirs) { foreach (dir, includeDirs) {
QString incdir; QString incdir;
if (!QDir::isAbsolutePath(dir)) if (!QDir::isAbsolutePath(dir))
incdir = mCurrentDirectory + "/"; incdir = mCurrentDirectory + "/";
@ -642,20 +642,20 @@ Settings MainWindow::GetCppcheckSettings()
const QStringList defines = pfile->GetDefines(); const QStringList defines = pfile->GetDefines();
QString define; QString define;
foreach(define, defines) { foreach (define, defines) {
if (!result.userDefines.empty()) if (!result.userDefines.empty())
result.userDefines += ";"; result.userDefines += ";";
result.userDefines += define.toStdString(); result.userDefines += define.toStdString();
} }
const QStringList libraries = pfile->GetLibraries(); const QStringList libraries = pfile->GetLibraries();
foreach(QString library, libraries) { foreach (QString library, libraries) {
const QString filename = library + ".cfg"; const QString filename = library + ".cfg";
TryLoadLibrary(&result.library, filename); TryLoadLibrary(&result.library, filename);
} }
const QStringList suppressions = pfile->GetSuppressions(); const QStringList suppressions = pfile->GetSuppressions();
foreach(QString suppression, suppressions) { foreach (QString suppression, suppressions) {
result.nomsg.addSuppressionLine(suppression.toStdString()); result.nomsg.addSuppressionLine(suppression.toStdString());
} }

View File

@ -119,7 +119,7 @@ bool ProjectFile::Read(const QString &filename)
insideProject = false; insideProject = false;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -143,7 +143,7 @@ bool ProjectFile::Read(const QString &filename)
QStringList ProjectFile::GetIncludeDirs() const QStringList ProjectFile::GetIncludeDirs() const
{ {
QStringList dirs; QStringList dirs;
foreach(QString path, mIncludeDirs) { foreach (QString path, mIncludeDirs) {
dirs << QDir::fromNativeSeparators(path); dirs << QDir::fromNativeSeparators(path);
} }
return dirs; return dirs;
@ -157,7 +157,7 @@ QStringList ProjectFile::GetDefines() const
QStringList ProjectFile::GetCheckPaths() const QStringList ProjectFile::GetCheckPaths() const
{ {
QStringList paths; QStringList paths;
foreach(QString path, mPaths) { foreach (QString path, mPaths) {
paths << QDir::fromNativeSeparators(path); paths << QDir::fromNativeSeparators(path);
} }
return paths; return paths;
@ -166,7 +166,7 @@ QStringList ProjectFile::GetCheckPaths() const
QStringList ProjectFile::GetExcludedPaths() const QStringList ProjectFile::GetExcludedPaths() const
{ {
QStringList paths; QStringList paths;
foreach(QString path, mExcludedPaths) { foreach (QString path, mExcludedPaths) {
paths << QDir::fromNativeSeparators(path); paths << QDir::fromNativeSeparators(path);
} }
return paths; return paths;
@ -175,7 +175,7 @@ QStringList ProjectFile::GetExcludedPaths() const
QStringList ProjectFile::GetLibraries() const QStringList ProjectFile::GetLibraries() const
{ {
QStringList libraries; QStringList libraries;
foreach(QString library, mLibraries) { foreach (QString library, mLibraries) {
libraries << library; libraries << library;
} }
return libraries; return libraries;
@ -184,7 +184,7 @@ QStringList ProjectFile::GetLibraries() const
QStringList ProjectFile::GetSuppressions() const QStringList ProjectFile::GetSuppressions() const
{ {
QStringList suppressions; QStringList suppressions;
foreach(QString suppression, mSuppressions) { foreach (QString suppression, mSuppressions) {
suppressions << suppression; suppressions << suppression;
} }
return suppressions; return suppressions;
@ -221,7 +221,7 @@ void ProjectFile::ReadIncludeDirs(QXmlStreamReader &reader)
allRead = true; allRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -258,7 +258,7 @@ void ProjectFile::ReadDefines(QXmlStreamReader &reader)
allRead = true; allRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -296,7 +296,7 @@ void ProjectFile::ReadCheckPaths(QXmlStreamReader &reader)
allRead = true; allRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -342,7 +342,7 @@ void ProjectFile::ReadExcludes(QXmlStreamReader &reader)
allRead = true; allRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -381,7 +381,7 @@ void ProjectFile::ReadStringList(QStringList &stringlist, QXmlStreamReader &read
allRead = true; allRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -449,7 +449,7 @@ bool ProjectFile::Write(const QString &filename)
if (!mIncludeDirs.isEmpty()) { if (!mIncludeDirs.isEmpty()) {
xmlWriter.writeStartElement(IncludeDirElementName); xmlWriter.writeStartElement(IncludeDirElementName);
foreach(QString incdir, mIncludeDirs) { foreach (QString incdir, mIncludeDirs) {
xmlWriter.writeStartElement(DirElementName); xmlWriter.writeStartElement(DirElementName);
xmlWriter.writeAttribute(DirNameAttrib, incdir); xmlWriter.writeAttribute(DirNameAttrib, incdir);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
@ -459,7 +459,7 @@ bool ProjectFile::Write(const QString &filename)
if (!mDefines.isEmpty()) { if (!mDefines.isEmpty()) {
xmlWriter.writeStartElement(DefinesElementName); xmlWriter.writeStartElement(DefinesElementName);
foreach(QString define, mDefines) { foreach (QString define, mDefines) {
xmlWriter.writeStartElement(DefineName); xmlWriter.writeStartElement(DefineName);
xmlWriter.writeAttribute(DefineNameAttrib, define); xmlWriter.writeAttribute(DefineNameAttrib, define);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
@ -469,7 +469,7 @@ bool ProjectFile::Write(const QString &filename)
if (!mPaths.isEmpty()) { if (!mPaths.isEmpty()) {
xmlWriter.writeStartElement(PathsElementName); xmlWriter.writeStartElement(PathsElementName);
foreach(QString path, mPaths) { foreach (QString path, mPaths) {
xmlWriter.writeStartElement(PathName); xmlWriter.writeStartElement(PathName);
xmlWriter.writeAttribute(PathNameAttrib, path); xmlWriter.writeAttribute(PathNameAttrib, path);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
@ -479,7 +479,7 @@ bool ProjectFile::Write(const QString &filename)
if (!mExcludedPaths.isEmpty()) { if (!mExcludedPaths.isEmpty()) {
xmlWriter.writeStartElement(ExcludeElementName); xmlWriter.writeStartElement(ExcludeElementName);
foreach(QString path, mExcludedPaths) { foreach (QString path, mExcludedPaths) {
xmlWriter.writeStartElement(ExcludePathName); xmlWriter.writeStartElement(ExcludePathName);
xmlWriter.writeAttribute(ExcludePathNameAttrib, path); xmlWriter.writeAttribute(ExcludePathNameAttrib, path);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
@ -508,7 +508,7 @@ void ProjectFile::WriteStringList(QXmlStreamWriter &xmlWriter, const QStringList
return; return;
xmlWriter.writeStartElement(startelementname); xmlWriter.writeStartElement(startelementname);
foreach(QString str, stringlist) { foreach (QString str, stringlist) {
xmlWriter.writeStartElement(stringelementname); xmlWriter.writeStartElement(stringelementname);
xmlWriter.writeCharacters(str); xmlWriter.writeCharacters(str);
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();

View File

@ -53,12 +53,12 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
if (!datadir.isEmpty()) if (!datadir.isEmpty())
searchPaths << datadir << datadir + "/cfg"; searchPaths << datadir << datadir + "/cfg";
QStringList libs; QStringList libs;
foreach(const QString sp, searchPaths) { foreach (const QString sp, searchPaths) {
QDir dir(sp); QDir dir(sp);
dir.setSorting(QDir::Name); dir.setSorting(QDir::Name);
dir.setNameFilters(QStringList("*.cfg")); dir.setNameFilters(QStringList("*.cfg"));
dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); dir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
foreach(QFileInfo item, dir.entryInfoList()) { foreach (QFileInfo item, dir.entryInfoList()) {
QString library = item.fileName(); QString library = item.fileName();
{ {
Library lib; Library lib;
@ -75,7 +75,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
} }
} }
qSort(libs); qSort(libs);
foreach(const QString library, libs) { foreach (const QString library, libs) {
QCheckBox *checkbox = new QCheckBox(this); QCheckBox *checkbox = new QCheckBox(this);
checkbox->setText(library); checkbox->setText(library);
mUI.librariesLayout->addWidget(checkbox); mUI.librariesLayout->addWidget(checkbox);
@ -208,7 +208,7 @@ QStringList ProjectFileDialog::GetExcludedPaths() const
QStringList ProjectFileDialog::GetLibraries() const QStringList ProjectFileDialog::GetLibraries() const
{ {
QStringList libraries; QStringList libraries;
foreach(const QCheckBox *checkbox, mLibraryCheckboxes) { foreach (const QCheckBox *checkbox, mLibraryCheckboxes) {
if (checkbox->isChecked()) if (checkbox->isChecked())
libraries << checkbox->text(); libraries << checkbox->text();
} }
@ -234,7 +234,7 @@ void ProjectFileDialog::SetRootPath(const QString &root)
void ProjectFileDialog::SetIncludepaths(const QStringList &includes) void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
{ {
foreach(QString dir, includes) { foreach (QString dir, includes) {
AddIncludeDir(dir); AddIncludeDir(dir);
} }
} }
@ -243,7 +243,7 @@ void ProjectFileDialog::SetDefines(const QStringList &defines)
{ {
QString definestr; QString definestr;
QString define; QString define;
foreach(define, defines) { foreach (define, defines) {
definestr += define; definestr += define;
definestr += ";"; definestr += ";";
} }
@ -255,14 +255,14 @@ void ProjectFileDialog::SetDefines(const QStringList &defines)
void ProjectFileDialog::SetPaths(const QStringList &paths) void ProjectFileDialog::SetPaths(const QStringList &paths)
{ {
foreach(QString path, paths) { foreach (QString path, paths) {
AddPath(path); AddPath(path);
} }
} }
void ProjectFileDialog::SetExcludedPaths(const QStringList &paths) void ProjectFileDialog::SetExcludedPaths(const QStringList &paths)
{ {
foreach(QString path, paths) { foreach (QString path, paths) {
AddExcludePath(path); AddExcludePath(path);
} }
} }

View File

@ -782,7 +782,7 @@ void ResultsTree::HideResult()
QModelIndexList selectedRows = mSelectionModel->selectedRows(); QModelIndexList selectedRows = mSelectionModel->selectedRows();
QModelIndex index; QModelIndex index;
foreach(index, selectedRows) { foreach (index, selectedRows) {
QStandardItem *item = mModel.itemFromIndex(index); QStandardItem *item = mModel.itemFromIndex(index);
//Set the "hide" flag for this item //Set the "hide" flag for this item
QVariantMap data = item->data().toMap(); QVariantMap data = item->data().toMap();

View File

@ -338,7 +338,7 @@ void ResultsView::ReadErrorsXml(const QString &filename)
} }
ErrorItem item; ErrorItem item;
foreach(item, errors) { foreach (item, errors) {
mUI.mTree->AddErrorItem(item); mUI.mTree->AddErrorItem(item);
} }
mUI.mTree->SetCheckDirectory(""); mUI.mTree->SetCheckDirectory("");

View File

@ -106,7 +106,7 @@ void SettingsDialog::InitIncludepathsList()
QSettings settings; QSettings settings;
const QString allPaths = settings.value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString(); const QString allPaths = settings.value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
const QStringList paths = allPaths.split(";", QString::SkipEmptyParts); const QStringList paths = allPaths.split(";", QString::SkipEmptyParts);
foreach(QString path, paths) { foreach (QString path, paths) {
AddIncludePath(path); AddIncludePath(path);
} }
} }
@ -115,7 +115,7 @@ void SettingsDialog::InitTranslationsList()
{ {
const QString current = mTranslator->GetCurrentLanguage(); const QString current = mTranslator->GetCurrentLanguage();
QList<TranslationInfo> translations = mTranslator->GetTranslations(); QList<TranslationInfo> translations = mTranslator->GetTranslations();
foreach(TranslationInfo translation, translations) { foreach (TranslationInfo translation, translations) {
QListWidgetItem *item = new QListWidgetItem; QListWidgetItem *item = new QListWidgetItem;
item->setText(translation.mName); item->setText(translation.mName);
item->setData(LangCodeRole, QVariant(translation.mCode)); item->setData(LangCodeRole, QVariant(translation.mCode));
@ -211,7 +211,7 @@ void SettingsDialog::AddApplication()
void SettingsDialog::RemoveApplication() void SettingsDialog::RemoveApplication()
{ {
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems(); QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
foreach(QListWidgetItem *item, selected) { foreach (QListWidgetItem *item, selected) {
const int removeIndex = mUI.mListWidget->row(item); const int removeIndex = mUI.mListWidget->row(item);
const int currentDefault = mTempApplications->GetDefaultApplication(); const int currentDefault = mTempApplications->GetDefaultApplication();
mTempApplications->RemoveApplication(removeIndex); mTempApplications->RemoveApplication(removeIndex);
@ -230,7 +230,7 @@ void SettingsDialog::EditApplication()
{ {
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems(); QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
QListWidgetItem *item = 0; QListWidgetItem *item = 0;
foreach(item, selected) { foreach (item, selected) {
int row = mUI.mListWidget->row(item); int row = mUI.mListWidget->row(item);
Application& app = mTempApplications->GetApplication(row); Application& app = mTempApplications->GetApplication(row);
ApplicationDialog dialog(tr("Modify an application"), app, this); ApplicationDialog dialog(tr("Modify an application"), app, this);

View File

@ -109,7 +109,7 @@ void ThreadResult::SetFiles(const QStringList &files)
// Determine the total size of all of the files to check, so that we can // Determine the total size of all of the files to check, so that we can
// show an accurate progress estimate // show an accurate progress estimate
quint64 sizeOfFiles = 0; quint64 sizeOfFiles = 0;
foreach(const QString& file, files) { foreach (const QString& file, files) {
sizeOfFiles += QFile(file).size(); sizeOfFiles += QFile(file).size();
} }
mMaxProgress = sizeOfFiles; mMaxProgress = sizeOfFiles;

View File

@ -71,7 +71,7 @@ TranslationHandler::~TranslationHandler()
const QStringList TranslationHandler::GetNames() const const QStringList TranslationHandler::GetNames() const
{ {
QStringList names; QStringList names;
foreach(TranslationInfo translation, mTranslations) { foreach (TranslationInfo translation, mTranslations) {
names.append(translation.mName); names.append(translation.mName);
} }
return names; return names;

View File

@ -75,7 +75,7 @@ int XmlReport::determineVersion(const QString &filename)
} }
break; break;
// Not handled // Not handled
case QXmlStreamReader::EndElement: case QXmlStreamReader::EndElement:
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:

View File

@ -132,7 +132,7 @@ QList<ErrorItem> XmlReportV1::Read()
insideResults = false; insideResults = false;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:

View File

@ -157,7 +157,7 @@ QList<ErrorItem> XmlReportV2::Read()
insideResults = false; insideResults = false;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:
@ -220,7 +220,7 @@ ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader)
errorRead = true; errorRead = true;
break; break;
// Not handled // Not handled
case QXmlStreamReader::NoToken: case QXmlStreamReader::NoToken:
case QXmlStreamReader::Invalid: case QXmlStreamReader::Invalid:
case QXmlStreamReader::StartDocument: case QXmlStreamReader::StartDocument:

View File

@ -999,7 +999,7 @@ void CheckIO::checkFormatString(const Token * const tok,
case 'l': case 'l':
if (i+1 != formatString.end() && *(i+1) == *i) if (i+1 != formatString.end() && *(i+1) == *i)
specifier += *i++; specifier += *i++;
// fallthrough // fallthrough
case 'j': case 'j':
case 'q': case 'q':
case 't': case 't':
@ -1301,7 +1301,7 @@ void CheckIO::checkFormatString(const Token * const tok,
specifier += *i++; specifier += *i++;
specifier += *i++; specifier += *i++;
} }
// fallthrough // fallthrough
case 'j': // intmax_t or uintmax_t case 'j': // intmax_t or uintmax_t
case 'z': // size_t case 'z': // size_t
case 't': // ptrdiff_t case 't': // ptrdiff_t

View File

@ -6,7 +6,7 @@
# If project management wishes to take a newer astyle version into use # If project management wishes to take a newer astyle version into use
# just change this string to match the start of astyle version string. # just change this string to match the start of astyle version string.
ASTYLE_VERSION="Artistic Style Version 2.03" ASTYLE_VERSION="Artistic Style Version 2.05.1"
ASTYLE="astyle" ASTYLE="astyle"
DETECTED_VERSION=`$ASTYLE --version 2>&1` DETECTED_VERSION=`$ASTYLE --version 2>&1`
@ -17,7 +17,7 @@ if [[ "$DETECTED_VERSION" != ${ASTYLE_VERSION}* ]]; then
fi fi
style="--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0" style="--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0"
options="--options=none --pad-header --unpad-paren --suffix=none --convert-tabs" options="--options=none --pad-header --unpad-paren --suffix=none --convert-tabs --attach-inlines"
$ASTYLE $style $options cli/*.cpp $ASTYLE $style $options cli/*.cpp
$ASTYLE $style $options cli/*.h $ASTYLE $style $options cli/*.h

View File

@ -1,7 +1,7 @@
REM A script to run Astyle for the sources @REM Script to run AStyle on the sources
SET STYLE=--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0 @SET STYLE=--style=stroustrup --indent=spaces=4 --indent-namespaces --lineend=linux --min-conditional-indent=0
SET OPTIONS=--pad-header --unpad-paren --suffix=none --convert-tabs @SET OPTIONS=--pad-header --unpad-paren --suffix=none --convert-tabs --attach-inlines
astyle %STYLE% %OPTIONS% cli/*.cpp astyle %STYLE% %OPTIONS% cli/*.cpp
astyle %STYLE% %OPTIONS% cli/*.h astyle %STYLE% %OPTIONS% cli/*.h

View File

@ -876,7 +876,7 @@ private:
ASSERT_EQUALS("return -1 ;", tokenizeAndStringify("return - __LINE__;")); ASSERT_EQUALS("return -1 ;", tokenizeAndStringify("return - __LINE__;"));
} }
void foreach() { void foreach () {
// #3690,#5154 // #3690,#5154
const char code[] ="void f() { for each ( char c in MyString ) { Console::Write(c); } }"; const char code[] ="void f() { for each ( char c in MyString ) { Console::Write(c); } }";
ASSERT_EQUALS("void f ( ) { asm ( \"char c in MyString\" ) { Console :: Write ( c ) ; } }" ,tokenizeAndStringify(code)); ASSERT_EQUALS("void f ( ) { asm ( \"char c in MyString\" ) { Console :: Write ( c ) ; } }" ,tokenizeAndStringify(code));

View File

@ -395,21 +395,21 @@ private:
void structmember12() { // #7179 void structmember12() { // #7179
checkStructMemberUsage("#include <stdio.h>\n" checkStructMemberUsage("#include <stdio.h>\n"
"struct\n" "struct\n"
"{\n" "{\n"
" union\n" " union\n"
" {\n" " {\n"
" struct\n" " struct\n"
" {\n" " {\n"
" int a;\n" " int a;\n"
" } struct1;\n" " } struct1;\n"
" };\n" " };\n"
"} var = {0};\n" "} var = {0};\n"
"int main(int argc, char *argv[])\n" "int main(int argc, char *argv[])\n"
"{\n" "{\n"
" printf(\"var.struct1.a = %d\n\", var.struct1.a);\n" " printf(\"var.struct1.a = %d\n\", var.struct1.a);\n"
" return 1;\n" " return 1;\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }