void CCrystalEditView::
SetAlternateDropTarget (IDropTarget *pDropTarget)
{
- ASSERT(m_pDropTarget->m_pAlternateDropTarget == NULL);
+ ASSERT(m_pDropTarget->m_pAlternateDropTarget == nullptr);
m_pDropTarget->m_pAlternateDropTarget = pDropTarget;
m_pDropTarget->m_pAlternateDropTarget->AddRef();
}
if (CCrystalTextView::OnCreate (lpCreateStruct) == -1)
return -1;
- ASSERT (m_pDropTarget == NULL);
+ ASSERT (m_pDropTarget == nullptr);
m_pDropTarget = new CEditDropTargetImpl (this);
if (!m_pDropTarget->Register (this))
{
TRACE0 ("Warning: Unable to register drop target for ccrystaleditview.\n");
delete m_pDropTarget;
- m_pDropTarget = NULL;
+ m_pDropTarget = nullptr;
}
return 0;
return;
CWinApp *pApp = AfxGetApp ();
- ASSERT (pApp != NULL);
+ ASSERT (pApp != nullptr);
CEditReplaceDlg dlg (this);
LastSearchInfos * lastSearch = dlg.GetLastSearchInfos();
{
if (!cchNewText)
return DeleteCurrentSelection();
- ASSERT(pszNewText);
+ ASSERT(pszNewText != nullptr);
m_pTextBuffer->BeginUndoGroup();
LPTSTR pszNew;
if (!iconvert_new (sText, &pszNew, dlg.m_nSource, dlg.m_nDest, dlg.m_bAlpha != false))
{
- ASSERT (pszNew);
+ ASSERT (pszNew != nullptr);
m_pTextBuffer->BeginUndoGroup ();
m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_RECODE);
if (nPos != 0 || nEndChar != 0)
m_aLines[nEndLine].m_dwRevisionNumber = m_dwCurrentRevisionNumber;
- if (bHistory == false)
+ if (!bHistory)
{
delete paSavedRevisionNumbers;
return true;
m_dwCurrentRevisionNumber++;
m_aLines[nStartLine].m_dwRevisionNumber = m_dwCurrentRevisionNumber;
- if (bHistory == false)
+ if (!bHistory)
{
delete paSavedRevisionNumbers;
return true;
CCrystalTextView::CCrystalTextView ()
: m_nScreenChars(-1)
-, m_pFindTextDlg(NULL)
+, m_pFindTextDlg(nullptr)
{
memset(((CView*)this)+1, 0, sizeof(*this) - sizeof(class CView)); // AFX_ZERO_INIT_OBJECT (CView)
- m_rxnode = NULL;
- m_pszMatched = NULL;
+ m_rxnode = nullptr;
+ m_pszMatched = nullptr;
m_bSelMargin = true;
m_bViewLineNumbers = false;
m_bWordWrap = false;
//BEGIN SW
m_panSubLines = new CArray<int, int>();
m_panSubLineIndexCache = new CArray<int, int>();
- ASSERT( m_panSubLines );
- ASSERT( m_panSubLineIndexCache );
+ ASSERT( m_panSubLines != nullptr );
+ ASSERT( m_panSubLineIndexCache != nullptr );
m_panSubLines->SetSize( 0, 4096 );
m_panSubLineIndexCache->SetSize( 0, 4096 );
m_pstrIncrementalSearchString = new CString;
- ASSERT( m_pstrIncrementalSearchString );
+ ASSERT( m_pstrIncrementalSearchString != nullptr );
m_pstrIncrementalSearchStringOld = new CString;
- ASSERT( m_pstrIncrementalSearchStringOld );
+ ASSERT( m_pstrIncrementalSearchStringOld != nullptr );
//END SW
m_ParseCookies = new vector<DWORD>;
m_pnActualLineLength = new vector<int>;
m_bSingle = false; // needed to be set in descendat classes
m_bRememberLastPos = false;
- m_pColors = NULL;
+ m_pColors = nullptr;
m_nLastLineIndexCalculatedSubLineIndex = -1;
}
CCrystalTextView::~CCrystalTextView ()
{
- ASSERT (m_hAccel == NULL);
- ASSERT (m_pCacheBitmap == NULL);
- ASSERT (m_pTextBuffer == NULL); // Must be correctly detached
+ ASSERT (m_hAccel == nullptr);
+ ASSERT (m_pCacheBitmap == nullptr);
+ ASSERT (m_pTextBuffer == nullptr); // Must be correctly detached
delete m_pFindTextDlg;
- if (m_pszLastFindWhat != NULL)
+ if (m_pszLastFindWhat != nullptr)
{
free (m_pszLastFindWhat);
- m_pszLastFindWhat=NULL;
+ m_pszLastFindWhat=nullptr;
}
if (m_rxnode)
{
RxFree (m_rxnode);
- m_rxnode = NULL;
+ m_rxnode = nullptr;
}
if (m_pszMatched)
{
free(m_pszMatched); // Allocated by _tcsdup()
- m_pszMatched = NULL;
+ m_pszMatched = nullptr;
}
//BEGIN SW
if( m_panSubLines )
m_pstrIncrementalSearchStringOld = NULL;
}
//END SW
- ASSERT(m_ParseCookies);
+ ASSERT(m_ParseCookies != nullptr);
delete m_ParseCookies;
m_ParseCookies = NULL;
- ASSERT(m_pnActualLineLength);
+ ASSERT(m_pnActualLineLength != nullptr);
delete m_pnActualLineLength;
m_pnActualLineLength = NULL;
delete m_pIcons;
m_rcPrintArea = m_ptPageArea;
CSize szTopLeft, szBottomRight;
CWinApp *pApp = AfxGetApp ();
- ASSERT (pApp != NULL);
+ ASSERT (pApp != nullptr);
GetPrintMargins (szTopLeft.cx, szTopLeft.cy, szBottomRight.cx, szBottomRight.cy);
pdc->HIMETRICtoLP (&szTopLeft);
pdc->HIMETRICtoLP (&szBottomRight);
void CCrystalTextView::
OnBeginPrinting (CDC * pdc, CPrintInfo * pInfo)
{
- ASSERT (m_pPrintFont == NULL);
+ ASSERT (m_pPrintFont == nullptr);
CFont *pDisplayFont = GetFont ();
LOGFONT lf;
{
if (pUpdateSource != this)
{
- ASSERT (pUpdateSource != NULL);
+ ASSERT (pUpdateSource != nullptr);
ASSERT_KINDOF (CCrystalTextView, pUpdateSource);
if (bHorz)
{
if (CView::OnCreate (lpCreateStruct) == -1)
return -1;
- ASSERT (m_hAccel == NULL);
+ ASSERT (m_hAccel == nullptr);
// vvv GetResourceHandle () ???
HINSTANCE hInst = AfxFindResourceHandle (MAKEINTRESOURCE(IDR_DEFAULT_ACCEL), RT_ACCELERATOR);
- ASSERT (hInst);
+ ASSERT (hInst != nullptr);
m_hAccel =::LoadAccelerators (hInst, MAKEINTRESOURCE (IDR_DEFAULT_ACCEL));
- ASSERT (m_hAccel != NULL);
+ ASSERT (m_hAccel != nullptr);
return 0;
}
}
else
{
- ASSERT (pszFindWhere != NULL);
- ASSERT (pszFindWhat != NULL);
+ ASSERT (pszFindWhere != nullptr);
+ ASSERT (pszFindWhat != nullptr);
int nCur = 0;
int nLength = (int) _tcslen (pszFindWhat);
LPCTSTR pszFindWhereOrig = pszFindWhere;
{
CPoint ptCurrentPos = ptStartPosition;
- ASSERT (pszText != NULL && _tcslen (pszText) > 0);
+ ASSERT (pszText != nullptr && _tcslen (pszText) > 0);
ASSERT_VALIDTEXTPOS (ptCurrentPos);
ASSERT_VALIDTEXTPOS (ptBlockBegin);
ASSERT_VALIDTEXTPOS (ptBlockEnd);
OnEditFind ()
{
CWinApp *pApp = AfxGetApp ();
- ASSERT (pApp != NULL);
+ ASSERT (pApp != nullptr);
if (!m_pFindTextDlg)
m_pFindTextDlg = new CFindTextDlg (this);
OnFilePageSetup ()
{
CWinApp *pApp = AfxGetApp ();
- ASSERT (pApp != NULL);
+ ASSERT (pApp != nullptr);
CPageSetupDialog dlg;
PRINTDLG pd;
if (m_CurSourceDef->type == SRC_C)
{
CDocument *pDoc = GetDocument ();
- ASSERT (pDoc);
+ ASSERT (pDoc != nullptr);
CString sFilePath = pDoc->GetPathName (), sOriginalPath = sFilePath;
if (!_tcsicmp (sFilePath.Right (2), _T (".c")))
{
void CCrystalTextView::
OnSelMargin ()
{
- ASSERT (m_CurSourceDef);
+ ASSERT (m_CurSourceDef != nullptr);
if (m_bSelMargin)
{
m_CurSourceDef->flags &= ~SRCOPT_SELMARGIN;
void CCrystalTextView::
OnWordWrap ()
{
- ASSERT (m_CurSourceDef);
+ ASSERT (m_CurSourceDef != nullptr);
if (m_bWordWrap)
{
m_CurSourceDef->flags &= ~SRCOPT_WORDWRAP;
{
static bool bUpdatedAtLastCall = false;
- ASSERT( pStatusBar && IsWindow( pStatusBar->m_hWnd ) );
+ ASSERT( pStatusBar != nullptr && IsWindow( pStatusBar->m_hWnd ) );
if( !pStatusBar || !IsWindow( pStatusBar->m_hWnd ) )
return;
, m_bFound(false)
, lastSearch({0})
{
- ASSERT (pBuddy != NULL);
+ ASSERT (pBuddy != nullptr);
}
void CEditReplaceDlg::
bool CEditReplaceDlg::
DoHighlightText ( bool bNotifyIfNotFound )
{
- ASSERT (m_pBuddy != NULL);
+ ASSERT (m_pBuddy != nullptr);
DWORD dwSearchFlags = 0;
if (m_bMatchCase)
dwSearchFlags |= FIND_MATCH_CASE;
bool CEditReplaceDlg::
DoReplaceText (LPCTSTR /*pszNewText*/, DWORD dwSearchFlags)
{
- ASSERT (m_pBuddy != NULL);
+ ASSERT (m_pBuddy != nullptr);
// m_pBuddy->m_nLastFindWhatLen
bool bFound;
// CFindTextDlg dialog
CFindTextDlg::CFindTextDlg (CCrystalTextView * pBuddy)
-: CDialog (CFindTextDlg::IDD, NULL)
+: CDialog (CFindTextDlg::IDD, nullptr)
, m_pBuddy(pBuddy)
, m_nDirection(1)
, m_bMatchCase(false)
, m_bNoClose(false)
, lastSearch({0})
{
- ASSERT (pBuddy != NULL);
+ ASSERT (pBuddy != nullptr);
Create(CFindTextDlg::IDD,pBuddy);
}
m_nDirection = nDirection;
UpdateLastSearch ();
- ASSERT (m_pBuddy != NULL);
+ ASSERT (m_pBuddy != nullptr);
if (!m_pBuddy->FindText(GetLastSearchInfos()))
{
EDITPADC_CLASS void FillComboBox (CComboBox &Control, LPCTSTR *pszItems)
{
Control.ResetContent();
- ASSERT (pszItems);
+ ASSERT (pszItems != nullptr);
while (*pszItems)
Control.AddString(*pszItems++);
}
void CCrystalParser::WrapLine( int nLineIndex, int nMaxLineWidth, int *anBreaks, int &nBreaks )
{
// The parser must be attached to a view!
- ASSERT( m_pTextView );
+ ASSERT( m_pTextView != nullptr );
int nLineLength = m_pTextView->GetLineLength( nLineIndex );
int nTabWidth = m_pTextView->GetTabSize();
CCrystalTextBlock::CCrystalTextBlock( TEXTBLOCK *pTextBlock, int &rnActualItems )
: m_rnActualItems( rnActualItems )
{
- ASSERT( pTextBlock );
+ ASSERT( pTextBlock != nullptr );
m_pTextBlock = pTextBlock;
}
void CGotoDlg::OnOK ()
{
CDialog::OnOK ();
- ASSERT (m_pBuddy != NULL);
+ ASSERT (m_pBuddy != nullptr);
m_pBuddy->GoToLine (_ttoi (m_sNumber), _tcschr (_T ("+-"), *(LPCTSTR)m_sNumber) != NULL);
}
#define DEFINE_BLOCK(pos, colorindex) \
ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != NULL)\
+if (pBuf != nullptr)\
{\
if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
void
RegValInit (RegVal *pValData)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
pValData->dwType = REG_NONE;
}
void
RegValFree (RegVal *pValData)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
|| pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ
|| pValData->dwType == REG_BINARY)
bool
RegValGetNumber (const RegVal *pValData, DWORD *pdwNumber)
{
- ASSERT (pValData &&pdwNumber);
+ ASSERT (pValData != nullptr && pdwNumber != nullptr);
if (pValData->dwType == REG_DWORD)
{
*pdwNumber = pValData->dwNumber;
bool
RegValGetBinary (const RegVal *pValData, LPBYTE pbyteData, DWORD dwSize)
{
- ASSERT (pValData &&pbyteData);
+ ASSERT (pValData != nullptr && pbyteData != nullptr);
if (pValData->dwType == REG_BINARY &&dwSize >= pValData->dwSize)
{
memcpy (pbyteData, pValData->pbyteData, pValData->dwSize);
bool
RegValGetNewBinary (const RegVal *pValData, LPBYTE *pbyteData, DWORD *pdwSize)
{
- ASSERT (pValData &&pbyteData);
+ ASSERT (pValData != nullptr && pbyteData != nullptr);
if (pValData->dwType == REG_BINARY)
{
LPBYTE pbyteNewData = (LPBYTE) malloc (pValData->dwSize);
- if (pbyteNewData)
+ if (pbyteNewData != nullptr)
{
*pbyteData = pbyteNewData;
*pdwSize = pValData->dwSize;
bool
RegValGetNewString (const RegVal *pValData, LPTSTR *pszString, DWORD *pdwLength)
{
- ASSERT (pValData &&pszString);
+ ASSERT (pValData != nullptr && pszString != nullptr);
if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
|| pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
{
LPTSTR pszNewString = (LPTSTR) malloc (pValData->dwLength + 1);
- if (pszNewString)
+ if (pszNewString != nullptr)
{
*pszString = pszNewString;
- if (pdwLength)
+ if (pdwLength != nullptr)
{
*pdwLength = pValData->dwLength;
}
bool
RegValGetString (const RegVal *pValData, LPTSTR pszString, DWORD dwLength)
{
- ASSERT (pValData &&pszString);
+ ASSERT (pValData != nullptr && pszString != nullptr);
if ((pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
|| pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
&& dwLength >= pValData->dwLength)
bool
RegValGetStringArr (const RegVal *pValData, LPTSTR pszStrings[], DWORD dwCount)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
if (pValData->dwType == REG_MULTI_SZ)
{
LPCTSTR pszString0;
bool
RegValGetNewStringArr (const RegVal *pValData, LPTSTR **pszStrings, DWORD *pdwCount)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
if (pValData->dwType == REG_MULTI_SZ)
{
LPTSTR pszString;
bool
RegValGetString (const RegVal *pValData, CString &sString)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
|| pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
{
bool
RegValGetStringArr (const RegVal *pValData, CStringArray &arrString)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
if (pValData->dwType == REG_MULTI_SZ)
{
arrString.RemoveAll ();
void
RegValSetNumber (RegVal *pValData, DWORD dwNumber)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
pValData->dwType = REG_DWORD;
pValData->dwNumber = dwNumber;
}
bool
RegValSetBinary (RegVal *pValData, const LPBYTE pbyteData, DWORD dwSize)
{
- ASSERT (pValData &&pbyteData);
+ ASSERT (pValData != nullptr && pbyteData != nullptr);
pValData->pbyteData = (LPBYTE) malloc (dwSize);
- if (pValData->pbyteData)
+ if (pValData->pbyteData != nullptr)
{
pValData->dwSize = dwSize;
pValData->dwType = REG_BINARY;
bool
RegValSetString (RegVal *pValData, LPCTSTR pszString)
{
- ASSERT (pValData &&pszString);
+ ASSERT (pValData != nullptr && pszString != nullptr);
DWORD dwLength = (DWORD) _tcslen (pszString) + 1;
pValData->pszString = (LPTSTR) malloc (dwLength);
- if (pValData->pszString)
+ if (pValData->pszString != nullptr)
{
pValData->dwLength = dwLength;
pValData->dwType = REG_SZ;
bool
RegValSetStringArr (RegVal *pValData, const LPCTSTR pszStrings[], DWORD dwCount)
{
- ASSERT (pValData &&pszStrings);
+ ASSERT (pValData != nullptr && pszStrings != nullptr);
DWORD i, dwSize = 1;
- if (dwCount)
+ if (dwCount != 0)
{
for (i = 0; i < dwCount; i++)
{
dwSize++;
}
pValData->pbyteData = (LPBYTE) malloc (dwSize);
- if (pValData->pbyteData)
+ if (pValData->pbyteData != nullptr)
{
pValData->dwSize = dwSize;
pValData->dwType = REG_MULTI_SZ;
LPBYTE pbyteData = pValData->pbyteData;
- if (dwCount)
+ if (dwCount != 0)
{
for (i = 0; i < dwCount; i++)
{
bool
RegValSetStringArr (RegVal *pValData, const CStringArray &arrString)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
DWORD i, dwSize = 1, dwCount = (DWORD) arrString.GetSize ();
- if (dwCount)
+ if (dwCount != 0)
{
for (i = 0; i < dwCount; i++)
{
dwSize++;
}
pValData->pbyteData = (LPBYTE) malloc (dwSize);
- if (pValData->pbyteData)
+ if (pValData->pbyteData != nullptr)
{
pValData->dwSize = dwSize;
pValData->dwType = REG_MULTI_SZ;
LPBYTE pbyteData = pValData->pbyteData;
- if (dwCount)
+ if (dwCount != 0)
{
for (i = 0; i < dwCount; i++)
{
bool
RegLoadVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, RegVal *pValData)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwSize;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
|| dwType == REG_MULTI_SZ || dwType == REG_BINARY)
{
LPBYTE pbyteData = (LPBYTE) malloc (dwSize);
- if (pbyteData)
+ if (pbyteData != nullptr)
{
if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, pbyteData, &dwSize) == ERROR_SUCCESS)
{
bool
RegLoadNumber (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, DWORD *pdwNumber)
{
- ASSERT (pdwNumber);
+ ASSERT (pdwNumber != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwSize;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
bool
RegLoadBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE pbyteData, DWORD dwSize)
{
- ASSERT (pbyteData);
+ ASSERT (pbyteData != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwRealSize;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
bool
RegLoadNewBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE *pbyteData, DWORD *pdwSize)
{
- ASSERT (pbyteData);
+ ASSERT (pbyteData != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwRealSize;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
bool
RegLoadString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR pszString, DWORD dwLength)
{
- ASSERT (pszString);
+ ASSERT (pszString != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwRealLength;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
bool
RegLoadNewString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR *pszString, DWORD *pdwLength)
{
- ASSERT (pszString);
+ ASSERT (pszString != nullptr);
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
DWORD dwType, dwRealLength;
if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
bool
RegSaveVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, const RegVal *pValData)
{
- ASSERT (pValData);
+ ASSERT (pValData != nullptr);
HKEY hSubKey = pszSubKey ? RegCreate (hKey, pszSubKey, KEY_WRITE) : hKey;
- if (hSubKey)
+ if (hSubKey != nullptr)
{
LONG lResult;
if (pValData->dwType == REG_DWORD)
for(m=0;m<=numSubMenus;++m){
if(submenu==m_AllSubMenus[m] ||
static_cast<UINT>(reinterpret_cast<uintptr_t>(submenu)) == static_cast<UINT>(reinterpret_cast<uintptr_t>(m_AllSubMenus[m])))
- return(TRUE);
+ return(true);
}
- return(FALSE);
+ return(false);
}
BOOL BCMenu::DestroyMenu()
void BCMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)
{
- ASSERT(lpDIS != NULL);
+ ASSERT(lpDIS != nullptr);
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
if(pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)DrawItem_Win9xNT2000(lpDIS);
else{
void BCMenu::DrawItem_Win9xNT2000 (LPDRAWITEMSTRUCT lpDIS)
{
- ASSERT(lpDIS != NULL);
+ ASSERT(lpDIS != nullptr);
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CRect rect;
UINT state0 = reinterpret_cast<BCMenuData*>(lpDIS->itemData)->nFlags;
void BCMenu::DrawItem_Theme(LPDRAWITEMSTRUCT lpDIS)
{
- ASSERT(lpDIS != NULL);
+ ASSERT(lpDIS != nullptr);
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
HDC hDC = lpDIS->hDC;
CRect rect(&lpDIS->rcItem);
m_MenuList.Add(mdata);
}
- ASSERT(mdata);
+ ASSERT(mdata != nullptr);
if(lpstrText)
mdata->SetWideString(lpstrText); //SK: modified for dynamic allocation
mdata->menuIconNormal = -1;
else{
UINT uiLoc;
BCMenu* pMenu = FindMenuOption(id,uiLoc);
- if(NULL!=pMenu) returnflag = pMenu->GetMenuText(uiLoc,string);
+ if(pMenu != nullptr) returnflag = pMenu->GetMenuText(uiLoc,string);
}
return(returnflag);
}
}
else{
BCMenu* pSubMenu = static_cast<BCMenu*>(GetSubMenu(uiId));
- if(NULL==pSubMenu){
+ if(pSubMenu == nullptr){
UINT uiCommandId = GetMenuItemID(uiId);
for(int i=0;i<m_MenuList.GetSize(); i++){
if(m_MenuList[i]->nID==uiCommandId){
}
else{
BCMenu* pSubMenu = static_cast<BCMenu*>(GetSubMenu(uiId));
- if(NULL==pSubMenu){
+ if(pSubMenu == nullptr){
UINT uiCommandId = GetMenuItemID(uiId);
for(int i=0;i<m_MenuList.GetSize(); i++){
if(m_MenuList[i]->nID==uiCommandId){
else{
UINT uiLoc;
BCMenu* pMenu = FindMenuOption(id,uiLoc);
- if(NULL!=pMenu) returnflag = pMenu->SetMenuText(uiLoc,string);
+ if(pMenu != nullptr) returnflag = pMenu->SetMenuText(uiLoc,string);
}
return(returnflag);
}
bool
CMoveConstraint::InitializeOriginalSize(HWND hwndDlg)
{
- ASSERT(hwndDlg && !m_hwndDlg);
+ ASSERT(hwndDlg != nullptr && m_hwndDlg == nullptr);
m_hwndDlg = hwndDlg;
return m_nOrigX != 0; // if 0, we didn't get WM_SIZE so we don't know the original size
bool
CMoveConstraint::InitializeOriginalSize(CWnd * pParent)
{
- ASSERT(pParent);
+ ASSERT(pParent != nullptr);
return InitializeOriginalSize(pParent->m_hWnd);
}
void
CMoveConstraint::InitializeSpecificSize(CWnd * pDlg, int nWidth, int nHeight)
{
- ASSERT(pDlg);
+ ASSERT(pDlg != nullptr);
InitializeSpecificSize(pDlg->m_hWnd, nWidth, nHeight);
}
bool
CMoveConstraint::InitializeCurrentSize(CWnd * pDlg)
{
- ASSERT(pDlg);
+ ASSERT(pDlg != nullptr);
return InitializeCurrentSize(pDlg->m_hWnd);
}
CMoveConstraint::
Constrain(CWnd * pWnd, double fLeftX, double fExpandX, double fAboveY, double fExpandY)
{
- ASSERT(pWnd);
+ ASSERT(pWnd != nullptr);
DoConstrain(pWnd, pWnd->m_hWnd, fLeftX, fExpandX, fAboveY, fExpandY);
}
Constraint & constraint = constraintList.GetAt(pos);
if (constraint.m_hwndChild)
continue;
- ASSERT(constraint.m_pWnd);
+ ASSERT(constraint.m_pWnd != nullptr);
if (constraint.m_pWnd->m_hWnd)
{
constraint.m_hwndChild = constraint.m_pWnd->m_hWnd;
size_t len = eol - data;
if (len >= sizeof buf)
{
- ASSERT(FALSE);
+ ASSERT(false);
break;
}
memcpy(buf, data, len);
int dummy;
tci.mask = TCIF_PARAM;
GetItem(item, &tci);
- if (MDIFrameList.Lookup((HWND)tci.lParam, dummy) == FALSE)
+ if (!MDIFrameList.Lookup((HWND)tci.lParam, dummy))
{
DeleteItem(item);
if (GetItemCount() == 0)
*/
inline void CMessageBoxDialog::SetMessageIcon ( HICON hIcon )
{
- ASSERT(hIcon != NULL);
+ ASSERT(hIcon != nullptr);
// Save the icon.
m_hIcon = hIcon;
// Try to load the given icon.
m_hIcon = AfxGetApp()->LoadIcon(nIconID);
- ASSERT(m_hIcon != NULL);
+ ASSERT(m_hIcon != nullptr);
}
/*
// Try to retrieve a handle to the application object.
CWinApp* pApplication = AfxGetApp();
- ASSERT(pApplication);
+ ASSERT(pApplication != nullptr);
// Check whether a handle was retrieved.
- if ( pApplication != NULL )
+ if ( pApplication != nullptr )
{
// Create the registry key for this application.
CString strKey = _T("Software\\");
// Try to retrieve a handle for the button.
CWnd* pButtonWnd = GetDlgItem(iter->nID);
- ASSERT(pButtonWnd);
+ ASSERT(pButtonWnd != nullptr);
// Check whether the handle was retrieved.
- if ( pButtonWnd != NULL )
+ if ( pButtonWnd != nullptr )
{
// Disable the button.
pButtonWnd->EnableWindow(FALSE);
// Try to retrieve a handle to access the button.
CWnd* pButtonWnd = GetDlgItem(iter->nID);
- ASSERT(pButtonWnd);
+ ASSERT(pButtonWnd != nullptr);
// Check whether a handle was retrieved.
- if ( pButtonWnd != NULL )
+ if ( pButtonWnd != nullptr )
{
// Enable the button again.
pButtonWnd->EnableWindow(TRUE);
// Try to determine the control element for the checkbox.
CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
- ASSERT(pCheckboxWnd);
+ ASSERT(pCheckboxWnd != nullptr);
// Check whether the control was retrieved.
- if ( pCheckboxWnd != NULL )
+ if ( pCheckboxWnd != nullptr )
{
// Move the checkbox window.
pCheckboxWnd->MoveWindow(nXPosition, nYPosition, m_sCheckbox.cx,
// Try to retrieve the handle to access the button.
CWnd* pButton = GetDlgItem(iter->nID);
- ASSERT(pButton);
+ ASSERT(pButton != nullptr);
// Check whether the handle was retrieved successfully.
- if ( pButton != NULL )
+ if ( pButton != nullptr )
{
// Move the button.
pButton->MoveWindow(nXButtonPosition, nYButtonPosition,
Free();
HRESULT hr = OleLoadPicture(pstm, 0, FALSE,
IID_IPicture, (void**)&m_spIPicture);
- ASSERT(SUCCEEDED(hr) && m_spIPicture);
+ ASSERT(SUCCEEDED(hr) && m_spIPicture != nullptr);
return true;
}
//
bool CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
{
- ASSERT(pDC);
+ ASSERT(pDC != nullptr);
if (rc.IsRectNull()) {
CSize sz = GetImageSize(pDC);
htiSel = m_tcPages.GetChildItem(htiSel);
CPropertyPage* pPage = (CPropertyPage*)m_tcPages.GetItemData(htiSel);
- ASSERT (pPage);
+ ASSERT (pPage != nullptr);
- if (pPage)
+ if (pPage != nullptr)
{
m_pphost.SetActivePage(pPage, FALSE);
if (m_nSelIndex != -1)
{
CPropertyPage* pPage1 = GetActivePage();
- ASSERT (pPage1);
+ ASSERT (pPage1 != nullptr);
- if (pPage1)
+ if (pPage1 != nullptr)
{
pPage1->ShowWindow(SW_HIDE);
pPage1->OnKillActive();
if (m_nSelIndex != -1)
{
CPropertyPage* pPage = GetActivePage();
- ASSERT (pPage);
+ ASSERT (pPage != nullptr);
- if (pPage)
+ if (pPage != nullptr)
pPage->MoveWindow(0, 0, cx, cy, TRUE);
}
}
return;
// enhance with proportional horizontal scroll synchronization
- ASSERT(pScrollBar != NULL);
+ ASSERT(pScrollBar != nullptr);
int curCol = ::GetDlgCtrlID(pScrollBar->m_hWnd) - AFX_IDW_HSCROLL_FIRST;
ASSERT(curCol >= 0 && curCol < m_nMaxCols);
CSplitterWnd::OnVScroll(nSBCode, nPos, pScrollBar);
// enhance with proportional vertical scroll synchronization
- ASSERT(pScrollBar != NULL);
+ ASSERT(pScrollBar != nullptr);
int curRow = ::GetDlgCtrlID(pScrollBar->m_hWnd) - AFX_IDW_VSCROLL_FIRST;
ASSERT(curRow >= 0 && curRow < m_nMaxRows);
// ComboBox's edit control is alway 1001.
CWnd *pWnd = m_bComboBoxEx ? this->GetEditCtrl() : GetDlgItem(1001);
- ASSERT(NULL != pWnd);
+ ASSERT(pWnd != nullptr);
SHAutoComplete(pWnd->m_hWnd, SHACF_FILESYSTEM);
break;
}
bool m_bMemDC; // `true` if CDC really is a Memory DC.
public:
- CMyMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
+ CMyMemDC(CDC* pDC, const CRect* pRect = nullptr) : CDC()
{
- ASSERT(pDC != NULL);
+ ASSERT(pDC != nullptr);
// Some initialization
m_pDC = pDC;
- m_oldBitmap = NULL;
+ m_oldBitmap = nullptr;
m_bMemDC = !pDC->IsPrinting();
// Get the rectangle to draw
- if (pRect == NULL) {
+ if (pRect == nullptr) {
pDC->GetClipBox(&m_rect);
} else {
m_rect = *pRect;
//
void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
{
- if (m_pDockBar != NULL)
+ if (m_pDockBar != nullptr)
{
// start the drag
- ASSERT(m_pDockContext != NULL);
+ ASSERT(m_pDockContext != nullptr);
ClientToScreen(&point);
m_pDockContext->StartDrag(point);
}
void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
- if (m_pDockBar != NULL)
+ if (m_pDockBar != nullptr)
{
// toggle docking
- ASSERT(m_pDockContext != NULL);
+ ASSERT(m_pDockContext != nullptr);
m_pDockContext->ToggleDocking();
}
else
{
// automatic child resizing - only one child is allowed
CWnd* pWnd = GetWindow(GW_CHILD);
- if (pWnd != NULL)
+ if (pWnd != nullptr)
{
pWnd->MoveWindow(0, 0, cx, cy);
- ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
+ ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == nullptr);
}
}
}
rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
break;
default:
- ASSERT(FALSE); // invalid hit test code
+ ASSERT(false); // invalid hit test code
}
- return TRUE;
+ return true;
}
UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
if (nEdge == 1) return HTTOP;
if (nEdge == 2) return HTRIGHT;
if (nEdge == 3) return HTBOTTOM;
- ASSERT(FALSE); // invalid edge code
+ ASSERT(false); // invalid edge code
return HTNOWHERE;
}
// place your SaveState or GlobalSaveState call in
// CMainFrame's OnClose() or DestroyWindow(), not in OnDestroy()
ASSERT_VALID(this);
- ASSERT(GetSafeHwnd());
+ ASSERT(GetSafeHwnd() != nullptr);
CWinApp* pApp = AfxGetApp();
LPCTSTR lpszProfileName)
{
POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
+ while (pos != nullptr)
{
CSizingControlBar* pBar =
static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
- ASSERT(pBar != NULL);
+ ASSERT(pBar != nullptr);
if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
pBar->LoadState(lpszProfileName);
}
LPCTSTR lpszProfileName)
{
POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
+ while (pos != nullptr)
{
CSizingControlBar* pBar =
static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
- ASSERT(pBar != NULL);
+ ASSERT(pBar != nullptr);
if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
pBar->SaveState(lpszProfileName);
}
// good idea to ASSERT that the assumption holds.
if (wbuff[n-1] == 0 && lpd[len-1] != 0)
{
- //assert(FALSE);
+ //assert(false);
*lossy = true;
--n;
}
*/
if (wbuff[n-1] == 0 && lpd[len-1] != 0)
{
- //assert(FALSE);
+ //assert(false);
*lossy = true;
--n;
}
bool linesMatch = true; // set to false when non-matching line is found.
int line = StartPos;
- while (line <= EndPos && linesMatch == true)
+ while (line <= EndPos && linesMatch)
{
size_t len = files[FileNo].linbuf[line + 1] - files[FileNo].linbuf[line];
const char *string = files[FileNo].linbuf[line];
*/
bool DiffFileInfo::IsEditableEncoding() const
{
- return encoding.m_bom == false;
+ return !encoding.m_bom;
}
{
// If we are saving user files
// we need an unpacker/packer, at least a "do nothing" one
- ASSERT(infoUnpacker != NULL);
+ ASSERT(infoUnpacker != nullptr);
// repack the file here, overwrite the temporary file we did save in
String csTempFileName = sIntermediateFilename;
infoUnpacker->subcode = m_unpackerSubcode;
m_pDiffParm->context->m_pCompareStats->SetCompareState(CompareStats::STATE_START);
- if (m_bOnlyRequested == false)
+ if (!m_bOnlyRequested)
m_threads[0].start(DiffThreadCollect, m_pDiffParm.get());
else
{
PathContext paths;
DiffFuncStruct *myStruct = static_cast<DiffFuncStruct *>(pParam);
- assert(myStruct->bOnlyRequested == false);
+ assert(!myStruct->bOnlyRequested);
// Stash abortable interface into context
myStruct->context->SetAbortable(myStruct->m_pAbortgate);
// We use the same plugin for both files, so it must be defined before
// second file
- assert(m_infoPrediffer->bToBeScanned == false);
+ assert(!m_infoPrediffer->bToBeScanned);
}
}
bool linesMatch = true; // set to false when non-matching line is found.
int line = StartPos;
- while (line <= EndPos && linesMatch == true)
+ while (line <= EndPos && linesMatch)
{
size_t len = files[FileNo].linbuf[line + 1] - files[FileNo].linbuf[line];
const char *string = files[FileNo].linbuf[line];
PackingInfo * unpacker;
PrediffingInfo * prediffer;
const_cast<CDiffContext&>(ctxt).FetchPluginInfos(filteredFilenames, &unpacker, &prediffer);
- if (prediffer->bToBeScanned == 1 || prediffer->pluginName.empty() == false)
+ if (prediffer->bToBeScanned == 1 || !prediffer->pluginName.empty())
nPredifferYes ++;
else
nPredifferNo ++;
*/
void CDirColsDlg::OnUp()
{
- MoveSelectedItems(TRUE);
+ MoveSelectedItems(true);
}
/**
*/
void CDirColsDlg::OnDown()
{
- MoveSelectedItems(FALSE);
+ MoveSelectedItems(false);
}
/**
*/
void CDirDoc::LoadLineFilterList()
{
- ASSERT(m_pCtxt);
+ ASSERT(m_pCtxt != nullptr);
bool bFilters = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
String filters = theApp.m_pLineFilters->GetAsString();
*/
void CDirDoc::AddMergeDoc(IMergeDoc * pMergeDoc)
{
- ASSERT(pMergeDoc);
+ ASSERT(pMergeDoc != nullptr);
m_MergeDocs.AddTail(pMergeDoc);
}
*/
void CDirDoc::MergeDocClosing(IMergeDoc * pMergeDoc)
{
- ASSERT(pMergeDoc);
+ ASSERT(pMergeDoc != nullptr);
if (POSITION pos = m_MergeDocs.CPtrList::Find(pMergeDoc))
m_MergeDocs.RemoveAt(pos);
else
- ASSERT(FALSE);
+ ASSERT(false);
// If dir compare is empty (no compare results) and we are not closing
// because of reuse close also dir compare
void CDirDoc::UpdateHeaderPath(int nIndex)
{
CDirFrame *pf = m_pDirView->GetParentFrame();
- ASSERT(pf);
+ ASSERT(pf != nullptr);
String sText;
if (!m_strDesc[nIndex].empty())
// 1st submenu of IDR_POPUP_DIRVIEW is for item popup
BCMenu *pPopup = static_cast<BCMenu*>(menu.GetSubMenu(0));
- ASSERT(pPopup != NULL);
+ ASSERT(pPopup != nullptr);
if (pDoc->m_nDirs < 3)
{
pPopup->AppendMenu(MF_POPUP, static_cast<int>(reinterpret_cast<uintptr_t>(menuPluginsHolder.m_hMenu)), s.c_str());
CFrameWnd *pFrame = GetTopLevelFrame();
- ASSERT(pFrame != NULL);
+ ASSERT(pFrame != nullptr);
pFrame->m_bAutoMenuEnable = FALSE;
// invoke context menu
// this will invoke all the OnUpdate methods to enable/disable the individual items
theApp.TranslateMenu(menu.m_hMenu);
// 2nd submenu of IDR_POPUP_DIRVIEW is for header popup
BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(1));
- ASSERT(pPopup != NULL);
+ ASSERT(pPopup != nullptr);
// invoke context menu
// this will invoke all the OnUpdate methods to enable/disable the individual items
// Make sure selection is at sensible place if all selected items
// were removed.
- if (bItemsRemoved == true)
+ if (bItemsRemoved)
{
UINT selected = GetSelectedCount();
if (selected == 0)
if (pos1 == SPECIAL_ITEM_POS)
{
- ASSERT(FALSE);
+ ASSERT(false);
return;
}
if (i == -1)
i = count;
- while (i < count && found == false)
+ while (i < count && !found)
{
UINT selected = m_pList->GetItemState(i, LVIS_SELECTED);
UINT focused = m_pList->GetItemState(i, LVIS_FOCUSED);
// Handle special shortcuts here
if (pMsg->message == WM_KEYDOWN)
{
- if (false == IsLabelEdit())
+ if (!IsLabelEdit())
{
// Check if we got 'ESC pressed' -message
if (pMsg->wParam == VK_ESCAPE)
// ESC doesn't close window when user is renaming an item.
if (pMsg->wParam == VK_ESCAPE)
{
- m_bUserCancelEdit = TRUE;
+ m_bUserCancelEdit = true;
// The edit control send LVN_ENDLABELEDIT when it loses focus,
// so we use it to cancel the rename action.
GetCursorPos(&point);
HWND hWnd = GetSafeHwnd();
CFrameWnd *pFrame = GetTopLevelFrame();
- ASSERT(pFrame != NULL);
+ ASSERT(pFrame != nullptr);
BOOL bAutoMenuEnableOld = pFrame->m_bAutoMenuEnable;
pFrame->m_bAutoMenuEnable = FALSE;
BOOL nCmd = TrackPopupMenu(pContextMenu->GetHMENU(), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, 0, hWnd, NULL);
{
// While the user is renaming an item, select all the edited text.
CEdit *pEdit = m_pList->GetEditControl();
- if (NULL != pEdit)
+ if (pEdit != nullptr)
{
pEdit->SetSel(pEdit->GetWindowTextLength());
}
*pResult = (SelBegin() == SelEnd());
// If label edit is allowed.
- if (FALSE == *pResult)
+ if (*pResult == FALSE)
{
const NMLVDISPINFO *pdi = (NMLVDISPINFO*)pNMHDR;
- ASSERT(pdi != NULL);
+ ASSERT(pdi != nullptr);
// Locate the edit box on the right column in case the user changed the
// column order.
// Set the edit control with the updated text.
CEdit *pEdit = m_pList->GetEditControl();
- ASSERT(NULL != pEdit);
+ ASSERT(pEdit != nullptr);
pEdit->SetWindowText(sText);
- m_bUserCancelEdit = FALSE;
+ m_bUserCancelEdit = false;
}
}
// "file.txt|FILE.txt"). The edit text was changed to "file.txt" and
// if the user accept it as the new file name, pszText is NULL.
- if (TRUE != m_bUserCancelEdit)
+ if (!m_bUserCancelEdit)
{
CEdit *pEdit = m_pList->GetEditControl();
- ASSERT(NULL != pEdit);
+ ASSERT(pEdit != nullptr);
CString sText;
pEdit->GetWindowText(sText);
*/
bool CDirView::IsLabelEdit() const
{
- return (NULL != m_pList->GetEditControl());
+ return (m_pList->GetEditControl() != nullptr);
}
/**
void CDirView::OnEditCopy()
{
CEdit *pEdit = m_pList->GetEditControl();
- if (NULL != pEdit)
+ if (pEdit != nullptr)
{
pEdit->Copy();
}
void CDirView::OnEditCut()
{
CEdit *pEdit = m_pList->GetEditControl();
- if (NULL != pEdit)
+ if (pEdit != nullptr)
{
pEdit->Cut();
}
void CDirView::OnEditPaste()
{
CEdit *pEdit = m_pList->GetEditControl();
- if (NULL != pEdit)
+ if (pEdit != nullptr)
{
pEdit->Paste();
}
void CDirView::OnEditUndo()
{
CEdit *pEdit = m_pList->GetEditControl();
- if (NULL != pEdit)
+ if (pEdit != nullptr)
{
pEdit->Undo();
}
{
LVHITTESTINFO lvhti = {0};
NMLVGETINFOTIP * pInfoTip = reinterpret_cast<NMLVGETINFOTIP*>(pNMHDR);
- ASSERT(pInfoTip);
+ ASSERT(pInfoTip != nullptr);
// Get subitem under mouse cursor
lvhti.pt = m_ptLastMousePos;
}
// if this packer does not work, that is an error
- if (bHandled == false)
+ if (!bHandled)
return false;
// if the buffer changed, write it before leaving
}
// if this unpacker does not work, that is an error
- if (bHandled == false)
+ if (!bHandled)
return false;
// valid the subcode
}
}
- if (bHandled == false)
+ if (!bHandled)
{
// we didn't find any unpacker, just hope it is normal Ansi/Unicode
handler->pluginName = _T("");
}
// if this unpacker does not work, that is an error
- if (bHandled == false)
+ if (!bHandled)
return false;
// if the buffer changed, write it before leaving
}
}
- if (bHandled == false)
+ if (!bHandled)
{
// we didn't find any prediffer, that is OK anyway
handler->pluginName = _T("");
theApp.TranslateMenu(menu.m_hMenu);
BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(0));
- ASSERT(pPopup != NULL);
+ ASSERT(pPopup != nullptr);
DWORD sel = GetSel();
if (HIWORD(sel) == LOWORD(sel))
string.length(), ucr::UTF8, ucr::CP_UTF_8, &buf);
unsigned i = 0;
- while (i < count && retval == false)
+ while (i < count && !retval)
{
const filter_item_ptr& item = m_list[i];
int result = 0;
goto exitPrepAndCompare;
// we use the same plugins for both files, so they must be defined before second file
- assert(infoUnpacker->bToBeScanned == false);
+ assert(!infoUnpacker->bToBeScanned);
}
// As we keep handles open on unpacked files, Transform() may not delete them.
for (int i = nLine ; i < nLine + nCount; i++)
{
- ASSERT (GetLineFlags(i) & LF_GHOST);
+ ASSERT ( (GetLineFlags(i) & LF_GHOST) != 0 );
m_aLines[i].Clear();
}
*/
void CHexMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
{
- ASSERT(pDirDoc && !m_pDirDoc);
+ ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
m_pDirDoc = pDirDoc;
}
bool CHexMergeDoc::OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], int nPane)
{
CHexMergeFrame *pf = GetParentFrame();
- ASSERT(pf);
+ ASSERT(pf != nullptr);
bool bSucceeded = true;
int nBuffer;
for (nBuffer = 0; nBuffer < nFiles; nBuffer++)
void CHexMergeDoc::UpdateHeaderPath(int pane)
{
CHexMergeFrame *pf = GetParentFrame();
- ASSERT(pf);
+ ASSERT(pf != nullptr);
String sText;
if (m_nBufferType[pane] == BUFFER_UNNAMED ||
{
for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
{
- ASSERT(pView[nBuffer] && !m_pView[nBuffer]);
+ ASSERT(pView[nBuffer] != nullptr && m_pView[nBuffer] == nullptr);
m_pView[nBuffer] = pView[nBuffer];
m_pView[nBuffer]->m_nThisPane = nBuffer;
}
if (f)
return S_OK;
HRESULT hr = (HRESULT)::GetLastError();
- ASSERT(hr);
+ ASSERT(hr != 0);
if (hr == 0)
hr = E_UNEXPECTED;
return hr;
*/
void CHexMergeView::OnDraw(CDC *)
{
- ASSERT(FALSE);
+ ASSERT(false);
}
/**
*/
void CImgMergeFrame::SetDirDoc(CDirDoc * pDirDoc)
{
- ASSERT(pDirDoc && !m_pDirDoc);
+ ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
m_pDirDoc = pDirDoc;
}
theApp.TranslateMenu(menu.m_hMenu);
BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(0));
- ASSERT(pPopup != NULL);
+ ASSERT(pPopup != nullptr);
CCmdUI cmdUI;
cmdUI.m_pMenu = pPopup;
break;
case ID_DISPLAY_MOVED_NONE:
SetConnectMovedBlocks(DISPLAY_MOVED_NONE);
- pDoc->SetDetectMovedBlocks(FALSE);
+ pDoc->SetDetectMovedBlocks(false);
break;
case ID_DISPLAY_MOVED_ALL:
SetConnectMovedBlocks(DISPLAY_MOVED_ALL);
- pDoc->SetDetectMovedBlocks(TRUE);
+ pDoc->SetDetectMovedBlocks(true);
break;
case ID_DISPLAY_MOVED_FOLLOW_DIFF:
SetConnectMovedBlocks(DISPLAY_MOVED_FOLLOW_DIFF);
- pDoc->SetDetectMovedBlocks(TRUE);
+ pDoc->SetDetectMovedBlocks(true);
break;
}
}
if (!m_pMenus[view]->LoadMenu(ID))
{
- ASSERT(FALSE);
+ ASSERT(false);
return NULL;
}
else
{
theApp.m_pGlobalFileFilter->SetFileFilterPath(path);
- theApp.m_pGlobalFileFilter->UseMask(FALSE);
+ theApp.m_pGlobalFileFilter->UseMask(false);
String sFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter);
}
CMainFrame * GetMainFrame()
{
CWnd * mainwnd = AfxGetMainWnd();
- ASSERT(mainwnd);
+ ASSERT(mainwnd != nullptr);
CMainFrame *pMainframe = dynamic_cast<CMainFrame*>(mainwnd);
- ASSERT(pMainframe);
+ ASSERT(pMainframe != nullptr);
return pMainframe;
}
VERIFY(menu.LoadMenu(IDR_POPUP_DIFF_OPTIONS));
theApp.TranslateMenu(menu.m_hMenu);
CMenu* pPopup = menu.GetSubMenu(0);
- if (NULL != pPopup)
+ if (pPopup != nullptr)
{
pPopup->TrackPopupMenu(TPM_RIGHTALIGN | TPM_RIGHTBUTTON,
pToolBar->rcButton.right, pToolBar->rcButton.bottom, this);
{
CDocManager* pDocManager = AfxGetApp()->m_pDocManager;
POSITION posTemplate = pDocManager->GetFirstDocTemplatePosition();
- ASSERT(posTemplate != NULL);
+ ASSERT(posTemplate != nullptr);
- while (posTemplate != NULL)
+ while (posTemplate != nullptr)
{
CDocTemplate* pTemplate = pDocManager->GetNextDocTemplate(posTemplate);
- ASSERT(pTemplate != NULL);
+ ASSERT(pTemplate != nullptr);
for (auto pDoc : GetDocList(static_cast<CMultiDocTemplate *>(pTemplate)))
{
- static_cast<CDocument *>(const_cast<void *>(pDoc))->SetTitle(NULL);
+ static_cast<CDocument *>(const_cast<void *>(pDoc))->SetTitle(nullptr);
((CFrameWnd*)AfxGetApp()->m_pMainWnd)->OnUpdateFrameTitle(TRUE);
}
}
});
// Refresh display
- UpdateAllViews(NULL);
+ UpdateAllViews(nullptr);
// Show possible error after updating screen
if (nRescanResult != RESCAN_SUPPRESSED)
*/
void CMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
{
- ASSERT(pDirDoc && !m_pDirDoc);
+ ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
m_pDirDoc = pDirDoc;
}
void CMergeDoc::UpdateHeaderPath(int pane)
{
CChildFrame *pf = GetParentFrame();
- ASSERT(pf);
+ ASSERT(pf != nullptr);
String sText;
bool bChanges = false;
else
{
sText = m_filePaths[pane];
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
{
m_pDirDoc->ApplyDisplayRoot(pane, sText);
}
void CMergeDoc::UpdateHeaderActivity(int pane, bool bActivate)
{
CChildFrame *pf = GetParentFrame();
- ASSERT(pf);
+ ASSERT(pf != nullptr);
pf->GetHeaderInterface()->SetActive(pane, bActivate);
}
GetParentFrame()->UpdateSplitter();
ForEachView([](auto& pView) { pView->UpdateStatusbar(); });
- UpdateAllViews(NULL);
+ UpdateAllViews(nullptr);
}
/**
{
if (pUpdateSource != this)
{
- ASSERT (pUpdateSource != NULL);
+ ASSERT (pUpdateSource != nullptr);
ASSERT_KINDOF (CCrystalTextView, pUpdateSource);
CMergeEditView *pSrcView = static_cast<CMergeEditView*>(pUpdateSource);
if (!bHorz) // changed this so bHorz works right
void CMergeEditView::OnRefresh()
{
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
pd->FlushAndRescan(true);
}
/// Store interface we use to display status line info
void CMergeEditView::SetStatusInterface(IMergeEditStatus * piMergeEditStatus)
{
- ASSERT(!m_piMergeEditStatus);
+ ASSERT(m_piMergeEditStatus == nullptr);
m_piMergeEditStatus = piMergeEditStatus;
}
DeleteMenu(hMenu, 0, MF_BYPOSITION);
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
// title
AppendMenu(hMenu, MF_STRING, ID_NO_PREDIFFER, _("No prediffer (normal)").c_str());
theApp.TranslateMenu(menu.m_hMenu);
BCMenu *pSub = static_cast<BCMenu *>(menu.GetSubMenu(0));
- ASSERT(pSub != NULL);
+ ASSERT(pSub != nullptr);
// Context menu opened using keyboard has no coordinates
if (point.x == -1 && point.y == -1)
if (m_pTextBuffer->applyEOLMode())
{
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
pd->UpdateHeaderPath(m_nThisPane);
pd->FlushAndRescan(true);
}
pCmdUI->Enable(true);
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
PrediffingInfo prediffer;
pd->GetPrediffer(&prediffer);
void CMergeEditView::OnPrediffer(UINT nID )
{
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
SetPredifferByMenu(nID);
pd->FlushAndRescan(true);
void CMergeEditView::SetPredifferByMenu(UINT nID )
{
CMergeDoc *pd = GetDocument();
- ASSERT(pd);
+ ASSERT(pd != nullptr);
if (nID == ID_NO_PREDIFFER)
{
void CMergeEditView::OnOpenFile()
{
CMergeDoc * pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
String sFileName = pDoc->m_filePaths[m_nThisPane];
if (sFileName.empty())
void CMergeEditView::OnOpenFileWith()
{
CMergeDoc * pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
String sFileName = pDoc->m_filePaths[m_nThisPane];
if (sFileName.empty())
void CMergeEditView::OnOpenFileWithEditor()
{
CMergeDoc * pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
String sFileName = pDoc->m_filePaths[m_nThisPane];
if (sFileName.empty())
void CMergeEditView::InvalidateSubLineIndexCache( int nLineIndex )
{
CMergeDoc * pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
// We have to invalidate sub line index cache on both panes.
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
void CMergeEditView::OnChangeScheme(UINT nID)
{
CMergeDoc *pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- ASSERT(pView != NULL);
+ ASSERT(pView != nullptr);
- if (pView != NULL)
+ if (pView != nullptr)
{
pView->SetTextType(CCrystalTextView::TextType(nID - ID_COLORSCHEME_FIRST));
pView->SetDisableBSAtSOL(false);
}
}
- pDoc->UpdateAllViews(NULL);
+ pDoc->UpdateAllViews(nullptr);
}
/**
lf.lfHeight = -MulDiv(nPointSize, nLogPixelsY, 72);
CMergeDoc *pDoc = GetDocument();
- ASSERT(pDoc != NULL);
+ ASSERT(pDoc != nullptr);
- if (pDoc != NULL )
+ if (pDoc != nullptr)
{
for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
{
CMergeEditView *pView = GetGroupView(nPane);
- ASSERT(pView != NULL);
+ ASSERT(pView != nullptr);
- if (pView != NULL)
+ if (pView != nullptr)
{
pView->SetFont(lf);
}
void COpenDoc::RefreshOptions()
{
m_bRecurse = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
- UpdateAllViews(NULL);
+ UpdateAllViews(nullptr);
}
/**
COpenView::COpenView()
: CFormView(COpenView::IDD)
- , m_pUpdateButtonStatusThread(NULL)
- , m_bRecurse(FALSE)
- , m_pDropHandler(NULL)
+ , m_pUpdateButtonStatusThread(nullptr)
+ , m_bRecurse(false)
+ , m_pDropHandler(nullptr)
, m_dwFlags()
, m_bAutoCompleteReady()
, m_bReadOnly {false, false, false}
VERIFY(menu.LoadMenu(IDR_POPUP_PROJECT));
theApp.TranslateMenu(menu.m_hMenu);
CMenu* pPopup = menu.GetSubMenu(0);
- if (NULL != pPopup)
+ if (pPopup != nullptr)
{
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
rcButton.left, rcButton.bottom, GetMainFrame());
*/
CPatchDlg::CPatchDlg(CWnd* pParent /*=NULL*/)
: CTrDialog(CPatchDlg::IDD, pParent)
- , m_caseSensitive(FALSE)
- , m_ignoreBlanks(0)
- , m_ignoreEOLDifference(FALSE)
+ , m_caseSensitive(false)
+ , m_ignoreBlanks(false)
+ , m_ignoreEOLDifference(false)
, m_whitespaceCompare(0)
- , m_appendFile(FALSE)
- , m_openToEditor(FALSE)
- , m_includeCmdLine(FALSE)
+ , m_appendFile(false)
+ , m_openToEditor(false)
+ , m_includeCmdLine(false)
, m_outputStyle(OUTPUT_NORMAL)
, m_contextLines(0)
{
{
m_outputStyle = (enum output_style) DIFF_OUTPUT_NORMAL;
m_contextLines = 0;
- m_caseSensitive = TRUE;
- m_ignoreEOLDifference = FALSE;
- m_ignoreBlanks = FALSE;
+ m_caseSensitive = true;
+ m_ignoreEOLDifference = false;
+ m_ignoreBlanks = false;
m_whitespaceCompare = WHITESPACE_COMPARE_ALL;
- m_openToEditor = FALSE;
- m_includeCmdLine = FALSE;
+ m_openToEditor = false;
+ m_includeCmdLine = false;
UpdateSettings();
}
// patch file EOLs correctly
diffOptions.bIgnoreEol = pDlgPatch->m_ignoreEOLDifference;
- diffOptions.bIgnoreCase = pDlgPatch->m_caseSensitive == false;
+ diffOptions.bIgnoreCase = !pDlgPatch->m_caseSensitive;
m_diffWrapper.SetOptions(&diffOptions);
}
else
for (size_t step = 0 ; step < piFileScriptArray->size() ; step ++)
{
const PluginInfoPtr & plugin = piFileScriptArray->at(step);
- if (plugin->m_bAutomatic == false || plugin->m_disabled)
+ if (!plugin->m_bAutomatic || plugin->m_disabled)
continue;
- if (plugin->TestAgainstRegList(filteredText) == false)
+ if (!plugin->TestAgainstRegList(filteredText))
continue;
return plugin.get();
}
CScriptsOfThread * scripts = CAllThreadsScripts::GetActiveSetNoAssert();
if (scripts == NULL)
return;
- if (scripts->Unlock() == true)
+ if (scripts->Unlock())
{
CAllThreadsScripts::Remove(scripts);
delete scripts;
* @brief set subfolder.
* @param [in] iSubfolder New value for subfolder inclusion.
*/
-void ProjectFile::SetSubfolders(int iSubfolder)
+void ProjectFile::SetSubfolders(bool bSubfolder)
{
- m_subfolders = iSubfolder ? 1 : 0;
+ m_subfolders = bSubfolder ? 1 : 0;
}
/**
void SetMiddle(const String& sMiddle, const bool * pReadOnly = NULL);
void SetRight(const String& sRight, const bool * pReadOnly = NULL);
void SetFilter(const String& sFilter);
- void SetSubfolders(int iSubfolder);
+ void SetSubfolders(bool bSubfolder);
void GetPaths(PathContext& files, bool & bSubFolders) const;
void SetPaths(const PathContext& files, bool bSubFolders = false);
PropCompareFolder::PropCompareFolder(COptionsMgr *optionsMgr)
: OptionsPanel(optionsMgr, PropCompareFolder::IDD)
, m_compareMethod(-1)
- , m_bStopAfterFirst(FALSE)
- , m_bIgnoreSmallTimeDiff(FALSE)
- , m_bIncludeUniqFolders(FALSE)
- , m_bIncludeSubdirs(FALSE)
- , m_bExpandSubdirs(FALSE)
- , m_bIgnoreReparsePoints(FALSE)
+ , m_bStopAfterFirst(false)
+ , m_bIgnoreSmallTimeDiff(false)
+ , m_bIncludeUniqFolders(false)
+ , m_bIncludeSubdirs(false)
+ , m_bExpandSubdirs(false)
+ , m_bIgnoreReparsePoints(false)
, m_nQuickCompareLimit(4 * Mega)
, m_nCompareThreads(-1)
{
OptionsPanel::OnInitDialog();
CComboBox *pWnd = (CComboBox*)GetDlgItem(IDC_AUTO_COMPLETE_SOURCE);
- ASSERT(NULL != pWnd);
+ ASSERT(pWnd != nullptr);
pWnd->AddString(_("Disabled").c_str());
pWnd->AddString(_("From file system").c_str());
*/
void PropTextColors::WriteOptions()
{
- GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, m_bCustomColors == false);
+ GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, !m_bCustomColors);
// User can only change colors via BrowseColorAndSave,
// which writes to m_pTempColors
// so user's latest choices are in m_pTempColors
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
- if (nullptr == pDoc)\r
+ if (pDoc == nullptr)\r
return;\r
EXPECT_EQ(ucr::UTF8, pDoc->m_ptBuf[0]->getEncoding().m_unicoding);\r
EXPECT_TRUE(pDoc->m_ptBuf[0]->getEncoding().m_bom);\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
- if (nullptr == pDoc)\r
+ if (pDoc == nullptr)\r
return;\r
\r
std::vector<CCrystalTextView::TEXTBLOCK> blocks;\r
CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
CDirDoc *pDoc = dynamic_cast<CDirDoc *>(pFrame->GetActiveDocument());\r
EXPECT_NE(nullptr, pDoc);\r
- if (nullptr == pDoc)\r
+ if (pDoc != nullptr)\r
{\r
pFrame->PostMessage(WM_CLOSE);\r
continue;\r