Commit 177cb3ef authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify

parent 344bdbd4
......@@ -347,7 +347,7 @@ void MultipleFileList::moveDownItem()
void MultipleFileList::removeAllItems()
{
QTreeWidgetItemIterator it(fileList, QTreeWidgetItemIterator::All);
while (*it != nullptr) {
while (*it) {
QTreeWidgetItem *item = *it;
QList<QTreeWidgetItem *> children = item->takeChildren();
......@@ -417,7 +417,7 @@ void MultipleFileList::removeEmptyItems()
bool MultipleFileList::isEmptyItem(QTreeWidgetItem *item) const
{
if (item->font(0).italic() == true) {
if (item->font(0).italic()) {
return true;
} else {
return false;
......
......@@ -93,24 +93,24 @@ LogLine *SyslogAnalyzer::parseMessage(const QString &logLine, const LogFile &ori
QString line(logLine);
line.remove(0, 4);
int monthNum = ParsingHelper::instance()->parseSyslogMonth(month);
const int monthNum = ParsingHelper::instance()->parseSyslogMonth(month);
// Day number
QString day(line.left(2));
int dayNum = day.toInt();
const int dayNum = day.toInt();
line.remove(0, 3);
// Time
QString stringTime(line.left(8));
int h = stringTime.leftRef(2).toInt();
const int h = stringTime.leftRef(2).toInt();
stringTime.remove(0, 3);
int m = stringTime.leftRef(2).toInt();
const int m = stringTime.leftRef(2).toInt();
stringTime.remove(0, 3);
int s = stringTime.leftRef(2).toInt();
const int s = stringTime.leftRef(2).toInt();
stringTime.remove(0, 3);
QDateTime dateTime(QDate(year, monthNum, dayNum), QTime(h, m, s));
const QDateTime dateTime(QDate(year, monthNum, dayNum), QTime(h, m, s));
if (dateTime.isValid() == false) {
logDebug() << "Malformed date and time";
return undefinedLogLine(logLine, originalFile);
......@@ -120,7 +120,7 @@ LogLine *SyslogAnalyzer::parseMessage(const QString &logLine, const LogFile &ori
QString hostname;
int nextSpace = line.indexOf(QLatin1Char(' '));
const int nextSpace = line.indexOf(QLatin1Char(' '));
int nextDoubleDot = line.indexOf(QLatin1Char(':'));
// Normal case or no process name
......
......@@ -46,7 +46,7 @@ public:
LogViewColumns initColumns() override;
protected:
QRegExp mCupsPageRegex;
const QRegExp mCupsPageRegex;
LogFileReader *createLogFileReader(const LogFile &logFile) override;
......
......@@ -82,12 +82,12 @@ LogLine *SambaAnalyzer::parseMessage(const QString &logLine, const LogFile &orig
// The function
int bracket = line.indexOf(QLatin1Char('('));
QString function = line.left(bracket);
const QString function = line.left(bracket);
line.remove(0, bracket + 1);
// The line number
bracket = line.indexOf(QLatin1Char(')'));
QString lineNumber = line.left(bracket);
const QString lineNumber = line.left(bracket);
// Remove the first return character and the two useless space of the first message line
line.remove(0, bracket + 4);
......
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