Skip to content

Commit bb642cc

Browse files
committed
re-ran clang-tidy and clang-format
1 parent 84f7638 commit bb642cc

30 files changed

+610
-200
lines changed

CobaltFusion/Throttle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace fusion {
1616
using namespace std::chrono_literals;
1717

1818
Throttle::Throttle(IExecutor& executor, int callsPerSecond, std::function<void()> fn) :
19-
m_delta(std::chrono::milliseconds(1000 / callsPerSecond)),
19+
m_delta(1000ms / callsPerSecond),
2020
m_callPending(false),
2121
m_fn(std::move(fn)),
2222
m_executor(executor)

DebugView++/AboutDlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BOOL CAboutDlg::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
2020
CenterWindow(GetParent());
2121
m_srclink.SubclassWindow(GetDlgItem(IDC_DEBUGVIEW_SRC_URL));
2222
m_link.SubclassWindow(GetDlgItem(IDC_DEBUGVIEW_URL));
23-
int version[4] = {VERSION};
23+
std::array<int, 4> version = {VERSION};
2424
SetDlgItemText(IDC_VERSION, WStr(wstringbuilder() << L"DebugView++ V" << version[0] << L"." << version[1] << L"." << version[2] << L"." << version[3]));
2525
SetDlgItemText(IDC_DATE, _T(__DATE__));
2626
return TRUE;

DebugView++/CLogViewTabItem2.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ void Add(const ViewPort& viewport, gdi::Line& line, gdi::Artifact a)
4141
std::wstring FormatDuration(Duration d)
4242
{
4343
if (d >= 1s)
44+
{
4445
return wstringbuilder() << d.count() / 1e9 << L" s";
46+
}
4547
if (d >= 1ms)
48+
{
4649
return wstringbuilder() << d.count() / 1e6 << L" ms";
50+
}
4751
if (d >= 1us)
52+
{
4853
return wstringbuilder() << d.count() / 1e3 << L" us";
54+
}
4955
return wstringbuilder() << d.count() << L" ns";
5056
}
5157

@@ -103,19 +109,27 @@ Duration Increase(Duration d)
103109
{
104110
Duration temp = d;
105111
while (temp > 10ns)
112+
{
106113
temp /= 10;
114+
}
107115
if (temp == 2ns)
116+
{
108117
return (d * 2) + (d / 2);
118+
}
109119
return d * 2;
110120
}
111121

112122
Duration Decrease(Duration d)
113123
{
114124
Duration temp = d;
115125
while (temp > 10ns)
126+
{
116127
temp /= 10;
128+
}
117129
if (temp == 5ns)
130+
{
118131
return (d - (d / 5)) / 2;
132+
}
119133
return std::max(1ns, d / 2);
120134
}
121135

DebugView++/CLogViewTabItem2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ using Duration = std::chrono::steady_clock::duration;
6363
class ViewPort
6464
{
6565
public:
66-
ViewPort() {}
66+
ViewPort() = default;
6767
ViewPort(TimePoint begin, TimePoint end, Duration timeUnitPerPixel);
6868
bool Contains(TimePoint p) const;
6969
gdi::Pixel ToPx(TimePoint p) const;
@@ -88,7 +88,7 @@ class ViewPort
8888
class CLogViewTabItem2 : public CTabViewTabItem
8989
{
9090
public:
91-
~CLogViewTabItem2();
91+
~CLogViewTabItem2() override;
9292
void SetView(std::shared_ptr<CLogView> pView);
9393
CLogView& GetView();
9494

DebugView++/DebugView++.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class CAppModuleInitialization
3535
{
3636
HRESULT hr = m_module.Init(nullptr, hInstance);
3737
if (FAILED(hr))
38+
{
3839
Win32::ThrowWin32Error(hr, "CAppModule::Init");
40+
}
3941
}
4042

4143
~CAppModuleInitialization()
@@ -110,16 +112,19 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
110112
CAppModuleInitialization moduleInit(_Module, hInstance);
111113

112114
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
113-
HANDLE hFile = nullptr, hPipe = nullptr;
115+
HANDLE hFile = nullptr;
116+
HANDLE hPipe = nullptr;
114117
switch (GetFileType(hStdIn))
115118
{
116119
case FILE_TYPE_DISK: hFile = hStdIn; break;
117120
case FILE_TYPE_PIPE: hPipe = hStdIn; break;
118121
default: break;
119122
}
120123

121-
if (hPipe && IsDBWinViewerActive())
124+
if ((hPipe != nullptr) && IsDBWinViewerActive())
125+
{
122126
return ForwardMessagesFromPipe(hPipe);
127+
}
123128

124129
CMainFrame wndMain;
125130
MessageLoop theLoop(_Module);
@@ -141,23 +146,35 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
141146
else if (args[i][0] != '/')
142147
{
143148
if (!fileName.empty())
149+
{
144150
throw std::runtime_error("multiple filenames specified on commandline");
151+
}
145152
fileName = args[i];
146153
}
147154
}
148155

149156
if (wndMain.CreateEx() == nullptr)
157+
{
150158
Win32::ThrowLastError(L"Main window creation failed!");
159+
}
151160

152161
wndMain.ShowWindow(cmdShow);
153162
if (boost::algorithm::iends_with(fileName, ".dbconf"))
163+
{
154164
wndMain.LoadConfiguration(fileName);
165+
}
155166
else if (!fileName.empty())
167+
{
156168
wndMain.Load(fileName, false);
157-
else if (hFile)
169+
}
170+
else if (hFile != nullptr)
171+
{
158172
wndMain.Load(hFile);
159-
else if (hPipe)
173+
}
174+
else if (hPipe != nullptr)
175+
{
160176
wndMain.CapturePipe(hPipe);
177+
}
161178

162179
return theLoop.Run();
163180
}

DebugView++/DropTargetSupport.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace debugviewpp {
1818
* https://www.codeproject.com/Articles/840/How-to-Implement-Drag-and-Drop-Between-Your-Progra
1919
*/
2020

21-
DropTargetSupport::DropTargetSupport() :
22-
m_hwnd(nullptr)
21+
DropTargetSupport::DropTargetSupport()
22+
2323
{
2424
}
2525

@@ -39,7 +39,7 @@ bool QueryDataObject(IDataObject* pDataObject, CLIPFORMAT format)
3939
FORMATETC fmtetc = {format, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
4040

4141
// does the data object support CF_TEXT using a HGLOBAL?
42-
return pDataObject->QueryGetData(&fmtetc) == S_OK ? true : false;
42+
return pDataObject->QueryGetData(&fmtetc) == S_OK;
4343
}
4444

4545
STDMETHODIMP DropTargetSupport::DragEnter(IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL /*pt*/, DWORD* pdwEffect)
@@ -98,7 +98,9 @@ std::wstring GetCF_HDROP(IDataObject* pDataObject)
9898
{
9999
std::vector<wchar_t> filename(DragQueryFile(hDropInfo, 0, nullptr, 0) + 1);
100100
if (DragQueryFile(hDropInfo, 0, filename.data(), static_cast<UINT>(filename.size())))
101+
{
101102
result = std::wstring(filename.data());
103+
}
102104
}
103105
GlobalUnlock(stgmed.hGlobal);
104106

DebugView++/DropTargetSupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class ATL_NO_VTABLE DropTargetSupport : public CComObjectRootEx<CComSingleThread
3434
STDMETHOD(Drop)
3535
(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override;
3636

37-
typedef boost::signals2::signal<void(const std::wstring& uri)> DroppedSignal;
37+
using DroppedSignal = boost::signals2::signal<void(const std::wstring&)>;
3838
boost::signals2::connection SubscribeToDropped(DroppedSignal::slot_type slot);
3939

4040
private:
41-
HWND m_hwnd;
41+
HWND m_hwnd = nullptr;
4242
DroppedSignal m_onDropped;
4343
};
4444

0 commit comments

Comments
 (0)