Skip to content

Commit

Permalink
minor cleanup and modernized nullptr usage
Browse files Browse the repository at this point in the history
  • Loading branch information
janwilmans committed Jun 15, 2019
1 parent fba10fd commit c8223ac
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DbgMsgSrc/DbgMsgSrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void SeparateProcessTest()
std::cerr << "SeparateProcessTest\n";
for (;;)
{
auto result = ShellExecute(0, L"open", L"DbgMsgSrc.exe", L"-n", nullptr, SW_HIDE);
auto result = ShellExecute(nullptr, L"open", L"DbgMsgSrc.exe", L"-n", nullptr, SW_HIDE);
if (result <= HINSTANCE(32))
{
std::cerr << "error starting DbgMsgSrc.exe\n";
Expand Down
1 change: 0 additions & 1 deletion DebugView++/CLogViewTabItem2.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class ViewPort
TimePoint ToTimePoint(gdi::Pixel p) const;
std::wstring FormatAsTime(gdi::Pixel p);

void SetWidth(gdi::Pixel width);
void ZoomInTo(gdi::Pixel position);
void ZoomOut(gdi::Pixel position);
private:
Expand Down
4 changes: 2 additions & 2 deletions DebugView++/DropTargetSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::string GetCF_TEXT(IDataObject* pDataObject)
{
std::string result;
// construct a FORMATETC object
FORMATETC fmtetc = {CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
FORMATETC fmtetc = {CF_TEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
STGMEDIUM stgmed;

if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
Expand All @@ -86,7 +86,7 @@ std::wstring GetCF_HDROP(IDataObject* pDataObject)
{
std::wstring result;
// construct a FORMATETC object
FORMATETC fmtetc = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
FORMATETC fmtetc = {CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
STGMEDIUM stgmed;

if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
Expand Down
10 changes: 5 additions & 5 deletions DebugView++/DropTargetSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class ATL_NO_VTABLE DropTargetSupport : public CComObjectRootEx<CComSingleThread
END_COM_MAP()

DropTargetSupport();
virtual ~DropTargetSupport() {}
~DropTargetSupport() = default;
void Register(HWND hwnd);
void Unregister();

STDMETHOD(DragEnter)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
STDMETHOD(DragLeave)();
STDMETHOD(Drop)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
STDMETHOD(DragEnter)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override;
STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override;
STDMETHOD(DragLeave)() override;
STDMETHOD(Drop)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override;

typedef boost::signals2::signal<void(const std::wstring& uri)> DroppedSignal;
boost::signals2::connection SubscribeToDropped(DroppedSignal::slot_type slot);
Expand Down
4 changes: 2 additions & 2 deletions DebugView++/LogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ void CLogView::OnViewProcessRename(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*
auto name = m_logFile[m_logLines[item].line].processName;
std::wstring wname = WStr(name);
CRenameProcessDlg dlg(wname);
if (dlg.DoModal(NULL) == IDOK)
if (dlg.DoModal(nullptr) == IDOK)
{
std::string newName = Str(dlg.GetName());
//m_logFile[m_logLines[item].line].processName = newName;
Expand Down Expand Up @@ -1269,7 +1269,7 @@ LRESULT CLogView::OnCustomDraw(NMHDR*)
#else
LRESULT CLogView::OnCustomDraw(NMHDR* pnmh)
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pnmh;
LPNMLVCUSTOMDRAW lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(pnmh);
if (lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT)
{
return CDRF_NOTIFYPOSTPAINT;
Expand Down
2 changes: 0 additions & 2 deletions DebugView++/LogView.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ class CLogView : public CDoubleBufferWindowImpl<CLogView, CListViewCtrl,
void OnException() const;
void OnException(const std::exception& ex);
LRESULT OnCreate(const CREATESTRUCT* pCreate);
void Close();
void OnContextMenu(HWND hWnd, CPoint pt);
void OnLButtonDown(UINT flags, CPoint point);
void OnMouseMove(UINT flags, CPoint point);
Expand Down Expand Up @@ -275,7 +274,6 @@ class CLogView : public CDoubleBufferWindowImpl<CLogView, CListViewCtrl,
int GetTextIndex(int iItem, int xPos) const;
int GetTextIndex(CDCHandle dc, int iItem, int xPos) const;
int TextHighlightHitTest(int iItem, const POINT& pt);
double GetRelativeTime(int iItem);
std::wstring GetColumnText(int iItem, Column::type column) const;
RECT GetItemRect(int iItem, unsigned code) const;
RECT GetSubItemRect(int iItem, int iSubItem, unsigned code) const;
Expand Down
6 changes: 3 additions & 3 deletions DebugView++/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ bool CMainFrame::LoadSettings()
reg.QueryDWORDValue(L"Y", y) == ERROR_SUCCESS && static_cast<int>(y) >= GetSystemMetrics(SM_YVIRTUALSCREEN) &&
reg.QueryDWORDValue(L"Width", cx) == ERROR_SUCCESS && static_cast<int>(x + cx) <= GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN) &&
reg.QueryDWORDValue(L"Height", cy) == ERROR_SUCCESS && static_cast<int>(y + cy) <= GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN))
SetWindowPos(0, x, y, cx, cy, SWP_NOZORDER);
SetWindowPos(nullptr, x, y, cx, cy, SWP_NOZORDER);

m_linkViews = Win32::RegGetDWORDValue(reg, L"LinkViews", 0) != 0;
m_logSources.SetAutoNewLine(Win32::RegGetDWORDValue(reg, L"AutoNewLine", 1) != 0);
Expand Down Expand Up @@ -1044,7 +1044,7 @@ void CMainFrame::OnFileOpen(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*
L"DebugView++ Log Files (*.dblog)\0*.dblog\0"
L"DebugView Log Files (*.log)\0*.log\0"
L"All Files (*.*)\0*.*\0\0",
0);
nullptr);
dlg.m_ofn.nFilterIndex = 0;
dlg.m_ofn.lpstrTitle = L"Load Log File";
if (dlg.DoModal() == IDOK)
Expand Down Expand Up @@ -1117,7 +1117,7 @@ void CMainFrame::OnFileSaveLog(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndC
CFileDialog dlg(false, L".dblog", m_logFileName.c_str(), OFN_OVERWRITEPROMPT,
L"DebugView++ Log Files (*.dblog)\0*.dblog\0"
L"All Files (*.*)\0*.*\0\0",
0);
nullptr);
dlg.m_ofn.nFilterIndex = 0;
dlg.m_ofn.lpstrTitle = L"Save all messages in memory buffer";
if (dlg.DoModal() == IDOK)
Expand Down
1 change: 0 additions & 1 deletion DebugView++/MainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class CMainFrame : public CTabbedFrameImpl<CMainFrame, CDotNetTabCtrl<SelectedTa
LRESULT OnScRestore(UINT, INT, HWND);
LRESULT OnScClose(UINT, INT, HWND);
LRESULT OnBeginTabDrag(NMHDR* pnmh);
LRESULT OnChangingTab(NMHDR* pnmh);
LRESULT OnChangeTab(NMHDR* pnmh);
LRESULT OnCloseTab(NMHDR* pnmh);
LRESULT OnDeleteTab(NMHDR* pnmh);
Expand Down
2 changes: 1 addition & 1 deletion DebugView++/RenameProcessDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CRenameProcessDlg :
public ExceptionHandler<CRenameProcessDlg, std::exception>
{
public:
CRenameProcessDlg(const std::wstring& name);
explicit CRenameProcessDlg(const std::wstring& name);

enum { IDD = IDD_RENAMEPROCESS };

Expand Down
2 changes: 1 addition & 1 deletion DebugView++/RunDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void CRunDlg::OnBrowse(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/)
CFileDialog dlg(true, L".exe", L"", OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,
L"EXE Files (*.exe)\0*.exe\0"
L"All Files\0*.*\0"
L"\0", 0);
L"\0", nullptr);
dlg.m_ofn.nFilterIndex = 0;
dlg.m_ofn.lpstrTitle = L"Select Executable File";

Expand Down
4 changes: 2 additions & 2 deletions DebugView++Test/DebugView++Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(LineBufferTest1)
FILETIME ft;
ft.dwLowDateTime = 42;
ft.dwHighDateTime = 43;
buffer.Add(42.0, ft, 0, "test", nullptr);
buffer.Add(42.0, ft, nullptr, "test", nullptr);

auto lines = buffer.GetLines();
auto& line = lines[0];
Expand All @@ -292,7 +292,7 @@ BOOST_AUTO_TEST_CASE(LineBufferTest2) // test overflows boosttestui with log-out
FILETIME ft;
ft.dwLowDateTime = 43;
ft.dwHighDateTime = 44;
buffer.Add(42.0, ft, 0, "test", nullptr);
buffer.Add(42.0, ft, nullptr, "test", nullptr);
}

auto lines = buffer.GetLines();
Expand Down

0 comments on commit c8223ac

Please sign in to comment.