More of the same...
*/
void LineInfo::Clear()
{
- if (m_pcLine != NULL)
+ if (m_pcLine != nullptr)
{
delete[] m_pcLine;
- m_pcLine = NULL;
+ m_pcLine = nullptr;
m_nLength = 0;
m_nMax = 0;
m_nEolChars = 0;
*/
void LineInfo::FreeBuffer()
{
- if (m_pcLine != NULL)
+ if (m_pcLine != nullptr)
{
delete[] m_pcLine;
- m_pcLine = NULL;
+ m_pcLine = nullptr;
m_nLength = 0;
m_nMax = 0;
m_nEolChars = 0;
m_nMax = ALIGN_BUF_SIZE (m_nLength + 1);
ASSERT (m_nMax < INT_MAX);
ASSERT (m_nMax >= m_nLength + 1);
- if (m_pcLine != NULL)
+ if (m_pcLine != nullptr)
delete[] m_pcLine;
m_pcLine = new TCHAR[m_nMax];
ZeroMemory(m_pcLine, m_nMax * sizeof(TCHAR));
m_nLength = 0;
m_nEolChars = 0;
m_nMax = ALIGN_BUF_SIZE (m_nLength + 1);
- if (m_pcLine != NULL)
+ if (m_pcLine != nullptr)
delete [] m_pcLine;
m_pcLine = new TCHAR[m_nMax];
ZeroMemory(m_pcLine, m_nMax * sizeof(TCHAR));
/**
* @brief Get line's EOL bytes.
- * @return EOL bytes, or NULL if no EOL bytes.
+ * @return EOL bytes, or `nullptr` if no EOL bytes.
*/
LPCTSTR LineInfo::GetEol() const
{
if (HasEol())
return &m_pcLine[Length()];
else
- return NULL;
+ return nullptr;
}
/**
m_nEolChars -= static_cast<int>(nDelete);
}
ASSERT (m_nLength <= INT_MAX); // assert "positive int"
- if (m_pcLine)
+ if (m_pcLine != nullptr)
m_pcLine[FullLength()] = '\0';
}
{
m_nLength = nStartChar;
ASSERT (m_nLength <= INT_MAX); // assert "positive int"
- if (m_pcLine)
+ if (m_pcLine != nullptr)
m_pcLine[nStartChar] = 0;
m_nEolChars = 0;
}
*/
void LineInfo::CopyFrom(const LineInfo &li)
{
- if (m_pcLine != NULL)
+ if (m_pcLine != nullptr)
delete [] m_pcLine;
m_pcLine = new TCHAR[li.m_nMax];
memcpy(m_pcLine, li.m_pcLine, li.m_nMax * sizeof(TCHAR));
m_nAction = src.m_nAction;
SetText(src.GetText(), src.GetTextLength());
INT_PTR size = src.m_paSavedRevisionNumbers->GetSize();
- if (!m_paSavedRevisionNumbers)
+ if (m_paSavedRevisionNumbers == nullptr)
m_paSavedRevisionNumbers = new CDWordArray();
m_paSavedRevisionNumbers->SetSize(size);
INT_PTR i;
{
ASSERT (nLength < INT_MAX);
m_pszText = (TextBuffer *)malloc(sizeof(TextBuffer) + (nLength+2) * sizeof(TCHAR));
- if (m_pszText)
+ if (m_pszText != nullptr)
{
m_pszText->size = nLength;
memcpy(m_pszText->data, pszText, nLength * sizeof(TCHAR));
// possible char value
if (((INT_PTR)m_pszText >> 16) != 0)
free(m_pszText);
- m_pszText = NULL;
+ m_pszText = nullptr;
}
virtual ~UndoRecord () // destructor\r
{\r
FreeText();\r
- if (m_paSavedRevisionNumbers)\r
- delete m_paSavedRevisionNumbers;\r
+ if (m_paSavedRevisionNumbers != nullptr)\r
+ delete m_paSavedRevisionNumbers;\r
}\r
\r
void SetText (LPCTSTR pszText, size_t cchText);\r
#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--;\
continue;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
CCrystalEditView * m_pOwner;
public :
CEditDropTargetImpl (CCrystalEditView * pOwner)
- : m_pOwner(pOwner), m_pAlternateDropTarget(NULL)
+ : m_pOwner(pOwner), m_pAlternateDropTarget(nullptr)
{
};
bool CCrystalEditView::
QueryEditable ()
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return false;
return !m_pTextBuffer->GetReadOnly ();
}
{
if (!QueryEditable ())
return;
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return;
CString text;
{
if (!QueryEditable ())
return;
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return;
if (!IsSelection ())
return;
void CCrystalEditView::
OnEditDelete ()
{
- if (!QueryEditable () || m_pTextBuffer == NULL)
+ if (!QueryEditable () || m_pTextBuffer == nullptr)
return;
CPoint ptSelStart, ptSelEnd;
m_pTextBuffer->BeginUndoGroup(m_bMergeUndo);
m_bMergeUndo = false;
- if (QueryEditable () && m_pTextBuffer != NULL)
+ if (QueryEditable () && m_pTextBuffer != nullptr)
{
CPoint ptCursorPos;
if (IsSelection ())
(nChar != 27 || GetKeyState(VK_ESCAPE) >= 0) &&
nChar != 9 && nChar != 10 && nChar != 13)
{
- if (QueryEditable () && m_pTextBuffer != NULL)
+ if (QueryEditable () && m_pTextBuffer != nullptr)
{
m_pTextBuffer->BeginUndoGroup (m_bMergeUndo);
m_bMergeUndo = true;
return;
}
- if (!QueryEditable () || m_pTextBuffer == NULL)
+ if (!QueryEditable () || m_pTextBuffer == nullptr)
return;
CPoint ptCursorPos = GetCursorPos ();
void CCrystalEditView::
OnEditTab ()
{
- if (!QueryEditable () || m_pTextBuffer == NULL)
+ if (!QueryEditable () || m_pTextBuffer == nullptr)
return;
bool bTabify = false;
void CCrystalEditView::
OnEditUntab ()
{
- if (!QueryEditable () || m_pTextBuffer == NULL)
+ if (!QueryEditable () || m_pTextBuffer == nullptr)
return;
bool bTabify = false;
void CCrystalEditView::
OnUpdateIndicatorRead (CCmdUI * pCmdUI)
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
pCmdUI->Enable (false);
else
pCmdUI->Enable (m_pTextBuffer->GetReadOnly ());
{
CLIPFORMAT fmt = GetClipTcharTextFormat(); // CF_TEXT or CF_UNICODETEXT
HGLOBAL hData = pDataObject->GetGlobalData (fmt);
- if (hData == NULL)
+ if (hData == nullptr)
return false;
CPoint ptDropPos = ClientToText (ptClient);
UINT cbData = (UINT) ::GlobalSize (hData);
UINT cchText = cbData / sizeof(TCHAR) - 1;
LPTSTR pszText = (LPTSTR)::GlobalLock (hData);
- if (pszText == NULL)
+ if (pszText == nullptr)
return false;
// Open the undo group
void CCrystalEditView::
OnDestroy ()
{
- if (m_pDropTarget != NULL)
+ if (m_pDropTarget != nullptr)
{
m_pDropTarget->Revoke ();
if (m_pDropTarget->m_pAlternateDropTarget)
m_pDropTarget->m_pAlternateDropTarget->Release();
delete m_pDropTarget;
- m_pDropTarget = NULL;
+ m_pDropTarget = nullptr;
}
CCrystalTextView::OnDestroy ();
{
CCrystalTextView::UpdateView (pSource, pContext, dwFlags, nLineIndex);
- if (m_bSelectionPushed && pContext != NULL)
+ if (m_bSelectionPushed && pContext != nullptr)
{
pContext->RecalcPoint (m_ptSavedSelStart);
pContext->RecalcPoint (m_ptSavedSelEnd);
lastSearch->m_bWholeWord = (m_dwLastReplaceFlags & FIND_WHOLE_WORD) != 0;
lastSearch->m_bRegExp = (m_dwLastReplaceFlags & FIND_REGEXP) != 0;
lastSearch->m_bNoWrap = (m_dwLastReplaceFlags & FIND_NO_WRAP) != 0;
- if (m_pszLastFindWhat != NULL)
+ if (m_pszLastFindWhat != nullptr)
lastSearch->m_sText = m_pszLastFindWhat;
}
else
// Save Replace parameters for 'F3' command
m_bLastReplace = true;
- if (m_pszLastFindWhat != NULL)
+ if (m_pszLastFindWhat != nullptr)
free (m_pszLastFindWhat);
m_pszLastFindWhat = _tcsdup (lastSearch->m_sText);
m_dwLastReplaceFlags = 0;
{
if (!cchNewText)
return DeleteCurrentSelection();
- ASSERT(pszNewText != nullptr);
+ ASSERT (pszNewText != nullptr);
m_pTextBuffer->BeginUndoGroup();
void CCrystalEditView::
OnUpdateEditUndo (CCmdUI * pCmdUI)
{
- bool bCanUndo = m_pTextBuffer != NULL && m_pTextBuffer->CanUndo ();
+ bool bCanUndo = m_pTextBuffer != nullptr && m_pTextBuffer->CanUndo ();
pCmdUI->Enable (bCanUndo);
// Since we need text only for menus...
- if (pCmdUI->m_pMenu != NULL)
+ if (pCmdUI->m_pMenu != nullptr)
{
// Tune up 'resource handle'
HINSTANCE hOldResHandle = AfxGetResourceHandle ();
bool CCrystalEditView::
DoEditUndo ()
{
- if (m_pTextBuffer != NULL && m_pTextBuffer->CanUndo ())
+ if (m_pTextBuffer != nullptr && m_pTextBuffer->CanUndo ())
{
CPoint ptCursorPos;
if (m_pTextBuffer->Undo (this, ptCursorPos))
bool CCrystalEditView::
DoEditRedo ()
{
- if (m_pTextBuffer != NULL && m_pTextBuffer->CanRedo ())
+ if (m_pTextBuffer != nullptr && m_pTextBuffer->CanRedo ())
{
CPoint ptCursorPos;
if (m_pTextBuffer->Redo (this, ptCursorPos))
void CCrystalEditView::
OnUpdateEditRedo (CCmdUI * pCmdUI)
{
- bool bCanRedo = m_pTextBuffer != NULL && m_pTextBuffer->CanRedo ();
+ bool bCanRedo = m_pTextBuffer != nullptr && m_pTextBuffer->CanRedo ();
pCmdUI->Enable (bCanRedo);
// Since we need text only for menus...
- if (pCmdUI->m_pMenu != NULL)
+ if (pCmdUI->m_pMenu != nullptr)
{
// Tune up 'resource handle'
HINSTANCE hOldResHandle = AfxGetResourceHandle ();
// m_pTextBuffer->BeginUndoGroup ();
int x, y;
- m_pTextBuffer->InsertText (NULL, ptCursorPos.y, ptCursorPos.x,
+ m_pTextBuffer->InsertText (nullptr, ptCursorPos.y, ptCursorPos.x,
pszInsertStr, nPos, y, x, CE_ACTION_AUTOINDENT);
CPoint pt (x, y);
SetCursorPos (pt);
// m_pTextBuffer->BeginUndoGroup ();
int x, y;
- m_pTextBuffer->InsertText (NULL, ptCursorPos.y, ptCursorPos.x,
+ m_pTextBuffer->InsertText (nullptr, ptCursorPos.y, ptCursorPos.x,
pszInsertStr, nPos, y, x, CE_ACTION_AUTOINDENT);
CPoint pt (x, y);
SetCursorPos (pt);
pszInsertStr[1] = _T ('\0');
// m_pTextBuffer->BeginUndoGroup ();
int x, y;
- m_pTextBuffer->InsertText (NULL, ptCursorPos.y, ptCursorPos.x - 1,
+ m_pTextBuffer->InsertText (nullptr, ptCursorPos.y, ptCursorPos.x - 1,
pszInsertStr, 1, y, x, CE_ACTION_AUTOINDENT);
ptCursorPos.x = x + 1;
ptCursorPos.y = y;
// m_pTextBuffer->BeginUndoGroup ();
int x, y;
- m_pTextBuffer->InsertText (NULL, ptCursorPos.y, ptCursorPos.x - 1,
+ m_pTextBuffer->InsertText (nullptr, ptCursorPos.y, ptCursorPos.x - 1,
pszInsertStr, nPos, y, x, CE_ACTION_AUTOINDENT);
CPoint pt (x + 1, y);
SetCursorPos (pt);
}
}
// m_pTextBuffer->BeginUndoGroup ();
- m_pTextBuffer->DeleteText (NULL, ptCursorPos.y, ptCursorPos.x - nPos - 1,
+ m_pTextBuffer->DeleteText (nullptr, ptCursorPos.y, ptCursorPos.x - nPos - 1,
ptCursorPos.y, ptCursorPos.x - 1, CE_ACTION_AUTOINDENT);
ptCursorPos.x -= nPos;
SetCursorPos (ptCursorPos);
m_pTextBuffer->DeleteText (this, ptCursorPos.y, ptCursorPos.x, ptCursorPos.y, ptCursorPos.x + nLength, CE_ACTION_AUTOEXPAND);
LPTSTR pszExpand = sExpand.GetBuffer (sExpand.GetLength () + 1);
LPTSTR pszSlash = _tcschr (pszExpand, _T ('\\'));
- if (!pszSlash)
+ if (pszSlash == nullptr)
{
m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszExpand, _tcslen(pszExpand), y, x, CE_ACTION_AUTOEXPAND);
ptCursorPos.x = x;
SetAnchor (ptCursorPos);
OnEditOperation (CE_ACTION_TYPING, pszExpand, _tcslen(pszExpand));
ptCursorPos = GetCursorPos ();
- if (!pszSlash)
+ if (pszSlash == nullptr)
break;
switch (*pszSlash)
{
ptCursorPos = GetCursorPos ();
pszExpand = pszSlash + 1;
pszSlash = _tcschr (pszExpand, '\\');
- if (pszSlash)
+ if (pszSlash != nullptr)
*pszSlash++ = '\0';
}
}
return 0;
}
-HMODULE CCrystalEditView::hSpellDll = NULL;
+HMODULE CCrystalEditView::hSpellDll = nullptr;
TCHAR CCrystalEditView::szWIspellPath[_MAX_PATH];
SpellData CCrystalEditView::spellData;
int (*CCrystalEditView::SpellInit) (SpellData*);
}
else
{
- SpellInit = SpellCheck = SpellConfig = NULL;
+ SpellInit = SpellCheck = SpellConfig = nullptr;
if (bAlert)
::MessageBox (AfxGetMainWnd ()->GetSafeHwnd (), _T ("Error loading \"wispell.dll\"."), _T ("Error"), MB_OK|MB_ICONEXCLAMATION);
}
- return hSpellDll != NULL;
+ return hSpellDll != nullptr;
}
void CCrystalEditView::
spellData.hParent = GetSafeHwnd ();
spellData.nRow = ptCursorPos.y;
spellData.pUserData = (LPVOID) (LPCVOID) this;
- spellData.pszBuffer = NULL;
+ spellData.pszBuffer = nullptr;
m_pTextBuffer->BeginUndoGroup ();
if (SpellCheck (&spellData) == IDCANCEL)
{
for (int i = 0; i < 13; i++)
{
pszEnd = _tcschr (pszEnd, _T ('\n'));
- if (pszEnd)
+ if (pszEnd != nullptr)
pszEnd++;
else
break;
}
- if (pszEnd)
+ if (pszEnd != nullptr)
*pszEnd = _T ('\0');
dlg.m_sOriginal.ReleaseBuffer ();
if (dlg.DoModal () != IDOK)
m_pTextBuffer->FlushUndoGroup (this);
}
- if (pszNew)
+ if (pszNew != nullptr)
free (pszNew);
}
}
m_nSyncPosition = m_nUndoPosition = 0;
m_bUndoGroup = m_bUndoBeginGroup = false;
ASSERT (m_aUndoBuf.size () == 0);
- UpdateViews (NULL, NULL, UPDATE_RESET);
+ UpdateViews (nullptr, nullptr, UPDATE_RESET);
//BEGIN SW
m_ptLastChange.x = m_ptLastChange.y = -1;
//END SW
ASSERT (!m_bInit);
ASSERT (m_aLines.size() == 0);
- HANDLE hFile = NULL;
+ HANDLE hFile = nullptr;
int nCurrentMax = 256;
TCHAR *pcLineBuf = new TCHAR[nCurrentMax];
if (dwFileAttributes == (DWORD) - 1)
__leave;
- hFile =::CreateFile (pszFileName, GENERIC_READ, FILE_SHARE_READ + FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ hFile =::CreateFile (pszFileName, GENERIC_READ, FILE_SHARE_READ + FILE_SHARE_WRITE, nullptr,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
__leave;
const DWORD dwBufSize = 32768;
LPSTR pcBuf = (LPSTR) _alloca (dwBufSize);
DWORD dwCurSize;
- if (!::ReadFile (hFile, pcBuf, dwBufSize, &dwCurSize, NULL))
+ if (!::ReadFile (hFile, pcBuf, dwBufSize, &dwCurSize, nullptr))
__leave;
if (nCrlfStyle == CRLF_STYLE_AUTOMATIC)
dwBufPtr++;
if (dwBufPtr == dwCurSize && dwCurSize == dwBufSize)
{
- if (!::ReadFile (hFile, pcBuf, dwBufSize, &dwCurSize, NULL))
+ if (!::ReadFile (hFile, pcBuf, dwBufSize, &dwCurSize, nullptr))
__leave;
dwBufPtr = 0;
}
bSuccess = true;
RetypeViews (pszFileName);
- UpdateViews (NULL, NULL, UPDATE_RESET);
+ UpdateViews (nullptr, nullptr, UPDATE_RESET);
}
__finally
{
}
- if (hFile != NULL && hFile != INVALID_HANDLE_VALUE)
+ if (hFile != nullptr && hFile != INVALID_HANDLE_VALUE)
::CloseHandle (hFile);
delete [] pcLineBuf;
//BEGIN SW
if (::GetTempFileName (szTempFileDir, _T ("CRE"), 0, szTempFileName) == 0)
__leave;
- hTempFile =::CreateFile (szTempFileName, GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hTempFile =::CreateFile (szTempFileName, GENERIC_WRITE, 0, nullptr,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hTempFile == INVALID_HANDLE_VALUE)
__leave;
{
LPTSTR pszBuf;
iconvert_new (m_aLines[nLine].GetLine(0), &pszBuf, 1, m_nSourceEncoding, m_nSourceEncoding == 15);
- if (!::WriteFile (hTempFile, pszBuf, nLength, &dwWrittenBytes, NULL))
+ if (!::WriteFile (hTempFile, pszBuf, nLength, &dwWrittenBytes, nullptr))
{
free (pszBuf);
__leave;
free (pszBuf);
}
else
- if (!::WriteFile (hTempFile, pszLine, nLength, &dwWrittenBytes, NULL))
+ if (!::WriteFile (hTempFile, pszLine, nLength, &dwWrittenBytes, nullptr))
__leave;
if (nLength != (int) dwWrittenBytes)
__leave;
if (nLine < nLineCount - 1) // Last line must not end with CRLF
{
- if (!::WriteFile (hTempFile, pszCRLF, nCRLFLength, &dwWrittenBytes, NULL))
+ if (!::WriteFile (hTempFile, pszCRLF, nCRLFLength, &dwWrittenBytes, nullptr))
__leave;
if (nCRLFLength != (int) dwWrittenBytes)
__leave;
m_dwRevisionNumberOnSave = m_dwCurrentRevisionNumber;
// redraw line revision marks
- UpdateViews (NULL, NULL, UPDATE_FLAGSONLY);
+ UpdateViews (nullptr, nullptr, UPDATE_FLAGSONLY);
}
__finally
{
ASSERT ((m_aLines[nPrevLine].m_dwFlags & dwFlag) != 0);
m_aLines[nPrevLine].m_dwFlags &= ~dwFlag;
if (bUpdate)
- UpdateViews (NULL, NULL, UPDATE_SINGLELINE | UPDATE_FLAGSONLY, nPrevLine);
+ UpdateViews (nullptr, nullptr, UPDATE_SINGLELINE | UPDATE_FLAGSONLY, nPrevLine);
}
}
else
m_aLines[nLine].m_dwFlags = dwNewFlags;
if (bUpdate)
- UpdateViews (NULL, NULL, UPDATE_SINGLELINE | UPDATE_FLAGSONLY, nLine);
+ UpdateViews (nullptr, nullptr, UPDATE_SINGLELINE | UPDATE_FLAGSONLY, nLine);
}
}
CString &text, CRLFSTYLE nCrlfStyle /*= CRLF_STYLE_AUTOMATIC */,
bool bExcludeInvisibleLines/*= true*/) const
{
- GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, (nCrlfStyle == CRLF_STYLE_AUTOMATIC) ? NULL : GetStringEol (nCrlfStyle), bExcludeInvisibleLines);
+ GetText(nStartLine, nStartChar, nEndLine, nEndChar, text, (nCrlfStyle == CRLF_STYLE_AUTOMATIC) ? nullptr : GetStringEol (nCrlfStyle), bExcludeInvisibleLines);
}
RemoveView (CCrystalTextView * pView)
{
POSITION pos = m_lpViews.GetHeadPosition ();
- while (pos != NULL)
+ while (pos != nullptr)
{
POSITION thispos = pos;
CCrystalTextView *pvw = m_lpViews.GetNext (pos);
POSITION pos = m_lpViews.GetHeadPosition ();
CString sNew = GetExt (lpszFileName);
CCrystalTextView::TextDefinition *def = CCrystalTextView::GetTextType (sNew);
- while (pos != NULL)
+ while (pos != nullptr)
{
CCrystalTextView *pView = m_lpViews.GetNext (pos);
pView->SetTextType (def);
UpdateViews (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwUpdateFlags, int nLineIndex /*= -1*/ )
{
POSITION pos = m_lpViews.GetHeadPosition ();
- while (pos != NULL)
+ while (pos != nullptr)
{
CCrystalTextView *pView = m_lpViews.GetNext (pos);
pView->UpdateView (pSource, pContext, dwUpdateFlags, nLineIndex);
// delete part of one line
m_aLines[nStartLine].Delete(nStartChar, nEndChar);
- if (pSource!=NULL)
+ if (pSource!=nullptr)
UpdateViews (pSource, &context, UPDATE_SINGLELINE | UPDATE_HORZRANGE, nStartLine);
}
else
if (nStartChar == 0)
m_aLines[nStartLine].m_dwFlags = dwFlags;
- if (pSource!=NULL)
+ if (pSource!=nullptr)
UpdateViews (pSource, &context, UPDATE_HORZRANGE | UPDATE_VERTRANGE, nStartLine);
}
}
- if (pSource!=NULL)
+ if (pSource!=nullptr)
{
if (nInsertedLines > 0)
UpdateViews (pSource, &context, UPDATE_HORZRANGE | UPDATE_VERTRANGE, nLine);
ASSERT ((m_aUndoBuf[0].m_dwFlags & UNDO_BEGINGROUP) != 0);
intptr_t nPosition;
- if (pos == NULL)
+ if (pos == nullptr)
{
// Start from beginning
nPosition = m_nUndoPosition;
}
}
if (nPosition >= static_cast<intptr_t>(m_aUndoBuf.size ()))
- return NULL; // No more redo actions!
+ return nullptr; // No more redo actions!
return (POSITION) nPosition;
}
#ifdef CRYSEDIT_RES_HANDLE
AfxSetResourceHandle (CRYSEDIT_RES_HANDLE);
#else
- if (CCrystalTextView::s_hResourceInst != NULL)
+ if (CCrystalTextView::s_hResourceInst != nullptr)
AfxSetResourceHandle (CCrystalTextView::s_hResourceInst);
#endif
bool bSuccess = false;
FlushUndoGroup (CCrystalTextView * pSource)
{
ASSERT (m_bUndoGroup);
- if (pSource != NULL)
+ if (pSource != nullptr)
{
ASSERT (static_cast<size_t>(m_nUndoPosition) <= m_aUndoBuf.size());
if (m_nUndoPosition > 0)
IMPLEMENT_DYNCREATE (CCrystalTextView, CView)
-HINSTANCE CCrystalTextView::s_hResourceInst = NULL;
+HINSTANCE CCrystalTextView::s_hResourceInst = nullptr;
static ptrdiff_t FindStringHelper(LPCTSTR pszLineBegin, LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, int &nLen, RxNode *&rxnode, RxMatchRes *rxmatch);
for (int i = 0; i < _countof (CCrystalTextView::m_SourceDefs); i++, def++)
if (MatchType (def->exts, sExt))
return def;
- return NULL;
+ return nullptr;
}
bool CCrystalTextView::
free (m_pszLastFindWhat);
m_pszLastFindWhat=nullptr;
}
- if (m_rxnode)
+ if (m_rxnode != nullptr)
{
RxFree (m_rxnode);
m_rxnode = nullptr;
}
- if (m_pszMatched)
+ if (m_pszMatched != nullptr)
{
free(m_pszMatched); // Allocated by _tcsdup()
m_pszMatched = nullptr;
}
//BEGIN SW
- if( m_panSubLines )
+ if( m_panSubLines != nullptr )
{
delete m_panSubLines;
- m_panSubLines = NULL;
+ m_panSubLines = nullptr;
}
- if( m_panSubLineIndexCache )
+ if( m_panSubLineIndexCache != nullptr )
{
delete m_panSubLineIndexCache;
- m_panSubLineIndexCache = NULL;
+ m_panSubLineIndexCache = nullptr;
}
- if( m_pstrIncrementalSearchString )
+ if( m_pstrIncrementalSearchString != nullptr )
{
delete m_pstrIncrementalSearchString;
- m_pstrIncrementalSearchString = NULL;
+ m_pstrIncrementalSearchString = nullptr;
}
- if( m_pstrIncrementalSearchStringOld )
+ if( m_pstrIncrementalSearchStringOld != nullptr )
{
delete m_pstrIncrementalSearchStringOld;
- m_pstrIncrementalSearchStringOld = NULL;
+ m_pstrIncrementalSearchStringOld = nullptr;
}
//END SW
ASSERT(m_ParseCookies != nullptr);
delete m_ParseCookies;
- m_ParseCookies = NULL;
+ m_ParseCookies = nullptr;
ASSERT(m_pnActualLineLength != nullptr);
delete m_pnActualLineLength;
- m_pnActualLineLength = NULL;
+ m_pnActualLineLength = nullptr;
delete m_pIcons;
- if (m_pMarkers)
+ if (m_pMarkers != nullptr)
m_pMarkers->DeleteView(this);
}
PreCreateWindow (CREATESTRUCT & cs)
{
CWnd *pParentWnd = CWnd::FromHandlePermanent (cs.hwndParent);
- if (pParentWnd == NULL || !pParentWnd->IsKindOf (RUNTIME_CLASS (CSplitterWnd)))
+ if (pParentWnd == nullptr || !pParentWnd->IsKindOf (RUNTIME_CLASS (CSplitterWnd)))
{
// View must always create its own scrollbars,
// if only it's not used within splitter
CCrystalTextBuffer *CCrystalTextView::
LocateTextBuffer ()
{
- return NULL;
+ return nullptr;
}
/**
if (L > 0)
dwCookie = (*m_ParseCookies)[L - 1];
ASSERT (dwCookie != - 1);
- (*m_ParseCookies)[L] = ParseLine (dwCookie, L, NULL, nBlocks);
+ (*m_ParseCookies)[L] = ParseLine (dwCookie, L, nullptr, nBlocks);
ASSERT ((*m_ParseCookies)[L] != - 1);
L++;
}
*/
void CCrystalTextView::InvalidateScreenRect(bool bInvalidateView)
{
- if (m_pCacheBitmap != NULL)
+ if (m_pCacheBitmap != nullptr)
{
delete m_pCacheBitmap;
- m_pCacheBitmap = NULL;
+ m_pCacheBitmap = nullptr;
}
m_nScreenChars = -1;
m_nScreenLines = -1;
++nBlocks;
const TCHAR *pszChars = GetLineChars(nLineIndex);
int nLineLength = GetLineLength(nLineIndex);
- if (pszChars)
+ if (pszChars != nullptr)
{
for (const TCHAR *p = pszChars; p < pszChars + nLineLength; )
{
COLORREF CCrystalTextView::
GetColor (int nColorIndex)
{
- if (m_pColors)
+ if (m_pColors != nullptr)
{
nColorIndex &= ~COLORINDEX_APPLYFORCE;
return m_pColors->GetColor(nColorIndex);
DWORD CCrystalTextView::
GetLineFlags (int nLineIndex) const
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return 0;
return m_pTextBuffer->GetLineFlags (nLineIndex);
}
}
}
}
- if (m_pIcons == NULL)
+ if (m_pIcons == nullptr)
{
m_pIcons = new CImageList;
VERIFY (m_pIcons->Create(MARGIN_ICON_WIDTH, MARGIN_ICON_HEIGHT,
if (nLineNumber > 0)
{
int nBreaks = 0;
- WrapLineCached( nLineIndex, GetScreenChars(), NULL, nBreaks );
+ WrapLineCached( nLineIndex, GetScreenChars(), nullptr, nBreaks );
for (int i = 0; i < nBreaks; i++)
{
CPoint pt(rect.right - MARGIN_ICON_WIDTH, rect.top + (GetLineHeight()
CRect rcClient;
GetClientRect (rcClient);
- if (!m_pTextBuffer)
+ if (m_pTextBuffer == nullptr)
{
pdc->FillSolidRect(&rcClient, GetSysColor(COLOR_WINDOW));
return;
CDC cacheDC;
VERIFY (cacheDC.CreateCompatibleDC (pdc));
- if (m_pCacheBitmap == NULL)
+ if (m_pCacheBitmap == nullptr)
{
m_pCacheBitmap = new CBitmap;
VERIFY(m_pCacheBitmap->CreateCompatibleBitmap(pdc, rcClient.Width(), rcClient.Height()));
m_nIdealCharPos = -1;
m_ptAnchor.x = 0;
m_ptAnchor.y = 0;
- if (m_pIcons != NULL)
+ if (m_pIcons != nullptr)
{
delete m_pIcons;
- m_pIcons = NULL;
+ m_pIcons = nullptr;
}
for (int I = 0; I < 4; I++)
{
- if (m_apFonts[I] != NULL)
+ if (m_apFonts[I] != nullptr)
{
delete m_apFonts[I];
- m_apFonts[I] = NULL;
+ m_apFonts[I] = nullptr;
}
}
InvalidateLineCache( 0, -1 );
int CCrystalTextView::
GetCRLFMode ()
{
- if (m_pTextBuffer)
+ if (m_pTextBuffer != nullptr)
{
return m_pTextBuffer->GetCRLFMode ();
}
void CCrystalTextView::
SetCRLFMode (CRLFSTYLE nCRLFMode)
{
- if (m_pTextBuffer)
+ if (m_pTextBuffer != nullptr)
{
m_pTextBuffer->SetCRLFMode (nCRLFMode);
}
int CCrystalTextView::
GetTabSize ()
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return 4;
return m_pTextBuffer->GetTabSize();
SetTabSize (int nTabSize)
{
ASSERT (nTabSize >= 0 && nTabSize <= 64);
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return;
if (m_pTextBuffer->GetTabSize() != nTabSize)
if (bItalic)
nIndex |= 2;
- if (m_apFonts[nIndex] == NULL)
+ if (m_apFonts[nIndex] == nullptr)
{
m_apFonts[nIndex] = new CFont;
if (!m_lfBaseFont.lfHeight)
if (!m_apFonts[nIndex]->CreateFontIndirect (&m_lfBaseFont))
{
delete m_apFonts[nIndex];
- m_apFonts[nIndex] = NULL;
+ m_apFonts[nIndex] = nullptr;
return CView::GetFont ();
}
}
{
// get a number of lines this wrapped lines contains
int nBreaks = 0;
- WrapLineCached( nLineIndex, GetScreenChars(), NULL, nBreaks );
+ WrapLineCached( nLineIndex, GetScreenChars(), nullptr, nBreaks );
return GetEmptySubLines(nLineIndex) + nBreaks + 1;
}
GetSiblingView (int nRow, int nCol)
{
CSplitterWnd *pSplitter = GetParentSplitter (this, false);
- if (pSplitter == NULL)
- return NULL;
+ if (pSplitter == nullptr)
+ return nullptr;
CWnd *pWnd = CWnd::FromHandlePermanent (
::GetDlgItem (pSplitter->m_hWnd, pSplitter->IdFromRowCol (nRow, nCol)));
- if (pWnd == NULL || !pWnd->IsKindOf (RUNTIME_CLASS (CCrystalTextView)))
- return NULL;
+ if (pWnd == nullptr || !pWnd->IsKindOf (RUNTIME_CLASS (CCrystalTextView)))
+ return nullptr;
return (CCrystalTextView *) pWnd;
}
CView::OnInitialUpdate ();
CString sDoc = GetDocument ()->GetPathName (), sExt = GetExt (sDoc);
SetTextType (sExt);
- AttachToBuffer (NULL);
+ AttachToBuffer (nullptr);
CSplitterWnd *pSplitter = GetParentSplitter (this, false);
- if (pSplitter != NULL)
+ if (pSplitter != nullptr)
{
// See CSplitterWnd::IdFromRowCol() implementation
int nRow = (GetDlgCtrlID () - AFX_IDW_PANE_FIRST) / 16;
if (nRow > 0)
{
CCrystalTextView *pSiblingView = GetSiblingView (0, nCol);
- if (pSiblingView != NULL && pSiblingView != this)
+ if (pSiblingView != nullptr && pSiblingView != this)
{
m_nOffsetChar = pSiblingView->m_nOffsetChar;
ASSERT (m_nOffsetChar >= 0 && m_nOffsetChar <= GetMaxLineLength (m_nTopLine, GetScreenLines()));
if (nCol > 0)
{
CCrystalTextView *pSiblingView = GetSiblingView (nRow, 0);
- if (pSiblingView != NULL && pSiblingView != this)
+ if (pSiblingView != nullptr && pSiblingView != this)
{
m_nTopLine = pSiblingView->m_nTopLine;
ASSERT (m_nTopLine >= 0 && m_nTopLine < GetLineCount ());
if (!m_pPrintFont->CreateFontIndirect (&lf))
{
delete m_pPrintFont;
- m_pPrintFont = NULL;
+ m_pPrintFont = nullptr;
return;
}
void CCrystalTextView::
OnEndPrinting (CDC * pdc, CPrintInfo * pInfo)
{
- if (m_pPrintFont != NULL)
+ if (m_pPrintFont != nullptr)
{
delete m_pPrintFont;
- m_pPrintFont = NULL;
+ m_pPrintFont = nullptr;
SetFont(m_lfSavedBaseFont);
}
m_nPrintPages = 0;
rcMargin.top = rcLine.bottom;
}
- pdc->SelectClipRgn (NULL);
+ pdc->SelectClipRgn (nullptr);
}
int CCrystalTextView::
GetLineCount ()
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return 1; // Single empty line
int nLineCount = m_pTextBuffer->GetLineCount ();
int CCrystalTextView::
GetLineLength (int nLineIndex) const
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return 0;
return m_pTextBuffer->GetLineLength (nLineIndex);
}
int CCrystalTextView::
GetFullLineLength (int nLineIndex) const
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
return 0;
return m_pTextBuffer->GetFullLineLength (nLineIndex);
}
void CCrystalTextView::
DetachFromBuffer ()
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
m_pTextBuffer->RemoveView (this);
- m_pTextBuffer = NULL;
+ m_pTextBuffer = nullptr;
// don't reset CCrystalEditView options
CCrystalTextView::ResetView ();
}
bool CCrystalTextView::
GetBold (int nColorIndex)
{
- if (m_pColors)
+ if (m_pColors != nullptr)
{
nColorIndex &= ~COLORINDEX_APPLYFORCE;
return m_pColors->GetBold(nColorIndex);
{
GetFont ()->GetLogFont (&m_lfBaseFont);
DetachFromBuffer ();
- m_hAccel = NULL;
+ m_hAccel = nullptr;
CView::OnDestroy ();
for (int I = 0; I < 4; I++)
{
- if (m_apFonts[I] != NULL)
+ if (m_apFonts[I] != nullptr)
{
delete m_apFonts[I];
- m_apFonts[I] = NULL;
+ m_apFonts[I] = nullptr;
}
}
- if (m_pCacheBitmap != NULL)
+ if (m_pCacheBitmap != nullptr)
{
delete m_pCacheBitmap;
- m_pCacheBitmap = NULL;
+ m_pCacheBitmap = nullptr;
}
}
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;
if (nCol != nCurrentCol) // We don't need to update ourselves
{
CCrystalTextView *pSiblingView = GetSiblingView (nCurrentRow, nCol);
- if (pSiblingView != NULL)
+ if (pSiblingView != nullptr)
pSiblingView->OnUpdateSibling (this, false);
}
}
if (nRow != nCurrentRow) // We don't need to update ourselves
{
CCrystalTextView *pSiblingView = GetSiblingView (nRow, nCurrentCol);
- if (pSiblingView != NULL)
+ if (pSiblingView != nullptr)
pSiblingView->OnUpdateSibling (this, false);
}
}
// [JRT]: Support For Disabling Drag and Drop...
if (!m_bDisableDragAndDrop) // If Drag And Drop Not Disabled
- ::SetCursor (::LoadCursor (NULL, IDC_ARROW)); // Set To Arrow Cursor
+ ::SetCursor (::LoadCursor (nullptr, IDC_ARROW)); // Set To Arrow Cursor
}
else
- ::SetCursor (::LoadCursor (NULL, IDC_IBEAM));
+ ::SetCursor (::LoadCursor (nullptr, IDC_IBEAM));
}
return true;
}
GetLineBySubLine( pt.y, nLine, nSubLineOffset );
pt.y = nLine;
- LPCTSTR pszLine = NULL;
+ LPCTSTR pszLine = nullptr;
int nLength = 0;
vector<int> anBreaks(1);
int nBreaks = 0;
void CCrystalTextView::
GetText (const CPoint & ptStart, const CPoint & ptEnd, CString & text, bool bExcludeInvisibleLines /*= true*/)
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
m_pTextBuffer->GetText (ptStart.y, ptStart.x, ptEnd.y, ptEnd.x, text);
else
text = _T ("");
void CCrystalTextView::
GetTextInColumnSelection (CString & text, bool bExcludeInvisibleLines /*= true*/)
{
- if (m_pTextBuffer == NULL)
+ if (m_pTextBuffer == nullptr)
{
text = _T ("");
return;
}
// All those points must be recalculated and validated
- if (pContext != NULL)
+ if (pContext != nullptr)
{
pContext->RecalcPoint (m_ptCursorPos);
pContext->RecalcPoint (m_ptSelStart);
#ifdef CRYSEDIT_RES_HANDLE
return CRYSEDIT_RES_HANDLE;
#else
- if (s_hResourceInst != NULL)
+ if (s_hResourceInst != nullptr)
return s_hResourceInst;
return AfxGetResourceHandle ();
#endif
{
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
{
- if (m_hAccel != NULL)
+ if (m_hAccel != nullptr)
{
if (::TranslateAccelerator (m_hWnd, m_hAccel, pMsg))
return true;
m_nLineHeight = -1;
for (int I = 0; I < 4; I++)
{
- if (m_apFonts[I] != NULL)
+ if (m_apFonts[I] != nullptr)
{
delete m_apFonts[I];
- m_apFonts[I] = NULL;
+ m_apFonts[I] = nullptr;
}
}
if (::IsWindow (m_hWnd))
void CCrystalTextView::
OnUpdateIndicatorCRLF (CCmdUI * pCmdUI)
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
std::basic_string<TCHAR> eol;
CRLFSTYLE crlfMode = m_pTextBuffer->GetCRLFMode ();
pCmdUI->Enable (true);
break;
default:
- pCmdUI->SetText (NULL);
+ pCmdUI->SetText (nullptr);
pCmdUI->Enable (false);
}
}
else
{
- pCmdUI->SetText (NULL);
+ pCmdUI->SetText (nullptr);
pCmdUI->Enable (false);
}
}
{
int nBookmarkID = nCmdID - ID_EDIT_TOGGLE_BOOKMARK0;
ASSERT (nBookmarkID >= 0 && nBookmarkID <= 9);
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
DWORD dwFlags = GetLineFlags (m_ptCursorPos.y);
DWORD dwMask = LF_BOOKMARK (nBookmarkID);
{
int nBookmarkID = nCmdID - ID_EDIT_GO_BOOKMARK0;
ASSERT (nBookmarkID >= 0 && nBookmarkID <= 9);
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
int nLine = m_pTextBuffer->GetLineWithFlag (LF_BOOKMARK (nBookmarkID));
if (nLine >= 0)
void CCrystalTextView::
OnClearBookmarks ()
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
for (int nBookmarkID = 0; nBookmarkID <= 9; nBookmarkID++)
{
{
PrepareSelBounds ();
if (m_ptDrawSelStart == m_ptDrawSelEnd)
- return NULL;
+ return nullptr;
CString text;
GetText (m_ptDrawSelStart, m_ptDrawSelEnd, text);
int cchText = text.GetLength();
SIZE_T cbData = (cchText + 1) * sizeof(TCHAR);
HGLOBAL hData =::GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, cbData);
- if (hData == NULL)
- return NULL;
+ if (hData == nullptr)
+ return nullptr;
LPTSTR pszData = (LPTSTR)::GlobalLock (hData);
- if (!pszData)
- return NULL;
+ if (pszData == nullptr)
+ return nullptr;
memcpy (pszData, text, cbData);
::GlobalUnlock (hData);
pszPos = _tcsstr(pszFindWhere, pszFindWhat);
else
pszPos = StrStrI(pszFindWhere, pszFindWhat);
- if (pszPos == NULL)
+ if (pszPos == nullptr)
return -1;
if ((dwFlags & FIND_WHOLE_WORD) == 0)
return nCur + (int) (pszPos - pszFindWhere);
FindText (LPCTSTR pszText, const CPoint & ptStartPos, DWORD dwFlags,
bool bWrapSearch, CPoint * pptFoundPos)
{
- if (m_pMarkers)
+ if (m_pMarkers != nullptr)
{
m_pMarkers->SetMarker(_T("EDITOR_MARKER"), pszText, dwFlags, COLORINDEX_MARKERBKGND0, false);
if (m_pMarkers->GetEnabled())
LPCTSTR p = s;
int n = 0;
const int l = (int) _tcslen (m);
- while ((p = _tcsstr (p, m)) != NULL)
+ while ((p = _tcsstr (p, m)) != nullptr)
{
n++;
p += l;
{
LPCTSTR p = s;
int n = 0;
- while ((p = _tcschr (p, c)) != NULL)
+ while ((p = _tcschr (p, c)) != nullptr)
{
n++;
p++;
size_t nPos = ::FindStringHelper (line, static_cast<LPCTSTR>(line) + ptCurrentPos.x, what, dwFlags, m_nLastFindWhatLen, m_rxnode, &m_rxmatch);
if (nPos != -1)
{
- if (m_pszMatched)
+ if (m_pszMatched != nullptr)
free(m_pszMatched);
m_pszMatched = _tcsdup (line);
if (nEolns)
}
else
{
- if (m_pszMatched)
+ if (m_pszMatched != nullptr)
free(m_pszMatched);
- m_pszMatched = NULL;
+ m_pszMatched = nullptr;
}
// Go further, text was not found
// Save search parameters for 'F3' command
m_bLastSearch = true;
- if (m_pszLastFindWhat != NULL)
+ if (m_pszLastFindWhat != nullptr)
free (m_pszLastFindWhat);
m_pszLastFindWhat = _tcsdup (lastSearch->m_sText);
m_dwLastSearchFlags = dwSearchFlags;
CWinApp *pApp = AfxGetApp ();
ASSERT (pApp != nullptr);
- if (!m_pFindTextDlg)
+ if (m_pFindTextDlg == nullptr)
m_pFindTextDlg = new CFindTextDlg (this);
LastSearchInfos * lastSearch = m_pFindTextDlg->GetLastSearchInfos();
{
// Get the latest search parameters
ConvertSearchFlagsToLastSearchInfos(lastSearch, m_dwLastSearchFlags);
- if (m_pszLastFindWhat != NULL)
+ if (m_pszLastFindWhat != nullptr)
lastSearch->m_sText = m_pszLastFindWhat;
}
else
{
bool bEnable = m_bLastSearch;
// Show dialog if no last find text
- if (m_pszLastFindWhat == NULL || _tcslen(m_pszLastFindWhat) == 0)
+ if (m_pszLastFindWhat == nullptr || _tcslen(m_pszLastFindWhat) == 0)
bEnable = false;
CString sText;
if (bEnable)
void CCrystalTextView::ToggleBookmark(int nLine)
{
ASSERT(nLine >= 0 && nLine < GetLineCount());
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
DWORD dwFlags = GetLineFlags (nLine);
DWORD dwMask = LF_BOOKMARKS;
void CCrystalTextView::
OnNextBookmark ()
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
int nLine = m_pTextBuffer->FindNextBookmarkLine (m_ptCursorPos.y);
if (nLine >= 0)
void CCrystalTextView::
OnPrevBookmark ()
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
int nLine = m_pTextBuffer->FindPrevBookmarkLine (m_ptCursorPos.y);
if (nLine >= 0)
void CCrystalTextView::
OnClearAllBookmarks ()
{
- if (m_pTextBuffer != NULL)
+ if (m_pTextBuffer != nullptr)
{
int nLineCount = GetLineCount ();
for (int I = 0; I < nLineCount; I++)
OnForceRedraw ()
{
//Invalidate ();
- RedrawWindow (NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW);
+ RedrawWindow (nullptr, nullptr, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW);
}
void CCrystalTextView::
void CCrystalTextView::OnUpdateEditFindIncrementalForward(CCmdUI* pCmdUI)
{
- if (m_pTextBuffer)
+ if (m_pTextBuffer != nullptr)
{
int nLines = m_pTextBuffer->GetLineCount ();
int nChars = m_pTextBuffer->GetLineLength (m_ptCursorPos.y);
void CCrystalTextView::OnUpdateEditFindIncrementalBackward(CCmdUI* pCmdUI)
{
- if (m_pTextBuffer)
+ if (m_pTextBuffer != nullptr)
{
pCmdUI->Enable(m_ptCursorPos.y > 0 || m_ptCursorPos.x > 0);
return;
bool CCrystalTextView::
SetTextTypeByContent (LPCTSTR pszContent)
{
- RxNode *rxnode = NULL;
+ RxNode *rxnode = nullptr;
RxMatchRes rxmatch;
int nLen;
if (::FindStringHelper(pszContent, pszContent, _T("^\\s*\\<\\?xml\\s+.+?\\?\\>\\s*$"),
SetSelection (ptStart, ptEnd);
SetCapture ();
- m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, NULL);
+ m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, nullptr);
ASSERT (m_nDragSelTimer != 0);
m_bColumnSelection = false;
m_bWordSelection = false;
SetSelection (ptStart, ptEnd);
SetCapture ();
- m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, NULL);
+ m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, nullptr);
ASSERT (m_nDragSelTimer != 0);
m_bColumnSelection = bAlt;
m_bWordSelection = bControl;
}
// Moving to normal selection mode
- ::SetCursor (::LoadCursor (NULL, IDC_IBEAM));
+ ::SetCursor (::LoadCursor (nullptr, IDC_IBEAM));
m_bLineSelection = m_bWordSelection = false;
}
EnsureVisible (m_ptCursorPos);
SetSelection (ptStart, ptEnd);
SetCapture ();
- m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, NULL);
+ m_nDragSelTimer = SetTimer (CRYSTAL_TIMER_DRAGSEL, 100, nullptr);
ASSERT (m_nDragSelTimer != 0);
m_bColumnSelection = false;
m_bWordSelection = true;
bool CCrystalTextView::
PutToClipboard (LPCTSTR pszText, int cchText, bool bColumnSelection)
{
- if (pszText == NULL || cchText == 0)
+ if (pszText == nullptr || cchText == 0)
return false;
CWaitCursor wc;
{
SIZE_T dwSize = GlobalSize(hData);
LPTSTR pszData = (LPTSTR)::GlobalLock (hData);
- if (pszData)
+ if (pszData != nullptr)
{
memcpy (pszData, pszText, cbData);
if (dwSize > cbData)
CEditReplaceDlg::CEditReplaceDlg (CCrystalEditView * pBuddy)
-: CDialog (CEditReplaceDlg::IDD, NULL)
+: CDialog (CEditReplaceDlg::IDD, nullptr)
, m_pBuddy(pBuddy)
, m_bMatchCase(false)
, m_bWholeWord(false)
_T ("Apple Macintosh"),
_T ("Apple Macintosh for Central Europe"),
_T ("Corky"),
- NULL
+ nullptr
};
EDITPADC_CLASS int nCodeNames = sizeof (pszCodeNames) / sizeof (pszCodeNames[0]) - 1;
/////////////////////////////////////////////////////////////////////////////
// CCharConvDlg dialog
-CCharConvDlg::CCharConvDlg () : CDialog (CCharConvDlg::IDD, NULL)
+CCharConvDlg::CCharConvDlg () : CDialog (CCharConvDlg::IDD, nullptr)
{
//{{AFX_DATA_INIT(CCharConvDlg)
m_nSource = 1;
m_sPreview = pszNew;
UpdateData (false);
}
- if (pszNew)
+ if (pszNew != nullptr)
free (pszNew);
}
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
n = new RxNode();
if (n == nullptr) return nullptr;
- const char * errormsg = NULL;
+ const char * errormsg = nullptr;
int erroroffset = 0;
int pcre_opts = 0;
std::string regexString;
if (*s) {
LPTSTR p = (LPTSTR) realloc(*s, NewLen * sizeof(TCHAR));
- if (!p)
+ if (p == nullptr)
return 0;
*s = p;
assert(*s != 0);
if( m_pSyntaxParser != nullptr )
{
CCrystalTextBlock *pTextBlock =
- pBuf? new CCrystalTextBlock( (CCrystalTextBlock::TEXTBLOCK*)pBuf, nActualItems ) : NULL;
+ pBuf? new CCrystalTextBlock( (CCrystalTextBlock::TEXTBLOCK*)pBuf, nActualItems ) : nullptr;
dwCookie = m_pSyntaxParser->ParseLine( dwCookie, nLineIndex, pTextBlock );
if( pTextBlock )
CCrystalParser::CCrystalParser()
{
- m_pTextView = NULL;
+ m_pTextView = nullptr;
}
iconvert (LPTSTR string, int source_coding, int destination_coding, bool alphabet_only)
{
ptrdiff_t posit = -2;
- LPCTSTR source_chars, destination_chars, cod_pos = NULL;
+ LPCTSTR source_chars, destination_chars, cod_pos = nullptr;
TCHAR ch;
LPTSTR s = string;
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
_T ("white-space"),
_T ("width"),
_T ("word-spacing"),
- NULL
+ nullptr
};
static LPTSTR s_apszCss2KeywordList[] =
_T ("widths"),
_T ("x-height"),
_T ("z-index"),
- NULL
+ nullptr
};
static bool
IsXKeyword (LPTSTR apszKeywords[], LPCTSTR pszChars, int nLength)
{
- for (int L = 0; apszKeywords[L] != NULL; L++)
+ for (int L = 0; apszKeywords[L] != nullptr; L++)
{
if (_tcsnicmp (apszKeywords[L], pszChars, nLength) == 0
&& apszKeywords[L][nLength] == 0)
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
\r
\r
CTextMarkerDlg::CTextMarkerDlg (CCrystalTextMarkers & markers, const CString& sText, DWORD dwFlags)\r
-: CDialog (CTextMarkerDlg::IDD, NULL)\r
+: CDialog (CTextMarkerDlg::IDD, nullptr)\r
, m_markers(markers)\r
, m_nCurItemIndex(0)\r
, m_tempMarkers(markers)\r
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
int GetExtPosition (LPCTSTR pszString)
{
- if (!pszString || !*pszString)
+ if (pszString == nullptr || !*pszString)
return 0;
const CString sString = pszString;
int len = sString.GetLength (), posit = len;
int GetNamePosition (LPCTSTR pszString)
{
- if (!pszString || !*pszString)
+ if (pszString == nullptr || !*pszString)
return 0;
const CString sString = pszString;
int posit = sString.GetLength ();
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
int len;
/* Check args */
- if (pat == NULL)
+ if (pat == nullptr)
return (false);
/* Verify that the pattern is valid */
int rc;
/* Check args */
- if (fname == NULL)
- return (false);
+ if (fname == nullptr)
+ return (0);
- if (pat == NULL)
- return (false);
+ if (pat == nullptr)
+ return (0);
/* Verify that the pattern is valid, and get its length */
if (!fpattern_isvalid (pat))
- return (false);
+ return (0);
/* Attempt to match pattern against filename */
if (fname[0] == _T('\0'))
int rc;
/* Check args */
- if (fname == NULL)
+ if (fname == nullptr)
return (false);
- if (pat == NULL)
+ if (pat == nullptr)
return (false);
/* Assume that pattern is well-formed */
\r
#define DEFINE_BLOCK(pos, colorindex) \\r
ASSERT((pos) >= 0 && (pos) <= nLength);\\r
-if (pBuf != NULL)\\r
+if (pBuf != nullptr)\\r
{\\r
if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\\r
if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\\r
continue;\r
}\r
\r
- if (pBuf == NULL)\r
+ if (pBuf == nullptr)\r
continue; // We don't need to extract keywords,\r
// for faster parsing skip the rest of loop\r
\r
/////////////////////////////////////////////////////////////////////////////
// CGotoDlg dialog
-CGotoDlg::CGotoDlg (CCrystalTextView * pBuddy):CDialog (CGotoDlg::IDD, NULL)
+CGotoDlg::CGotoDlg (CCrystalTextView * pBuddy):CDialog (CGotoDlg::IDD, nullptr)
{
m_pBuddy = pBuddy;
//{{AFX_DATA_INIT(CGotoDlg)
{
CDialog::OnOK ();
ASSERT (m_pBuddy != nullptr);
- m_pBuddy->GoToLine (_ttoi (m_sNumber), _tcschr (_T ("+-"), *(LPCTSTR)m_sNumber) != NULL);
+ m_pBuddy->GoToLine (_ttoi (m_sNumber), _tcschr (_T ("+-"), *(LPCTSTR)m_sNumber) != nullptr);
}
void CGotoDlg::
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
nHeight = rc.Height() * nHeight + 16;
if(rc.top + nHeight > nMax)
nHeight = nMax - rc.top;
- Control.SetWindowPos(NULL, 0, 0, rc.Width(), nHeight, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
+ Control.SetWindowPos(nullptr, 0, 0, rc.Width(), nHeight, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
}
-void SetComboBoxWidth(CComboBox &Control, LPCTSTR lpszText = NULL)
+void SetComboBoxWidth(CComboBox &Control, LPCTSTR lpszText = nullptr)
{
int cnt = Control.GetCount();
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
continue;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
_T ("msgid"),
_T ("msgid_plural"),
_T ("msgstr"),
- NULL
+ nullptr
};
static bool
IsXKeyword (LPTSTR apszKeywords[], LPCTSTR pszChars, int nLength)
{
- for (int L = 0; apszKeywords[L] != NULL; L++)
+ for (int L = 0; apszKeywords[L] != nullptr; L++)
{
if (_tcsnicmp (apszKeywords[L], pszChars, nLength) == 0
&& apszKeywords[L][nLength] == 0)
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
dwLength = (DWORD) _tcslen (pszString1) + 1;
LPTSTR pszNewString = (LPTSTR) malloc (dwLength);
*pszDstString = pszNewString;
- if (pszNewString)
+ if (pszNewString != nullptr)
{
while ((*pszNewString = (BYTE) *pszString1) != _T ('\0'))
{
dwRealCount++;
}
LPTSTR *pszNewStrings = (LPTSTR *) malloc (dwRealCount *sizeof (LPTSTR));
- if (pszNewStrings)
+ if (pszNewStrings != nullptr)
{
*pszStrings = pszNewStrings;
*pdwCount = dwRealCount;
dwLength = (DWORD) _tcslen (pszString) + 1;
LPTSTR pszNewString = (LPTSTR) malloc (dwLength);
*pszNewStrings = pszNewString;
- if (pszNewString)
+ if (pszNewString != nullptr)
{
while ((*pszNewString = (BYTE) *pszString) != _T ('\0'))
{
{
return hSubKey;
}
- return NULL;
+ return nullptr;
}
/* open computer registry */
{
return hSubKey;
}
- return NULL;
+ return nullptr;
}
/* create computer registry */
{
HKEY hSubKey;
DWORD dwDisposition;
- if (RegCreateKeyEx (hKey, pszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, dwRights,
- NULL, &hSubKey, &dwDisposition) == ERROR_SUCCESS)
+ if (RegCreateKeyEx (hKey, pszSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, dwRights,
+ nullptr, &hSubKey, &dwDisposition) == ERROR_SUCCESS)
{
return hSubKey;
}
- return NULL;
+ return nullptr;
}
/* close computer registry */
if (hSubKey != nullptr)
{
DWORD dwType, dwSize;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwSize) == ERROR_SUCCESS)
{
if (dwType == REG_DWORD)
{
ASSERT (dwSize == sizeof (DWORD));
DWORD dwNumber;
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, (LPBYTE) &dwNumber, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, (LPBYTE) &dwNumber, &dwSize) == ERROR_SUCCESS)
{
ASSERT (dwSize == sizeof (DWORD));
RegValFree (pValData);
LPBYTE pbyteData = (LPBYTE) malloc (dwSize);
if (pbyteData != nullptr)
{
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, pbyteData, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, pbyteData, &dwSize) == ERROR_SUCCESS)
{
RegValFree (pValData);
pValData->dwType = dwType;
if (hSubKey != nullptr)
{
DWORD dwType, dwSize;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwSize) == ERROR_SUCCESS)
{
if (dwType == REG_DWORD)
{
ASSERT (dwSize == sizeof (DWORD));
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, (LPBYTE) pdwNumber, &dwSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, (LPBYTE) pdwNumber, &dwSize) == ERROR_SUCCESS)
{
ASSERT (dwSize == sizeof (DWORD));
if (hSubKey != hKey)
if (hSubKey != nullptr)
{
DWORD dwType, dwRealSize;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwRealSize) == ERROR_SUCCESS)
{
if (dwType == REG_BINARY &&dwSize >= dwRealSize)
{
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, pbyteData, &dwRealSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, pbyteData, &dwRealSize) == ERROR_SUCCESS)
{
if (hSubKey != hKey)
RegClose (hSubKey);
if (hSubKey != nullptr)
{
DWORD dwType, dwRealSize;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwRealSize) == ERROR_SUCCESS)
{
if (dwType == REG_BINARY)
{
LPBYTE pbyteNewData = (LPBYTE) malloc (dwRealSize);
- if (pbyteNewData)
+ if (pbyteNewData != nullptr)
{
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, pbyteNewData, &dwRealSize) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, pbyteNewData, &dwRealSize) == ERROR_SUCCESS)
{
*pbyteData = pbyteNewData;
*pdwSize = dwRealSize;
if (hSubKey != nullptr)
{
DWORD dwType, dwRealLength;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwRealLength) == ERROR_SUCCESS)
{
if ((dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_LINK
|| dwType == REG_MULTI_SZ) &&dwLength >= dwRealLength)
{
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, (LPBYTE) pszString, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, (LPBYTE) pszString, &dwRealLength) == ERROR_SUCCESS)
{
if (hSubKey != hKey)
RegClose (hSubKey);
if (hSubKey != nullptr)
{
DWORD dwType, dwRealLength;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwRealLength) == ERROR_SUCCESS)
{
if (dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_LINK
|| dwType == REG_MULTI_SZ)
{
LPTSTR pszNewString = (LPTSTR) malloc (dwRealLength);
- if (pszNewString)
+ if (pszNewString != nullptr)
{
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, (LPBYTE) pszNewString, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, (LPBYTE) pszNewString, &dwRealLength) == ERROR_SUCCESS)
{
*pszString = pszNewString;
- if (pdwLength)
+ if (pdwLength != nullptr)
{
*pdwLength = dwRealLength;
}
if (hSubKey)
{
DWORD dwType, dwRealLength;
- if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, nullptr, &dwRealLength) == ERROR_SUCCESS)
{
if (dwType == REG_SZ || dwType == REG_EXPAND_SZ || dwType == REG_LINK
|| dwType == REG_MULTI_SZ)
{
LPTSTR pszString = sString.GetBuffer (dwRealLength);
- if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, (LPBYTE) pszString, &dwRealLength) == ERROR_SUCCESS)
+ if (RegQueryValueEx (hSubKey, pszValName, 0, nullptr, (LPBYTE) pszString, &dwRealLength) == ERROR_SUCCESS)
{
sString.ReleaseBuffer (dwRealLength);
if (hSubKey != hKey)
RegDeleteSubKeys (HKEY hKey)
{
DWORD dwSubKeyCnt, dwMaxSubKey;
- if (RegQueryInfoKey (hKey, NULL, NULL, 0, &dwSubKeyCnt, &dwMaxSubKey,
- NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (RegQueryInfoKey (hKey, nullptr, nullptr, 0, &dwSubKeyCnt, &dwMaxSubKey,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
if (dwSubKeyCnt)
{
LPTSTR pszKeyName = (LPTSTR) malloc (dwMaxSubKey += 1);
- if (pszKeyName)
+ if (pszKeyName != nullptr)
{
do
{
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ | KEY_WRITE) : hKey;
if (hSubKey)
{
- if (pszValName)
+ if (pszValName != nullptr)
{
if (RegDeleteValue (hSubKey, pszValName) == ERROR_SUCCESS)
{
HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
if (hSubKey)
{
- if (RegQueryInfoKey (hSubKey, NULL, NULL, 0, pdwSubKeyCount, NULL, NULL, pdwValueCount, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (RegQueryInfoKey (hSubKey, nullptr, nullptr, 0, pdwSubKeyCount, nullptr, nullptr, pdwValueCount, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
if (hSubKey != hKey)
RegClose (hSubKey);
return false;
}
-static LPTSTR g_pszValue = NULL;
+static LPTSTR g_pszValue = nullptr;
static DWORD g_dwValueCnt, g_dwValue, g_dwValueMax;
bool RegFindFirstValue (HKEY hKey, LPCTSTR *ppszValue, RegVal *pValData);
bool
RegFindFirstValue (HKEY hKey, LPCTSTR *ppszValue, RegVal *pValData)
{
- if (RegQueryInfoKey (hKey, NULL, NULL, 0, NULL, NULL, NULL,
- &g_dwValueCnt, &g_dwValueMax, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (RegQueryInfoKey (hKey, nullptr, nullptr, 0, nullptr, nullptr, nullptr,
+ &g_dwValueCnt, &g_dwValueMax, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
if (g_dwValueCnt)
{
- if (g_pszValue)
+ if (g_pszValue != nullptr)
{
free (g_pszValue);
- g_pszValue = NULL;
+ g_pszValue = nullptr;
}
g_pszValue = (LPTSTR) malloc (g_dwValueMax += 1);
if (g_pszValue)
{
DWORD dwMaxValue = g_dwValueMax;
g_dwValue = 0;
- if (RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
*ppszValue = g_pszValue;
- return RegLoadVal (hKey, NULL, g_pszValue, pValData);
+ return RegLoadVal (hKey, nullptr, g_pszValue, pValData);
}
}
}
bool RegFindNextValue (HKEY hKey, LPCTSTR *ppszValue, RegVal *pValData)
{
DWORD dwMaxValue = g_dwValueMax;
- if (g_dwValue < g_dwValueCnt && RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (g_dwValue < g_dwValueCnt && RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
{
*ppszValue = g_pszValue;
- return RegLoadVal (hKey, NULL, g_pszValue, pValData);
+ return RegLoadVal (hKey, nullptr, g_pszValue, pValData);
}
return false;
}
/* closes registry walking */
void RegFindClose ()
{
- if (g_pszValue)
+ if (g_pszValue != nullptr)
{
free (g_pszValue);
- g_pszValue = NULL;
+ g_pszValue = nullptr;
}
}
/* load data of any type */
bool CReg::LoadVal (LPCTSTR pszValName, RegVal *pValData)
{
- return RegLoadVal (hKey, NULL, pszValName, pValData);
+ return RegLoadVal (hKey, nullptr, pszValName, pValData);
}
/* load data of any type from subkey */
/* load a number */
bool CReg::LoadNumber (LPCTSTR pszValName, DWORD *pdwNumber)
{
- return RegLoadNumber (hKey, NULL, pszValName, pdwNumber);
+ return RegLoadNumber (hKey, nullptr, pszValName, pdwNumber);
}
/* load a number from subkey */
/* load binary data */
bool CReg::LoadBinary (LPCTSTR pszValName, LPBYTE pbyteData, DWORD dwSize)
{
- return RegLoadBinary (hKey, NULL, pszValName, pbyteData, dwSize);
+ return RegLoadBinary (hKey, nullptr, pszValName, pbyteData, dwSize);
}
/* load binary data from subkey */
/* load new binary data */
bool CReg::LoadNewBinary (LPCTSTR pszValName, LPBYTE *pbyteData, DWORD *pdwSize)
{
- return RegLoadNewBinary (hKey, NULL, pszValName, pbyteData, pdwSize);
+ return RegLoadNewBinary (hKey, nullptr, pszValName, pbyteData, pdwSize);
}
/* load new binary data from subkey */
/* load a string */
bool CReg::LoadString (LPCTSTR pszValName, LPTSTR pszString, DWORD dwLength)
{
- return RegLoadString (hKey, NULL, pszValName, pszString, dwLength);
+ return RegLoadString (hKey, nullptr, pszValName, pszString, dwLength);
}
/* load a string from subkey */
/* load a new string */
bool CReg::LoadNewString (LPCTSTR pszValName, LPTSTR *pszString, DWORD *pdwLength)
{
- return RegLoadNewString (hKey, NULL, pszValName, pszString, pdwLength);
+ return RegLoadNewString (hKey, nullptr, pszValName, pszString, pdwLength);
}
/* load a new string from subkey */
/* load an array of strings */
bool CReg::LoadStringArr (LPCTSTR pszValName, LPTSTR pszStrings[], DWORD dwCount)
{
- return RegLoadStringArr (hKey, NULL, pszValName, pszStrings, dwCount);
+ return RegLoadStringArr (hKey, nullptr, pszValName, pszStrings, dwCount);
}
/* load an array of strings from subkey */
/* load a new array of strings */
bool CReg::LoadNewStringArr (LPCTSTR pszValName, LPTSTR **pszStrings, DWORD *pdwCount)
{
- return RegLoadNewStringArr (hKey, NULL, pszValName, pszStrings, pdwCount);
+ return RegLoadNewStringArr (hKey, nullptr, pszValName, pszStrings, pdwCount);
}
/* load a new array of strings from subkey */
/* load a string */
bool CReg::LoadString (LPCTSTR pszValName, CString &sString)
{
- return RegLoadString (hKey, NULL, pszValName, sString);
+ return RegLoadString (hKey, nullptr, pszValName, sString);
}
/* load a string from subkey */
/* load an array of strings */
bool CReg::LoadStringArr (LPCTSTR pszValName, CStringArray &arrString)
{
- return RegLoadStringArr (hKey, NULL, pszValName, arrString);
+ return RegLoadStringArr (hKey, nullptr, pszValName, arrString);
}
/* load an array of strings from subkey */
/* store data of any type */
bool CReg::SaveVal (LPCTSTR pszValName, const RegVal *pValData)
{
- return RegSaveVal (hKey, NULL, pszValName, pValData);
+ return RegSaveVal (hKey, nullptr, pszValName, pValData);
}
/* store data of any type to subkey */
/* store a number */
bool CReg::SaveNumber (LPCTSTR pszValName, DWORD dwNumber)
{
- return RegSaveNumber (hKey, NULL, pszValName, dwNumber);
+ return RegSaveNumber (hKey, nullptr, pszValName, dwNumber);
}
/* store a number to subkey */
/* store binary data */
bool CReg::SaveBinary (LPCTSTR pszValName, const LPBYTE pbyteData, DWORD dwSize)
{
- return RegSaveBinary (hKey, NULL, pszValName, pbyteData, dwSize);
+ return RegSaveBinary (hKey, nullptr, pszValName, pbyteData, dwSize);
}
/* store binary data to subkey */
/* store a string */
bool CReg::SaveString (LPCTSTR pszValName, LPCTSTR pszString)
{
- return RegSaveString (hKey, NULL, pszValName, pszString);
+ return RegSaveString (hKey, nullptr, pszValName, pszString);
}
/* store a string to subkey */
/* store an array of strings */
bool CReg::SaveStringArr (LPCTSTR pszValName, const LPCTSTR pszStrings[], DWORD dwCount)
{
- return RegSaveStringArr (hKey, NULL, pszValName, pszStrings, dwCount);
+ return RegSaveStringArr (hKey, nullptr, pszValName, pszStrings, dwCount);
}
/* store an array of strings to subkey */
/* store an array of strings */
bool CReg::SaveStringArr (LPCTSTR pszValName, const CStringArray &arrString)
{
- return RegSaveStringArr (hKey, NULL, pszValName, arrString);
+ return RegSaveStringArr (hKey, nullptr, pszValName, arrString);
}
/* store an array of strings to subkey */
/* delete the given value or key in the registry with all of its subkeys */
bool CReg::DeleteKey (LPCTSTR pszValName)
{
- return RegDeleteKey (hKey, NULL, pszValName);
+ return RegDeleteKey (hKey, nullptr, pszValName);
}
/* delete the given value or key in the registry with all of its subkeys in subkey */
/* check wether the given key has other subkeys and/or values */
bool CReg::HasEntries (DWORD *pdwSubKeyCount, DWORD *pdwValueCount)
{
- return RegHasEntries (hKey, NULL, pdwSubKeyCount, pdwValueCount);
+ return RegHasEntries (hKey, nullptr, pdwSubKeyCount, pdwValueCount);
}
/* check wether the given key has other subkeys and/or values in subkey */
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
static bool
IsXKeyword (LPTSTR apszKeywords[], LPCTSTR pszChars, int nLength)
{
- for (int L = 0; apszKeywords[L] != NULL; L++)
+ for (int L = 0; apszKeywords[L] != nullptr; L++)
{
if (_tcsnicmp (apszKeywords[L], pszChars, nLength) == 0
&& apszKeywords[L][nLength] == 0)
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
\r
#define DEFINE_BLOCK(pos, colorindex) \\r
ASSERT((pos) >= 0 && (pos) <= nLength);\\r
-if (pBuf != NULL)\\r
+if (pBuf != nullptr)\\r
{\\r
if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\\r
if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\\r
continue;\r
}\r
\r
- if (pBuf == NULL)\r
+ if (pBuf == nullptr)\r
continue; // We don't need to extract keywords,\r
// for faster parsing skip the rest of loop\r
\r
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
if (CStatusBar::OnCreate (lpCreateStruct) == -1)
return -1;
SetFont (CFont::FromHandle ((HFONT) GetStockObject (DEFAULT_GUI_FONT)));
- SetTimer (ID_INDICATOR_TIME, 1000, NULL);
+ SetTimer (ID_INDICATOR_TIME, 1000, nullptr);
return 0;
}
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
// continue;
// }
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
#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--;\
bFirstChar = false;
}
- if (pBuf == NULL)
+ if (pBuf == nullptr)
continue; // We don't need to extract keywords,
// for faster parsing skip the rest of loop
{ 0, 0, DllBuild_Merge7z, },\r
"Merge7z\\Merge7z%u%02u" DECORATE_U ".dll",\r
"Merge7z",\r
- NULL\r
+ nullptr\r
};\r
\r
std::vector<Merge7z::Format *(*)(const String& path)> Merge7zFormatRegister::optionalFormats;\r
{\r
try {\r
Merge7z::Format *piHandler = ArchiveGuessFormat(pszFile);\r
- if (piHandler)\r
+ if (piHandler != nullptr)\r
return true;\r
else\r
return false;\r
Merge7z::Format *ArchiveGuessFormat(const String& path)\r
{\r
if (GetOptionsMgr()->GetInt(OPT_ARCHIVE_ENABLE) == 0)\r
- return NULL;\r
+ return nullptr;\r
if (paths::IsDirectory(path))\r
- return NULL;\r
+ return nullptr;\r
String path2(path);\r
// Map extensions through ExternalArchiveFormat.ini\r
static TCHAR null[] = _T("");\r
static const TCHAR section[] = _T("extensions");\r
String entry = paths::FindExtension(path);\r
TCHAR value[20];\r
- static LPCTSTR filename = NULL;\r
- if (filename == NULL)\r
+ static LPCTSTR filename = nullptr;\r
+ if (filename == nullptr)\r
{\r
TCHAR cPath[INTERNET_MAX_PATH_LENGTH];\r
- DWORD cchPath = SearchPath(NULL, _T("ExternalArchiveFormat.ini"), NULL,\r
- INTERNET_MAX_PATH_LENGTH, cPath, NULL);\r
+ DWORD cchPath = SearchPath(nullptr, _T("ExternalArchiveFormat.ini"), nullptr,\r
+ INTERNET_MAX_PATH_LENGTH, cPath, nullptr);\r
filename = cchPath && cchPath < INTERNET_MAX_PATH_LENGTH ? _tcsdup(cPath) : null;\r
}\r
if (*filename &&\r
try\r
{\r
Merge7z::Format *pFormat = m_Merge7z->GuessFormat(path2.c_str());\r
- if (!pFormat)\r
+ if (pFormat == nullptr)\r
pFormat = Merge7zFormatRegister::GuessFormat(path2);\r
return pFormat;\r
}\r
catch (...)\r
{\r
Merge7z::Format *pFormat = Merge7zFormatRegister::GuessFormat(path2);\r
- if (pFormat)\r
+ if (pFormat != nullptr)\r
return pFormat;\r
throw;\r
}\r
// As long as the Merge7z*.DLL has not yet been loaded, Merge7z\r
// [0] points to the name of the DLL (with placeholders for 7-\r
// Zip major and minor version numbers). Once the DLL has been\r
- // loaded successfully, Merge7z[0] is set to NULL, causing the\r
+ // loaded successfully, Merge7z[0] is set to nullptr, causing the\r
// if to fail on subsequent calls.\r
\r
if (const char *format = Merge7z[0])\r
* storage, along with the Envelope itself. The Envelope pointer is passed to\r
* Merge7z as the return value of the function. It is not meant to be a success\r
* indicator, so if no temporary storage is required, it is perfectly alright\r
- * to return NULL.\r
+ * to return `nullptr`.\r
*/\r
Merge7z::Envelope *DirItemEnumerator::Enum(Item &item)\r
{\r
{\r
DeleteFile(path);\r
Merge7z::Format *piHandler = ArchiveGuessFormat(path);\r
- if (piHandler)\r
+ if (piHandler != nullptr)\r
{\r
HWND hwndOwner = CWnd::GetSafeOwner()->GetSafeHwnd();\r
CString pathIntermediate;\r
void DirItemEnumerator::CompressArchive(LPCTSTR path)\r
{\r
String strPath;\r
- if (path == 0)\r
+ if (path == nullptr)\r
{\r
// No path given, so prompt for path!\r
static const TCHAR _T_Merge7z[] = _T("Merge7z");\r
\r
DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)\r
{\r
- DecompressResult res(files, NULL, paths::IS_EXISTING_DIR);\r
+ DecompressResult res(files, nullptr, paths::IS_EXISTING_DIR);\r
try\r
{\r
String path;\r
// Handle archives using 7-zip\r
Merge7z::Format *piHandler;\r
piHandler = ArchiveGuessFormat(res.files[0]);\r
- if (piHandler)\r
+ if (piHandler != nullptr)\r
{\r
res.pTempPathContext = new CTempPathContext;\r
path = env::GetTempChildPath();\r
}\r
piHandler = res.files[1].empty() ? nullptr\r
: ArchiveGuessFormat(res.files[1]);\r
- if (piHandler)\r
+ if (piHandler != nullptr)\r
{\r
if (!res.pTempPathContext)\r
{\r
res.files[1] = path;\r
}\r
piHandler = (res.files.GetSize() <= 2) ? nullptr : ArchiveGuessFormat(res.files[2]);\r
- if (piHandler)\r
+ if (piHandler != nullptr)\r
{\r
if (!res.pTempPathContext)\r
{\r
class CAboutDlg::Impl : public CTrDialog
{
public:
- Impl(CAboutDlg *p, CWnd* pParent = NULL);
+ Impl(CAboutDlg *p, CWnd* pParent = nullptr);
// Dialog Data
//{{AFX_DATA(CAboutDlg::Impl)
ON_NOTIFY(NM_CLICK, IDC_WWW, OnBnClickedWWW)
END_MESSAGE_MAP()
-CAboutDlg::Impl::Impl(CAboutDlg *p, CWnd* pParent /*=NULL*/)
+CAboutDlg::Impl::Impl(CAboutDlg *p, CWnd* pParent /*= nullptr*/)
: CTrDialog(CAboutDlg::Impl::IDD)
, m_p(p)
{
void CAboutDlg::Impl::OnBnClickedWWW(NMHDR *pNMHDR, LRESULT *pResult)
{
PNMLINK pNMLink = (PNMLINK)pNMHDR;
- ShellExecute(NULL, _T("open"), pNMLink->item.szUrl, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), pNMLink->item.szUrl, nullptr, nullptr, SW_SHOWNORMAL);
}
CAboutDlg::CAboutDlg() : m_pimpl(new CAboutDlg::Impl(this)) {}
CLocationView *pLocationView = new CLocationView;
DWORD dwStyle = AFX_WS_DEFAULT_VIEW & ~WS_BORDER;
- pLocationView->Create(NULL, NULL, dwStyle, CRect(0,0,40,100), &m_wndLocationBar, 152, pContext);
+ pLocationView->Create(nullptr, nullptr, dwStyle, CRect(0,0,40,100), &m_wndLocationBar, 152, pContext);
// Merge frame has also a dockable bar at the very bottom
// This is not the client area, but we create it now because we want
m_pwndDetailMergeEditSplitterView = new CMergeEditSplitterView();
m_pwndDetailMergeEditSplitterView->m_bDetailView = true;
- m_pwndDetailMergeEditSplitterView->Create(NULL, NULL, dwStyle, CRect(0,0,1,1), &m_wndDetailBar, ID_VIEW_DETAIL_BAR+1, pContext);
+ m_pwndDetailMergeEditSplitterView->Create(nullptr, nullptr, dwStyle, CRect(0,0,1,1), &m_wndDetailBar, ID_VIEW_DETAIL_BAR+1, pContext);
// tell merge doc about these views
m_pMergeDoc = dynamic_cast<CMergeDoc *>(pContext->m_pCurrentDoc);
}
/**
- * @brief Alternative LockWindowUpdate(NULL) API.
+ * @brief Alternative LockWindowUpdate(nullptr) API.
* See the comment near the code that calls this function.
*/
static bool MyUnlockWindowUpdate(HWND hwnd)
m_bActivated = true;
// get the active child frame, and a flag whether it is maximized
- if (oldActiveFrame == NULL)
+ if (oldActiveFrame == nullptr)
// for the first frame, get the restored/maximized state from the registry
bMaximized = theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), TRUE);
if (bMaximized)
m_wndDetailBar.SaveState(_T("Settings"));
int iRow, iCol;
- m_wndSplitter.GetActivePane(&iRow, NULL);
+ m_wndSplitter.GetActivePane(&iRow, nullptr);
if (iRow >= 0)
{
auto& splitterWnd = static_cast<CMergeEditSplitterView *>(m_wndSplitter.GetPane(iRow, 0))->m_wndSplitter;
LRESULT CChildFrame::OnStorePaneSizes(WPARAM wParam, LPARAM lParam)
{
KillTimer(IDT_SAVEPOSITION);
- SetTimer(IDT_SAVEPOSITION, 300, NULL);
+ SetTimer(IDT_SAVEPOSITION, 300, nullptr);
return 0;
}
if (pData == nullptr){
UINT loc;
BCMenu *pMenu = FindMenuOption(static_cast<int>(nID), loc);
- ASSERT(pMenu != this);
+ ASSERT (pMenu != this);
if (loc != -1){
return pMenu->FindMenuItem(nID);
}
if(mdata != nullptr){
HMENU bchmenu=(HMENU)mdata->nID;
CMenu *ptr=FromHandle(bchmenu);
- if(ptr!=nullptr){
+ if(ptr != nullptr){
bool flag = !!ptr->IsKindOf(RUNTIME_CLASS( BCMenu ));
if(flag)
return static_cast<BCMenu *>(ptr);
CMoveConstraint::CMoveConstraint()
{
m_bSubclassed = false;
- m_oldWndProc = NULL;
+ m_oldWndProc = nullptr;
m_sRegistryValueName = _T("UnnamedWindow");
m_sRegistrySubkey = _T("LastWindowPos");
ClearMostData();
// clears everything but m_bSubclassed
// this is called from constructor, OnDestroy, and destructor
// so it can't assume any numerical variables have sane values
- m_hwndDlg=NULL;
+ m_hwndDlg=nullptr;
// m_rectDlgOriginal
m_nOrigX=0;
m_nOrigY=0;
}
else
{
- if (!pWnd) // only CWnds can be deferred
+ if (pWnd == nullptr) // only CWnds can be deferred
return false;
m_nDelayed++;
}
return false;
SetWindowLongPtr(m_hwndDlg, GWLP_WNDPROC, (__int3264)(LONG_PTR)(m_oldWndProc));
RemoveProp(m_hwndDlg, _T("CMoveConstraintData"));
- m_oldWndProc = NULL;
+ m_oldWndProc = nullptr;
m_bSubclassed = false;
return true;
}
m_pFormView->SetScrollSizes(MM_TEXT, size);
}
- InvalidateRect(m_hwndDlg, NULL, TRUE);
+ InvalidateRect(m_hwndDlg, nullptr, TRUE);
UpdateWindow(m_hwndDlg);
}
{
pTTT->lpszText = (LPTSTR)(LPCTSTR)ti.m_sText;
}
- *plresult = TRUE; // return TRUE from original window proc
+ *plresult = true; // return `true` from original window proc
return true; // stop processing this message
}
return false;
if (m_nMaxY && m_nMaxY < height) height = m_nMaxY;
wprc.right = wprc.left + width;
wprc.bottom = wprc.top + height;
- SetWindowPos(m_hwndDlg, NULL,
+ SetWindowPos(m_hwndDlg, nullptr,
wprc.left, wprc.top, wprc.right - wprc.left, wprc.bottom - wprc.top,
SWP_NOZORDER | SWP_NOACTIVATE);
}
EmptyClipboard();
const size_t dataSiz = text.length() + 1;
HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dataSiz * sizeof(TCHAR));
- if (hData != NULL)
+ if (hData != nullptr)
{
if (LPTSTR pszData = static_cast<LPTSTR>(::GlobalLock(hData)))
{
GlobalUnlock(hData);
}
CLIPFORMAT fmt = GetClipTcharTextFormat();
- bOK = SetClipboardData(fmt, hData) != NULL;
+ bOK = SetClipboardData(fmt, hData) != nullptr;
}
CloseClipboard();
}
{
CLIPFORMAT fmt = GetClipTcharTextFormat();
HGLOBAL hData = GetClipboardData(fmt);
- if (hData != NULL)
+ if (hData != nullptr)
{
LPTSTR pszData = (LPTSTR) GlobalLock(hData);
- if (pszData != NULL)
+ if (pszData != nullptr)
{
text = pszData;
GlobalUnlock(hData);
~CExconverterMLang()
{
- if (m_pmlang)
+ if (m_pmlang != nullptr)
m_pmlang->Release();
if (m_hLibMLang)
FreeLibrary(m_hLibMLang);
bool initialize()
{
- DllGetClassObjectFunc pfnDllGetClassObject = NULL;
- IClassFactory *pClassFactory = NULL;
+ DllGetClassObjectFunc pfnDllGetClassObject = nullptr;
+ IClassFactory *pClassFactory = nullptr;
m_hLibMLang = LoadLibrary(_T("mlang.dll"));
- if (m_hLibMLang)
+ if (m_hLibMLang != nullptr)
{
pfnDllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(m_hLibMLang, "DllGetClassObject");
- if (pfnDllGetClassObject)
+ if (pfnDllGetClassObject != nullptr)
{
HRESULT hr = pfnDllGetClassObject(CLSID_CMultiLanguage, IID_IClassFactory, (void**)&pClassFactory);
- if (pClassFactory)
+ if (pClassFactory != nullptr)
{
- hr = pClassFactory->CreateInstance(NULL, IID_IMultiLanguage2, (void**)&m_pmlang);
+ hr = pClassFactory->CreateInstance(nullptr, IID_IMultiLanguage2, (void**)&m_pmlang);
if (SUCCEEDED(hr))
{
pClassFactory->Release();
}
}
}
- if (pClassFactory)
+ if (pClassFactory != nullptr)
pClassFactory->Release();
- if (m_hLibMLang)
+ if (m_hLibMLang != nullptr)
{
FreeLibrary(m_hLibMLang);
- m_hLibMLang = NULL;
+ m_hLibMLang = nullptr;
}
return false;
}
std::vector<CodePageInfo> enumCodePages()
{
std::vector<CodePageInfo> cpinfo;
- IEnumCodePage *pEnumCodePage = NULL;
+ IEnumCodePage *pEnumCodePage = nullptr;
ULONG ccpInfo;
HRESULT hr = m_pmlang->EnumCodePages(MIMECONTF_SAVABLE_BROWSER | MIMECONTF_VALID | MIMECONTF_VALID_NLS, 0, &pEnumCodePage);
if (FAILED(hr))
};
#ifdef _MSC_VER
-__declspec(thread) static IExconverter *m_pexconv = NULL;
+__declspec(thread) static IExconverter *m_pexconv = nullptr;
#else
-static __thread IExconverter *m_pexconv = NULL;
+static __thread IExconverter *m_pexconv = nullptr;
#endif
static std::list<std::unique_ptr<IExconverter> > m_exconv_list;
static Poco::FastMutex m_mutex;
if (!pexconv->initialize())
{
delete pexconv;
- return NULL;
+ return nullptr;
}
m_pexconv = pexconv;
Poco::FastMutex::ScopedLock lock(m_mutex);
m_pMainFrame = pMainFrame;
m_dwStyle = CBRS_TOP;
- if (!CWnd::Create(WC_TABCONTROL, NULL, WS_CHILD | WS_VISIBLE | TCS_OWNERDRAWFIXED, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_FIRST+30))
+ if (!CWnd::Create(WC_TABCONTROL, nullptr, WS_CHILD | WS_VISIBLE | TCS_OWNERDRAWFIXED, CRect(0, 0, 0, 0), pMainFrame, AFX_IDW_CONTROLBAR_FIRST+30))
return FALSE;
TabCtrl_SetPadding(m_hWnd, determineIconSize(), 4);
CWnd* pMDIChild = FromHandle((HWND)tci.lParam);
m_pMainFrame->MDIActivate(pMDIChild);
CMenu* pPopup = pMDIChild->GetSystemMenu(FALSE);
- if (!pPopup) return;
+ if (pPopup == nullptr) return;
MENUITEMINFO mii = { sizeof MENUITEMINFO };
if (!pPopup->GetMenuItemInfo(ID_CLOSE_OTHER_TABS, &mii, FALSE))
{
if (!hIcon)
hIcon = (HICON)GetClassLongPtr(hwndFrame, GCLP_HICONSM);
if (hIcon)
- DrawIconEx(lpDraw->hDC, rc.left - iconsize.cx - 2, rc.top + (rc.bottom - rc.top - iconsize.cy) / 2, hIcon, iconsize.cx, iconsize.cy, 0, NULL, DI_NORMAL);
+ DrawIconEx(lpDraw->hDC, rc.left - iconsize.cx - 2, rc.top + (rc.bottom - rc.top - iconsize.cy) / 2, hIcon, iconsize.cx, iconsize.cy, 0, nullptr, DI_NORMAL);
}
DrawText(lpDraw->hDC, szBuf, -1, &rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
m_font.CreateFontIndirect(&ncm.lfMessageFont);
LOGFONT lf = { 0 };
- HTHEME hTheme = OpenThemeData(NULL, _T("TEXTSTYLE"));
- if (hTheme && SUCCEEDED(GetThemeFont(hTheme, NULL, TEXT_MAININSTRUCTION, 0, TMT_FONT, &lf)))
+ HTHEME hTheme = OpenThemeData(nullptr, _T("TEXTSTYLE"));
+ if (hTheme && SUCCEEDED(GetThemeFont(hTheme, nullptr, TEXT_MAININSTRUCTION, 0, TMT_FONT, &lf)))
{
m_fontMainInstruction.CreateFontIndirect(&lf);
GetThemeColor(hTheme, TEXT_MAININSTRUCTION, 0, TMT_TEXTCOLOR, &m_clrMainInstructionFont);
struct ModelessMesssageBoxParam *p = (struct ModelessMesssageBoxParam *)lpParam;
// Create the message box dialog.
- CMessageBoxDialog dlgMessage(NULL, p->strMessage, _T(""), p->nType);
+ CMessageBoxDialog dlgMessage(nullptr, p->strMessage, _T(""), p->nType);
delete p;
CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
// Check whether the control can be accessed.
- if ( pCheckboxWnd != NULL )
+ if ( pCheckboxWnd != nullptr )
{
// Check whether the checkbox is checked.
bDontDisplayAgain =
CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
// Check whether the checkbox handle was retrieved.
- if ( pCheckboxWnd != NULL )
+ if ( pCheckboxWnd != nullptr )
{
// Disable the checkbox.
pCheckboxWnd->EnableWindow(FALSE);
}
// Install a timer.
- m_nTimeoutTimer = SetTimer(MESSAGE_BOX_TIMER, 1000, NULL);
+ m_nTimeoutTimer = SetTimer(MESSAGE_BOX_TIMER, 1000, nullptr);
}
// Check whether a default button was defined.
CWnd* pFocusWnd = GetFocus();
// Check whether a handle was retrieved.
- if ( pFocusWnd != NULL )
+ if ( pFocusWnd != nullptr )
{
// Try to determine the ID of the element.
int nID = pFocusWnd->GetDlgCtrlID();
CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
// Check whether the checkbox was found.
- if ( pCheckboxWnd != NULL )
+ if ( pCheckboxWnd != nullptr )
{
// Enable the checkbox.
pCheckboxWnd->EnableWindow(TRUE);
case MB_OKCANCEL:
// Add two buttons: "Ok" and "Cancel".
- AddButton(IDOK, IDS_MESSAGEBOX_OK, TRUE);
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, FALSE, TRUE);
+ AddButton(IDOK, IDS_MESSAGEBOX_OK, true);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, false, true);
break;
case MB_ABORTRETRYIGNORE:
// Add three buttons: "Abort", "Retry" and "Ignore".
- AddButton(IDABORT, IDS_MESSAGEBOX_ABORT, TRUE);
+ AddButton(IDABORT, IDS_MESSAGEBOX_ABORT, true);
AddButton(IDRETRY, IDS_MESSAGEBOX_RETRY);
AddButton(IDIGNORE, IDS_MESSAGEBOX_IGNORE);
case MB_YESNOCANCEL:
// Add three buttons: "Yes", "No" and "Cancel".
- AddButton(IDYES, IDS_MESSAGEBOX_YES, TRUE);
+ AddButton(IDYES, IDS_MESSAGEBOX_YES, true);
// Check whether to add a "Yes to all" button.
if ( m_nStyle & MB_YES_TO_ALL )
AddButton(IDNOTOALL, IDS_MESSAGEBOX_NO_TO_ALL);
}
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, FALSE, TRUE);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, false, true);
break;
case MB_YESNO:
// Add two buttons: "Yes" and "No".
- AddButton(IDYES, IDS_MESSAGEBOX_YES, TRUE);
+ AddButton(IDYES, IDS_MESSAGEBOX_YES, true);
// Check whether to add a "Yes to all" button.
if ( m_nStyle & MB_YES_TO_ALL )
case MB_RETRYCANCEL:
// Add two buttons: "Retry" and "Cancel".
- AddButton(IDRETRY, IDS_MESSAGEBOX_RETRY, TRUE);
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, FALSE, TRUE);
+ AddButton(IDRETRY, IDS_MESSAGEBOX_RETRY, true);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, false, true);
break;
case MB_CANCELTRYCONTINUE:
// Add three buttons: "Cancel", "Try again" and "Continue".
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, TRUE, TRUE);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, true, true);
AddButton(IDTRYAGAIN, IDS_MESSAGEBOX_RETRY);
AddButton(IDCONTINUE, IDS_MESSAGEBOX_CONTINUE);
case MB_CONTINUEABORT:
// Add two buttons: "Continue" and "Abort".
- AddButton(IDCONTINUE, IDS_MESSAGEBOX_CONTINUE, TRUE);
+ AddButton(IDCONTINUE, IDS_MESSAGEBOX_CONTINUE, true);
AddButton(IDABORT, IDS_MESSAGEBOX_ABORT);
break;
case MB_SKIPSKIPALLCANCEL:
// Add three buttons: "Skip", "Skip all" and "Cancel".
- AddButton(IDSKIP, IDS_MESSAGEBOX_SKIP, TRUE);
+ AddButton(IDSKIP, IDS_MESSAGEBOX_SKIP, true);
AddButton(IDSKIPALL, IDS_MESSAGEBOX_SKIPALL);
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, FALSE, TRUE);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, false, true);
break;
case MB_IGNOREIGNOREALLCANCEL:
// Add three buttons: "Ignore", "Ignore all" and "Cancel".
- AddButton(IDIGNORE, IDS_MESSAGEBOX_IGNORE, TRUE);
+ AddButton(IDIGNORE, IDS_MESSAGEBOX_IGNORE, true);
AddButton(IDIGNOREALL, IDS_MESSAGEBOX_IGNOREALL);
- AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, FALSE, TRUE);
+ AddButton(IDCANCEL, IDS_MESSAGEBOX_CANCEL, false, true);
break;
case MB_OK:
// Add just one button: "Ok".
- AddButton(IDOK, IDS_MESSAGEBOX_OK, TRUE, TRUE);
+ AddButton(IDOK, IDS_MESSAGEBOX_OK, true, true);
break;
}
// Check whether an icon was specified.
- if ( ( m_nStyle & MB_ICONMASK ) && ( m_hIcon == NULL ) )
+ if ( ( m_nStyle & MB_ICONMASK ) && ( m_hIcon == nullptr ) )
{
// Switch the icon.
switch ( m_nStyle & MB_ICONMASK )
void CMessageBoxDialog::CreateIconControl ( )
{
// Check whether an icon was defined.
- if ( m_hIcon != NULL )
+ if ( m_hIcon != nullptr )
{
// Create a structure to read information about the icon.
ICONINFO iiIconInfo;
CRect rcDummy;
// Create the control for the icon.
- m_stcIcon.Create(NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | SS_ICON,
+ m_stcIcon.Create(nullptr, WS_CHILD | WS_VISIBLE | WS_DISABLED | SS_ICON,
rcDummy, this, (UINT)IDC_STATIC);
// Set the icon of the control.
// Create a DC for accessing the display driver.
CDC dcDisplay;
- dcDisplay.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
+ dcDisplay.CreateDC(_T("DISPLAY"), nullptr, nullptr, nullptr);
// Select the new font and store the old one.
CFont* pOldFont = dcDisplay.SelectObject(&m_fontMainInstruction);
int nMaxWidth = ( GetSystemMetrics(SM_CXSCREEN) / 2 ) + 100;
// Check whether an icon is displayed.
- if ( m_hIcon != NULL )
+ if ( m_hIcon != nullptr )
{
// Decrease the maximum width.
nMaxWidth -= m_sIcon.cx + 2 * XDialogUnitToPixel(CX_BORDER);
int nYPosition = YDialogUnitToPixel(CY_BORDER) * 2;
// Check whether an icon is defined.
- if ( m_hIcon != NULL )
+ if ( m_hIcon != nullptr )
{
// Move the icon control.
m_stcIcon.MoveWindow(XDialogUnitToPixel(CX_BORDER) * 2,
// synchronize tree
CPropertyPage* pPage = m_pphost.GetActivePage();
- HTREEITEM hti = NULL;
+ HTREEITEM hti = nullptr;
if (m_mapPP2HTI.Lookup(pPage, (void*&)hti) && hti)
m_tcPages.SelectItem(hti);
/**
* @brief Read options from storage to UI controls.
- * @param [in] bUpdate If TRUE UpdateData() is called
+ * @param [in] bUpdate If `true` UpdateData() is called
*/
void CPreferencesDlg::ReadOptions(bool bUpdate)
{
void CPreferencesDlg::OnImportButton()
{
String s;
- if (SelectFile(GetSafeHwnd(), s, true, NULL, _("Select file for import"), _("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
+ if (SelectFile(GetSafeHwnd(), s, true, nullptr, _("Select file for import"), _("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
{
if (m_pOptionsMgr->ImportOptions(s) == COption::OPT_OK)
{
void CPreferencesDlg::OnExportButton()
{
String settingsFile;
- if (SelectFile(GetSafeHwnd(), settingsFile, false, NULL, _("Select file for export"),
+ if (SelectFile(GetSafeHwnd(), settingsFile, false, nullptr, _("Select file for export"),
_("Options files (*.ini)|*.ini|All Files (*.*)|*.*||")))
{
// Add settings file extension if it is missing
*/
void CPreferencesDlg::SafeUpdatePage(CPropertyPage* pPage, bool bSaveAndValidate)
{
- if (pPage->GetSafeHwnd() != NULL)
+ if (pPage->GetSafeHwnd() != nullptr)
pPage->UpdateData(bSaveAndValidate);
}
{
ASSERT_VALID(pParent);
- if (!pParent || !::IsWindow(*pParent))
+ if (pParent == nullptr || !::IsWindow(*pParent))
return FALSE;
CWnd* pRefCtrl = pParent->GetDlgItem(nRefCtrlID);
ASSERT_VALID(pRefCtrl);
- if (!pRefCtrl || !::IsWindow(*pRefCtrl))
+ if (pRefCtrl == nullptr || !::IsWindow(*pRefCtrl))
return FALSE;
CRect rHost;
{
ASSERT_VALID(pParent);
- if (!pParent || !::IsWindow(*pParent))
+ if (pParent == nullptr || !::IsWindow(*pParent))
return FALSE;
if (!m_aPages.GetSize())
return FALSE;
- if (!CWnd::Create(NULL, NULL, WS_CHILD | WS_VISIBLE, *lpRect, pParent, uCtrlID))
+ if (!CWnd::Create(nullptr, nullptr, WS_CHILD | WS_VISIBLE, *lpRect, pParent, uCtrlID))
return FALSE;
// create the first page
CPropertyPage* CPropertyPageHost::GetActivePage()
{
if (m_nSelIndex < 0)
- return NULL;
+ return nullptr;
CPropertyPage* pPage = m_aPages[m_nSelIndex].pPage;
- if (!pPage || !pPage->GetSafeHwnd())
- return NULL;
+ if (pPage == nullptr || !pPage->GetSafeHwnd())
+ return nullptr;
return pPage;
}
bool CPropertyPageHost::SetActivePage(int nIndex, bool bAndFocus /*= true*/)
{
if (nIndex < 0 || nIndex >= m_aPages.GetSize())
- return FALSE;
+ return false;
CPropertyPage* pPage = m_aPages[nIndex].pPage;
- if (!pPage)
- return FALSE;
+ if (pPage == nullptr)
+ return false;
CWnd* pFocus = GetFocus();
if (!pPage->GetSafeHwnd() && !pPage->Create(pPage->m_psp.pszTemplate, this))
- return FALSE;
+ return false;
// make sure we can into/out of the page
pPage->ModifyStyleEx(0, WS_EX_CONTROLPARENT | DS_CONTROL);
bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle /*= nullptr*/, DWORD dwItemData /*= 0*/)
{
- if (!pPage || !pPage->IsKindOf(RUNTIME_CLASS(CPropertyPage)))
- return FALSE;
+ if (pPage == nullptr || !pPage->IsKindOf(RUNTIME_CLASS(CPropertyPage)))
+ return false;
if (FindPage(pPage) == -1)
{
PAGEITEM pi(pPage, szTitle, dwItemData);
int nPage = (int) m_aPages.Add(pi);
- if (szTitle)
+ if (szTitle != nullptr)
{
pPage->m_psp.pszTitle = m_aPages[nPage].sTitle; // the final string address
pPage->m_psp.dwFlags |= PSP_USETITLE;
}
}
- return TRUE;
+ return true;
}
int CPropertyPageHost::FindPage(CPropertyPage* pPage)
CWnd* pWndCtrl = pWndFocus;
// Walk up the parent chain, until we find an OLE control.
- while ((pWndCtrl != NULL) && (pWndCtrl->m_pCtrlSite == NULL) &&
+ while ((pWndCtrl != nullptr) && (pWndCtrl->m_pCtrlSite == nullptr) &&
(pWndCtrl->GetParent() != pWndDlg))
{
pWndCtrl = pWndCtrl->GetParent();
}
// let the control attempt to translate the message
- if (pWndCtrl != NULL && pWndCtrl->m_pCtrlSite != NULL &&
- pWndCtrl->m_pCtrlSite->m_pActiveObject != NULL &&
+ if (pWndCtrl != nullptr && pWndCtrl->m_pCtrlSite != nullptr &&
+ pWndCtrl->m_pCtrlSite->m_pActiveObject != nullptr &&
pWndCtrl->m_pCtrlSite->m_pActiveObject->TranslateAccelerator(lpMsg) == S_OK)
{
return TRUE;
// handle CTRLINFO_EATS_RETURN and CTRLINFO_EATS_ESCAPE flags
if ((uMsg == WM_KEYUP || uMsg == WM_KEYDOWN || uMsg == WM_CHAR) &&
- pWndCtrl != NULL && pWndCtrl->m_pCtrlSite != NULL &&
+ pWndCtrl != nullptr && pWndCtrl->m_pCtrlSite != nullptr &&
((LOWORD(lpMsg->wParam) == VK_RETURN &&
(pWndCtrl->m_pCtrlSite->m_ctlInfo.dwFlags & CTRLINFO_EATS_RETURN)) ||
(LOWORD(lpMsg->wParam) == VK_ESCAPE &&
CPropertyPage* CPropertyPageHost::GetPage(int nIndex)
{
if (nIndex < 0 || nIndex > m_aPages.GetSize())
- return NULL;
+ return nullptr;
return m_aPages[nIndex].pPage;
}
return m_aPages[nPage].pPage;
}
- return NULL;
+ return nullptr;
}
HMENU CShellContextMenu::GetHMENU() const
{
- return ::IsMenu(m_hShellContextMenu) ? m_hShellContextMenu : NULL;
+ return ::IsMenu(m_hShellContextMenu) ? m_hShellContextMenu : nullptr;
}
bool CShellContextMenu::HandleMenuMessage(UINT message, WPARAM wParam, LPARAM lParam, LRESULT& retval)
case WM_DRAWITEM:
case WM_INITMENUPOPUP:
case WM_MEASUREITEM:
- if (m_pShellContextMenu3)
+ if (m_pShellContextMenu3 != nullptr)
{
if (FAILED(/*hr = */m_pShellContextMenu3->HandleMenuMsg(message, wParam, lParam/*, &retval*/)))
{
//assert(false);
}
}
- else if (m_pShellContextMenu2)
+ else if (m_pShellContextMenu2 != nullptr)
{
if (FAILED(/*hr = */m_pShellContextMenu2->HandleMenuMsg(message, wParam, lParam)))
{
retval = (message == WM_INITMENUPOPUP) ? 0 : TRUE;
return true;
case WM_MENUCHAR:
- if (m_pShellContextMenu3)
+ if (m_pShellContextMenu3 != nullptr)
{
retval = 0;
if (FAILED(/*hr = */m_pShellContextMenu3->HandleMenuMsg2(message, wParam, lParam, &retval)))
parentDir = currentDir;
LPITEMIDLIST dirPidl;
- if (FAILED(/*hr = */pDesktop->ParseDisplayName(NULL, // hwnd
- NULL, // pbc
+ if (FAILED(/*hr = */pDesktop->ParseDisplayName(nullptr, // hwnd
+ nullptr, // pbc
CT2OLE(currentDir.c_str()), // pszDisplayName
- NULL, // pchEaten
+ nullptr, // pchEaten
&dirPidl, // ppidl
- NULL // pdwAttributes
+ nullptr // pdwAttributes
)))
{
return false;
}
if (FAILED(/*hr = */pDesktop->BindToObject(dirPidl, // pidl
- NULL, // pbc
- IID_IShellFolder, // riid
+ nullptr, // pbc
+ IID_IShellFolder, // riid
reinterpret_cast<void**>(&pCurrFolder))))
{
return false;
}
LPITEMIDLIST pidl;
- if (FAILED(/*hr = */pCurrFolder->ParseDisplayName(NULL,
- NULL,
+ if (FAILED(/*hr = */pCurrFolder->ParseDisplayName(nullptr,
+ nullptr,
CT2OLE(file.filename.c_str()),
- NULL,
+ nullptr,
&pidl,
- NULL)))
+ nullptr)))
{
return false;
}
}
IContextMenuPtr pCMenu1;
- if (FAILED(/*hr = */pCurrFolder->GetUIObjectOf(NULL,
+ if (FAILED(/*hr = */pCurrFolder->GetUIObjectOf(nullptr,
static_cast<unsigned>(pidls.Size()),
pidls.GetList(),
IID_IContextMenu,
void CShellContextMenu::ReleaseShellContextMenu()
{
- m_pShellContextMenu2 = NULL;
- m_pShellContextMenu3 = NULL;
- m_pPreferredMenu = NULL;
+ m_pShellContextMenu2 = nullptr;
+ m_pShellContextMenu3 = nullptr;
+ m_pPreferredMenu = nullptr;
}
catch (Exception& e)
{
LastErrorCustom(ucr::toTString(e.displayText()));
- m_hMapping = NULL;
+ m_hMapping = nullptr;
return false;
}
* @brief Read one (DOS or UNIX or Mac) line.
* @param [out] line Line read.
* @param [out] eol EOL bytes read (if any).
- * @param [out] lossy TRUE if there were lossy encoding.
+ * @param [out] lossy `true` if there were lossy encoding.
* @return true if there is more lines to read, false when last line is read.
*/
bool UniMemFile::ReadString(String & line, String & eol, bool * lossy)
* @brief Constructor for asking only numeric version info.
* This constructor creates instance that only reads version numbers,
* not several strings there are. This saves some time.
- * @param [in] bVersionOnly If TRUE only version numbers are read.
+ * @param [in] bVersionOnly If `true` only version numbers are read.
*/
CVersionInfo::CVersionInfo(bool bVersionOnly)
: m_wLanguage(0)
/**
* @brief Constructor.
* @param [in] szFileToVersion Filename to read version from.
- * @param [in] bDllVersion If TRUE queries DLL version.
+ * @param [in] bDllVersion If `true` queries DLL version.
*/
CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion,
bool bDllVersion)
if (m_strFileName.empty())
{
- ::GetModuleFileName(NULL, szFileName, MAX_PATH);
+ ::GetModuleFileName(nullptr, szFileName, MAX_PATH);
m_strFileName = szFileName;
}
else
CPoint(rcGrip.left + pointToPixel(2.25), rcGrip.top - pointToPixel(0.75));
pDC->ExtTextOut(ptOrg.x, ptOrg.y,
- ETO_CLIPPED, rcGrip, sTitle, NULL);
+ ETO_CLIPPED, rcGrip, sTitle, nullptr);
pDC->SelectObject(pOldFont);
pDC->SetBkMode(nOldBkMode);
// register and create the window - skip CControlBar::Create()
CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS,
- ::LoadCursor(NULL, IDC_ARROW),
+ ::LoadCursor(nullptr, IDC_ARROW),
::GetSysColorBrush(COLOR_BTNFACE), 0);
dwStyle &= ~CBRS_ALL; // keep only the generic window styles
GetRowSizingBars(arrSCBars);
AFX_SIZEPARENTPARAMS layout;
layout.hDWP = pDockBar->m_bLayoutQuery ?
- NULL : ::BeginDeferWindowPos(static_cast<int>(arrSCBars.GetSize()));
+ nullptr : ::BeginDeferWindowPos(static_cast<int>(arrSCBars.GetSize()));
for (int i = 0; i < arrSCBars.GetSize(); i++)
if (arrSCBars[i]->m_nStateFlags & (delayHide|delayShow))
arrSCBars[i]->RecalcDelayShow(&layout);
- if (layout.hDWP != NULL)
+ if (layout.hDWP != nullptr)
::EndDeferWindowPos(layout.hDWP);
// get available length
m_dwSCBStyle &= ~SCBS_EDGEALL;
// add resizing edges between bars on the same row
- if (!IsFloating() && m_pDockBar != NULL)
+ if (!IsFloating() && m_pDockBar != nullptr)
{
CSCBArray arrSCBars;
int nThis;
// make sure no updates are pending
if (!m_bDragShowContent)
- RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
+ RedrawWindow(nullptr, nullptr, RDW_ALLCHILDREN | RDW_UPDATENOW);
m_htEdge = nHitTest;
m_bTracking = true;
// remaining client area of the mainframe
CRect rcT;
m_pDockSite->RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST,
- reposQuery, &rcT, NULL, TRUE);
+ reposQuery, &rcT, nullptr, TRUE);
int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;
bool bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
rc.OffsetRect(bHorzTracking ? nOfs : 0, bHorzTracking ? 0 : nOfs);
rc.OffsetRect(-rcFrame.TopLeft());
- CDC *pDC = m_pDockSite->GetDCEx(NULL,
+ CDC *pDC = m_pDockSite->GetDCEx(nullptr,
DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
CBrush* pBrush = CDC::GetHalftoneBrush();
CBrush* pBrushOld = pDC->SelectObject(pBrush);
// find the first and the last bar in row
for (nFirst = -1, i = nThis - 1; i >= 0 && nFirst == -1; i--)
- if (m_pDockBar->m_arrBars[i] == NULL)
+ if (m_pDockBar->m_arrBars[i] == nullptr)
nFirst = i + 1;
for (nLast = -1, i = nThis + 1; i < nBars && nLast == -1; i++)
- if (m_pDockBar->m_arrBars[i] == NULL)
+ if (m_pDockBar->m_arrBars[i] == nullptr)
nLast = i - 1;
ASSERT((nLast != -1) && (nFirst != -1));
if (i < nThis)
{
m_pDockBar->m_arrBars.InsertAt(i + 1,
- (CControlBar*) NULL);
+ (CControlBar*) nullptr);
return false;
}
}
// we have enough bars - go negotiate with them
- m_pDockBar->m_arrBars.InsertAt(i, (CControlBar*) NULL);
+ m_pDockBar->m_arrBars.InsertAt(i, (CControlBar*) nullptr);
nLast = i - 1;
break;
}
#endif
if (!CMiniFrameWnd::CreateEx(dwExStyle,
- NULL, &afxChNil, dwStyle, rectDefault, pParent))
+ nullptr, &afxChNil, dwStyle, rectDefault, pParent))
{
m_bInRecalcLayout = FALSE;
return FALSE;
return;
}
- if (GetSizingControlBar() != NULL)
+ if (GetSizingControlBar() != nullptr)
CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
else
baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
CSizingControlBar* CSCBMiniDockFrameWnd::GetSizingControlBar()
{
CWnd* pWnd = GetWindow(GW_CHILD); // get the dockbar
- if (pWnd == NULL)
- return NULL;
+ if (pWnd == nullptr)
+ return nullptr;
pWnd = pWnd->GetWindow(GW_CHILD); // get the controlbar
- if (pWnd == NULL)
- return NULL;
+ if (pWnd == nullptr)
+ return nullptr;
if (!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- return NULL;
+ return nullptr;
return static_cast<CSizingControlBar*>(pWnd);
}
void CSCBMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy)
{
CSizingControlBar* pBar = GetSizingControlBar();
- if ((pBar != NULL) && (GetStyle() & MFS_4THICKFRAME) == 0
+ if ((pBar != nullptr) && (GetStyle() & MFS_4THICKFRAME) == 0
&& pBar->IsVisible() &&
cx + 4 >= pBar->m_szMinFloat.cx &&
cy + 4 >= pBar->m_szMinFloat.cy)
baseCSCBMiniDockFrameWnd::OnGetMinMaxInfo(lpMMI);
CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
+ if (pBar != nullptr)
{
CRect r(CPoint(0, 0), pBar->m_szMinFloat - CSize(4, 4));
#ifndef _SCB_MINIFRAME_CAPTION
if ((GetStyle() & MFS_4THICKFRAME) != 0)
{
CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
+ if (pBar != nullptr)
{
lpwndpos->flags |= SWP_NOSIZE; // don't size this time
// prevents flicker
char outch[3] = {0};
BOOL defaulted = FALSE;
DWORD flags = WC_NO_BEST_FIT_CHARS;
- if (WideCharToMultiByte(codepage, flags, &wch, 1, outch, sizeof(outch), NULL, &defaulted)
+ if (WideCharToMultiByte(codepage, flags, &wch, 1, outch, sizeof(outch), nullptr, &defaulted)
&& !defaulted)
{
ch = outch;
// already lossy, so make our best shot
DWORD flags = WC_COMPOSITECHECK + WC_DISCARDNS + WC_SEPCHARS + WC_DEFAULTCHAR;
TCHAR outbuff[16];
- int n = WideCharToMultiByte(codepage, flags, &wch, 1, outbuff, sizeof(outbuff) - 1, NULL, NULL);
+ int n = WideCharToMultiByte(codepage, flags, &wch, 1, outbuff, sizeof(outbuff) - 1, nullptr, nullptr);
if (n > 0)
{
outbuff[n] = 0;
if (cpout == CP_UTF8)
{
flags = 0;
- pdefaulted = NULL;
+ pdefaulted = nullptr;
}
if (cpout == CP_UCS2LE)
{
}
else
{
- n = WideCharToMultiByte(cpout, flags, wbuff.get(), n, dest, destsize - 1, NULL, pdefaulted);
+ n = WideCharToMultiByte(cpout, flags, wbuff.get(), n, dest, destsize - 1, nullptr, pdefaulted);
if (!n)
{
int nsyserr = ::GetLastError();
{
// From UCS-2LE to 8-bit (or UTF-8)
- // WideCharToMultiByte: lpDefaultChar & lpUsedDefaultChar must be NULL when using UTF-8
+ // WideCharToMultiByte: lpDefaultChar & lpUsedDefaultChar must be `nullptr` when using UTF-8
int destcp = (unicoding2 == UTF8 ? CP_UTF8 : codepage2);
if (destcp == CP_ACP || IsValidCodePage(destcp))
{
DWORD flags = 0;
- int bytes = WideCharToMultiByte(destcp, flags, (LPCWSTR)src, static_cast<int>(srcbytes/2), 0, 0, NULL, NULL);
+ int bytes = WideCharToMultiByte(destcp, flags, (LPCWSTR)src, static_cast<int>(srcbytes/2), 0, 0, nullptr, nullptr);
dest->resize(bytes + 2);
int losses = 0;
- bytes = WideCharToMultiByte(destcp, flags, (LPCWSTR)src, static_cast<int>(srcbytes/2), (char *)dest->ptr, static_cast<int>(dest->capacity), NULL, NULL);
+ bytes = WideCharToMultiByte(destcp, flags, (LPCWSTR)src, static_cast<int>(srcbytes/2), (char *)dest->ptr, static_cast<int>(dest->capacity), nullptr, nullptr);
dest->ptr[bytes] = 0;
dest->ptr[bytes+1] = 0;
dest->size = bytes;
if (len)
{
to.resize(len);
- WideCharToMultiByte(codepage, 0, from.c_str(), static_cast<int>(from.length()), &to[0], static_cast<int>(len), NULL, NULL);
+ WideCharToMultiByte(codepage, 0, from.c_str(), static_cast<int>(from.length()), &to[0], static_cast<int>(len), nullptr, nullptr);
}
else
{
path2 = String(pf+2);
}
String name = paths::FindFileName(path2);
- CVersionInfo vi(path2.c_str(), TRUE);
+ CVersionInfo vi(path2.c_str(), true);
String sModifiedTime = _T("");
if (name != path)
{
DWORD nRetVal = FileLoadResult::FRESULT_OK;
// Set encoding based on extension, if we know one
- paths::SplitFilename(pszFileName, NULL, NULL, &sExt);
+ paths::SplitFilename(pszFileName, nullptr, nullptr, &sExt);
CCrystalTextView::TextDefinition *def =
CCrystalTextView::GetTextType(sExt.c_str());
if (def && def->encoding != -1)
else
{
sIntermediateFilename = env::GetTemporaryFileName(m_strTempPath,
- _T("MRG_"), NULL);
+ _T("MRG_"), nullptr);
if (sIntermediateFilename.empty())
return SAVE_FAILED; //Nothing to do if even tempfile name fails
bOpenSuccess = !!file.OpenCreate(sIntermediateFilename);
m_dwRevisionNumberOnSave = m_dwCurrentRevisionNumber;
// redraw line revision marks
- UpdateViews (NULL, NULL, UPDATE_FLAGSONLY);
+ UpdateViews (nullptr, nullptr, UPDATE_FLAGSONLY);
}
catch (Exception& e)
{
{
if (bDetectMovedBlocks)
{
- if (m_pMovedLines[0] == NULL)
+ if (m_pMovedLines[0] == nullptr)
{
m_pMovedLines[0].reset(new MovedLines);
m_pMovedLines[1].reset(new MovedLines);
* @brief Find comment marker in string, excluding portions enclosed in quotation marks or apostrophes
* @param [in] target - string to search
* @param [in] marker - marker to search for
- * @return Returns position of marker, or NULL if none is present
+ * @return Returns position of marker, or `nullptr` if none is present
*/
static const char *FindCommentMarker(const char *target, const char *marker)
{
prev = c;
++target;
}
- return NULL;
+ return nullptr;
}
/**
* @param [in] diffData files to compare.
* @param [out] bin_status used to return binary status from compare.
* @param [out] bin_file Returns which file was binary file as bitmap.
- So if first file is binary, first bit is set etc. Can be NULL if binary file
+ So if first file is binary, first bit is set etc. Can be `nullptr` if binary file
info is not needed (faster compare since diffutils don't bother checking
second file if first is binary).
* @return true when compare succeeds, false if error happened during compare.
{
// Diff files. depth is zero because we are not comparing dirs
*diffs = diff_2_files (diffData->m_inf, 0, bin_status,
- (m_pMovedLines[0] != NULL), bin_file);
+ (m_pMovedLines[0] != nullptr), bin_file);
CopyDiffutilTextStats(diffData->m_inf, diffData);
}
catch (SE_Exception&)
{
- *diffs = NULL;
+ *diffs = nullptr;
bRet = false;
}
return bRet;
/**
* @brief Find the CDiffContext diffpos of an item from its left & right paths
- * @return POSITION to item, NULL if not found.
- * @note Filenames must be same, if they differ NULL is returned.
+ * @return POSITION to item, `nullptr` if not found.
+ * @note Filenames must be same, if they differ `nullptr` is returned.
*/
uintptr_t FindItemFromPaths(const CDiffContext& ctxt, const PathContext& paths)
{
size_t len = GlobalSize(hMem);
HGLOBAL hMemW = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT, (len + 1) * sizeof(wchar_t));
if (!hMemW)
- return NULL;
+ return nullptr;
LPCSTR pstr = reinterpret_cast<LPCSTR>(GlobalLock(hMem));
LPWSTR pwstr = reinterpret_cast<LPWSTR>(GlobalLock(hMemW));
- if (!pstr || !pwstr)
- return NULL;
+ if (pstr == nullptr || pwstr == nullptr)
+ return nullptr;
int wlen = MultiByteToWideChar(codepage, 0, pstr, static_cast<int>(len), pwstr, static_cast<int>(len + 1));
if (len > 0 && pstr[len - 1] != '\0')
{
if (!dlg.m_sReportFile.empty())
{
String path;
- paths::SplitFilename(dlg.m_sReportFile, &path, NULL, NULL);
+ paths::SplitFilename(dlg.m_sReportFile, &path, nullptr, nullptr);
if (!paths::CreateIfNeeded(path))
{
errStr = _("Folder does not exist.");
e->ReportError(MB_ICONSTOP);
e->Delete();
}
- m_pFile = NULL;
+ m_pFile = nullptr;
return bRet;
}
void DirCmpReport::GenerateXmlHtmlContent(bool xml)
{
String sFileName, sParentDir;
- paths::SplitFilename((const TCHAR *)m_pFile->GetFilePath(), &sParentDir, &sFileName, NULL);
+ paths::SplitFilename((const TCHAR *)m_pFile->GetFilePath(), &sParentDir, &sFileName, nullptr);
String sRelDestDir = sFileName.substr(0, sFileName.find_last_of(_T("."))) + _T(".files");
String sDestDir = paths::ConcatPath(sParentDir, sRelDestDir);
if (!xml && m_bIncludeFileCmpReport && m_pFileCmpReport)
/**
* @brief Move selected items one position up or down.
- * @param [in] bUp If TRUE items are moved up,
+ * @param [in] bUp If `true` items are moved up,
* if FALSE items are moved down.
*/
void CDirColsDlg::MoveSelectedItems(bool bUp)
return FALSE;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
- CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarList);
+ CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarList);
if (m_pTaskbarList)
m_pTaskbarList->SetProgressState(AfxGetMainWnd()->m_hWnd, TBPF_INDETERMINATE);
#endif
void DirCompProgressBar::StartUpdating()
{
ClearStat();
- SetTimer(IDT_UPDATE, UPDATE_INTERVAL, NULL);
+ SetTimer(IDT_UPDATE, UPDATE_INTERVAL, nullptr);
}
/**
* Initialises directory compare with paths given and recursive choice.
* Previous compare context is first free'd.
* @param [in] paths Paths to compare
- * @param [in] bRecursive If TRUE subdirectories are included to compare.
+ * @param [in] bRecursive If `true` subdirectories are included to compare.
*/
void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathContext *pTempPathContext)
{
* @param [in] paths Paths for files we update
* @param [in] nDiffs Total amount of differences
* @param [in] nTrivialDiffs Amount of ignored differences
- * @param [in] bIdentical TRUE if files became identical, FALSE otherwise.
+ * @param [in] bIdentical `true` if files became identical, FALSE otherwise.
*/
void CDirDoc::UpdateChangedItem(PathContext &paths,
UINT nDiffs, UINT nTrivialDiffs, bool bIdentical)
// get the active child frame, and a flag whether it is maximized
BOOL bMaximized;
CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized);
- if (oldActiveFrame == NULL)
+ if (oldActiveFrame == nullptr)
// for the first frame, get the restored/maximized state from the registry
bMaximized = theApp.GetProfileInt(_T("Settings"), _T("ActiveFrameMax"), TRUE);
if (bMaximized)
{
if (nDirs < 3)
AddToList(subdir[0], subdir[1],
- (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : NULL,
- (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : NULL,
+ (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : nullptr,
+ (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : nullptr,
nDiffCode, myStruct, parent);
else
AddToList(subdir[0], subdir[1], subdir[2],
- (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : NULL,
- (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : NULL,
- (nDiffCode & DIFFCODE::THIRD ) ? &dirs[2][k] : NULL,
+ (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : nullptr,
+ (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : nullptr,
+ (nDiffCode & DIFFCODE::THIRD ) ? &dirs[2][k] : nullptr,
nDiffCode, myStruct, parent);
}
else
if (nDirs < 3)
{
DIFFITEM *me = AddToList(subdir[0], subdir[1],
- (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : NULL,
- (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : NULL,
+ (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : nullptr,
+ (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : nullptr,
nDiffCode, myStruct, parent);
if ((nDiffCode & DIFFCODE::SKIPPED) == 0 && ((nDiffCode & DIFFCODE::SIDEFLAGS) == DIFFCODE::BOTH || bUniques))
{
else
{
DIFFITEM *me = AddToList(subdir[0], subdir[1], subdir[2],
- (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : NULL,
- (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : NULL,
- (nDiffCode & DIFFCODE::THIRD ) ? &dirs[2][k] : NULL,
+ (nDiffCode & DIFFCODE::FIRST ) ? &dirs[0][i] : nullptr,
+ (nDiffCode & DIFFCODE::SECOND) ? &dirs[1][j] : nullptr,
+ (nDiffCode & DIFFCODE::THIRD ) ? &dirs[2][k] : nullptr,
nDiffCode, myStruct, parent);
if ((nDiffCode & DIFFCODE::SKIPPED) == 0 && ((nDiffCode & DIFFCODE::SIDEFLAGS) == DIFFCODE::ALL || bUniques))
{
{
// We don't actually 'compare' directories, just add non-ignored
// directories to list.
- StoreDiffData(di, pCtxt, NULL);
+ StoreDiffData(di, pCtxt, nullptr);
}
else
{
else
{
di.diffcode.diffcode |= DIFFCODE::SKIPPED;
- StoreDiffData(di, pCtxt, NULL);
+ StoreDiffData(di, pCtxt, nullptr);
}
}
}
}
// Replace standard header with sort header
- if (HWND hWnd = ListView_GetHeader(m_pList->m_hWnd))
+ HWND hWnd = ListView_GetHeader(m_pList->m_hWnd);
+ if (hWnd != nullptr)
m_ctlSortHeader.SubclassWindow(hWnd);
// Load the icons used for the list view (to reflect diff status)
*/
void CDirView::StartCompare(CompareStats *pCompareStats)
{
- if (m_pCmpProgressBar == NULL)
+ if (m_pCmpProgressBar == nullptr)
m_pCmpProgressBar.reset(new DirCompProgressBar());
if (!::IsWindow(m_pCmpProgressBar->GetSafeHwnd()))
DWORD dwFlags[3];
for (int nIndex = 0; nIndex < pathsParent.GetSize(); ++nIndex)
dwFlags[nIndex] = FFILEOPEN_NOMRU | (pDoc->GetReadOnly(nIndex) ? FFILEOPEN_READONLY : 0);
- GetMainFrame()->DoFileOpen(&pathsParent, dwFlags, NULL, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? NULL : pDoc);
+ GetMainFrame()->DoFileOpen(&pathsParent, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDoc);
}
// fall through (no break!)
case AllowUpwardDirectory::No:
{
// Open subfolders
// Don't add folders to MRU
- GetMainFrame()->DoFileOpen(&paths, dwFlags, NULL, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? NULL : pDoc);
+ GetMainFrame()->DoFileOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, (GetAsyncKeyState(VK_CONTROL) & 0x8000) ? nullptr : pDoc);
}
else if (HasZipSupport() && std::count_if(paths.begin(), paths.end(), ArchiveGuessFormat) == paths.GetSize())
{
// Open archives, not adding paths to MRU
- GetMainFrame()->DoFileOpen(&paths, dwFlags, NULL, _T(""), GetDiffContext().m_bRecursive, NULL, _T(""), infoUnpacker);
+ GetMainFrame()->DoFileOpen(&paths, dwFlags, nullptr, _T(""), GetDiffContext().m_bRecursive, nullptr, _T(""), infoUnpacker);
}
else
{
fileloc[pane].setPath(paths[pane]);
dwFlags[pane] |= FFILEOPEN_NOMRU | (pDoc->GetReadOnly(nPane[pane]) ? FFILEOPEN_READONLY : 0);
}
- GetMainFrame()->ShowHexMergeDoc(pDoc, paths.GetSize(), fileloc, dwFlags, NULL);
+ GetMainFrame()->ShowHexMergeDoc(pDoc, paths.GetSize(), fileloc, dwFlags, nullptr);
}
/// User chose (context menu) delete left
else if (m_bTreeMode && sel >= 0)
{
const DIFFITEM& di = GetDiffItem(sel);
- if (di.parent != NULL)
+ if (di.parent != nullptr)
{
int i = GetItemIndex((uintptr_t)di.parent);
if (i >= 0)
}
else if (wParam == CDiffThread::EVENT_COMPARE_PROGRESSED)
{
- InvalidateRect(NULL, FALSE);
+ InvalidateRect(nullptr, FALSE);
}
else if (wParam == CDiffThread::EVENT_COLLECT_COMPLETED)
{
}
MSG msg;
- while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
+ while (::PeekMessage(&msg, nullptr, NULL, NULL, PM_NOREMOVE))
if (!AfxGetApp()->PumpMessage())
break;
GetMainFrame()->OnUpdateFrameTitle(FALSE);
void CDirView::ShowShellContextMenu(SIDE_TYPE stype)
{
- CShellContextMenu *pContextMenu = NULL;
+ CShellContextMenu *pContextMenu = nullptr;
switch (stype)
{
case SIDE_LEFT:
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);
+ BOOL nCmd = TrackPopupMenu(pContextMenu->GetHMENU(), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, 0, hWnd, nullptr);
if (nCmd)
pContextMenu->InvokeCommand(nCmd, hWnd);
pContextMenu->ReleaseShellContextMenu();
void CDirView::OnSize(UINT nType, int cx, int cy)
{
CListView::OnSize(nType, cx, cy);
- GetDocument()->SetTitle(NULL);
+ GetDocument()->SetTitle(nullptr);
}
/**
{
*pResult = FALSE;
- // We can't use the normal condition of pszText==NULL to know if the
+ // We can't use the normal condition of pszText==`nullptr` to know if the
// user cancels editing when file names had different case (e.g.
// "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 the user accept it as the new file name, pszText is `nullptr`.
if (!m_bUserCancelEdit)
{
ApplyCodepage(SelBegin(), SelEnd(), GetDiffContext(), affected, dlg.GetLoadCodepage());
- m_pList->InvalidateRect(NULL);
+ m_pList->InvalidateRect(nullptr);
m_pList->UpdateWindow();
// TODO: We could loop through any active merge windows belonging to us
*
* @param [in] hMenu Handle to the menu to check ownership of.
* @return Either m_pShellContextMenuLeft, m_pShellContextMenuRight
- * or NULL if hMenu is not owned by these two.
+ * or `nullptr` if hMenu is not owned by these two.
*/
CShellContextMenu* CDirView::GetCorrespondingShellContextMenu(HMENU hMenu) const
{
- CShellContextMenu* pMenu = NULL;
+ CShellContextMenu* pMenu = nullptr;
if (m_pShellContextMenuLeft && hMenu == m_pShellContextMenuLeft->GetHMENU())
pMenu = m_pShellContextMenuLeft.get();
else if (m_pShellContextMenuMiddle && hMenu == m_pShellContextMenuMiddle->GetHMENU())
#else
DropData->CacheGlobalData(CF_TEXT, hMem);
#endif
- DROPEFFECT de = DropData->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE, NULL);
+ DROPEFFECT de = DropData->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE, nullptr);
}
*pResult = 0;
DirActions CDirView::MakeDirActions(DirActions::method_type2 func) const
{
const CDirDoc *pDoc = GetDocument();
- return DirActions(pDoc->GetDiffContext(), pDoc->GetReadOnly(), NULL, func);
+ return DirActions(pDoc->GetDiffContext(), pDoc->GetReadOnly(), nullptr, func);
}
const CDiffContext& CDirView::GetDiffContext() const
{
ASSERT (pane >= 0 && pane < countof(m_Edit));
- // Check for NULL since window may be closing..
+ // Check for `nullptr` since window may be closing..
if (m_hWnd == nullptr)
return _T("");
{
ASSERT (pane >= 0 && pane < countof(m_Edit));
- // Check for NULL since window may be closing..
+ // Check for `nullptr` since window may be closing..
if (m_hWnd == nullptr)
return;
{
ASSERT (pane >= 0 && pane < countof(m_Edit));
- // Check for NULL since window may be closing..
+ // Check for `nullptr` since window may be closing..
if (m_hWnd == nullptr)
return;
SetTextColor(::GetSysColor(COLOR_INACTIVECAPTIONTEXT));
SetBackColor(::GetSysColor(COLOR_INACTIVECAPTION));
}
- RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ RedrawWindow(nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
}
/**
HBRUSH CFilepathEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
UNUSED_ALWAYS(nCtlColor);
- // Return a non-NULL brush if the parent's
+ // Return a non-`nullptr` brush if the parent's
//handler should not be called
//set text color
// use our own byte-by-byte compare
if (tFiles.GetSize() == 2)
{
- if (m_pByteCompare == NULL)
+ if (m_pByteCompare == nullptr)
m_pByteCompare.reset(new ByteCompare());
bool success = m_pByteCompare->SetCompareOptions(
*pCtxt->GetCompareOptions(CMP_QUICK_CONTENT));
}
else
{
- if (m_pByteCompare == NULL)
+ if (m_pByteCompare == nullptr)
m_pByteCompare.reset(new ByteCompare());
bool success = m_pByteCompare->SetCompareOptions(
*pCtxt->GetCompareOptions(CMP_QUICK_CONTENT));
*/
bool CHexMergeView::IsLoadable()
{
- static void *pv = NULL;
- if (pv == NULL)
+ static void *pv = nullptr;
+ if (pv == nullptr)
{
pv = LoadLibrary(_T("Frhed\\hekseditU.dll"));
}
SetTitle(nullptr);
LPCTSTR lpszWndClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW,
- LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), NULL);
+ ::LoadCursor(nullptr, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), nullptr);
if (!CMDIChildWnd::Create(lpszWndClass, GetTitle(), WS_OVERLAPPEDWINDOW | WS_CHILD, rectDefault, pParent))
return false;
else
{
sText = m_filePaths.GetPath(pane);
- if (m_pDirDoc)
+ if (m_pDirDoc != nullptr)
m_pDirDoc->ApplyDisplayRoot(pane, sText);
}
if (m_pImgMergeWindow->IsModified(pane))
void SetDirDoc(CDirDoc * pDirDoc);
void UpdateResources();
bool CloseNow();
- void DirDocClosing(CDirDoc * pDirDoc) { m_pDirDoc = NULL; }
+ void DirDocClosing(CDirDoc * pDirDoc) { m_pDirDoc = nullptr; }
void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; };
void SetLastCompareResult(int nResult);
void UpdateLastCompareResult();
* @param [in] enabled Is filter enabled?
* @return Index of added row.
*/
-int LineFiltersDlg::AddRow(const String& filter /*= NULL*/, bool enabled /*=false*/)
+int LineFiltersDlg::AddRow(const String& filter /*= nullptr*/, bool enabled /*= false*/)
{
int items = m_filtersList.GetItemCount();
int ind = m_filtersList.InsertItem(items, filter.c_str());
DECLARE_MESSAGE_MAP()
void InitList();
- int AddRow(const String& filter = NULL, bool enabled = false);
+ int AddRow(const String& filter = nullptr, bool enabled = false);
void EditSelectedFilter();
private:
// CLoadSaveCodepageDlg dialog
-CLoadSaveCodepageDlg::CLoadSaveCodepageDlg(int nFiles, CWnd* pParent /*=NULL*/)
+CLoadSaveCodepageDlg::CLoadSaveCodepageDlg(int nFiles, CWnd* pParent /*= nullptr*/)
: CTrDialog(CLoadSaveCodepageDlg::IDD, pParent)
, m_bAffectsLeft(true)
, m_bAffectsMiddle(true)
CTrDialog::OnInitDialog();
IExconverter *pexconv = Exconverter::getInstance();
- if (pexconv != NULL)
+ if (pexconv != nullptr)
{
CComboBox combol, combos;
combol.Attach(::GetDlgItem(m_hWnd, IDC_LOAD_CODEPAGE_TEXTBOX));
{
public:
// Construction
- CLoadSaveCodepageDlg(int nFiles, CWnd* pParent = NULL); // standard constructor
+ CLoadSaveCodepageDlg(int nFiles, CWnd* pParent = nullptr); // standard constructor
void SetLeftRightAffectStrings(const String & sAffectsLeft, const String & sAffectsMiddle, const String & sAffectsRight);
void EnableSaveCodepage(bool enable) { m_bEnableSaveCodepage = enable; }
void SetCodepages(int codepage) { m_nLoadCodepage = m_nSaveCodepage = codepage; }
{
// look for last submenu
for (i = ::GetMenuItemCount(menu) ; i >= 0 ; i--)
- if (::GetSubMenu(menu, i) != NULL)
+ if (::GetSubMenu(menu, i) != nullptr)
return ::GetSubMenu(menu, i);
}
else
{
// look for first submenu
for (i = 0 ; i < ::GetMenuItemCount(menu) ; i++)
- if (::GetSubMenu(menu, i) != NULL)
+ if (::GetSubMenu(menu, i) != nullptr)
return ::GetSubMenu(menu, i);
}
// error, submenu not found
- return NULL;
+ return nullptr;
}
/**
{
if (menu_view == (m_MenuIcons[index].menusToApply & menu_view))
{
- m_pMenus[view]->ModifyODMenu(NULL, m_MenuIcons[index].menuitemID, m_MenuIcons[index].iconResID);
+ m_pMenus[view]->ModifyODMenu(nullptr, m_MenuIcons[index].menuitemID, m_MenuIcons[index].iconResID);
}
}
pOpenDoc->m_bRecurse = bRecurse;
if (infoUnpacker)
pOpenDoc->m_infoHandler = *infoUnpacker;
- CFrameWnd *pFrame = theApp.m_pOpenTemplate->CreateNewFrame(pOpenDoc, NULL);
+ CFrameWnd *pFrame = theApp.m_pOpenTemplate->CreateNewFrame(pOpenDoc, nullptr);
theApp.m_pOpenTemplate->InitialUpdateFrame(pFrame, pOpenDoc);
return true;
}
}
}
- CTempPathContext *pTempPathContext = NULL;
+ CTempPathContext *pTempPathContext = nullptr;
if (pathsType == paths::IS_EXISTING_DIR)
{
DecompressResult res= DecompressArchive(m_hWnd, tFiles);
CDirDoc::m_nDirsTemp = tFiles.GetSize();
if (m_pMenus[MENU_DIRVIEW] == nullptr)
theApp.m_pDirTemplate->m_hMenuShared = NewDirViewMenu();
- pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->OpenDocumentFile(NULL));
+ pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->OpenDocumentFile(nullptr));
}
else
{
pDirDoc->SetReportFile(sReportFile);
pDirDoc->SetDescriptions(strDesc);
- pDirDoc->SetTitle(NULL);
+ pDirDoc->SetTitle(nullptr);
for (int nIndex = 0; nIndex < tFiles.GetSize(); nIndex++)
pDirDoc->SetReadOnly(nIndex, bRO[nIndex]);
{
FRAMETYPE frame = GetFrameType(GetActiveFrame());
CHOOSEFONT cf = { sizeof CHOOSEFONT };
- LOGFONT *lf = NULL;
+ LOGFONT *lf = nullptr;
cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCREENFONTS;
if (frame == FRAME_FILE)
cf.Flags |= CF_FIXEDPITCHONLY; // Only fixed-width fonts for merge view
// Re-read MergeDoc settings (also updates view settings)
// and rescan using new options
pMergeDoc->RefreshOptions();
- pMergeDoc->FlushAndRescan(TRUE);
+ pMergeDoc->FlushAndRescan(true);
}
}
{
// Create a new merge doc
DocClass::m_nBuffersTemp = nFiles;
- DocClass *pMergeDoc = static_cast<DocClass*>(pTemplate->OpenDocumentFile(NULL));
+ DocClass *pMergeDoc = static_cast<DocClass*>(pTemplate->OpenDocumentFile(nullptr));
if (pMergeDoc != nullptr)
{
pDirDoc->AddMergeDoc(pMergeDoc);
}
}
- DoFileOpen(&tFiles, dwFlags, NULL, _T(""), recurse);
+ DoFileOpen(&tFiles, dwFlags, nullptr, _T(""), recurse);
}
void CMainFrame::OnPluginUnpackMode(UINT nID )
{
// NB: GetActiveDocument does not return the Merge Doc
// even when the merge edit view is in front
- // NB: CChildFrame::GetActiveView returns NULL when location view active
+ // NB: CChildFrame::GetActiveView returns `nullptr` when location view active
// So we have this rather complicated logic to try to get a merge edit view
// We look at the front child window, which should be a frame
// and we can get a MergeEditView from it, if it is a CChildFrame
int i = GetMenuItemCount(prediffersSubmenu);
while (i --)
::DeleteMenu(prediffersSubmenu, 0, MF_BYPOSITION);
- ::AppendMenu(prediffersSubmenu, MF_SEPARATOR, 0, NULL);
+ ::AppendMenu(prediffersSubmenu, MF_SEPARATOR, 0, nullptr);
}
}
}
if (bFileCompareRescan)
{
for (auto pMergeDoc : GetAllMergeDocs())
- pMergeDoc->FlushAndRescan(TRUE);
+ pMergeDoc->FlushAndRescan(true);
}
else if (bFolderCompareRescan)
{
pOpenDoc->m_strExt = static_cast<FileFilterHelper *>(ctxt.m_piFilterGlobal)->GetFilterNameOrMask();
}
- CFrameWnd *pOpenFrame = theApp.m_pOpenTemplate->CreateNewFrame(pOpenDoc, NULL);
+ CFrameWnd *pOpenFrame = theApp.m_pOpenTemplate->CreateNewFrame(pOpenDoc, nullptr);
theApp.m_pOpenTemplate->InitialUpdateFrame(pOpenFrame, pOpenDoc);
}
void CMainFrame::OnHelpReleasenotes()
{
const String sPath = paths::ConcatPath(env::GetProgPath(), RelNotes);
- ShellExecute(NULL, _T("open"), sPath.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), sPath.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
/**
*/
void CMainFrame::OnHelpTranslations()
{
- ShellExecute(NULL, _T("open"), TranslationsUrl, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), TranslationsUrl, nullptr, nullptr, SW_SHOWNORMAL);
}
/**
if (pActiveFrame != nullptr)
{
if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
- pMainFrame->MDISetMenu(pNewMergeMenu, NULL);
+ pMainFrame->MDISetMenu(pNewMergeMenu, nullptr);
else if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame)))
- pMainFrame->MDISetMenu(pNewMergeMenu, NULL);
+ pMainFrame->MDISetMenu(pNewMergeMenu, nullptr);
else if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame)))
- pMainFrame->MDISetMenu(pNewImgMergeMenu, NULL);
+ pMainFrame->MDISetMenu(pNewImgMergeMenu, nullptr);
else if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CDirFrame)))
- pMainFrame->MDISetMenu(pNewDirMenu, NULL);
+ pMainFrame->MDISetMenu(pNewDirMenu, nullptr);
else
- pMainFrame->MDISetMenu(pNewDefaultMenu, NULL);
+ pMainFrame->MDISetMenu(pNewDefaultMenu, nullptr);
}
else
- pMainFrame->MDISetMenu(pNewDefaultMenu, NULL);
+ pMainFrame->MDISetMenu(pNewDefaultMenu, nullptr);
// Don't delete the old menu
// There is a bug in BCMenu or in Windows98 : the new menu does not
for (auto& msg : cmdInfo.m_sErrorMessages)
{
String line = _T("WinMerge: ") + msg + _T("\n");
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), line.c_str(), static_cast<DWORD>(line.length()), &dwWritten, NULL);
+ WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), line.c_str(), static_cast<DWORD>(line.length()), &dwWritten, nullptr);
}
FreeConsole();
}
// As the window class name is decorated to distinguish between ANSI and
// UNICODE build, so will be the mutex name.
wsprintf(szMutexName, _T("%s-%s"), CMainFrame::szClassName, szDesktopName);
- HANDLE hMutex = CreateMutex(NULL, FALSE, szMutexName);
+ HANDLE hMutex = CreateMutex(nullptr, FALSE, szMutexName);
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);
+ HWND hWnd = FindWindow(CMainFrame::szClassName, nullptr);
if (hWnd != nullptr)
{
if (IsIconic(hWnd))
SetForegroundWindow(GetLastActivePopup(hWnd));
LPTSTR cmdLine = GetCommandLine();
COPYDATASTRUCT data = { 0, (lstrlen(cmdLine) + 1) * sizeof(TCHAR), cmdLine};
- if (SendMessage(hWnd, WM_COPYDATA, NULL, (LPARAM)&data))
+ if (::SendMessage(hWnd, WM_COPYDATA, NULL, (LPARAM)&data))
{
ReleaseMutex(hMutex);
CloseHandle(hMutex);
cmdInfo.m_dwRightFlags |= FFILEOPEN_CMDLINE;
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwMiddleFlags, cmdInfo.m_dwRightFlags};
bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
- dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, NULL,
+ dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
cmdInfo.m_sPreDiffer);
}
else if (cmdInfo.m_Files.GetSize() > 1)
{
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwRightFlags, FFILEOPEN_NONE};
bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
- dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, NULL,
+ dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
cmdInfo.m_sPreDiffer);
}
else if (cmdInfo.m_Files.GetSize() == 1)
{
DWORD dwFlags[3] = {cmdInfo.m_dwLeftFlags, cmdInfo.m_dwRightFlags, FFILEOPEN_NONE};
bCompared = pMainFrame->DoFileOpen(&cmdInfo.m_Files,
- dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, NULL,
+ dwFlags, strDesc, cmdInfo.m_sReportFile, cmdInfo.m_bRecurse, nullptr,
cmdInfo.m_sPreDiffer);
}
}
STARTUPINFO stInfo = { sizeof STARTUPINFO };
PROCESS_INFORMATION processInfo;
- retVal = !!CreateProcess(NULL, (LPTSTR)sCmd.c_str(),
- NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
+ retVal = !!CreateProcess(nullptr, (LPTSTR)sCmd.c_str(),
+ nullptr, nullptr, FALSE, CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr,
&stInfo, &processInfo);
if (!retVal)
void CMergeApp::OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl)
{
if (paths::DoesPathExist(szFile) == paths::IS_EXISTING_FILE)
- ShellExecute(NULL, _T("open"), _T("notepad.exe"), szFile, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), _T("notepad.exe"), szFile, nullptr, SW_SHOWNORMAL);
else
- ShellExecute(NULL, _T("open"), szUrl, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), szUrl, nullptr, nullptr, SW_SHOWNORMAL);
}
/**
* @brief Show Help - this is for opening help from outside mainframe.
- * @param [in] helpLocation Location inside help, if NULL main help is opened.
+ * @param [in] helpLocation Location inside help, if `nullptr` main help is opened.
*/
-void CMergeApp::ShowHelp(LPCTSTR helpLocation /*= NULL*/)
+void CMergeApp::ShowHelp(LPCTSTR helpLocation /*= nullptr*/)
{
String sPath = env::GetProgPath();
LANGID LangId = GetLangId();
if (helpLocation == nullptr)
{
if (paths::DoesPathExist(sPath) == paths::IS_EXISTING_FILE)
- ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOC, NULL);
+ ::HtmlHelp(nullptr, sPath.c_str(), HH_DISPLAY_TOC, NULL);
else
- ShellExecute(NULL, _T("open"), DocsURL, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, _T("open"), DocsURL, nullptr, nullptr, SW_SHOWNORMAL);
}
else
{
if (paths::DoesPathExist(sPath) == paths::IS_EXISTING_FILE)
{
sPath += helpLocation;
- ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOPIC, NULL);
+ ::HtmlHelp(nullptr, sPath.c_str(), HH_DISPLAY_TOPIC, NULL);
}
}
}
{
// Overwrite read-only file
case IDYESTOALL:
- bApplyToAll = TRUE; // Don't ask again (no break here)
+ bApplyToAll = true; // Don't ask again (no break here)
case IDYES:
CFile::GetStatus(strSavePath.c_str(), status);
status.m_mtime = 0; // Avoid unwanted changes
bool CMergeApp::IsProjectFile(const String& filepath) const
{
String ext;
- paths::SplitFilename(filepath, NULL, NULL, &ext);
+ paths::SplitFilename(filepath, nullptr, nullptr, &ext);
if (strutils::compare_nocase(ext, ProjectFile::PROJECTFILE_EXT) == 0)
return true;
else
GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, bRecursive);
- bool rtn = GetMainFrame()->DoFileOpen(&tFiles, dwFlags, NULL, sReportFile, bRecursive);
+ bool rtn = GetMainFrame()->DoFileOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive);
AddToRecentProjectsMRU(sProject.c_str());
return rtn;
{
// sPathName will be added to the top of the MRU list.
// If sPathName already exists in the MRU list, it will be moved to the top
- if (m_pRecentFileList != NULL) {
+ if (m_pRecentFileList != nullptr) {
m_pRecentFileList->Add(sPathName);
m_pRecentFileList->WriteList();
}
COptionsMgr * GetMergeOptionsMgr() { return static_cast<COptionsMgr *> (m_pOptions.get()); }
FileFilterHelper * GetGlobalFileFilter() { return m_pGlobalFileFilter.get(); }
- void ShowHelp(LPCTSTR helpLocation = NULL);
+ void ShowHelp(LPCTSTR helpLocation = nullptr);
void OpenFileToExternalEditor(const String& file, int nLineNumber = 1);
void OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl);
bool CreateBackup(bool bFolder, const String& pszPath);
for (size_t i = 0; i < Merge7zFormatRegister::optionalFormats.size(); ++i)
{
Merge7z::Format* pFormat = Merge7zFormatRegister::optionalFormats[i](path);
- if (pFormat)
+ if (pFormat != nullptr)
return pFormat;
}
- return NULL;
+ return nullptr;
}
static std::vector<Merge7z::Format *(*)(const String& path)> optionalFormats;
}
// and we don't repack the file
- PackingInfo * tempPacker = NULL;
+ PackingInfo * tempPacker = nullptr;
// write buffer out to temporary file
String sError;
int nGroup = GetActiveMergeView()->m_nThisGroup;
CMergeEditView *pViewSrc = m_pView[nGroup][srcPane];
CMergeEditView *pViewDst = m_pView[nGroup][dstPane];
- CCrystalTextView *pSource = bUpdateView ? pViewDst : NULL;
+ CCrystalTextView *pSource = bUpdateView ? pViewDst : nullptr;
// suppress Rescan during this method
// (Not only do we not want to rescan a lot of times, but
* Creates backup file if wanted to. And if saving to given path fails,
* allows user to select new location/name for file.
* @param [in] szPath Path where to save including filename. Can be
- * empty/NULL if new file is created (scratchpad) without filename.
+ * empty/`nullptr` if new file is created (scratchpad) without filename.
* @param [out] bSaveSuccess Will contain information about save success with
* the original name (to determine if file statuses should be changed)
* @param [in] nBuffer Index (0-based) of buffer to save
* Safe top-level file saving function. Asks user to select filename
* and path. Does not create backups.
* @param [in] szPath Path where to save including filename. Can be
- * empty/NULL if new file is created (scratchpad) without filename.
+ * empty/`nullptr` if new file is created (scratchpad) without filename.
* @param [out] bSaveSuccess Will contain information about save success with
* the original name (to determine if file statuses should be changed)
* @param [in] nBuffer Index (0-based) of buffer to save
CMergeDoc::FileChange CMergeDoc::IsFileChangedOnDisk(LPCTSTR szPath, DiffFileInfo &dfi,
bool bSave, int nBuffer)
{
- DiffFileInfo *fileInfo = NULL;
+ DiffFileInfo *fileInfo = nullptr;
bool bFileChanged = false;
bool bIgnoreSmallDiff = GetOptionsMgr()->GetBool(OPT_IGNORE_SMALL_FILETIME);
int tolerance = 0;
{
if (!cp) // 0 is our signal value for invalid
return false;
- return GetEncodingNameFromCodePage(cp) != NULL;
+ return GetEncodingNameFromCodePage(cp) != nullptr;
}
/**
pf->GetHeaderInterface()->SetText(pane, sText);
- SetTitle(NULL);
+ SetTitle(nullptr);
}
/**
bool CMergeDoc::OpenWithUnpackerDialog()
{
// let the user choose a handler
- CSelectUnpackerDlg dlg(m_filePaths[0], NULL);
+ CSelectUnpackerDlg dlg(m_filePaths[0], nullptr);
// create now a new infoUnpacker to initialize the manual/automatic flag
PackingInfo infoUnpacker(PLUGIN_AUTO);
dlg.SetInitialInfoHandler(&infoUnpacker);
{
DWORD dwFlags[3] = {FFILEOPEN_NOMRU, FFILEOPEN_NOMRU, FFILEOPEN_NOMRU};
GetMainFrame()->DoFileOpen(&m_filePaths, dwFlags, m_strDesc, _T(""),
- GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS), NULL, _T(""), &infoUnpacker);
+ GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS), nullptr, _T(""), &infoUnpacker);
CloseNow();
}
else
String CMergeDoc::GetFileExt(LPCTSTR sFileName, LPCTSTR sDescription) const
{
String sExt;
- paths::SplitFilename(sFileName, NULL, NULL, &sExt);
+ paths::SplitFilename(sFileName, nullptr, nullptr, &sExt);
return sExt;
}
// calculate HTML font size
LOGFONT lf;
CDC dc;
- dc.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
+ dc.CreateDC(_T("DISPLAY"), nullptr, nullptr, nullptr);
m_pView[0][0]->GetFont(lf);
int nFontSize = -MulDiv (lf.lfHeight, 72, dc.GetDeviceCaps (LOGPIXELSY));
*/
bool CMergeDoc::DoFileEncodingDialog()
{
- if (!PromptAndSaveIfNeeded(TRUE))
+ if (!PromptAndSaveIfNeeded(true))
return false;
CLoadSaveCodepageDlg dlg(m_nBuffers);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMergeEditSplitterView)
public:
- virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+ virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = nullptr);
virtual void OnDraw(CDC* pDC);
virtual void OnInitialUpdate();
virtual void OnSize(UINT nType, int cx, int cy);
// tell the others views about this diff (no need to call UpdateSiblingScrollPos)
CSplitterWnd *pSplitterWnd = GetParentSplitter(this, false);
- // pSplitterWnd is NULL if WinMerge started minimized.
+ // pSplitterWnd is `nullptr` if WinMerge started minimized.
if (pSplitterWnd != nullptr)
{
int nRows = pSplitterWnd->GetRowCount ();
nAction == CE_ACTION_DELETE ||
nAction == CE_ACTION_CUT)
{
- if (!SetTimer(IDT_RESCAN, RESCAN_TIMEOUT, NULL))
+ if (!SetTimer(IDT_RESCAN, RESCAN_TIMEOUT, nullptr))
pDoc->FlushAndRescan();
}
else
// build the menu : first part, suggested plugins
// title
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);
AppendMenu(hMenu, MF_STRING, ID_SUGGESTED_PLUGINS, _("Suggested plugins").c_str());
int ID = ID_PREDIFFERS_FIRST; // first ID in menu
// build the menu : second part, others plugins
// title
- AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr);
AppendMenu(hMenu, MF_STRING, ID_NOT_SUGGESTED_PLUGINS, _("Other plugins").c_str());
ID = ID_PREDIFFERS_FIRST; // first ID in menu
if (dlg.DoModal() == IDOK)
{
CMergeDoc * pDoc1 = GetDocument();
- CMergeEditView * pCurrentView = NULL;
+ CMergeEditView * pCurrentView = nullptr;
// Get views
pCurrentView = GetGroupView(m_nThisPane);
{
// append the scripts submenu
HMENU scriptsSubmenu = dynamic_cast<CMainFrame*>(AfxGetMainWnd())->GetScriptsSubmenu(AfxGetMainWnd()->GetMenu()->m_hMenu);
- if (scriptsSubmenu != NULL)
+ if (scriptsSubmenu != nullptr)
createScriptsSubmenu(scriptsSubmenu);
pCmdUI->Enable(true);
{
if (nLineIndex >= pView->GetLineCount())
return 0;
- pView->WrapLineCached( nLineIndex, pView->GetScreenChars(), NULL, nBreaks[nPane] );
+ pView->WrapLineCached( nLineIndex, pView->GetScreenChars(), nullptr, nBreaks[nPane] );
}
nMaxBreaks = max(nMaxBreaks, nBreaks[nPane]);
}
String name = theApp.LoadString(ID_COLORSCHEME_FIRST);
AppendMenu(hSubMenu, MF_STRING, ID_COLORSCHEME_FIRST, name.c_str());
- AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
+ AppendMenu(hSubMenu, MF_SEPARATOR, 0, nullptr);
for (int i = ID_COLORSCHEME_FIRST + 1; i <= ID_COLORSCHEME_LAST; ++i)
{
dc.SetBkColor(m_cachedColors.clrWordDiff);
dc.ExtTextOut(
lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.top,
- ETO_OPAQUE, &lpDrawItemStruct->rcItem, _T(""), NULL );
+ ETO_OPAQUE, &lpDrawItemStruct->rcItem, _T(""), nullptr );
}
else
{
rc.top = rc.Height() - sz.cy;
// This actually moves the view window
- pView->SetWindowPos(NULL, rc.left, rc.top, sz.cx, sz.cy,
+ pView->SetWindowPos(nullptr, rc.left, rc.top, sz.cx, sz.cy,
SWP_NOACTIVATE|SWP_NOZORDER);
}
}
rc.bottom = rc.top + m_sizeOrig.cy;
m_rectTracker.m_rect.right = m_rectTracker.m_rect.left + width;
m_rectTracker.m_rect.bottom = m_rectTracker.m_rect.top + m_sizeOrig.cy;
- SetWindowPos(NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOZORDER);
+ SetWindowPos(nullptr, rc.left, rc.top, rc.Width(), rc.Height(), SWP_NOZORDER);
m_constraint.UpdateSizes();
}
}
}
// If left path is a project-file, load it
String ext;
- paths::SplitFilename(m_strPath[0], NULL, NULL, &ext);
+ paths::SplitFilename(m_strPath[0], nullptr, nullptr, &ext);
if (m_strPath[1].empty() && strutils::compare_nocase(ext, ProjectFile::PROJECTFILE_EXT) == 0)
LoadProjectFile(m_strPath[0]);
PackingInfo tmpPackingInfo(pDoc->m_infoHandler);
GetMainFrame()->DoFileOpen(
&tmpPathContext, std::array<DWORD, 3>(pDoc->m_dwFlags).data(),
- NULL, _T(""), pDoc->m_bRecurse, NULL, _T(""), &tmpPackingInfo);
+ nullptr, _T(""), pDoc->m_bRecurse, nullptr, _T(""), &tmpPackingInfo);
}
/**
MSG msg;
BOOL bRet;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
CAssureScriptsForThread scriptsForRescan;
- while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
+ while( (bRet = GetMessage( &msg, nullptr, 0, 0 )) != 0)
{
if (bRet == -1)
break;
// Check if we have project file as left side path
bool bProject = false;
String ext;
- paths::SplitFilename(paths[0], NULL, NULL, &ext);
+ paths::SplitFilename(paths[0], nullptr, nullptr, &ext);
if (paths[1].empty() && strutils::compare_nocase(ext, ProjectFile::PROJECTFILE_EXT) == 0)
bProject = true;
if (!m_pUpdateButtonStatusThread)
{
m_pUpdateButtonStatusThread = AfxBeginThread(
- UpdateButtonStatesThread, NULL, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
+ UpdateButtonStatesThread, nullptr, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
m_pUpdateButtonStatusThread->m_bAutoDelete = FALSE;
m_pUpdateButtonStatusThread->ResumeThread();
while (PostThreadMessage(m_pUpdateButtonStatusThread->m_nThreadID, WM_NULL, 0, 0) == FALSE)
TerminateThread(m_pUpdateButtonStatusThread->m_hThread, 0);
}
delete m_pUpdateButtonStatusThread;
- m_pUpdateButtonStatusThread = NULL;
+ m_pUpdateButtonStatusThread = nullptr;
}
/**
{
// (Re)start timer to path validity check delay
// If timer starting fails, update buttonstates immediately
- if (!SetTimer(IDT_CHECKFILES, CHECKFILES_TIMEOUT, NULL))
+ if (!SetTimer(IDT_CHECKFILES, CHECKFILES_TIMEOUT, nullptr))
UpdateButtonStates();
}
/**
* @brief Constructor, initializes members.
*/
-CPatchDlg::CPatchDlg(CWnd* pParent /*=NULL*/)
+CPatchDlg::CPatchDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(CPatchDlg::IDD, pParent)
, m_caseSensitive(false)
, m_ignoreBlanks(false)
{
// Construction
public:
- explicit CPatchDlg(CWnd* pParent = NULL); // standard constructor
+ explicit CPatchDlg(CWnd* pParent = nullptr); // standard constructor
// Functions to add and get selected files (as PATCHFILEs)
void AddItem(const PATCHFILES& pf);
/**
* @brief Constructor.
*/
-PluginsListDlg::PluginsListDlg(CWnd* pParent /*=NULL*/)
+PluginsListDlg::PluginsListDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(PluginsListDlg::IDD, pParent)
{
}
for (int i = 0; i < m_list.GetItemCount(); ++i)
{
- PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(NULL, String(m_list.GetItemText(i, 0)));
+ PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(nullptr, String(m_list.GetItemText(i, 0)));
plugin->m_disabled = !m_list.GetCheck(i);
}
CAllThreadsScripts::GetActiveSet()->SaveSettings();
DECLARE_DYNAMIC(PluginsListDlg)
public:
- explicit PluginsListDlg(CWnd* pParent = NULL); // standard constructor
+ explicit PluginsListDlg(CWnd* pParent = nullptr); // standard constructor
virtual ~PluginsListDlg();
// Dialog Data
* @param [out] pReadOnly true if readonly was specified for path.
* @return Left path.
*/
-String ProjectFile::GetLeft(bool * pReadOnly /*=NULL*/) const
+String ProjectFile::GetLeft(bool * pReadOnly /*= nullptr*/) const
{
- if (pReadOnly)
+ if (pReadOnly != nullptr)
*pReadOnly = m_bLeftReadOnly;
return m_paths.GetLeft();
}
* @param [in] sLeft Left path.
* @param [in] bReadOnly Will path be recorded read-only?
*/
-void ProjectFile::SetLeft(const String& sLeft, const bool * pReadOnly /*=NULL*/)
+void ProjectFile::SetLeft(const String& sLeft, const bool * pReadOnly /*= nullptr*/)
{
m_paths.SetLeft(sLeft, false);
- if (pReadOnly)
+ if (pReadOnly != nullptr)
m_bLeftReadOnly = *pReadOnly;
}
* @brief Returns middle path.
* @param [out] pReadOnly true if readonly was specified for path.
*/
-String ProjectFile::GetMiddle(bool * pReadOnly /*=NULL*/) const
+String ProjectFile::GetMiddle(bool * pReadOnly /*= nullptr*/) const
{
- if (pReadOnly)
+ if (pReadOnly != nullptr)
*pReadOnly = m_bMiddleReadOnly;
return m_paths.GetMiddle();
}
* @param [in] sMiddle Middle path.
* @param [in] bReadOnly Will path be recorded read-only?
*/
-void ProjectFile::SetMiddle(const String& sMiddle, const bool * pReadOnly /*=NULL*/)
+void ProjectFile::SetMiddle(const String& sMiddle, const bool * pReadOnly /*= nullptr*/)
{
m_paths.SetMiddle(sMiddle, false);
- if (pReadOnly)
+ if (pReadOnly != nullptr)
m_bMiddleReadOnly = *pReadOnly;
return;
* @param [out] pReadOnly true if readonly was specified for path.
* @return Right path.
*/
-String ProjectFile::GetRight(bool * pReadOnly /*=NULL*/) const
+String ProjectFile::GetRight(bool * pReadOnly /*= nullptr*/) const
{
- if (pReadOnly)
+ if (pReadOnly != nullptr)
*pReadOnly = m_bRightReadOnly;
return m_paths.GetRight();
}
* @param [in] sRight Right path.
* @param [in] bReadOnly Will path be recorded read-only?
*/
-void ProjectFile::SetRight(const String& sRight, const bool * pReadOnly /*=NULL*/)
+void ProjectFile::SetRight(const String& sRight, const bool * pReadOnly /*= nullptr*/)
{
m_paths.SetRight(sRight, false);
- if (pReadOnly)
+ if (pReadOnly != nullptr)
m_bRightReadOnly = *pReadOnly;
}
bool HasFilter() const;
bool HasSubfolders() const;
- String GetLeft(bool * pReadOnly = NULL) const;
+ String GetLeft(bool * pReadOnly = nullptr) const;
bool GetLeftReadOnly() const;
- String GetMiddle(bool * pReadOnly = NULL) const;
+ String GetMiddle(bool * pReadOnly = nullptr) const;
bool GetMiddleReadOnly() const;
String GetMiddle() const;
- String GetRight(bool * pReadOnly = NULL) const;
+ String GetRight(bool * pReadOnly = nullptr) const;
bool GetRightReadOnly() const;
String GetFilter() const;
int GetSubfolders() const;
- void SetLeft(const String& sLeft, const bool * pReadOnly = NULL);
- void SetMiddle(const String& sMiddle, const bool * pReadOnly = NULL);
- void SetRight(const String& sRight, const bool * pReadOnly = NULL);
+ void SetLeft(const String& sLeft, const bool * pReadOnly = nullptr);
+ void SetMiddle(const String& sMiddle, const bool * pReadOnly = nullptr);
+ void SetRight(const String& sRight, const bool * pReadOnly = nullptr);
void SetFilter(const String& sFilter);
void SetSubfolders(bool bSubfolder);
m_comboCustomCodepageValue.SetWindowText(strutils::to_str(m_nCustomCodepageValue).c_str());
IExconverter *pexconv = Exconverter::getInstance();
- if (pexconv != NULL)
+ if (pexconv != nullptr)
{
std::vector<CodePageInfo> cpi = pexconv->enumCodePages();
for (size_t i = 0, j = 0; i < cpi.size(); i++)
, m_bScroll(false)
, m_bSingleInstance(false)
, m_bVerifyPaths(false)
-, m_bCloseWindowWithEsc(TRUE)
+, m_bCloseWindowWithEsc(true)
, m_bAskMultiWindowClose(false)
, m_nAutoCompleteSource(0)
, m_bPreserveFiletime(false)
AdvancedContextMenuCheck();
UpdateData(FALSE);
- SetTimer(0, 1000, NULL);
+ SetTimer(0, 1000, nullptr);
return TRUE; // return TRUE unless you set the focus to a control
}
/**
* @brief Enable / disable color controls on dialog.
- * @param [in] bEnable If TRUE color controls are enabled.
+ * @param [in] bEnable If `true` color controls are enabled.
*/
void PropTextColors::EnableColorButtons(bool bEnable)
{
* @brief Constructor.
* @param [in] pParent Dialog's parent window.
*/
-SaveClosingDlg::SaveClosingDlg(CWnd* pParent /*=NULL*/)
+SaveClosingDlg::SaveClosingDlg(CWnd* pParent /*= nullptr*/)
: CTrDialog(SaveClosingDlg::IDD, pParent)
, m_leftSave(SAVECLOSING_SAVE)
, m_middleSave(SAVECLOSING_SAVE)
SAVECLOSING_DISCARD, /**< Discard changes */
};
- explicit SaveClosingDlg(CWnd* pParent = NULL); // standard constructor
+ explicit SaveClosingDlg(CWnd* pParent = nullptr); // standard constructor
void DoAskFor(bool bLeft = false, bool bMiddle = false, bool bRight = false);
// Dialog Data
// texts for the default unpackers
noPlugin.reset(new PluginInfo);
- noPlugin->m_lpDispatch = NULL;
+ noPlugin->m_lpDispatch = nullptr;
noPlugin->m_name = _("<None>");
automaticPlugin.reset(new PluginInfo);
- automaticPlugin->m_lpDispatch = NULL;
+ automaticPlugin->m_lpDispatch = nullptr;
automaticPlugin->m_name = _("<Automatic>");
automaticPlugin->m_description = _("The adapted unpacker is applied to both files (one file only needs the extension)");
}
-CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename, CWnd* pParent /*=NULL*/)
+CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename, CWnd* pParent /*= nullptr*/)
: CTrDialog(CSelectUnpackerDlg::IDD, pParent), m_filteredFilenames(filename)
{
Initialize();
}
-CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*=NULL*/)
+CSelectUnpackerDlg::CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*= nullptr*/)
: CTrDialog(CSelectUnpackerDlg::IDD, pParent), m_filteredFilenames(filename1 + _T("|") + filename2)
{
Initialize();
public:
// Construction
- CSelectUnpackerDlg(const String& filename, CWnd* pParent /*=NULL*/);
- CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*=NULL*/);
+ CSelectUnpackerDlg(const String& filename, CWnd* pParent /*= nullptr*/);
+ CSelectUnpackerDlg(const String& filename1, const String& filename2, CWnd* pParent /*= nullptr*/);
~CSelectUnpackerDlg();
void SetInitialInfoHandler(PackingInfo * infoHandler);
/**
* @brief A constructor.
*/
-CSharedFilterDlg::CSharedFilterDlg(FilterType type, CWnd* pParent /*=NULL*/)
+CSharedFilterDlg::CSharedFilterDlg(FilterType type, CWnd* pParent /*= nullptr*/)
: CTrDialog(CSharedFilterDlg::IDD, pParent), m_selectedType(type)
{
}
// Construction
public:
enum FilterType : int { SHARED = 0, PRIVATE = 1 };
- CSharedFilterDlg(FilterType type, CWnd* pParent = NULL);
+ CSharedFilterDlg(FilterType type, CWnd* pParent = nullptr);
FilterType GetSelectedFilterType() const { return m_selectedType; }
// Implementation
DECLARE_DYNAMIC(CTrDialog)\r
public:\r
CTrDialog() : CDialog() {}\r
- CTrDialog(UINT nIDTemplate, CWnd *pParent = NULL) : CDialog(nIDTemplate, pParent) {}\r
- CTrDialog(LPCTSTR lpszTemplateName, CWnd *pParentWnd = NULL) : CDialog(lpszTemplateName, pParentWnd) {}\r
+ CTrDialog(UINT nIDTemplate, CWnd *pParent = nullptr) : CDialog(nIDTemplate, pParent) {}\r
+ CTrDialog(LPCTSTR lpszTemplateName, CWnd *pParentWnd = nullptr) : CDialog(lpszTemplateName, pParentWnd) {}\r
\r
virtual BOOL OnInitDialog();\r
};\r
else if (guessEncodingType & 2)
{
IExconverter *pexconv = Exconverter::getInstance();
- if (pexconv && src != NULL)
+ if (pexconv != nullptr && src != nullptr)
{
int autodetectType = (unsigned)guessEncodingType >> 16;
cp = pexconv->detectInputCodepage(autodetectType, cp, src, len);
* - IS_EXISTING_DIR : path points to existing folder
* - IS_EXISTING_FILE : path points to existing file
*/
-PATH_EXISTENCE DoesPathExist(const String& szPath, bool (*IsArchiveFile)(const String&))
+PATH_EXISTENCE DoesPathExist(const String& szPath, bool (*IsArchiveFile)(const String&) /*= nullptr*/)
{
if (szPath.empty())
return DOES_NOT_EXIST;
_tcscpy_s(pFullPath, MAX_PATH_FULL, tPath.c_str());
// We are done if this is not a short name.
- if (_tcschr(pFullPath, _T('~')) == NULL)
+ if (_tcschr(pFullPath, _T('~')) == nullptr)
return pFullPath;
// We have to do it the hard way because GetLongPathName is not
// and leave the invalid stuff at the end.
String sLong;
TCHAR *ptr = pFullPath;
- TCHAR *end = NULL;
+ TCHAR *end = nullptr;
// Skip to \ position d:\abcd or \\host\share\abcd
// indicated by ^ ^ ^
* - IS_EXISTING_FILE : both are files & exist
* - DOES_NOT_EXIST : in all other cases
*/
-PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveFile)(const String&))
+PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveFile)(const String&) /*= nullptr*/)
{
// fail if not both specified
if (paths.GetSize() < 2 || paths[0].empty() || paths[1].empty())
{
const TCHAR ShortcutExt[] = _T(".lnk");
TCHAR ext[_MAX_EXT] = {0};
- _tsplitpath_s(inPath.c_str(), NULL, 0, NULL, 0, NULL, 0, ext, _MAX_EXT);
+ _tsplitpath_s(inPath.c_str(), nullptr, 0, nullptr, 0, nullptr, 0, ext, _MAX_EXT);
if (_tcsicmp(ext, ShortcutExt) == 0)
return true;
else
HRESULT hres;
// Create instance for shell link
- hres = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+ hres = ::CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*) &psl);
if (SUCCEEDED(hres))
{
{
// find the path from that
TCHAR buf[MAX_PATH_FULL] = {0};
- psl->GetPath(buf, MAX_PATH_FULL, NULL, SLGP_UNCPRIORITY);
+ psl->GetPath(buf, MAX_PATH_FULL, nullptr, SLGP_UNCPRIORITY);
outFile = buf;
}
ppf->Release();
{
if (!ext)
{
- if (pExt)
+ if (pExt != nullptr)
{
(*pExt) = pszChar + 1;
}
// Ok, found last slash, so we collect any info desired
// and we're done
- if (pPath)
+ if (pPath != nullptr)
{
// Grab directory (omit trailing slash)
size_t len = pszChar - pathLeft.c_str();
pPath->erase(len); // Cut rest of path
}
- if (pFile)
+ if (pFile != nullptr)
{
// Grab file
*pFile = pszChar + 1;
}
// Never found a delimiter
- if (pFile)
+ if (pFile != nullptr)
{
*pFile = pathLeft;
}
endSplit:
// if both filename & extension requested, remove extension from filename
- if (pFile && pExt && extptr)
+ if (pFile != nullptr && pExt != nullptr && extptr != nullptr)
{
size_t extlen = pend - extptr;
pFile->erase(pFile->length() - extlen);
bool EndsWithSlash(const String& s);
-PATH_EXISTENCE DoesPathExist(const String& szPath, bool (*IsArchiveFile)(const String&) = NULL);
+PATH_EXISTENCE DoesPathExist(const String& szPath, bool (*IsArchiveFile)(const String&) = nullptr);
String FindFileName(const String& path);
String FindExtension(const String& path);
void normalize(String & sPath);
String GetLongPath(const String& szPath, bool bExpandEnvs = true);
bool CreateIfNeeded(const String& szPath);
-PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveFile)(const String&) = NULL);
+PATH_EXISTENCE GetPairComparability(const PathContext & paths, bool (*IsArchiveFile)(const String&) = nullptr);
bool IsDirectory(const String& path);
bool IsShortcut(const String& inPath);
String ExpandShortcut(const String &inFile);