Commit d0e908cf authored by Michael Reeves's avatar Michael Reeves

Apply some cppcheck fixes

*Make one paramenter contructors explict to avoid acciedental casting
*intialize variables.
parent 189e793b
...@@ -1312,7 +1312,7 @@ void calcDiff3LineListUsingBC( ...@@ -1312,7 +1312,7 @@ void calcDiff3LineListUsingBC(
{ {
i3_last_equal_A = i3; i3_last_equal_A = i3;
} }
i3++; ++i3;
} }
/* If i3_last_equal_A isn't still set to d3ll.end(), then /* If i3_last_equal_A isn't still set to d3ll.end(), then
...@@ -1389,7 +1389,7 @@ void calcDiff3LineListUsingBC( ...@@ -1389,7 +1389,7 @@ void calcDiff3LineListUsingBC(
{ {
i3_last_equal_A = i3; i3_last_equal_A = i3;
} }
i3++; ++i3;
} }
/* If i3_last_equal_A isn't still set to d3ll.end(), then /* If i3_last_equal_A isn't still set to d3ll.end(), then
......
...@@ -321,20 +321,21 @@ void calcDiff3LineVector( Diff3LineList& d3ll, Diff3LineVector& d3lv ); ...@@ -321,20 +321,21 @@ void calcDiff3LineVector( Diff3LineList& d3ll, Diff3LineVector& d3lv );
class Selection class Selection
{ {
public: public:
Selection(){ reset(); oldLastLine=-1; lastLine=-1; oldFirstLine=-1; } Selection(){}
int firstLine; int firstLine = -1;
int firstPos; int firstPos = -1;
int lastLine; int lastLine = -1;
int lastPos; int lastPos = -1;
int oldLastLine; int oldLastLine = -1;
int oldFirstLine; int oldFirstLine = -1;
bool bSelectionContainsData; bool bSelectionContainsData = false;
bool isEmpty() { return firstLine==-1 || (firstLine==lastLine && firstPos==lastPos) || bSelectionContainsData==false;} bool isEmpty() { return firstLine == -1 || (firstLine == lastLine && firstPos == lastPos) || bSelectionContainsData == false; }
void reset(){ void reset()
oldFirstLine=firstLine; {
oldLastLine =lastLine; oldFirstLine = firstLine;
firstLine=-1; oldLastLine = lastLine;
lastLine=-1; firstLine = -1;
lastLine = -1;
bSelectionContainsData = false; bSelectionContainsData = false;
} }
void start( int l, int p ) { firstLine = l; firstPos = p; } void start( int l, int p ) { firstLine = l; firstPos = p; }
......
...@@ -50,7 +50,7 @@ static QAtomicInt s_runnableCount = 0; ...@@ -50,7 +50,7 @@ static QAtomicInt s_runnableCount = 0;
class DiffTextWindowData class DiffTextWindowData
{ {
public: public:
DiffTextWindowData(DiffTextWindow* p) explicit DiffTextWindowData(DiffTextWindow* p)
{ {
m_pDiffTextWindow = p; m_pDiffTextWindow = p;
m_bPaintingAllowed = false; m_bPaintingAllowed = false;
...@@ -83,7 +83,7 @@ class DiffTextWindowData ...@@ -83,7 +83,7 @@ class DiffTextWindowData
#endif #endif
} }
DiffTextWindow* m_pDiffTextWindow; DiffTextWindow* m_pDiffTextWindow;
DiffTextWindowFrame* m_pDiffTextWindowFrame; DiffTextWindowFrame* m_pDiffTextWindowFrame = NULL;
QTextCodec* m_pTextCodec; QTextCodec* m_pTextCodec;
e_LineEndStyle m_eLineEndStyle; e_LineEndStyle m_eLineEndStyle;
......
...@@ -59,7 +59,7 @@ class StatusInfo : public QDialog ...@@ -59,7 +59,7 @@ class StatusInfo : public QDialog
QTextEdit* m_pTextEdit; QTextEdit* m_pTextEdit;
public: public:
StatusInfo(QWidget* pParent) : QDialog(pParent) explicit StatusInfo(QWidget* pParent) : QDialog(pParent)
{ {
QVBoxLayout* pVLayout = new QVBoxLayout(this); QVBoxLayout* pVLayout = new QVBoxLayout(this);
m_pTextEdit = new QTextEdit(this); m_pTextEdit = new QTextEdit(this);
...@@ -236,7 +236,7 @@ class DirectoryMergeWindow::Data : public QAbstractItemModel ...@@ -236,7 +236,7 @@ class DirectoryMergeWindow::Data : public QAbstractItemModel
{ {
public: public:
DirectoryMergeWindow* q; DirectoryMergeWindow* q;
Data(DirectoryMergeWindow* pDMW) explicit Data(DirectoryMergeWindow* pDMW)
{ {
q = pDMW; q = pDMW;
m_pOptions = 0; m_pOptions = 0;
...@@ -377,7 +377,7 @@ class DirectoryMergeWindow::Data : public QAbstractItemModel ...@@ -377,7 +377,7 @@ class DirectoryMergeWindow::Data : public QAbstractItemModel
{ {
public: public:
const FileAccess* m_pFA; const FileAccess* m_pFA;
FileKey(const FileAccess& fa) : m_pFA(&fa) {} explicit FileKey(const FileAccess& fa) : m_pFA(&fa) {}
int getParents(const FileAccess* pFA, const FileAccess* v[]) const int getParents(const FileAccess* pFA, const FileAccess* v[]) const
{ {
...@@ -683,7 +683,7 @@ class DirectoryMergeWindow::DirMergeItemDelegate : public QStyledItemDelegate ...@@ -683,7 +683,7 @@ class DirectoryMergeWindow::DirMergeItemDelegate : public QStyledItemDelegate
DirectoryMergeWindow::Data* d; DirectoryMergeWindow::Data* d;
public: public:
DirMergeItemDelegate(DirectoryMergeWindow* pParent) explicit DirMergeItemDelegate(DirectoryMergeWindow* pParent)
: QStyledItemDelegate(pParent), m_pDMW(pParent), d(pParent->d) : QStyledItemDelegate(pParent), m_pDMW(pParent), d(pParent->d)
{ {
} }
...@@ -2380,7 +2380,7 @@ class MfiCompare ...@@ -2380,7 +2380,7 @@ class MfiCompare
Qt::SortOrder mOrder; Qt::SortOrder mOrder;
public: public:
MfiCompare(Qt::SortOrder order) explicit MfiCompare(Qt::SortOrder order)
{ {
mOrder = order; mOrder = order;
} }
...@@ -3296,16 +3296,19 @@ DirectoryMergeInfo::DirectoryMergeInfo(QWidget* pParent) ...@@ -3296,16 +3296,19 @@ DirectoryMergeInfo::DirectoryMergeInfo(QWidget* pParent)
m_pInfoA = new QLabel(this); m_pInfoA = new QLabel(this);
grid->addWidget(m_pInfoA, line, 1); grid->addWidget(m_pInfoA, line, 1);
++line; ++line;
m_pB = new QLabel("B", this); m_pB = new QLabel("B", this);
grid->addWidget(m_pB, line, 0); grid->addWidget(m_pB, line, 0);
m_pInfoB = new QLabel(this); m_pInfoB = new QLabel(this);
grid->addWidget(m_pInfoB, line, 1); grid->addWidget(m_pInfoB, line, 1);
++line; ++line;
m_pC = new QLabel("C", this); m_pC = new QLabel("C", this);
grid->addWidget(m_pC, line, 0); grid->addWidget(m_pC, line, 0);
m_pInfoC = new QLabel(this); m_pInfoC = new QLabel(this);
grid->addWidget(m_pInfoC, line, 1); grid->addWidget(m_pInfoC, line, 1);
++line; ++line;
m_pDest = new QLabel(i18n("Dest"), this); m_pDest = new QLabel(i18n("Dest"), this);
grid->addWidget(m_pDest, line, 0); grid->addWidget(m_pDest, line, 0);
m_pInfoDest = new QLabel(this); m_pInfoDest = new QLabel(this);
......
...@@ -158,7 +158,7 @@ class DirectoryMergeInfo : public QFrame ...@@ -158,7 +158,7 @@ class DirectoryMergeInfo : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
DirectoryMergeInfo( QWidget* pParent ); explicit DirectoryMergeInfo( QWidget* pParent );
void setInfo( void setInfo(
const FileAccess& APath, const FileAccess& APath,
const FileAccess& BPath, const FileAccess& BPath,
......
...@@ -120,7 +120,7 @@ void FileAccess::createData() ...@@ -120,7 +120,7 @@ void FileAccess::createData()
} }
} }
const FileAccess& FileAccess::operator=(const FileAccess& other) FileAccess& FileAccess::operator=(const FileAccess& other)
{ {
m_size = other.m_size; m_size = other.m_size;
m_filePath = other.m_filePath; m_filePath = other.m_filePath;
...@@ -1691,7 +1691,7 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b ...@@ -1691,7 +1691,7 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b
bool bCaseSensitive = true; bool bCaseSensitive = true;
#endif #endif
// Now remove all entries that don't match: // Now remove all entries that should be ignored:
t_DirectoryList::iterator i; t_DirectoryList::iterator i;
for(i = pDirList->begin(); i != pDirList->end();) for(i = pDirList->begin(); i != pDirList->end();)
{ {
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
~FileAccess(); ~FileAccess();
FileAccess( const QString& name, bool bWantToWrite=false ); // name: local file or dirname or url (when supported) FileAccess( const QString& name, bool bWantToWrite=false ); // name: local file or dirname or url (when supported)
FileAccess(const FileAccess& other); FileAccess(const FileAccess& other);
const FileAccess& operator=(const FileAccess& other); FileAccess& operator=(const FileAccess& other);
void setFile( const QString& name, bool bWantToWrite=false ); void setFile( const QString& name, bool bWantToWrite=false );
bool isValid() const; bool isValid() const;
...@@ -134,7 +134,7 @@ class FileAccessJobHandler : public QObject ...@@ -134,7 +134,7 @@ class FileAccessJobHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
FileAccessJobHandler( FileAccess* pFileAccess ); explicit FileAccessJobHandler( FileAccess* pFileAccess );
bool get( void* pDestBuffer, long maxLength ); bool get( void* pDestBuffer, long maxLength );
bool put( const void* pSrcBuffer, long maxLength, bool bOverwrite, bool bResume=false, int permissions=-1 ); bool put( const void* pSrcBuffer, long maxLength, bool bOverwrite, bool bResume=false, int permissions=-1 );
...@@ -155,16 +155,16 @@ private: ...@@ -155,16 +155,16 @@ private:
// Data needed during Job // Data needed during Job
qint64 m_transferredBytes; qint64 m_transferredBytes;
char* m_pTransferBuffer; // Needed during get or put char* m_pTransferBuffer = NULL; // Needed during get or put
qint64 m_maxLength; qint64 m_maxLength;
QString m_filePattern; QString m_filePattern;
QString m_fileAntiPattern; QString m_fileAntiPattern;
QString m_dirAntiPattern; QString m_dirAntiPattern;
t_DirectoryList* m_pDirList; t_DirectoryList* m_pDirList = NULL;
bool m_bFindHidden; bool m_bFindHidden = false;
bool m_bRecursive; bool m_bRecursive = false;
bool m_bFollowDirLinks; bool m_bFollowDirLinks = false;
bool scanLocalDirectory( const QString& dirName, t_DirectoryList* dirList ); bool scanLocalDirectory( const QString& dirName, t_DirectoryList* dirList );
......
...@@ -3047,6 +3047,9 @@ Overview::Overview(Options* pOptions) ...@@ -3047,6 +3047,9 @@ Overview::Overview(Options* pOptions)
m_eOverviewMode = eOMNormal; m_eOverviewMode = eOMNormal;
m_nofLines = 1; m_nofLines = 1;
m_bPaintingAllowed = false; m_bPaintingAllowed = false;
m_firstLine = 0;
m_pageHeight = 0;
setFixedWidth(20); setFixedWidth(20);
} }
......
...@@ -32,7 +32,7 @@ class Overview : public QWidget ...@@ -32,7 +32,7 @@ class Overview : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
Overview( Options* pOptions ); explicit Overview( Options* pOptions );
void init( Diff3LineList* pDiff3LineList, bool bTripleDiff ); void init( Diff3LineList* pDiff3LineList, bool bTripleDiff );
void reset(); void reset();
...@@ -444,7 +444,7 @@ private: ...@@ -444,7 +444,7 @@ private:
QComboBox* m_pEncodingSelector; QComboBox* m_pEncodingSelector;
Options* m_pOptions; Options* m_pOptions;
public: public:
WindowTitleWidget(Options* pOptions); explicit WindowTitleWidget(Options* pOptions);
QTextCodec* getEncoding(); QTextCodec* getEncoding();
void setFileName(const QString& fileName ); void setFileName(const QString& fileName );
QString getFileName(); QString getFileName();
......
...@@ -472,7 +472,7 @@ class OptionComboBox : public QComboBox, public OptionItem ...@@ -472,7 +472,7 @@ class OptionComboBox : public QComboBox, public OptionItem
private: private:
OptionComboBox(const OptionIntEdit&); // private copy constructor without implementation OptionComboBox(const OptionIntEdit&); // private copy constructor without implementation
int* m_pVarNum; int* m_pVarNum;
int m_preservedNumVal; int m_preservedNumVal = 0;
QString* m_pVarStr; QString* m_pVarStr;
QString m_preservedStrVal; QString m_preservedStrVal;
int m_defaultVal; int m_defaultVal;
...@@ -1873,7 +1873,7 @@ class ConfigValueMap : public ValueMap ...@@ -1873,7 +1873,7 @@ class ConfigValueMap : public ValueMap
KConfigGroup m_config; KConfigGroup m_config;
public: public:
ConfigValueMap(const KConfigGroup& config) : m_config(config) {} explicit ConfigValueMap(const KConfigGroup& config) : m_config(config) {}
void writeEntry(const QString& s, const QFont& v) void writeEntry(const QString& s, const QFont& v)
{ {
......
...@@ -117,7 +117,7 @@ class FontChooser : public QGroupBox ...@@ -117,7 +117,7 @@ class FontChooser : public QGroupBox
QPlainTextEdit* m_pExampleTextEdit; QPlainTextEdit* m_pExampleTextEdit;
QLabel* m_pLabel; QLabel* m_pLabel;
public: public:
FontChooser( QWidget* pParent ); explicit FontChooser( QWidget* pParent );
QFont font(); QFont font();
void setFont( const QFont&, bool ); void setFont( const QFont&, bool );
private slots: private slots:
......
...@@ -68,7 +68,7 @@ class FindDialog : public QDialog ...@@ -68,7 +68,7 @@ class FindDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
FindDialog(QWidget* pParent); explicit FindDialog(QWidget* pParent);
void setVisible(bool); //override QDialog::setVisible() void setVisible(bool); //override QDialog::setVisible()
Q_SIGNALS: Q_SIGNALS:
......
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