Make some functions const

This commit is contained in:
badaix 2020-03-25 08:37:18 +01:00
parent a8d1769ca7
commit d52b5f1e6a
2 changed files with 5 additions and 4 deletions

View file

@ -44,14 +44,14 @@ ProcessStream::ProcessStream(PcmListener* pcmListener, boost::asio::io_context&
} }
bool ProcessStream::fileExists(const std::string& filename) bool ProcessStream::fileExists(const std::string& filename) const
{ {
struct stat buffer; struct stat buffer;
return (stat(filename.c_str(), &buffer) == 0); return (stat(filename.c_str(), &buffer) == 0);
} }
std::string ProcessStream::findExe(const std::string& filename) std::string ProcessStream::findExe(const std::string& filename) const
{ {
/// check if filename exists /// check if filename exists
if (fileExists(filename)) if (fileExists(filename))

View file

@ -22,6 +22,7 @@
#include <boost/process.hpp> #include <boost/process.hpp>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
#include "posix_stream.hpp" #include "posix_stream.hpp"
#include "watchdog.hpp" #include "watchdog.hpp"
@ -66,8 +67,8 @@ protected:
virtual void onStderrMsg(const std::string& line); virtual void onStderrMsg(const std::string& line);
virtual void initExeAndPath(const std::string& filename); virtual void initExeAndPath(const std::string& filename);
bool fileExists(const std::string& filename); bool fileExists(const std::string& filename) const;
std::string findExe(const std::string& filename); std::string findExe(const std::string& filename) const;
size_t wd_timeout_sec_; size_t wd_timeout_sec_;
std::unique_ptr<Watchdog> watchdog_; std::unique_ptr<Watchdog> watchdog_;