Skip to content

Commit 193aa7d

Browse files
author
Martin Ettl
committed
astyle fix
1 parent b5fb01c commit 193aa7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4597
-4595
lines changed

cli/cppcheckexecutor.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
4141
{
4242
cppCheck.parseFromArgs(argc, argv);
4343
}
44-
catch (std::runtime_error &e)
44+
catch(std::runtime_error &e)
4545
{
4646
std::cerr << e.what() << std::endl;
4747
return EXIT_FAILURE;
4848
}
4949

5050
_settings = cppCheck.settings();
51-
if (_settings._xml)
51+
if(_settings._xml)
5252
{
5353
reportErr(ErrorLogger::ErrorMessage::getXMLHeader());
5454
}
5555

5656
unsigned int returnValue = 0;
57-
if (_settings._jobs == 1)
57+
if(_settings._jobs == 1)
5858
{
5959
// Single process
6060
returnValue = cppCheck.check();
6161
}
62-
else if (!ThreadExecutor::isEnabled())
62+
else if(!ThreadExecutor::isEnabled())
6363
{
6464
std::cout << "No thread support yet implemented for this platform." << std::endl;
6565
}
@@ -72,12 +72,12 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
7272
returnValue = executor.check();
7373
}
7474

75-
if (_settings._xml)
75+
if(_settings._xml)
7676
{
7777
reportErr(ErrorLogger::ErrorMessage::getXMLFooter());
7878
}
7979

80-
if (returnValue)
80+
if(returnValue)
8181
return _settings._exitCode;
8282
else
8383
return 0;
@@ -95,20 +95,20 @@ void CppCheckExecutor::reportOut(const std::string &outmsg)
9595

9696
void CppCheckExecutor::reportStatus(unsigned int index, unsigned int max)
9797
{
98-
if (max > 1 && !_settings._errorsOnly)
98+
if(max > 1 && !_settings._errorsOnly)
9999
{
100100
std::ostringstream oss;
101101
oss << index << "/" << max
102-
<< " files checked " <<
103-
static_cast<int>(static_cast<double>(index) / max*100)
104-
<< "% done";
102+
<< " files checked " <<
103+
static_cast<int>(static_cast<double>(index) / max * 100)
104+
<< "% done";
105105
std::cout << oss.str() << std::endl;
106106
}
107107
}
108108

109109
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
110110
{
111-
if (_settings._xml)
111+
if(_settings._xml)
112112
{
113113
reportErr(msg.toXML());
114114
}

cli/threadexecutor.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#endif
3131

3232
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, const Settings &settings, ErrorLogger &errorLogger)
33-
: _filenames(filenames), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
33+
: _filenames(filenames), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
3434
{
3535

3636
}
@@ -49,49 +49,49 @@ ThreadExecutor::~ThreadExecutor()
4949
bool ThreadExecutor::handleRead(unsigned int &result)
5050
{
5151
char type = 0;
52-
if (read(_pipe[0], &type, 1) <= 0)
52+
if(read(_pipe[0], &type, 1) <= 0)
5353
{
5454
return false;
5555
}
5656

57-
if (type != '1' && type != '2' && type != '3')
57+
if(type != '1' && type != '2' && type != '3')
5858
{
5959
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
6060
exit(0);
6161
}
6262

6363
unsigned int len = 0;
64-
if (read(_pipe[0], &len, sizeof(len)) <= 0)
64+
if(read(_pipe[0], &len, sizeof(len)) <= 0)
6565
{
6666
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
6767
exit(0);
6868
}
6969

7070
char *buf = new char[len];
71-
if (read(_pipe[0], buf, len) <= 0)
71+
if(read(_pipe[0], buf, len) <= 0)
7272
{
7373
std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl;
7474
exit(0);
7575
}
7676

77-
if (type == '1')
77+
if(type == '1')
7878
{
7979
_errorLogger.reportOut(buf);
8080
}
81-
else if (type == '2')
81+
else if(type == '2')
8282
{
8383
ErrorLogger::ErrorMessage msg;
8484
msg.deserialize(buf);
8585

8686
// Alert only about unique errors
8787
std::string errmsg = msg.toText();
88-
if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end())
88+
if(std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end())
8989
{
9090
_errorList.push_back(errmsg);
9191
_errorLogger.reportErr(msg);
9292
}
9393
}
94-
else if (type == '3')
94+
else if(type == '3')
9595
{
9696
_fileCount++;
9797
std::istringstream iss(buf);
@@ -109,32 +109,32 @@ unsigned int ThreadExecutor::check()
109109
{
110110
_fileCount = 0;
111111
unsigned int result = 0;
112-
if (pipe(_pipe) == -1)
112+
if(pipe(_pipe) == -1)
113113
{
114114
perror("pipe");
115115
exit(1);
116116
}
117117

118118
int flags = 0;
119-
if ((flags = fcntl(_pipe[0], F_GETFL, 0)) < 0)
119+
if((flags = fcntl(_pipe[0], F_GETFL, 0)) < 0)
120120
{
121121
perror("fcntl");
122122
exit(1);
123123
}
124124

125-
if (fcntl(_pipe[0], F_SETFL, flags | O_NONBLOCK) < 0)
125+
if(fcntl(_pipe[0], F_SETFL, flags | O_NONBLOCK) < 0)
126126
{
127127
perror("fcntl");
128128
exit(1);
129129
}
130130

131131
unsigned int childCount = 0;
132-
for (unsigned int i = 0; i < _filenames.size(); i++)
132+
for(unsigned int i = 0; i < _filenames.size(); i++)
133133
{
134134
// Keep only wanted amount of child processes running at a time.
135-
if (childCount >= _settings._jobs)
135+
if(childCount >= _settings._jobs)
136136
{
137-
while (handleRead(result))
137+
while(handleRead(result))
138138
{
139139

140140
}
@@ -145,13 +145,13 @@ unsigned int ThreadExecutor::check()
145145
}
146146

147147
pid_t pid = fork();
148-
if (pid < 0)
148+
if(pid < 0)
149149
{
150150
// Error
151151
std::cerr << "Failed to create child process" << std::endl;
152152
exit(EXIT_FAILURE);
153153
}
154-
else if (pid == 0)
154+
else if(pid == 0)
155155
{
156156
CppCheck fileChecker(*this);
157157
fileChecker.settings(_settings);
@@ -166,14 +166,14 @@ unsigned int ThreadExecutor::check()
166166
++childCount;
167167
}
168168

169-
while (childCount > 0)
169+
while(childCount > 0)
170170
{
171171
int stat = 0;
172172
waitpid(0, &stat, 0);
173173
--childCount;
174174
}
175175

176-
while (handleRead(result))
176+
while(handleRead(result))
177177
{
178178

179179
}
@@ -188,7 +188,7 @@ void ThreadExecutor::writeToPipe(char type, const std::string &data)
188188
out[0] = type;
189189
std::memcpy(&(out[1]), &len, sizeof(len));
190190
std::memcpy(&(out[1+sizeof(len)]), data.c_str(), len);
191-
if (write(_pipe[1], out, len + 1 + sizeof(len)) <= 0)
191+
if(write(_pipe[1], out, len + 1 + sizeof(len)) <= 0)
192192
{
193193
delete [] out;
194194
out = 0;

gui/aboutdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "aboutdialog.h"
2424

2525
AboutDialog::AboutDialog(const QString &version, QWidget *parent)
26-
: QDialog(parent)
26+
: QDialog(parent)
2727
{
2828
mUI.setupUi(this);
2929

gui/applicationdialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ApplicationDialog::ApplicationDialog(const QString &name,
3030
const QString &path,
3131
const QString &title,
3232
QWidget *parent) :
33-
QDialog(parent)
33+
QDialog(parent)
3434
{
3535
mUI.setupUi(this);
3636

@@ -61,13 +61,13 @@ void ApplicationDialog::Browse()
6161
QString(),
6262
filter);
6363

64-
if (!selectedFile.isEmpty())
64+
if(!selectedFile.isEmpty())
6565
{
6666
QString path(QDir::toNativeSeparators(selectedFile));
6767

6868
// In Windows we must surround paths including spaces with quotation marks.
6969
#ifdef Q_WS_WIN
70-
if (path.indexOf(" ") > -1)
70+
if(path.indexOf(" ") > -1)
7171
{
7272
path.insert(0, "\"");
7373
path.append("\"");
@@ -91,7 +91,7 @@ QString ApplicationDialog::GetPath()
9191

9292
void ApplicationDialog::Ok()
9393
{
94-
if (mUI.mName->text().isEmpty() || mUI.mPath->text().isEmpty())
94+
if(mUI.mName->text().isEmpty() || mUI.mPath->text().isEmpty())
9595
{
9696
QMessageBox msg(QMessageBox::Warning,
9797
tr("Cppcheck"),

gui/applicationlist.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "common.h"
2222

2323
ApplicationList::ApplicationList(QObject *parent) :
24-
QObject(parent)
24+
QObject(parent)
2525
{
2626
//ctor
2727
}
@@ -37,9 +37,9 @@ void ApplicationList::LoadSettings(QSettings *programSettings)
3737
QStringList names = programSettings->value(SETTINGS_APPLICATION_NAMES, QStringList()).toStringList();
3838
QStringList paths = programSettings->value(SETTINGS_APPLICATION_PATHS, QStringList()).toStringList();
3939

40-
if (names.size() == paths.size())
40+
if(names.size() == paths.size())
4141
{
42-
for (int i = 0; i < names.size(); i++)
42+
for(int i = 0; i < names.size(); i++)
4343
{
4444
AddApplicationType(names[i], paths[i]);
4545
}
@@ -51,7 +51,7 @@ void ApplicationList::SaveSettings(QSettings *programSettings)
5151
QStringList names;
5252
QStringList paths;
5353

54-
for (int i = 0; i < GetApplicationCount(); i++)
54+
for(int i = 0; i < GetApplicationCount(); i++)
5555
{
5656
names << GetApplicationName(i);
5757
paths << GetApplicationPath(i);
@@ -69,7 +69,7 @@ int ApplicationList::GetApplicationCount() const
6969

7070
QString ApplicationList::GetApplicationName(const int index) const
7171
{
72-
if (index >= 0 && index < mApplications.size())
72+
if(index >= 0 && index < mApplications.size())
7373
{
7474
return mApplications[index].Name;
7575
}
@@ -79,7 +79,7 @@ QString ApplicationList::GetApplicationName(const int index) const
7979

8080
QString ApplicationList::GetApplicationPath(const int index) const
8181
{
82-
if (index >= 0 && index < mApplications.size())
82+
if(index >= 0 && index < mApplications.size())
8383
{
8484
return mApplications[index].Path;
8585
}
@@ -93,7 +93,7 @@ void ApplicationList::SetApplicationType(const int index,
9393
const QString &name,
9494
const QString &path)
9595
{
96-
if (index >= 0 && index < mApplications.size())
96+
if(index >= 0 && index < mApplications.size())
9797
{
9898
mApplications[index].Name = name;
9999
mApplications[index].Path = path;
@@ -102,7 +102,7 @@ void ApplicationList::SetApplicationType(const int index,
102102

103103
void ApplicationList::AddApplicationType(const QString &name, const QString &path)
104104
{
105-
if (name.isEmpty() || path.isEmpty())
105+
if(name.isEmpty() || path.isEmpty())
106106
{
107107
return;
108108
}
@@ -121,7 +121,7 @@ void ApplicationList::RemoveApplication(const int index)
121121

122122
void ApplicationList::MoveFirst(const int index)
123123
{
124-
if (index < mApplications.size() && index > 0)
124+
if(index < mApplications.size() && index > 0)
125125
{
126126
mApplications.move(index, 0);
127127
}
@@ -130,13 +130,13 @@ void ApplicationList::MoveFirst(const int index)
130130

131131
void ApplicationList::Copy(ApplicationList *list)
132132
{
133-
if (!list)
133+
if(!list)
134134
{
135135
return;
136136
}
137137

138138
Clear();
139-
for (int i = 0; i < list->GetApplicationCount(); i++)
139+
for(int i = 0; i < list->GetApplicationCount(); i++)
140140
{
141141
AddApplicationType(list->GetApplicationName(i), list->GetApplicationPath(i));
142142
}

gui/checkthread.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <QDebug>
2222

2323
CheckThread::CheckThread(ThreadResult &result) :
24-
mState(Ready),
25-
mResult(result),
26-
mCppcheck(result)
24+
mState(Ready),
25+
mResult(result),
26+
mCppcheck(result)
2727
{
2828
//ctor
2929
}
@@ -45,18 +45,18 @@ void CheckThread::run()
4545
QString file;
4646
file = mResult.GetNextFile();
4747

48-
while (!file.isEmpty() && mState == Running)
48+
while(!file.isEmpty() && mState == Running)
4949
{
5050
qDebug() << "Checking file" << file;
5151
mCppcheck.addFile(file.toStdString());
5252
mCppcheck.check();
5353
mCppcheck.clearFiles();
5454
emit FileChecked(file);
5555

56-
if (mState == Running)
56+
if(mState == Running)
5757
file = mResult.GetNextFile();
5858
}
59-
if (mState == Running)
59+
if(mState == Running)
6060
mState = Ready;
6161
else
6262
mState = Stopped;

0 commit comments

Comments
 (0)