Skip to content

Commit

Permalink
a few clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janwilmans committed Jul 23, 2019
1 parent a2357d2 commit 8a7ab37
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DebugView++Lib/DbgviewReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace Magic
const int Unknown5 = Base + 0x30;
const int ForceCarriageReturnsEnable = Base + 0x34;
const int ForceCarriageReturnsDisable = Base + 0x38;
};
} // Magic

template <typename T>
std::string ToHex(const T& s)
Expand Down
2 changes: 1 addition & 1 deletion DebugView++Lib/FileIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void OpenLogFile(std::ofstream& ofstream, const std::wstring& filename, OpenMode
}
}

std::string GetOffsetText(double time)
std::string GetOffsetText(double time) // todo: use libfmt ? consider speed here, so maybe not ?
{
char buf[32];
sprintf_s(buf, "%.06f", time);
Expand Down
8 changes: 2 additions & 6 deletions DebugView++Lib/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ std::string MatchKey(const std::smatch& match, MatchType::type matchType)
}
return key;
}
else
{
return boost::to_lower_copy(match.str());
}
return boost::to_lower_copy(match.str());
}

Filter::Filter() :
Expand All @@ -49,8 +46,7 @@ std::regex_constants::syntax_option_type MakeSot(MatchType::type matchType)
{
if (matchType == MatchType::RegexCase)
return std::regex_constants::optimize;
else
return std::regex_constants::icase | std::regex_constants::optimize;
return std::regex_constants::icase | std::regex_constants::optimize;
}

Filter::Filter(const std::string& text, MatchType::type matchType, FilterType::type filterType, COLORREF bgColor, COLORREF fgColor, bool enable, bool matched) :
Expand Down
2 changes: 1 addition & 1 deletion DebugView++Lib/LogFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void LogFile::Clear()
void LogFile::Add(const Message& msg)
{
auto props = m_processInfo.GetProcessProperties(msg.processId, WStr(msg.processName).str());
m_messages.push_back(InternalMessage(msg.time, msg.systemTime, props.uid));
m_messages.emplace_back(InternalMessage(msg.time, msg.systemTime, props.uid));
m_storage.Add(msg.text);
}

Expand Down
8 changes: 4 additions & 4 deletions DebugView++Lib/PolledLogSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,26 @@ void PolledLogSource::Poll()
void PolledLogSource::AddMessage(Win32::Handle handle, const std::string& message)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_lines.push_back(PollLine(std::move(handle), message, this));
m_lines.emplace_back(PollLine(std::move(handle), message, this));
}

void PolledLogSource::AddMessage(DWORD pid, const std::string& processName, const std::string& message)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_lines.push_back(PollLine(pid, processName, message, this));
m_lines.emplace_back(PollLine(pid, processName, message, this));
}

void PolledLogSource::AddMessage(const std::string& message)
{
std::lock_guard<std::mutex> lock(m_mutex);
std::string msg = message;
m_lines.push_back(PollLine(0, "[internal]", msg, this));
m_lines.emplace_back(PollLine(0, "[internal]", msg, this));
}

void PolledLogSource::AddMessage(double time, FILETIME systemTime, DWORD pid, const std::string& processName, const std::string& message)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_lines.push_back(PollLine(time, systemTime, pid, processName, message, this));
m_lines.emplace_back(PollLine(time, systemTime, pid, processName, message, this));
}

void PolledLogSource::Signal()
Expand Down
1 change: 1 addition & 0 deletions DebugView++Lib/ProcessInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ std::wstring ProcessInfo::GetProcessName(HANDLE handle)
if (rc == 0)
return L"";

// todo: make function? what does this do? (jan)
const wchar_t* name = buf.data();
for (auto it = buf.data(); *it; ++it)
{
Expand Down
2 changes: 1 addition & 1 deletion DebugView++Lib/ProcessMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void ProcessMonitor::Add(DWORD pid, HANDLE handle)
{
m_q.Push([this, pid, handle]
{
m_processes.push_back(ProcessMonitor::ProcessInfo(pid, handle));
m_processes.emplace_back(ProcessMonitor::ProcessInfo(pid, handle));
});
Win32::SetEvent(m_event);
}
Expand Down
4 changes: 1 addition & 3 deletions DebugView++Lib/ProcessReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ ProcessReader::ProcessReader(Timer& timer, ILineBuffer& linebuffer, const std::w
StartThread();
}

ProcessReader::~ProcessReader()
{
}
ProcessReader::~ProcessReader() = default;

void ProcessReader::Abort()
{
Expand Down
2 changes: 1 addition & 1 deletion include/DebugView++Lib/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct LogFilter
void SaveFilterSettings(const std::vector<Filter>& filters, CRegKey& reg);
void LoadFilterSettings(std::vector<Filter>& filters, CRegKey& reg);

bool IsIncluded(std::vector<Filter>& filters, const std::string& message, MatchColors& matchColors);
bool IsIncluded(std::vector<Filter>& filters, const std::string& text, MatchColors& matchColors);
bool MatchFilterType(const std::vector<Filter>& filters, FilterType::type type, const std::string& text);

std::string MatchKey(const std::smatch& match, MatchType::type matchType);
Expand Down

0 comments on commit 8a7ab37

Please sign in to comment.