Commit e1189511 authored by Michael Reeves's avatar Michael Reeves

switch to nullptr.

*Windows specific code left out as I don't yet have a build environment to
test the change.
parent 58a0fd52
......@@ -58,9 +58,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_WARNING_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLANG_WARNING_FLAGS}")
set(
needed_features
cxx_generalized_initializers
cxx_constexpr
cxx_auto_type
cxx_nullptr
)
......
......@@ -67,7 +67,7 @@ int LineData::width(int tabSize) const
// This choice is good for C/C++.
bool equal(const LineData& l1, const LineData& l2, bool bStrict)
{
if(l1.pLine == 0 || l2.pLine == 0) return false;
if(l1.pLine == nullptr || l2.pLine == nullptr) return false;
if(bStrict && g_bIgnoreTrivialMatches) //&& (l1.occurances>=5 || l2.occurances>=5) )
return false;
......@@ -152,7 +152,7 @@ Optimizations: Skip unneeded steps.
SourceData::SourceData()
{
m_pOptions = 0;
m_pOptions = nullptr;
reset();
}
......@@ -163,7 +163,7 @@ SourceData::~SourceData()
void SourceData::reset()
{
m_pEncoding = 0;
m_pEncoding = nullptr;
m_fileAccess = FileAccess();
m_normalData.reset();
m_lmppData.reset();
......@@ -194,7 +194,7 @@ bool SourceData::isEmpty()
bool SourceData::hasData()
{
return m_normalData.m_pBuf != 0;
return m_normalData.m_pBuf != nullptr;
}
bool SourceData::isValid()
......@@ -265,15 +265,15 @@ QStringList SourceData::setData(const QString& data)
const LineData* SourceData::getLineDataForDiff() const
{
if(m_lmppData.m_pBuf == 0)
return m_normalData.m_v.size() > 0 ? &m_normalData.m_v[0] : 0;
if(m_lmppData.m_pBuf == nullptr)
return m_normalData.m_v.size() > 0 ? &m_normalData.m_v[0] : nullptr;
else
return m_lmppData.m_v.size() > 0 ? &m_lmppData.m_v[0] : 0;
return m_lmppData.m_v.size() > 0 ? &m_lmppData.m_v[0] : nullptr;
}
const LineData* SourceData::getLineDataForDisplay() const
{
return m_normalData.m_v.size() > 0 ? &m_normalData.m_v[0] : 0;
return m_normalData.m_v.size() > 0 ? &m_normalData.m_v[0] : nullptr;
}
int SourceData::getSizeLines() const
......@@ -321,7 +321,7 @@ bool SourceData::isBinaryEqualWith(const SourceData& other) const
void SourceData::FileData::reset()
{
delete[](char*) m_pBuf;
m_pBuf = 0;
m_pBuf = nullptr;
m_v.clear();
m_size = 0;
m_vSize = 0;
......@@ -347,7 +347,7 @@ bool SourceData::FileData::readFile(const QString& filename)
if(!bSuccess)
{
delete[] pBuf;
m_pBuf = 0;
m_pBuf = nullptr;
m_size = 0;
}
return bSuccess;
......@@ -427,7 +427,7 @@ static QTextCodec* getEncodingFromTag(const QByteArray& s, const QByteArray& enc
return QTextCodec::codecForName(encoding);
}
}
return 0;
return nullptr;
}
static QTextCodec* detectEncoding(const char* buf, qint64 size, qint64& skipBytes)
......@@ -485,7 +485,7 @@ static QTextCodec* detectEncoding(const char* buf, qint64 size, qint64& skipByte
break;
}
}
return 0;
return nullptr;
}
QTextCodec* SourceData::detectEncoding(const QString& fileName, QTextCodec* pFallbackCodec)
......@@ -1539,10 +1539,10 @@ static bool runDiff(const LineData* p1, int size1, const LineData* p2, int size2
pp.setCurrent(0);
diffList.clear();
if(p1[0].pLine == 0 || p2[0].pLine == 0 || size1 == 0 || size2 == 0)
if(p1[0].pLine == nullptr || p2[0].pLine == nullptr || size1 == 0 || size2 == 0)
{
Diff d(0, 0, 0);
if(p1[0].pLine == 0 && p2[0].pLine == 0 && size1 == size2)
if(p1[0].pLine == nullptr && p2[0].pLine == nullptr && size1 == size2)
d.nofEquals = size1;
else
{
......@@ -1556,7 +1556,7 @@ static bool runDiff(const LineData* p1, int size1, const LineData* p2, int size2
{
GnuDiff::comparison comparisonInput;
memset(&comparisonInput, 0, sizeof(comparisonInput));
comparisonInput.parent = 0;
comparisonInput.parent = nullptr;
comparisonInput.file[0].buffer = p1[0].pLine; //ptr to buffer
comparisonInput.file[0].buffered = (p1[size1 - 1].pLine - p1[0].pLine + p1[size1 - 1].size); // size of buffer
comparisonInput.file[1].buffer = p2[0].pLine; //ptr to buffer
......@@ -1572,7 +1572,7 @@ static bool runDiff(const LineData* p1, int size1, const LineData* p2, int size2
int equalLinesAtStart = comparisonInput.file[0].prefix_lines;
int currentLine1 = 0;
int currentLine2 = 0;
GnuDiff::change* p = 0;
GnuDiff::change* p = nullptr;
for(GnuDiff::change* e = script; e; e = p)
{
Diff d(0, 0, 0);
......@@ -2177,9 +2177,9 @@ void calcWhiteDiff3Lines(
for(; i3 != d3ll.end(); ++i3)
{
i3->bWhiteLineA = ((*i3).lineA == -1 || pldA == 0 || pldA[(*i3).lineA].whiteLine() || pldA[(*i3).lineA].bContainsPureComment);
i3->bWhiteLineB = ((*i3).lineB == -1 || pldB == 0 || pldB[(*i3).lineB].whiteLine() || pldB[(*i3).lineB].bContainsPureComment);
i3->bWhiteLineC = ((*i3).lineC == -1 || pldC == 0 || pldC[(*i3).lineC].whiteLine() || pldC[(*i3).lineC].bContainsPureComment);
i3->bWhiteLineA = ((*i3).lineA == -1 || pldA == nullptr || pldA[(*i3).lineA].whiteLine() || pldA[(*i3).lineA].bContainsPureComment);
i3->bWhiteLineB = ((*i3).lineB == -1 || pldB == nullptr || pldB[(*i3).lineB].whiteLine() || pldB[(*i3).lineB].bContainsPureComment);
i3->bWhiteLineC = ((*i3).lineC == -1 || pldC == nullptr || pldC[(*i3).lineC].whiteLine() || pldC[(*i3).lineC].bContainsPureComment);
}
}
......
......@@ -47,7 +47,7 @@ struct LineData
const QChar* pFirstNonWhiteChar;
int size;
LineData(){ pLine=0; pFirstNonWhiteChar=0; size=0; /*occurances=0;*/
LineData(){ pLine=nullptr; pFirstNonWhiteChar=nullptr; size=0; /*occurances=0;*/
bContainsPureComment=false; }
int width(int tabSize) const; // Calcs width considering tabs.
//int occurances;
......@@ -99,19 +99,19 @@ struct Diff3Line
{
lineA=-1; lineB=-1; lineC=-1;
bAEqC=false; bAEqB=false; bBEqC=false;
pFineAB=0; pFineBC=0; pFineCA=0;
pFineAB=nullptr; pFineBC=nullptr; pFineCA=nullptr;
linesNeededForDisplay=1;
sumLinesNeededForDisplay=0;
bWhiteLineA=false; bWhiteLineB=false; bWhiteLineC=false;
m_pDiffBufferInfo=0;
m_pDiffBufferInfo=nullptr;
}
~Diff3Line()
{
if (pFineAB!=0) delete pFineAB;
if (pFineBC!=0) delete pFineBC;
if (pFineCA!=0) delete pFineCA;
pFineAB=0; pFineBC=0; pFineCA=0;
if (pFineAB!=nullptr) delete pFineAB;
if (pFineBC!=nullptr) delete pFineBC;
if (pFineCA!=nullptr) delete pFineCA;
pFineAB=nullptr; pFineBC=nullptr; pFineCA=nullptr;
}
bool operator==( const Diff3Line& d3l ) const
......@@ -122,11 +122,11 @@ struct Diff3Line
const LineData* getLineData( int src ) const
{
assert( m_pDiffBufferInfo!=0 );
assert( m_pDiffBufferInfo!=nullptr );
if ( src == 1 && lineA >= 0 ) return &m_pDiffBufferInfo->m_pLineDataA[lineA];
if ( src == 2 && lineB >= 0 ) return &m_pDiffBufferInfo->m_pLineDataB[lineB];
if ( src == 3 && lineC >= 0 ) return &m_pDiffBufferInfo->m_pLineDataC[lineC];
return 0;
return nullptr;
}
QString getString( int src ) const
{
......@@ -289,7 +289,7 @@ private:
struct FileData
{
FileData(){ m_pBuf=0; m_size=0; m_vSize=0; m_bIsText=false; m_eLineEndStyle=eLineEndStyleUndefined; m_bIncompleteConversion=false;}
FileData(){ m_pBuf=nullptr; m_size=0; m_vSize=0; m_bIsText=false; m_eLineEndStyle=eLineEndStyleUndefined; m_bIncompleteConversion=false;}
~FileData(){ reset(); }
const char* m_pBuf;
int m_size;
......
This diff is collapsed.
This diff is collapsed.
......@@ -60,7 +60,7 @@ class FileAccess::Data
m_linkTarget = "";
//m_fileType = -1;
m_bLocal = true;
m_pParent = 0;
m_pParent = nullptr;
}
QUrl m_url;
......@@ -84,7 +84,7 @@ class FileAccess::Data
FileAccess::FileAccess(const QString& name, bool bWantToWrite)
{
m_pData = 0;
m_pData = nullptr;
m_bUseData = false;
setFile(name, bWantToWrite);
}
......@@ -98,20 +98,20 @@ FileAccess::FileAccess()
m_bSymLink = false;
m_bWritable = false;
m_bHidden = false;
m_pParent = 0;
m_pParent = nullptr;
m_size = 0;
}
FileAccess::FileAccess(const FileAccess& other)
{
m_pData = 0;
m_pData = nullptr;
m_bUseData = false;
*this = other;
}
void FileAccess::createData()
{
if(d() == 0)
if(d() == nullptr)
{
FileAccess* pParent = m_pParent; // backup because in union with m_pData
m_pData = new Data();
......@@ -180,7 +180,7 @@ static QString nicePath(const QFileInfo& fi)
void FileAccess::setFile(const QFileInfo& fi, FileAccess* pParent)
{
m_filePath = pParent == 0 ? fi.absoluteFilePath() : nicePath(fi.filePath()); // remove "./" at start
m_filePath = pParent == nullptr ? fi.absoluteFilePath() : nicePath(fi.filePath()); // remove "./" at start
m_bSymLink = fi.isSymLink();
if(m_bSymLink || (!m_bExists && m_filePath.contains("@@")))
......@@ -209,7 +209,7 @@ void FileAccess::setFile(const QFileInfo& fi, FileAccess* pParent)
#endif
}
if(d() != 0)
if(d() != nullptr)
{
#if defined(Q_WS_WIN)
// On some windows machines in a network this takes very long.
......@@ -290,13 +290,13 @@ void FileAccess::setFile(const QString& name, bool bWantToWrite)
m_size = 0;
m_modificationTime = QDateTime();
if(d() != 0)
if(d() != nullptr)
{
d()->reset();
d()->m_pParent = 0;
d()->m_pParent = nullptr;
}
else
m_pParent = 0;
m_pParent = nullptr;
// Note: Checking if the filename-string is empty is necessary for Win95/98/ME.
// The isFile() / isDir() queries would cause the program to crash.
......@@ -338,7 +338,7 @@ void FileAccess::setFile(const QString& name, bool bWantToWrite)
}
QFileInfo fi(localName);
setFile(fi, 0);
setFile(fi, nullptr);
}
else
{
......@@ -360,7 +360,7 @@ void FileAccess::setFile(const QString& name, bool bWantToWrite)
void FileAccess::addPath(const QString& txt)
{
if(d() != 0 && d()->m_url.isValid())
if(d() != nullptr && d()->m_url.isValid())
{
QUrl url = d()->m_url.adjusted(QUrl::StripTrailingSlash);
d()->m_url.setPath(url.path() + '/' + txt);
......@@ -480,7 +480,7 @@ void FileAccess::setUdsEntry(const KIO::UDSEntry& e)
bool FileAccess::isValid() const
{
return d() == 0 ? !m_filePath.isEmpty() : d()->m_bValidData;
return d() == nullptr ? !m_filePath.isEmpty() : d()->m_bValidData;
}
bool FileAccess::isFile() const
......@@ -522,7 +522,7 @@ qint64 FileAccess::size() const
QUrl FileAccess::url() const
{
if(d() != 0)
if(d() != nullptr)
return d()->m_url;
else
{
......@@ -537,7 +537,7 @@ QUrl FileAccess::url() const
bool FileAccess::isLocal() const
{
return d() == 0 || d()->m_bLocal;
return d() == nullptr || d()->m_bLocal;
}
bool FileAccess::isReadable() const
......@@ -546,7 +546,7 @@ bool FileAccess::isReadable() const
// On some windows machines in a network this takes very long to find out and it's not so important anyway.
return true;
#else
if(d() != 0)
if(d() != nullptr)
return d()->m_bReadable;
else
return QFileInfo(absoluteFilePath()).isReadable();
......@@ -567,7 +567,7 @@ bool FileAccess::isExecutable() const
// On some windows machines in a network this takes very long to find out and it's not so important anyway.
return true;
#else
if(d() != 0)
if(d() != nullptr)
return d()->m_bExecutable;
else
return QFileInfo(absoluteFilePath()).isExecutable();
......@@ -584,7 +584,7 @@ bool FileAccess::isHidden() const
QString FileAccess::readLink() const
{
if(d() != 0)
if(d() != nullptr)
return d()->m_linkTarget;
else
return QString();
......@@ -592,7 +592,7 @@ QString FileAccess::readLink() const
QString FileAccess::absoluteFilePath() const
{
if(parent() != 0)
if(parent() != nullptr)
return parent()->absoluteFilePath() + "/" + m_filePath;
else
{
......@@ -613,7 +613,7 @@ QString FileAccess::absoluteFilePath() const
// Just the name-part of the path, without parent directories
QString FileAccess::fileName() const
{
if(d() != 0)
if(d() != nullptr)
return d()->m_name;
else if(parent())
return m_filePath;
......@@ -648,7 +648,7 @@ FileAccess::Data* FileAccess::d()
if(m_bUseData)
return m_pData;
else
return 0;
return nullptr;
}
const FileAccess::Data* FileAccess::d() const
......@@ -656,7 +656,7 @@ const FileAccess::Data* FileAccess::d() const
if(m_bUseData)
return m_pData;
else
return 0;
return nullptr;
}
QString FileAccess::prettyAbsPath() const
......@@ -721,7 +721,7 @@ static bool interruptableReadFile(QFile& f, void* pDestBuffer, unsigned long max
bool FileAccess::readFile(void* pDestBuffer, unsigned long maxLength)
{
if(d() != 0 && !d()->m_localCopy.isEmpty())
if(d() != nullptr && !d()->m_localCopy.isEmpty())
{
QFile f(d()->m_localCopy);
if(f.open(QIODevice::ReadOnly))
......@@ -851,13 +851,13 @@ bool FileAccess::removeTempFile(const QString& name) // static
bool FileAccess::makeDir(const QString& dirName)
{
FileAccessJobHandler fh(0);
FileAccessJobHandler fh(nullptr);
return fh.mkDir(dirName);
}
bool FileAccess::removeDir(const QString& dirName)
{
FileAccessJobHandler fh(0);
FileAccessJobHandler fh(nullptr);
return fh.rmDir(dirName);
}
......@@ -907,12 +907,12 @@ qint64 FileAccess::sizeForReading()
QString FileAccess::getStatusText()
{
return d() == 0 ? QString() : d()->m_statusText;
return d() == nullptr ? QString() : d()->m_statusText;
}
void FileAccess::setStatusText(const QString& s)
{
if(!s.isEmpty() || d() != 0)
if(!s.isEmpty() || d() != nullptr)
{
createData();
d()->m_statusText = s;
......@@ -1375,7 +1375,7 @@ void CvsIgnoreList::init(FileAccess& dir, bool bUseLocalCvsIgnore)
if(size > 0)
{
char* buf = new char[size];
if(buf != 0)
if(buf != nullptr)
{
file.readFile(buf, size);
int pos1 = 0;
......@@ -1661,11 +1661,11 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b
}
else
{
KIO::ListJob* pListJob = 0;
KIO::ListJob* pListJob = nullptr;
pListJob = KIO::listDir(m_pFileAccess->url(), KIO::HideProgressInfo, true /*bFindHidden*/);
m_bSuccess = false;
if(pListJob != 0)
if(pListJob != nullptr)
{
connect(pListJob, &KIO::ListJob::entries, this, &FileAccessJobHandler::slotListDirProcessNewEntries);
connect(pListJob, &KIO::ListJob::result, this, &FileAccessJobHandler::slotSimpleJobResult);
......@@ -1731,7 +1731,7 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* pDirList, bool bRecursive, b
t_DirectoryList::iterator j;
for(j = dirList.begin(); j != dirList.end(); ++j)
{
if(j->parent() == 0)
if(j->parent() == nullptr)
j->m_filePath = i->fileName() + "/" + j->m_filePath;
}
......
......@@ -155,13 +155,13 @@ private:
// Data needed during Job
qint64 m_transferredBytes;
char* m_pTransferBuffer = NULL; // Needed during get or put
char* m_pTransferBuffer = nullptr; // Needed during get or put
qint64 m_maxLength;
QString m_filePattern;
QString m_fileAntiPattern;
QString m_dirAntiPattern;
t_DirectoryList* m_pDirList = NULL;
t_DirectoryList* m_pDirList = nullptr;
bool m_bFindHidden = false;
bool m_bRecursive = false;
bool m_bFollowDirLinks = false;
......
......@@ -718,7 +718,7 @@ GnuDiff::change *GnuDiff::add_change(lin line0, lin line1, lin deleted, lin inse
GnuDiff::change *GnuDiff::build_reverse_script(struct file_data const filevec[])
{
struct change *script = 0;
struct change *script = nullptr;
bool *changed0 = filevec[0].changed;
bool *changed1 = filevec[1].changed;
lin len0 = filevec[0].buffered_lines;
......@@ -754,7 +754,7 @@ GnuDiff::change *GnuDiff::build_reverse_script(struct file_data const filevec[])
GnuDiff::change *GnuDiff::build_script(struct file_data const filevec[])
{
struct change *script = 0;
struct change *script = nullptr;
bool *changed0 = filevec[0].changed;
bool *changed1 = filevec[1].changed;
lin i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines;
......
......@@ -31,7 +31,7 @@
#include "gnudiff_diff.h"
/* If non NULL, call this function when memory is exhausted. */
//void (*xalloc_fail_func) PARAMS ((void)) = 0;
void (*xalloc_fail_func)(void) = 0;
void (*xalloc_fail_func)(void) = nullptr;
void GnuDiff::xalloc_die(void)
{
......@@ -52,7 +52,7 @@ GnuDiff::xmalloc(size_t n)
void *p;
p = malloc(n == 0 ? 1 : n); // There are systems where malloc returns 0 for n==0.
if(p == 0)
if(p == nullptr)
xalloc_die();
return p;
}
......@@ -64,7 +64,7 @@ void *
GnuDiff::xrealloc(void *p, size_t n)
{
p = realloc(p, n == 0 ? 1 : n);
if(p == 0)
if(p == nullptr)
xalloc_die();
return p;
}
......
......@@ -35,7 +35,7 @@ namespace KDiff3 {
const char* slot,
KActionCollection* ac,
const char* actionName) {
assert( ac != 0 );
assert( ac != nullptr );
QAction * theAction = ac->addAction( actionName );
theAction->setText( text );
QObject::connect( theAction, SIGNAL( triggered() ), receiver, slot );
......@@ -48,7 +48,7 @@ namespace KDiff3 {
const char* slot,
KActionCollection* ac,
const char* actionName) {
assert( ac != 0 );
assert( ac != nullptr );
KToggleAction* theAction = new KToggleAction(ac);
ac->addAction( actionName, theAction );
theAction->setText( text );
......
......@@ -66,7 +66,7 @@
KActionCollection* KDiff3App::actionCollection()
{
if(m_pKDiff3Shell == 0)
if(m_pKDiff3Shell == nullptr)
return m_pKDiff3Part->actionCollection();
else
return m_pKDiff3Shell->actionCollection();
......@@ -74,16 +74,16 @@ KActionCollection* KDiff3App::actionCollection()
QStatusBar* KDiff3App::statusBar()
{
if(m_pKDiff3Shell == 0)
return 0;
if(m_pKDiff3Shell == nullptr)
return nullptr;
else
return m_pKDiff3Shell->statusBar();
}
KToolBar* KDiff3App::toolBar(const char* toolBarId)
{
if(m_pKDiff3Shell == 0)
return 0;
if(m_pKDiff3Shell == nullptr)
return nullptr;
else
return m_pKDiff3Shell->toolBar(toolBarId);
//return m_pKDiff3Shell->toolBar();
......@@ -91,7 +91,7 @@ KToolBar* KDiff3App::toolBar(const char* toolBarId)
bool KDiff3App::isPart()
{
return m_pKDiff3Shell == 0;
return m_pKDiff3Shell == nullptr;
}
bool KDiff3App::isFileSaved()
......@@ -121,32 +121,32 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
pal.setColor(QPalette::Text, pal.color(QPalette::Active, QPalette::Text));
setPalette(pal);
m_pMainSplitter = 0;
m_pDirectoryMergeSplitter = 0;
m_pDirectoryMergeWindow = 0;
m_pCornerWidget = 0;
m_pMainWidget = 0;
m_pDiffTextWindow1 = 0;
m_pDiffTextWindow2 = 0;
m_pDiffTextWindow3 = 0;
m_pDiffTextWindowFrame1 = 0;
m_pDiffTextWindowFrame2 = 0;
m_pDiffTextWindowFrame3 = 0;
m_pDiffWindowSplitter = 0;
m_pOverview = 0;
m_pMainSplitter = nullptr;
m_pDirectoryMergeSplitter = nullptr;
m_pDirectoryMergeWindow = nullptr;
m_pCornerWidget = nullptr;
m_pMainWidget = nullptr;
m_pDiffTextWindow1 = nullptr;
m_pDiffTextWindow2 = nullptr;
m_pDiffTextWindow3 = nullptr;
m_pDiffTextWindowFrame1 = nullptr;
m_pDiffTextWindowFrame2 = nullptr;
m_pDiffTextWindowFrame3 = nullptr;
m_pDiffWindowSplitter = nullptr;
m_pOverview = nullptr;
m_bTripleDiff = false;
m_pMergeResultWindow = 0;
m_pMergeWindowFrame = 0;
m_pMergeResultWindow = nullptr;
m_pMergeWindowFrame = nullptr;
m_bOutputModified = false;
m_bFileSaved = false;
m_bTimerBlock = false;
m_pHScrollBar = 0;
m_pDiffVScrollBar = 0;
m_pMergeVScrollBar = 0;
viewToolBar = 0;
m_pHScrollBar = nullptr;
m_pDiffVScrollBar = nullptr;
m_pMergeVScrollBar = nullptr;
viewToolBar = nullptr;
m_bRecalcWordWrapPosted = false;
m_bFinishMainInit = false;
m_pEventLoopForPrinting = 0;
m_pEventLoopForPrinting = nullptr;
m_bLoadFiles = false;
// Needed before any file operations via FileAccess happen.
......@@ -157,7 +157,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
}
// All default values must be set before calling readOptions().
m_pOptionDialog = new OptionDialog(m_pKDiff3Shell != NULL, this);
m_pOptionDialog = new OptionDialog(m_pKDiff3Shell != nullptr, this);
connect(m_pOptionDialog, &OptionDialog::applyDone, this, &KDiff3App::slotRefresh);
// This is just a convenience variable to make code that accesses options more readable
......@@ -360,14 +360,14 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
delete KDiff3Shell::getParser();
//if( args != 0 ) args->clear(); // Free up some memory.
if(m_pKDiff3Shell == 0) {
if(m_pKDiff3Shell == nullptr) {
completeInit();
}
}
void KDiff3App::completeInit(const QString& fn1, const QString& fn2, const QString& fn3)
{
if(m_pKDiff3Shell != 0)
if(m_pKDiff3Shell != nullptr)
{
QSize size = m_pOptions->m_geometry;
QPoint pos = m_pOptions->m_position;
......@@ -411,7 +411,7 @@ void KDiff3App::completeInit(const QString& fn1, const QString& fn2, const QStri
mainInit();
if(m_bAutoMode)
{
SourceData* pSD = 0;
SourceData* pSD = nullptr;
if(m_sd3.isEmpty()) {
if(m_totalDiffStatus.bBinaryAEqB) {
pSD = &m_sd1;
......@@ -432,7 +432,7 @@ void KDiff3App::completeInit(const QString& fn1, const QString& fn2, const QStri
}
}
if(pSD != 0)
if(pSD != nullptr)
{
// Save this file directly, not via the merge result window.
bool bSuccess = false;
......@@ -469,14 +469,14 @@ void KDiff3App::completeInit(const QString& fn1, const QString& fn2, const QStri
g_pProgressDialog->setStayHidden(false);
if(statusBar() != 0)
if(statusBar() != nullptr)
statusBar()->setSizeGripEnabled(true);
slotClipboardChanged(); // For initialisation.
slotUpdateAvailabilities();
if(!m_bDirCompare && m_pKDiff3Shell != 0)
if(!m_bDirCompare && m_pKDiff3Shell != nullptr)
{
bool bFileOpenError = false;
if((!m_sd1.isEmpty() && !m_sd1.hasData()) ||
......@@ -515,8 +515,8 @@ KDiff3App::~KDiff3App()
void KDiff3App::initActions(KActionCollection* ac)
{
if(ac == 0){
KMessageBox::error(0, "actionCollection==0");
if(ac == nullptr){
KMessageBox::error(nullptr, "actionCollection==0");
exit(-1);//we cann't recover from this.
}
fileOpen = KStandardAction::open(this, SLOT(slotFileOpen()), ac);
......@@ -660,7 +660,7 @@ void KDiff3App::initStatusBar()
{
///////////////////////////////////////////////////////////////////
// STATUSBAR
if(statusBar() != 0)
if(statusBar() != nullptr)
statusBar()->showMessage(i18n("Ready."));
}
......@@ -756,7 +756,7 @@ void KDiff3App::slotFileSaveAs()
{
slotStatusMsg(i18n("Saving file with a new filename..."));
QString s = QFileDialog::getSaveFileUrl(this, i18n("Save As..."), QUrl::fromLocalFile(QDir::currentPath()), 0).url(QUrl::PreferLocalFile);
QString s = QFileDialog::getSaveFileUrl(this, i18n("Save As..."), QUrl::fromLocalFile(QDir::currentPath()), nullptr).url(QUrl::PreferLocalFile);
if(!s.isEmpty()) {
m_outputFilename = s;
m_pMergeResultWindowTitle->setFileName(m_outputFilename);
......@@ -812,7 +812,7 @@ void printDiffTextWindow(MyPainter& painter, const QRect& view, const QString& h
void KDiff3App::slotFilePrint()
{
if(m_pDiffTextWindow1 == NULL)
if(m_pDiffTextWindow1 == nullptr)
return;
#ifdef QT_NO_PRINTER
slotStatusMsg(i18n("Printing not implemented."));
......@@ -1044,12 +1044,12 @@ void KDiff3App::slotFileQuit()
void KDiff3App::slotViewToolBar()
{
assert(viewToolBar != 0);
assert(viewToolBar != nullptr);
slotStatusMsg(i18n("Toggling toolbar..."));
m_pOptions->m_bShowToolBar = viewToolBar->isChecked();
///////////////////////////////////////////////////////////////////
// turn Toolbar on or off
if(toolBar(MAIN_TOOLBAR_NAME) != 0)
if(toolBar(MAIN_TOOLBAR_NAME) != nullptr)
{
if(!m_pOptions->m_bShowToolBar)
{
......@@ -1070,7 +1070,7 @@ void KDiff3App::slotViewStatusBar()
m_pOptions->m_bShowStatusBar = viewStatusBar->isChecked();
///////////////////////////////////////////////////////////////////
//turn Statusbar on or off
if(statusBar() != 0)
if(statusBar() != nullptr)
{
if(!viewStatusBar->isChecked())
{
......@@ -1089,7 +1089,7 @@ void KDiff3App::slotStatusMsg(const QString& text)
{
///////////////////////////////////////////////////////