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