- forgotten fixes from March

This commit is contained in:
Dmytro Bogovych 2020-05-05 12:34:52 +03:00
parent 762eb9ca33
commit 0d69c26a13
7 changed files with 233 additions and 212 deletions

View File

@ -1,6 +1,7 @@
#include "HL_CrashRpt.h"
#if defined(USE_CRASHRPT)
#include "HL_CrashRpt.h"
#include "HL_String.h"
@ -171,4 +172,22 @@ CrashReporterGuard::~CrashReporterGuard()
CrashReporter::free();
}
#else
CrashReporterThreadPoint::CrashReporterThreadPoint()
{
}
CrashReporterThreadPoint::~CrashReporterThreadPoint()
{
}
CrashReporterGuard::CrashReporterGuard()
{
}
CrashReporterGuard::~CrashReporterGuard()
{
}
#endif

View File

@ -20,6 +20,9 @@ bool CsvReader::readLine(std::vector<std::string>& cells)
std::string line;
if (!std::getline(mInputStream, line))
return false;
StringHelper::trim(line);
if (line.empty())
return false;
StringHelper::split(line, cells, ",;");
return true;

View File

@ -202,7 +202,6 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
std::string OsProcess::execCommand(const std::string& cmd)
{
std::string cp = cmd;
std::shared_ptr<FILE> pipe(popen(cp.c_str(), "r"), pclose);
if (!pipe)
throw std::runtime_error("Failed to run.");

View File

@ -276,8 +276,8 @@ float StringHelper::toFloat(const std::string &s, float v, bool* isOk)
std::string StringHelper::trim(const std::string &s)
{
auto wsfront = std::find_if_not(s.begin(), s.end(), [](int c) { return std::isspace(c); });
auto wsback = std::find_if_not(s.rbegin(), s.rend(), [](int c) { return std::isspace(c); }).base();
auto wsfront = std::find_if_not(s.begin(), s.end(), [](int c) { return std::isspace(c) || c == '\r' || c == '\n'; });
auto wsback = std::find_if_not(s.rbegin(), s.rend(), [](int c) { return std::isspace(c) || c == '\r' || c == '\n'; }).base();
return (wsback <= wsfront ? std::string() : std::string(wsfront,wsback));
}