More of the same...
{
m_bPreparingToDrag = false;
HGLOBAL hData = PrepareDragData ();
- if (hData != NULL)
+ if (hData != nullptr)
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->BeginUndoGroup ();
COleDataSource ds;
OnDropSource (de);
m_bDraggingText = false;
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->FlushUndoGroup (this);
}
}
bool CCrystalTextView::
IsSelection ()
{
+#if _MSC_VER < 1910 // VS2015 (and earlier?) generates a "performance" warning
+ // NOTE: Comparing two `CPoint` values yields a BOOL result; therefore this funny code
+ return (m_ptSelStart != m_ptSelEnd) ? true : false;
+#else
return (m_ptSelStart != m_ptSelEnd);
+#endif
}
void CCrystalTextView::
EmptyClipboard ();
SIZE_T cbData = (cchText + 1) * sizeof(TCHAR);
HGLOBAL hData = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, cbData);
- if (hData != NULL)
+ if (hData != nullptr)
{
SIZE_T dwSize = GlobalSize(hData);
LPTSTR pszData = (LPTSTR)::GlobalLock (hData);
memset(reinterpret_cast<char *>(pszData) + cbData, 0, dwSize - cbData);
GlobalUnlock (hData);
CLIPFORMAT fmt = GetClipTcharTextFormat();
- bOK = SetClipboardData (fmt, hData) != NULL;
+ bOK = SetClipboardData (fmt, hData) != nullptr;
if (bOK)
{
if (bColumnSelection)
- SetClipboardData (RegisterClipboardFormat (_T("MSDEVColumnSelect")), NULL);
+ SetClipboardData (RegisterClipboardFormat (_T("MSDEVColumnSelect")), nullptr);
if (dwSize == cbData)
- SetClipboardData (RegisterClipboardFormat (_T("WinMergeClipboard")), NULL);
+ SetClipboardData (RegisterClipboardFormat (_T("WinMergeClipboard")), nullptr);
}
}
}
{
CLIPFORMAT fmt = GetClipTcharTextFormat();
HGLOBAL hData = GetClipboardData (fmt);
- if (hData != NULL)
+ if (hData != nullptr)
{
LPTSTR pszData = (LPTSTR) GlobalLock (hData);
- if (pszData != NULL)
+ if (pszData != nullptr)
{
UINT cbData = (UINT) GlobalSize (hData);
// in case we get an odd length for unicodes
void CColorButton::SetColor(COLORREF clrFill, bool bInvalidate /* = true*/)
{
m_clrFill = clrFill;
- if (bInvalidate && m_hWnd)
+ if (bInvalidate && m_hWnd != nullptr)
Invalidate();
}
ASSERT((m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
m_dwDockStyle = dwDockStyle;
- if (m_pDockContext == NULL)
+ if (m_pDockContext == nullptr)
m_pDockContext = new CSCBDockContext(this);
// permanently wire the bar's owner to its current parent
- if (m_hWndOwner == NULL)
+ if (m_hWndOwner == nullptr)
m_hWndOwner = ::GetParent(m_hWnd);
}
#endif
for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
{
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
- ASSERT(pInfo != NULL);
+ ASSERT(pInfo != nullptr);
if (!pInfo->m_bFloating)
continue;
{
const DIFFITEM *cur;
int depth;
- for (depth = 0, cur = parent; cur; depth++, cur = cur->parent)
+ for (depth = 0, cur = parent; cur != nullptr; depth++, cur = cur->parent)
;
return depth;
}
bool DIFFITEM::IsAncestor(const DIFFITEM *pdi) const
{
const DIFFITEM *cur;
- for (cur = this; cur; cur = cur->parent)
+ for (cur = this; cur != nullptr; cur = cur->parent)
{
if (cur->parent == pdi)
return true;
bool DIFFITEM::HasChildren() const
{
DIFFITEM *p = static_cast<DIFFITEM *>(children.IsSibling(children.Flink));
- return p ? true : false;
+ return (p != nullptr) ? true : false;
}
void DIFFITEM::RemoveChildren()
diffcode.swap(idx1, idx2);
if (HasChildren())
{
- for (ListEntry *p = children.IsSibling(children.Flink); p; p = children.IsSibling(p->Flink))
+ for (ListEntry *p = children.IsSibling(children.Flink); p != nullptr; p = children.IsSibling(p->Flink))
static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
}
}
/**
* @brief Enables/disabled DiffList creation ands sets DiffList.
* This function enables or disables DiffList creation. When
- * @p diffList is NULL difflist is not created. When valid DiffList
- * pointer is given, compare results are stored into it.
+ * @p diffList is `nullptr`, a difflist was not created. When valid
+ * DiffList pointer is given, compare results are stored into it.
* @param [in] diffList Pointer to DiffList getting compare results.
*/
void CDiffWrapper::SetCreateDiffList(DiffList *diffList)
{
- if (diffList == NULL)
+ if (diffList == nullptr)
{
m_bUseDiffList = false;
- m_pDiffList = NULL;
+ m_pDiffList = nullptr;
}
else
{
// all flags are set correctly during the construction
m_infoPrediffer.reset(new PrediffingInfo);
- if (prediffer)
+ if (prediffer != nullptr)
*m_infoPrediffer = *prediffer;
}
void CDiffWrapper::GetPrediffer(PrediffingInfo * prediffer) const
const FilterCommentsSet& filtercommentsset) const
{
//Do easy test first
- if ((!StartOfComment || !EndOfComment) && !InLineComment)
+ if ((StartOfComment == nullptr || EndOfComment == nullptr) && InLineComment == nullptr)
return false;//In no Start and End pair, and no single in-line set, then it's not trivial
if (StartOfComment == Line.c_str() &&
return true;
}
- if (InLineComment && InLineComment < StartOfComment)
+ if (InLineComment != nullptr && InLineComment < StartOfComment)
{
if (InLineComment == Line.c_str())
return true;//If line starts with InLineComment marker, then entire line is trivial
}
//Done with easy test, so now do more complex test
- if (StartOfComment &&
- EndOfComment &&
+ if (StartOfComment != nullptr &&
+ EndOfComment != nullptr &&
StartOfComment < EndOfComment &&
IsTrivialBytes(Line.c_str(), StartOfComment, filtercommentsset) &&
IsTrivialBytes(EndOfComment + filtercommentsset.EndMarker.size(),
return false;
}
- if (EndOfComment &&
- (!StartOfComment || StartOfComment > EndOfComment) &&
- (!InLineComment || InLineComment > EndOfComment) )
+ if (EndOfComment != nullptr &&
+ (StartOfComment == nullptr || StartOfComment > EndOfComment) &&
+ (InLineComment == nullptr || InLineComment > EndOfComment) )
{
if (!IsTrivialBytes(EndOfComment+filtercommentsset.EndMarker.size(), LineData.c_str()+LineData.size(), filtercommentsset))
{
EndLineRight = files[1].linbuf[LineNumberRight + i + 1];
}
- if (EndLineLeft && EndLineRight)
+ if (EndLineLeft != nullptr && EndLineRight != nullptr)
{
std::string LineDataLeft(LineStrLeft, EndLineLeft);
std::string LineDataRight(LineStrRight, EndLineRight);
CommentStrRightStart = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.StartMarker.c_str());
CommentStrRightEnd = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.EndMarker.c_str());
- if (CommentStrLeftStart != NULL && CommentStrLeftEnd != NULL && CommentStrLeftStart < CommentStrLeftEnd)
+ if (CommentStrLeftStart != nullptr && CommentStrLeftEnd != nullptr && CommentStrLeftStart < CommentStrLeftEnd)
LineDataLeft.erase(CommentStrLeftStart - LineDataLeft.c_str(), CommentStrLeftEnd + filtercommentsset.EndMarker.size() - CommentStrLeftStart);
- else if (CommentStrLeftEnd != NULL)
+ else if (CommentStrLeftEnd != nullptr)
LineDataLeft.erase(0, CommentStrLeftEnd + filtercommentsset.EndMarker.size() - LineDataLeft.c_str());
- else if (CommentStrLeftStart != NULL)
+ else if (CommentStrLeftStart != nullptr)
LineDataLeft.erase(CommentStrLeftStart - LineDataLeft.c_str());
else if(LeftOp == OP_TRIVIAL && bFirstLoop)
LineDataLeft.erase(0); //This line is all in block comments
- if (CommentStrRightStart != NULL && CommentStrRightEnd != NULL && CommentStrRightStart < CommentStrRightEnd)
+ if (CommentStrRightStart != nullptr && CommentStrRightEnd != nullptr && CommentStrRightStart < CommentStrRightEnd)
LineDataRight.erase(CommentStrRightStart - LineDataRight.c_str(), CommentStrRightEnd + filtercommentsset.EndMarker.size() - CommentStrRightStart);
- else if (CommentStrRightEnd != NULL)
+ else if (CommentStrRightEnd != nullptr)
LineDataRight.erase(0, CommentStrRightEnd + filtercommentsset.EndMarker.size() - LineDataRight.c_str());
- else if (CommentStrRightStart != NULL)
+ else if (CommentStrRightStart != nullptr)
LineDataRight.erase(CommentStrRightStart - LineDataRight.c_str());
else if(RightOp == OP_TRIVIAL && bFirstLoop)
LineDataRight.erase(0); //This line is all in block comments
bFirstLoop = false;
- } while (CommentStrLeftStart != NULL || CommentStrLeftEnd != NULL
- || CommentStrRightStart != NULL || CommentStrRightEnd != NULL); //Loops until all blockcomments are lost
+ } while (CommentStrLeftStart != nullptr || CommentStrLeftEnd != nullptr
+ || CommentStrRightStart != nullptr || CommentStrRightEnd != nullptr); //Loops until all blockcomments are lost
}
if (!filtercommentsset.InlineMarker.empty())
const char * CommentStrLeft = FindCommentMarker(LineDataLeft.c_str(), filtercommentsset.InlineMarker.c_str());
const char * CommentStrRight = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.InlineMarker.c_str());
- if (CommentStrLeft != NULL)
+ if (CommentStrLeft != nullptr)
LineDataLeft.erase(CommentStrLeft - LineDataLeft.c_str());
- if (CommentStrRight != NULL)
+ if (CommentStrRight != nullptr)
LineDataRight.erase(CommentStrRight - LineDataRight.c_str());
}
*/
bool CDiffWrapper::RegExpFilter(int StartPos, int EndPos, int FileNo) const
{
- if (m_pFilterList == NULL)
+ if (m_pFilterList == nullptr)
{
throw "CDiffWrapper::RegExpFilter() called when "
- "filterlist doesn't exist (=NULL)";
+ "filterlist doesn't exist (=nullptr)";
}
bool linesMatch = true; // set to false when non-matching line is found.
PostFilter(thisob->line0, QtyLinesLeft, thisob->line1, QtyLinesRight, op, asLwrCaseExt);
}
- if (m_pFilterList && m_pFilterList->HasRegExps())
+ if (m_pFilterList != nullptr && m_pFilterList->HasRegExps())
{
//Determine quantity of lines in this block for both sides
int QtyLinesLeft = (trans_b0 - trans_a0);
}
// Adding new filter without previous filter
- if (m_pFilterList == NULL)
+ if (m_pFilterList == nullptr)
{
m_pFilterList.reset(new FilterList);
}
m_pDirView->DeleteAllDisplayItems();
// Anything that can go wrong here will yield an exception.
- // Default implementation of operator new() never returns NULL.
+ // Default implementation of operator new() never returns `nullptr`.
- if (m_pCompareStats == NULL)
+ if (m_pCompareStats == nullptr)
m_pCompareStats.reset(new CompareStats(m_nDirs));
m_pCtxt.reset(new CDiffContext(paths,
GetOptionsMgr()->GetInt(OPT_CMP_METHOD)));
m_pCtxt->m_bRecursive = bRecursive;
- if (pTempPathContext)
+ if (pTempPathContext != nullptr)
{
int nIndex;
for (nIndex = 0; nIndex < m_nDirs; nIndex++)
}
// All plugin management is done by our plugin manager
- m_pCtxt->m_piPluginInfos = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? &m_pluginman : NULL;
+ m_pCtxt->m_piPluginInfos = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? &m_pluginman : nullptr;
}
*/
void CDirDoc::Rescan()
{
- if (!m_pCtxt)
+ if (m_pCtxt == nullptr)
return;
CDirFrame *pf = m_pDirView->GetParentFrame();
*/
void CDirDoc::Redisplay()
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return;
// Do not redisplay an empty CDirView
CDirView * CDirDoc::GetMainView() const
{
- CDirView *pView = NULL;
+ CDirView *pView = nullptr;
if (POSITION pos = GetFirstViewPosition())
{
pView = static_cast<CDirView*>(GetNextView(pos));
*/
void CDirDoc::UpdateResources()
{
- if (m_pDirView)
+ if (m_pDirView != nullptr)
m_pDirView->UpdateResources();
SetTitle(nullptr);
// If dir compare is empty (no compare results) and we are not closing
// because of reuse close also dir compare
- if (m_pDirView)
+ if (m_pDirView != nullptr)
{
- if (m_pCtxt == NULL)
+ if (m_pCtxt == nullptr)
m_pDirView->PostMessage(WM_COMMAND, ID_FILE_CLOSE);
}
else if (m_MergeDocs.GetCount() == 0)
*/
void CDirDoc::RefreshOptions()
{
- if (m_pCtxt)
+ if (m_pCtxt != nullptr)
m_pCtxt->m_bRecursive = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
- if (m_pDirView)
+ if (m_pDirView != nullptr)
m_pDirView->RefreshOptions();
}
*/
void CDirDoc::SetDescriptions(const String strDesc[])
{
- if (strDesc)
+ if (strDesc != nullptr)
std::copy_n(strDesc, m_nDirs, m_strDesc);
}
*/
void CDirDoc::ApplyDisplayRoot(int nIndex, String &sText)
{
- if (m_pTempPathContext)
+ if (m_pTempPathContext != nullptr)
{
sText.erase(0, m_pTempPathContext->m_strRoot[nIndex].length());
sText.insert(0, m_pTempPathContext->m_strDisplayRoot[nIndex]);
* Formats and sets caption for directory compare window. Caption
* has left- and right-side paths separated with '-'.
*
- * @param [in] lpszTitle New title for window if. If this parameter
- * is not NULL we use this string, otherwise format caption from
+ * @param [in] lpszTitle New title for window. If this parameter
+ * is not `nullptr` we use this string, otherwise format caption from
* actual paths.
*/
void CDirDoc::SetTitle(LPCTSTR lpszTitle)
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return;
- if (lpszTitle)
+ if (lpszTitle != nullptr)
CDocument::SetTitle(lpszTitle);
- else if (!m_pCtxt || m_pCtxt->GetLeftPath().empty() ||
+ else if (m_pCtxt == nullptr || m_pCtxt->GetLeftPath().empty() ||
m_pCtxt->GetRightPath().empty() ||
(m_nDirs > 2 && m_pCtxt->GetMiddlePath().empty()))
{
*/
bool CDirDoc::IsArchiveFolders() const
{
- if (m_pTempPathContext)
+ if (m_pTempPathContext != nullptr)
return true;
else
return false;
{
std::swap(m_bRO[idx1], m_bRO[idx2]);
std::swap(m_strDesc[idx1], m_strDesc[idx2]);
- if (m_pTempPathContext)
+ if (m_pTempPathContext != nullptr)
m_pTempPathContext->Swap(idx1, idx2);
m_pCtxt->Swap(idx1, idx2);
m_pCompareStats->Swap(idx1, idx2);
bool CDirDoc::MoveableToNextDiff()
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return false;
CMessageBoxDialog dlg(nullptr, _("Do you want to move to the next file?").c_str());
const int nFormerResult = dlg.GetFormerResult();
bool CDirDoc::MoveableToPrevDiff()
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return false;
CMessageBoxDialog dlg(nullptr, _("Do you want to move to the previous file?").c_str());
const int nFormerResult = dlg.GetFormerResult();
void CDirDoc::MoveToNextDiff(IMergeDoc *pMergeDoc)
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return;
if (AfxMessageBox(_("Do you want to move to the next file?").c_str(), MB_YESNO | MB_DONT_ASK_AGAIN) == IDYES)
{
void CDirDoc::MoveToPrevDiff(IMergeDoc *pMergeDoc)
{
- if (!m_pDirView)
+ if (m_pDirView == nullptr)
return;
if (AfxMessageBox(_("Do you want to move to the previous file?").c_str(), MB_YESNO | MB_DONT_ASK_AGAIN) == IDYES)
{
UNREFERENCED_PARAMETER(lParam);
CDirDoc * pDoc = GetDocument();
- ASSERT(pDoc);
+ ASSERT(pDoc != nullptr);
if (wParam == CDiffThread::EVENT_COMPARE_COMPLETED)
{
*/
void CEditorFilePathBar::Resize()
{
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return;
WINDOWPLACEMENT infoBar;
*/
void CEditorFilePathBar::Resize(int widths[])
{
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return;
// resize left filename
*/
BOOL CEditorFilePathBar::OnToolTipNotify(UINT id, NMHDR * pTTTStruct, LRESULT * pResult)
{
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return FALSE;
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pTTTStruct;
ASSERT (pane >= 0 && pane < countof(m_Edit));
// Check for NULL since window may be closing..
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return _T("");
CString str;
ASSERT (pane >= 0 && pane < countof(m_Edit));
// Check for NULL since window may be closing..
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return;
m_Edit[pane].SetOriginalText(sString);
// TODO : is it better with the BOM or without (just change the last argument)
int nFileChanged = 0;
bool bSuccess = ::AnyCodepageToUTF8(codepage, filepath, tempFilepath, nFileChanged, false);
- if (bSuccess && nFileChanged)
+ if (bSuccess && nFileChanged!=0)
{
// we do not overwrite so we delete the old file
if (bMayOverwrite)
{
m_bActive = bActive;
- if (m_hWnd == NULL)
+ if (m_hWnd == nullptr)
return;
CRect rcWnd;
PathContext tFiles;
GetComparePaths(pCtxt, di, tFiles);
- struct change *script = NULL;
- struct change *script10 = NULL;
- struct change *script12 = NULL;
- struct change *script02 = NULL;
+ struct change *script10 = nullptr;
+ struct change *script12 = nullptr;
+ struct change *script02 = nullptr;
FolderCmp diffdata10, diffdata12, diffdata02;
String filepathUnpacked[3];
String filepathTransformed[3];
{
if (tFiles.GetSize() == 2)
{
- if (m_pDiffUtilsEngine == NULL)
+ if (m_pDiffUtilsEngine == nullptr)
m_pDiffUtilsEngine.reset(new CompareEngines::DiffUtils());
m_pDiffUtilsEngine->SetCodepage(codepage);
bool success = m_pDiffUtilsEngine->SetCompareOptions(
*pCtxt->GetCompareOptions(CMP_CONTENT));
if (success)
{
- if (pCtxt->m_pFilterList != NULL)
+ if (pCtxt->m_pFilterList != nullptr)
m_pDiffUtilsEngine->SetFilterList(pCtxt->m_pFilterList.get());
else
m_pDiffUtilsEngine->ClearFilterList();
}
else
{
- if (m_pDiffUtilsEngine == NULL)
+ if (m_pDiffUtilsEngine == nullptr)
m_pDiffUtilsEngine.reset(new CompareEngines::DiffUtils());
m_pDiffUtilsEngine->SetCodepage(codepage);
bool success = m_pDiffUtilsEngine->SetCompareOptions(
*pCtxt->GetCompareOptions(CMP_CONTENT));
if (success)
{
- if (pCtxt->m_pFilterList != NULL)
+ if (pCtxt->m_pFilterList != nullptr)
m_pDiffUtilsEngine->SetFilterList(pCtxt->m_pFilterList.get());
else
m_pDiffUtilsEngine->ClearFilterList();
int bin_flag10 = 0, bin_flag12 = 0, bin_flag02 = 0;
m_pDiffUtilsEngine->SetFileData(2, diffdata10.m_diffFileData.m_inf);
- bRet = m_pDiffUtilsEngine->Diff2Files(&script10, 0, &bin_flag10, false, NULL);
+ bRet = m_pDiffUtilsEngine->Diff2Files(&script10, 0, &bin_flag10, false, nullptr);
m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[1]);
m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[0]);
m_pDiffUtilsEngine->SetFileData(2, diffdata12.m_diffFileData.m_inf);
- bRet = m_pDiffUtilsEngine->Diff2Files(&script12, 0, &bin_flag12, false, NULL);
+ bRet = m_pDiffUtilsEngine->Diff2Files(&script12, 0, &bin_flag12, false, nullptr);
m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[1]);
m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[2]);
m_pDiffUtilsEngine->SetFileData(2, diffdata02.m_diffFileData.m_inf);
- bRet = m_pDiffUtilsEngine->Diff2Files(&script02, 0, &bin_flag02, false, NULL);
+ bRet = m_pDiffUtilsEngine->Diff2Files(&script02, 0, &bin_flag02, false, nullptr);
m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[0]);
m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[2]);
{
if ((code & DIFFCODE::TEXTFLAGS) == DIFFCODE::TEXT)
{
- if (!script12)
+ if (script12 == nullptr)
code |= DIFFCODE::DIFF1STONLY;
- else if (!script02)
+ else if (script02 == nullptr)
code |= DIFFCODE::DIFF2NDONLY;
- else if (!script10)
+ else if (script10 == nullptr)
code |= DIFFCODE::DIFF3RDONLY;
}
else
}
else if (nCompMethod == CMP_BINARY_CONTENT)
{
- if (m_pBinaryCompare == NULL)
+ if (m_pBinaryCompare == nullptr)
m_pBinaryCompare.reset(new BinaryCompare());
PathContext tFiles;
}
else if (nCompMethod == CMP_DATE || nCompMethod == CMP_DATE_SIZE || nCompMethod == CMP_SIZE)
{
- if (m_pTimeSizeCompare == NULL)
+ if (m_pTimeSizeCompare == nullptr)
m_pTimeSizeCompare.reset(new TimeSizeCompare());
m_pTimeSizeCompare->SetAdditionalOptions(pCtxt->m_bIgnoreSmallTimeDiff);
*/
CHexMergeDoc::~CHexMergeDoc()
{
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
m_pDirDoc->MergeDocClosing(this);
}
int CHexMergeDoc::UpdateDiffItem(CDirDoc *pDirDoc)
{
// If directory compare has results
- if (pDirDoc && pDirDoc->HasDiffs())
+ if (pDirDoc != nullptr && pDirDoc->HasDiffs())
{
CDiffContext &ctxt = pDirDoc->GetDiffContext();
if (UINT_PTR pos = FindItemFromPaths(ctxt, m_filePaths))
else
{
sText = m_filePaths.GetPath(pane);
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
m_pDirDoc->ApplyDisplayRoot(pane, sText);
}
if (m_pView[pane]->GetModified())
String sTitle;
String sFileName[3];
- if (lpszTitle)
+ if (lpszTitle != nullptr)
sTitle = lpszTitle;
else
{
CImgMergeFrame::~CImgMergeFrame()
{
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
{
m_pDirDoc->MergeDocClosing(this);
- m_pDirDoc = NULL;
+ m_pDirDoc = nullptr;
}
HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
- if (hModule)
+ if (hModule != nullptr)
{
bool (*WinIMerge_DestroyWindow)(IImgMergeWindow *) =
(bool (*)(IImgMergeWindow *))GetProcAddress(hModule, "WinIMerge_DestroyWindow");
bool (*WinIMerge_DestroyToolWindow)(IImgToolWindow *) =
(bool (*)(IImgToolWindow *))GetProcAddress(hModule, "WinIMerge_DestroyToolWindow");
- if (WinIMerge_DestroyWindow && WinIMerge_DestroyToolWindow)
+ if (WinIMerge_DestroyWindow != nullptr && WinIMerge_DestroyToolWindow != nullptr)
{
- if (m_pImgMergeWindow)
+ if (m_pImgMergeWindow != nullptr)
{
for (int pane = 0; pane < m_pImgMergeWindow->GetPaneCount(); ++pane)
RevokeDragDrop(m_pImgMergeWindow->GetPaneHWND(pane));
WinIMerge_DestroyWindow(m_pImgMergeWindow);
}
- if (m_pImgToolWindow)
+ if (m_pImgToolWindow != nullptr)
WinIMerge_DestroyToolWindow(m_pImgToolWindow);
- m_pImgMergeWindow = NULL;
- m_pImgToolWindow = NULL;
+ m_pImgMergeWindow = nullptr;
+ m_pImgToolWindow = nullptr;
}
}
}
bool CImgMergeFrame::IsLoadable()
{
static HMODULE hModule;
- if (!hModule)
+ if (hModule == nullptr)
{
hModule = LoadLibraryW(L"WinIMerge\\WinIMergeLib.dll");
- if (!hModule)
+ if (hModule == nullptr)
return false;
}
return true;
return FALSE;
HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
- if (!hModule)
+ if (hModule == nullptr)
return FALSE;
IImgMergeWindow * (*WinIMerge_CreateWindow)(HINSTANCE hInstance, HWND hWndParent, int nID) =
(IImgMergeWindow * (*)(HINSTANCE hInstance, HWND hWndParent, int nID))GetProcAddress(hModule, "WinIMerge_CreateWindow");
- if (!WinIMerge_CreateWindow ||
- (m_pImgMergeWindow = WinIMerge_CreateWindow(hModule, m_hWnd, AFX_IDW_PANE_FIRST)) == NULL)
+ if (WinIMerge_CreateWindow == nullptr ||
+ (m_pImgMergeWindow = WinIMerge_CreateWindow(hModule, m_hWnd, AFX_IDW_PANE_FIRST)) == nullptr)
{
FreeLibrary(hModule);
return FALSE;
IImgToolWindow * (*WinIMerge_CreateToolWindow)(HINSTANCE hInstance, HWND hWndParent, IImgMergeWindow *) =
(IImgToolWindow * (*)(HINSTANCE hInstance, HWND hWndParent, IImgMergeWindow *pImgMergeWindow))GetProcAddress(hModule, "WinIMerge_CreateToolWindow");
- if (!WinIMerge_CreateToolWindow ||
- (m_pImgToolWindow = WinIMerge_CreateToolWindow(hModule, m_wndLocationBar.m_hWnd, m_pImgMergeWindow)) == NULL)
+ if (WinIMerge_CreateToolWindow == nullptr ||
+ (m_pImgToolWindow = WinIMerge_CreateToolWindow(hModule, m_wndLocationBar.m_hWnd, m_pImgMergeWindow)) == nullptr)
{
return FALSE;
}
{
bool barIsCorrect = true;
CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
- if (!pInfo)
+ if (pInfo == nullptr)
barIsCorrect = false;
else
{
m_wndFilePathBar.SetText(pane, sText.c_str());
- SetTitle(NULL);
+ SetTitle(nullptr);
}
/// update splitting position for panels 1/2 and headerbar and statusbar
void CImgMergeFrame::UpdateHeaderSizes()
{
- if (IsWindowVisible() && m_pImgMergeWindow)
+ if (IsWindowVisible() && m_pImgMergeWindow != nullptr)
{
int w[3];
CRect rc, rcMergeWindow;
String sTitle;
String sFileName[3];
- if (lpszTitle)
+ if (lpszTitle != nullptr)
sTitle = lpszTitle;
else
{
{
String file;
String ext;
- paths::SplitFilename(m_filePaths[nBuffer], NULL, &file, &ext);
+ paths::SplitFilename(m_filePaths[nBuffer], nullptr, &file, &ext);
sFileName[nBuffer] += file;
if (!ext.empty())
{
sTitle = strutils::join(&sFileName[0], &sFileName[0] + nBuffers, _T(" - "));
}
CMDIChildWnd::SetTitle(sTitle.c_str());
- if (m_hWnd)
+ if (m_hWnd != nullptr)
SetWindowText(sTitle.c_str());
}
UpdateLastCompareResult();
}
}
- else if (m_pDirDoc)
+ else if (m_pDirDoc != nullptr)
m_pDirDoc->MoveToNextDiff(this);
}
m_pImgMergeWindow->GetNextDiffIndex() >= 0 ||
(m_pImgMergeWindow->GetDiffCount() > 0 && m_pImgMergeWindow->GetCurrentDiffIndex() == -1);
- if (!enabled && m_pDirDoc)
+ if (!enabled && m_pDirDoc != nullptr)
enabled = m_pDirDoc->MoveableToNextDiff();
pCmdUI->Enable(enabled);
UpdateLastCompareResult();
}
}
- else if (m_pDirDoc)
+ else if (m_pDirDoc != nullptr)
m_pDirDoc->MoveToPrevDiff(this);
}
m_pImgMergeWindow->GetPrevDiffIndex() >= 0 ||
(m_pImgMergeWindow->GetDiffCount() > 0 && m_pImgMergeWindow->GetCurrentDiffIndex() == -1);
- if (!enabled && m_pDirDoc)
+ if (!enabled && m_pDirDoc != nullptr)
enabled = m_pDirDoc->MoveableToPrevDiff();
pCmdUI->Enable(enabled);
const DWORD dwFlags[], const String strDesc[], const String& sReportFile /*= _T("")*/,
const PackingInfo * infoUnpacker /*= nullptr*/)
{
- if (!m_pMenus[MENU_MERGEVIEW])
+ if (m_pMenus[MENU_MERGEVIEW] == nullptr)
theApp.m_pDiffTemplate->m_hMenuShared = NewMergeViewMenu();
CMergeDoc * pMergeDoc = GetMergeDocForDiff<CMergeDoc>(theApp.m_pDiffTemplate, pDirDoc, nFiles);
FileLocation fileloc[3];
std::copy_n(ifileloc, nFiles, fileloc);
- ASSERT(pMergeDoc); // must ASSERT to get an answer to the question below ;-)
- if (!pMergeDoc)
+ ASSERT(pMergeDoc != nullptr); // must ASSERT to get an answer to the question below ;-)
+ if (pMergeDoc == nullptr)
return false; // when does this happen ?
// if an unpacker is selected, it must be used during LoadFromFile
const DWORD dwFlags[], const String strDesc[], const String& sReportFile /*= _T("")*/,
const PackingInfo * infoUnpacker /*= nullptr*/)
{
- if (!m_pMenus[MENU_HEXMERGEVIEW])
+ if (m_pMenus[MENU_HEXMERGEVIEW] == nullptr)
theApp.m_pHexMergeTemplate->m_hMenuShared = NewHexMergeViewMenu();
CHexMergeDoc *pHexMergeDoc = GetMergeDocForDiff<CHexMergeDoc>(theApp.m_pHexMergeTemplate, pDirDoc, nFiles);
if (!pHexMergeDoc)
const DWORD dwFlags[] /*= nullptr*/, const String strDesc[] /*= nullptr*/, const String& sReportFile /*= T("")*/, bool bRecurse /*= false*/, CDirDoc *pDirDoc/*= nullptr*/,
String prediffer /*= _T("")*/, const PackingInfo *infoUnpacker /*= nullptr*/)
{
- if (pDirDoc && !pDirDoc->CloseMergeDocs())
+ if (pDirDoc != nullptr && !pDirDoc->CloseMergeDocs())
return false;
FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL));
Merge7zFormatMergePluginScope scope(infoUnpacker);
PathContext tFiles;
- if (pFiles)
+ if (pFiles != nullptr)
tFiles = *pFiles;
bool bRO[3] = {0};
if (dwFlags)
paths::PATH_EXISTENCE pathsType = paths::GetPairComparability(tFiles, IsArchiveFile);
if (pathsType == paths::DOES_NOT_EXIST)
{
- if (!m_pMenus[MENU_OPENVIEW])
+ if (m_pMenus[MENU_OPENVIEW] == nullptr)
theApp.m_pOpenTemplate->m_hMenuShared = NewOpenViewMenu();
COpenDoc *pOpenDoc = static_cast<COpenDoc *>(theApp.m_pOpenTemplate->CreateNewDocument());
if (dwFlags)
// Determine if we want a new dirview open, now that we know if it was
// an archive. Don't open a new dirview if we are comparing files.
- if (!pDirDoc)
+ if (pDirDoc == nullptr)
{
if (pathsType == paths::IS_EXISTING_DIR)
{
CDirDoc::m_nDirsTemp = tFiles.GetSize();
- if (!m_pMenus[MENU_DIRVIEW])
+ if (m_pMenus[MENU_DIRVIEW] == nullptr)
theApp.m_pDirTemplate->m_hMenuShared = NewDirViewMenu();
pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->OpenDocumentFile(NULL));
}
// open the diff
if (pathsType == paths::IS_EXISTING_DIR)
{
- if (pDirDoc)
+ if (pDirDoc != nullptr)
{
// Anything that can go wrong inside InitCompare() will yield an
// exception. There is no point in checking return value.
{
for (auto pDoc : GetAllDirDocs())
{
- if (pDoc)
+ if (pDoc != nullptr)
{
CDirView *pView = pDoc->GetMainView();
- if (pView)
+ if (pView != nullptr)
pView->SetFont(m_lfDir);
}
}
// Create a new merge doc
DocClass::m_nBuffersTemp = nFiles;
DocClass *pMergeDoc = static_cast<DocClass*>(pTemplate->OpenDocumentFile(NULL));
- if (pMergeDoc)
+ if (pMergeDoc != nullptr)
{
pDirDoc->AddMergeDoc(pMergeDoc);
pMergeDoc->SetDirDoc(pDirDoc);
// update the editor scripts submenu
HMENU scriptsSubmenu = GetScriptsSubmenu(m_hMenuDefault);
- if (scriptsSubmenu != NULL)
+ if (scriptsSubmenu != nullptr)
CMergeEditView::createScriptsSubmenu(scriptsSubmenu);
UpdatePrediffersMenu();
}
// and we can get a MergeEditView from it, if it is a CChildFrame
// (DirViews use a different frame type)
CChildFrame * pFrame = dynamic_cast<CChildFrame *>(GetActiveFrame());
- if (!pFrame) return 0;
+ if (pFrame == nullptr) return nullptr;
// Try to get the active MergeEditView (ie, left or right)
if (pFrame->GetActiveView() != nullptr && pFrame->GetActiveView()->IsKindOf(RUNTIME_CLASS(CMergeEditView)))
{
void CMainFrame::UpdatePrediffersMenu()
{
CMenu* menu = GetMenu();
- if (menu == NULL)
+ if (menu == nullptr)
{
return;
}
HMENU hMainMenu = menu->m_hMenu;
HMENU prediffersSubmenu = GetPrediffersSubmenu(hMainMenu);
- if (prediffersSubmenu != NULL)
+ if (prediffersSubmenu != nullptr)
{
CMergeEditView * pEditView = GetActiveMergeEditView();
- if (pEditView)
+ if (pEditView != nullptr)
pEditView->createPrediffersSubmenu(prediffersSubmenu);
else
{
LRESULT CMainFrame::OnUser1(WPARAM wParam, LPARAM lParam)
{
CFrameWnd * pFrame = GetActiveFrame();
- if (pFrame)
+ if (pFrame != nullptr)
{
IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
- if (!pMergeDoc)
+ if (pMergeDoc == nullptr)
pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
- if (pMergeDoc)
+ if (pMergeDoc != nullptr)
pMergeDoc->CheckFileChanged();
}
return 0;
while (pChild)
{
CDocument* pDoc;
- if ((pDoc = pChild->GetActiveDocument()) != NULL)
+ if ((pDoc = pChild->GetActiveDocument()) != nullptr)
{
if (!pDoc->SaveModified())
return;
*/
void CMainFrame::OnSaveProject()
{
- if (!m_pMenus[MENU_OPENVIEW])
+ if (m_pMenus[MENU_OPENVIEW] == nullptr)
theApp.m_pOpenTemplate->m_hMenuShared = NewOpenViewMenu();
COpenDoc *pOpenDoc = static_cast<COpenDoc *>(theApp.m_pOpenTemplate->CreateNewDocument());
#endif
CFrameWnd * pFrame = GetActiveFrame();
- if (pFrame)
+ if (pFrame != nullptr)
{
IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
- if (!pMergeDoc)
+ if (pMergeDoc == nullptr)
pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
- if (pMergeDoc)
+ if (pMergeDoc != nullptr)
PostMessage(WM_USER+1);
}
}
{
CFrameWnd::OnUpdateFrameTitle(bAddToTitle);
- if (m_wndTabBar.m_hWnd)
+ if (m_wndTabBar.m_hWnd != nullptr)
m_wndTabBar.UpdateTabs();
}
{
// append the MRU submenu
HMENU hMenu = GetSubmenu(AfxGetMainWnd()->GetMenu()->m_hMenu, ID_FILE_NEW, false);
- if (hMenu == NULL)
+ if (hMenu == nullptr)
return;
// empty the menu
}
CFrameWnd *pActiveFrame = pMainFrame->GetActiveFrame();
- if (pActiveFrame)
+ if (pActiveFrame != nullptr)
{
if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
pMainFrame->MDISetMenu(pNewMergeMenu, NULL);
// Don't delete the old menu
// There is a bug in BCMenu or in Windows98 : the new menu does not
// appear correctly if we destroy the old one
- // if (pOldDefaultMenu)
+ // if (pOldDefaultMenu != nullptr)
// pOldDefaultMenu->DestroyMenu();
- // if (pOldMergeMenu)
+ // if (pOldMergeMenu != nullptr)
// pOldMergeMenu->DestroyMenu();
- // if (pOldDirMenu)
+ // if (pOldDirMenu = nullptr)
// pOldDirMenu->DestroyMenu();
// m_hMenuDefault is used to redraw the main menu when we close a child frame
// Prevents DLL hijacking
HMODULE hLibrary = GetModuleHandle(_T("kernel32.dll"));
BOOL (WINAPI *pfnSetSearchPathMode)(DWORD) = (BOOL (WINAPI *)(DWORD))GetProcAddress(hLibrary, "SetSearchPathMode");
- if (pfnSetSearchPathMode)
+ if (pfnSetSearchPathMode != nullptr)
pfnSetSearchPathMode(0x00000001L /*BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE*/ | 0x00008000L /*BASE_SEARCH_PATH_PERMANENT*/);
BOOL (WINAPI *pfnSetDllDirectoryA)(LPCSTR) = (BOOL (WINAPI *)(LPCSTR))GetProcAddress(hLibrary, "SetDllDirectoryA");
- if (pfnSetDllDirectoryA)
+ if (pfnSetDllDirectoryA != nullptr)
pfnSetDllDirectoryA("");
JumpList::SetCurrentProcessExplicitAppUserModelID(L"Thingamahoochie.WinMerge");
// UNICODE build, so will be the mutex name.
wsprintf(szMutexName, _T("%s-%s"), CMainFrame::szClassName, szDesktopName);
HANDLE hMutex = CreateMutex(NULL, FALSE, szMutexName);
- if (hMutex)
+ if (hMutex != nullptr)
WaitForSingleObject(hMutex, INFINITE);
if (bSingleInstance && GetLastError() == ERROR_ALREADY_EXISTS)
{
// Activate previous instance and send commandline to it
HWND hWnd = FindWindow(CMainFrame::szClassName, NULL);
- if (hWnd)
+ if (hWnd != nullptr)
{
if (IsIconic(hWnd))
ShowWindow(hWnd, SW_RESTORE);
m_fontGUI.CreateFontIndirect(&ncm.lfMenuFont);
}
- if (m_pSyntaxColors)
+ if (m_pSyntaxColors != nullptr)
Options::SyntaxColors::Load(GetOptionsMgr(), m_pSyntaxColors.get());
- if (m_pMarkers)
+ if (m_pMarkers != nullptr)
m_pMarkers->LoadFromRegistry();
- if (m_pLineFilters)
+ if (m_pLineFilters != nullptr)
m_pLineFilters->Initialize(GetOptionsMgr());
// If there are no filters loaded, and there is filter string in previous
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
{
- if (hMutex)
+ if (hMutex != nullptr)
{
ReleaseMutex(hMutex);
CloseHandle(hMutex);
// Set the menu
// Note : for Windows98 compatibility, use FromHandle and not Attach/Detach
CMenu * pNewMenu = CMenu::FromHandle(pMainFrame->m_hMenuDefault);
- pMainFrame->MDISetMenu(pNewMenu, NULL);
+ pMainFrame->MDISetMenu(pNewMenu, nullptr);
// The main window has been initialized, so activate and update it.
pMainFrame->ActivateFrame(cmdInfo.m_nCmdShow);
if (!ParseArgsAndDoOpen(cmdInfo, pMainFrame) && bCommandLineInvoke)
bContinue = false;
- if (hMutex)
+ if (hMutex != nullptr)
ReleaseMutex(hMutex);
// If user wants to cancel the compare, close WinMerge
CWnd* pParentWnd = CWnd::GetActiveWindow();
// Check whether an active window was retrieved successfully.
- if ( pParentWnd == NULL )
+ if ( pParentWnd == nullptr )
{
// Try to retrieve a handle to the last active popup.
CWnd * mainwnd = GetMainWnd();
- if (mainwnd)
+ if (mainwnd != nullptr)
pParentWnd = mainwnd->GetLastActivePopup();
}
String sPath = env::GetProgPath();
LANGID LangId = GetLangId();
sPath = paths::ConcatPath(sPath, DocsPath);
- if (helpLocation == NULL)
+ if (helpLocation == nullptr)
{
if (paths::DoesPathExist(sPath) == paths::IS_EXISTING_FILE)
::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOC, NULL);
static Merge7zFormatMergePluginImpl *GetInstance()
{
- if (!g_pluginformat)
+ if (g_pluginformat == nullptr)
{
g_pluginformat = new Merge7zFormatMergePluginImpl();
Poco::FastMutex::ScopedLock lock(g_mutex);
Merge7z::Format *Merge7zFormatMergePluginImpl::GuessFormat(const String& path)
{
Merge7zFormatMergePluginImpl *format = GetInstance();
- PluginInfo *plugin = NULL;
+ PluginInfo *plugin = nullptr;
if (format->m_infoUnpacker.m_PluginOrPredifferMode != PLUGIN_MANUAL)
plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_FOLDER_PACK_UNPACK", path);
else if (!format->m_infoUnpacker.m_PluginName.empty())
plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", format->m_infoUnpacker.m_PluginName);
- if (!plugin)
- return NULL;
+ if (plugin == nullptr)
+ return nullptr;
if (!plugin::InvokeIsFolder(path, plugin->m_lpDispatch))
- return NULL;
+ return nullptr;
format->m_plugin = plugin;
return format;
}
HRESULT Merge7zFormatMergePluginImpl::DeCompressArchive(HWND, LPCTSTR path, LPCTSTR folder)
{
- if (!m_plugin)
+ if (m_plugin == nullptr)
return E_FAIL;
paths::CreateIfNeeded(path);
int nChanged = 0;
return E_FAIL;
}
-Merge7z::Format::Inspector *Merge7zFormatMergePluginImpl::Open(HWND, LPCTSTR) { return NULL; }
-Merge7z::Format::Updater *Merge7zFormatMergePluginImpl::Update(HWND, LPCTSTR) { return NULL; }
+Merge7z::Format::Inspector *Merge7zFormatMergePluginImpl::Open(HWND, LPCTSTR) { return nullptr; }
+Merge7z::Format::Updater *Merge7zFormatMergePluginImpl::Update(HWND, LPCTSTR) { return nullptr; }
HRESULT Merge7zFormatMergePluginImpl::GetHandlerProperty(HWND, PROPID, PROPVARIANT *, VARTYPE) { return E_FAIL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerName(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerClassID(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerExtension(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerAddExtension(HWND) { return NULL; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerName(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerClassID(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerExtension(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerAddExtension(HWND) { return nullptr; }
VARIANT_BOOL Merge7zFormatMergePluginImpl::GetHandlerUpdate(HWND) { return VARIANT_FALSE; }
VARIANT_BOOL Merge7zFormatMergePluginImpl::GetHandlerKeepName(HWND) { return VARIANT_FALSE; }
, m_bHasSyncPoints(false)
, m_bAutoMerged(false)
, m_nGroups(0)
-, m_pView{0}
+, m_pView{nullptr}
{
DIFFOPTIONS options = {0};
Options::DiffOptions::Load(GetOptionsMgr(), options);
m_diffWrapper.SetOptions(&options);
- m_diffWrapper.SetPrediffer(NULL);
+ m_diffWrapper.SetPrediffer(nullptr);
}
/**
*/
CMergeDoc::~CMergeDoc()
{
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
{
m_pDirDoc->MergeDocClosing(this);
- m_pDirDoc = NULL;
+ m_pDirDoc = nullptr;
}
}
if (bChangedOriginal)
{
// If DirDoc contains diffs
- if (m_pDirDoc && m_pDirDoc->HasDiffs())
+ if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
{
for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
{
if (bModified && bSaveSuccess)
{
// If DirDoc contains compare results
- if (m_pDirDoc && m_pDirDoc->HasDiffs())
+ if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
{
for (int nBuffer1 = 0; nBuffer1 < m_nBuffers; nBuffer1++)
{
(bRModified && bRSaveSuccess))
{
// If directory compare has results
- if (m_pDirDoc && m_pDirDoc->HasDiffs())
+ if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
{
if (m_bEditAfterRescan[0] || m_bEditAfterRescan[1] || (m_nBuffers == 3 && m_bEditAfterRescan[2]))
FlushAndRescan(false);
void CMergeDoc::DirDocClosing(CDirDoc * pDirDoc)
{
ASSERT(m_pDirDoc == pDirDoc);
- m_pDirDoc = 0;
+ m_pDirDoc = nullptr;
// TODO (Perry 2003-03-30): perhaps merge doc should close now ?
}
if (std::find_if(nSuccess, nSuccess + m_nBuffers, [](DWORD d){return !FileLoadResult::IsOk(d);} ) != nSuccess + m_nBuffers)
{
CChildFrame *pFrame = GetParentFrame();
- if (pFrame)
+ if (pFrame != nullptr)
{
// Use verify macro to trap possible error in debug.
VERIFY(pFrame->DestroyWindow());
// Define the prediffer
PackingInfo * infoUnpacker = nullptr;
PrediffingInfo * infoPrediffer = nullptr;
- if (bFiltersEnabled && m_pDirDoc)
+ if (bFiltersEnabled && m_pDirDoc != nullptr)
{
m_pDirDoc->GetPluginManager().FetchPluginInfos(m_strBothFilenames, &infoUnpacker, &infoPrediffer);
m_diffWrapper.SetPrediffer(infoPrediffer);
// Force repaint of location pane to update it in case we had some warning
// dialog visible and it got painted before files were loaded
- if (m_pView[0][0])
+ if (m_pView[0][0] != nullptr)
m_pView[0][0]->RepaintLocationPane();
return true;
String sTitle;
String sFileName[3];
- if (lpszTitle)
+ if (lpszTitle != nullptr)
sTitle = lpszTitle;
else
{
// If archive, use archive path + folder + filename inside archive
// If desc text given, use it
PathContext paths = m_filePaths;
- if (m_pDirDoc && m_pDirDoc->IsArchiveFolders())
+ if (m_pDirDoc != nullptr && m_pDirDoc->IsArchiveFolders())
{
for (int i = 0; i < paths.GetSize(); i++)
m_pDirDoc->ApplyDisplayRoot(i, paths[i]);
String tdtag = _T("<td class=\"ln\">");
DWORD dwFlags = m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer]);
if (nBuffer == 0 &&
- (dwFlags & (LF_DIFF | LF_GHOST)) && (idx[nBuffer] == 0 ||
- !(m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer] - 1) & (LF_DIFF | LF_GHOST))))
+ (dwFlags & (LF_DIFF | LF_GHOST))!=0 && (idx[nBuffer] == 0 ||
+ (m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer] - 1) & (LF_DIFF | LF_GHOST))==0 ))
{
++nDiff;
tdtag += strutils::format(_T("<a name=\"d%d\" href=\"#d%d\">.</a>"), nDiff, nDiff);
}
- if (!(dwFlags & LF_GHOST) && m_pView[0][nBuffer]->GetViewLineNumbers())
+ if ((dwFlags & LF_GHOST)==0 && m_pView[0][nBuffer]->GetViewLineNumbers())
tdtag += strutils::format(_T("%d</td>"), m_ptBuf[nBuffer]->ComputeRealLine(idx[nBuffer]) + 1);
else
tdtag += _T("</td>");
void CMergeEditView::UpdateSiblingScrollPos (bool bHorz)
{
CSplitterWnd *pSplitterWnd = GetParentSplitter (this, false);
- if (pSplitterWnd != NULL)
+ if (pSplitterWnd != nullptr)
{
// See CSplitterWnd::IdFromRowCol() implementation for details
int nCurrentRow = (GetDlgCtrlID () - AFX_IDW_PANE_FIRST) / 16;
// for (int nCol = 0; nCol < nCols; nCol++)
// {
// CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
-// if (pSiblingView != NULL)
+// if (pSiblingView != nullptr)
// if (pSiblingView->GetSubLineCount() <= newTopSubLine)
// newTopSubLine = pSiblingView->GetSubLineCount()-1;
// }
if (!(nRow == nCurrentRow && nCol == nCurrentCol)) // We don't need to update ourselves
{
CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
- if (pSiblingView != NULL && pSiblingView->m_nThisGroup == m_nThisGroup)
+ if (pSiblingView != nullptr && pSiblingView->m_nThisGroup == m_nThisGroup)
pSiblingView->OnUpdateSibling (this, bHorz);
}
}
CSplitterWnd *pSplitterWnd = GetParentSplitter(this, false);
// pSplitterWnd is NULL if WinMerge started minimized.
- if (pSplitterWnd != NULL)
+ if (pSplitterWnd != nullptr)
{
int nRows = pSplitterWnd->GetRowCount ();
int nCols = pSplitterWnd->GetColumnCount ();
for (int nCol = 0; nCol < nCols; nCol++)
{
CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
- if (pSiblingView != NULL)
+ if (pSiblingView != nullptr)
pSiblingView->OnDisplayDiff(nDiff);
}
}
const DIFFRANGE * dfi = pd->m_diffList.LastSignificantDiffRange();
bool enabled;
- if (!dfi)
+ if (dfi == nullptr)
{
// There aren't any significant differences
enabled = false;
const DIFFRANGE * dfi = pd->m_diffList.FirstSignificantDiffRange();
bool enabled;
- if (!dfi)
+ if (dfi == nullptr)
{
// There aren't any significant differences
enabled = false;
const DIFFRANGE * dfi = pd->m_diffList.LastSignificant3wayDiffRange(nDiffType);
- if (!dfi)
+ if (dfi == nullptr)
{
// There aren't any significant differences
pCmdUI->Enable(false);
const DIFFRANGE * dfi = pd->m_diffList.FirstSignificant3wayDiffRange(nDiffType);
- if (!dfi)
+ if (dfi == nullptr)
{
// There aren't any significant differences
pCmdUI->Enable(false);
if (nPane == m_nThisPane)
continue;
CCrystalEditView *pView = GetGroupView(nPane);
- if (pView)
+ if (pView != nullptr)
pView->Invalidate();
}
}
{
CMergeDoc *pDoc = GetDocument();
CSplitterWnd *pSplitterWnd = GetParentSplitter(this, false);
- CMergeEditView *pCurrentView = NULL;
- if (pSplitterWnd)
+ CMergeEditView *pCurrentView = nullptr;
+ if (pSplitterWnd != nullptr)
pCurrentView = static_cast<CMergeEditView*>
(pSplitterWnd->GetActivePane());
*/
void CMergeEditView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
{
- if (pScrollBar == NULL)
+ if (pScrollBar == nullptr)
{
// Scroll did not come frome a scroll bar
// Find the appropriate scroll bar
*/
void CMergeEditView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
{
- if (pScrollBar == NULL)
+ if (pScrollBar == nullptr)
{
// Scroll did not come frome a scroll bar
// Find the appropriate scroll bar
{
// Must force recalculation due to caching of data in location pane.
CLocationView *pLocationView = GetDocument()->GetLocationView();
- if (pLocationView)
+ if (pLocationView != nullptr)
pLocationView->ForceRecalculate();
}
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- if (pView)
+ if (pView != nullptr)
pView->InvalidateScreenRect(false);
}
}
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- if (pView)
+ if (pView != nullptr)
pView->Invalidate();
}
}
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- if (pView)
+ if (pView != nullptr)
{
if (nLineIndex >= pView->GetLineCount())
return 0;
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- if (pView)
+ if (pView != nullptr)
pView->CCrystalTextView::InvalidateSubLineIndexCache( nLineIndex );
}
}
int nBottomLine /*= -1*/)
{
CMergeDoc *pDoc = GetDocument();
- if (pDoc == NULL)
+ if (pDoc == nullptr)
return;
CLocationView *pLocationView = pDoc->GetLocationView();
- if (pLocationView != NULL && IsWindow(pLocationView->GetSafeHwnd()))
+ if (pLocationView != nullptr && IsWindow(pLocationView->GetSafeHwnd()))
{
pLocationView->UpdateVisiblePos(nTopLine, nBottomLine);
}