code style

This commit is contained in:
John
2023-05-18 13:00:12 +02:00
parent 5b53fa313b
commit e606772e9d
8 changed files with 21 additions and 22 deletions
+1 -2
View File
@@ -875,8 +875,7 @@ int main(int argc, char* argv[], char* envp[]) {
s_configPath += "/"; s_configPath += "/";
} }
const string lang = MappedFileReader::normalizeLanguage( const string lang = MappedFileReader::normalizeLanguage(
s_opt.preferLanguage == nullptr || !s_opt.preferLanguage[0] ? "" : s_opt.preferLanguage s_opt.preferLanguage == nullptr || !s_opt.preferLanguage[0] ? "" : s_opt.preferLanguage);
);
string configLocalPrefix, configUriPrefix; string configLocalPrefix, configUriPrefix;
HttpClient* configHttpClient = nullptr; HttpClient* configHttpClient = nullptr;
if (s_configPath.find("://") == string::npos) { if (s_configPath.find("://") == string::npos) {
+5 -5
View File
@@ -21,11 +21,11 @@
#endif #endif
#include "ebusd/mainloop.h" #include "ebusd/mainloop.h"
#include "ebusd/scan.h"
#include <iomanip> #include <iomanip>
#include <deque> #include <deque>
#include <algorithm> #include <algorithm>
#include "ebusd/main.h" #include "ebusd/main.h"
#include "ebusd/scan.h"
#include "lib/utils/log.h" #include "lib/utils/log.h"
#include "lib/ebus/data.h" #include "lib/ebus/data.h"
@@ -106,10 +106,10 @@ result_t UserList::addFromFile(const string& filename, unsigned int lineNo, map<
MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messages, ScanHelper* scanHelper) MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messages, ScanHelper* scanHelper)
: Thread(), m_device(device), m_reconnectCount(0), m_userList(opt.accessLevel), m_messages(messages), m_scanHelper(scanHelper), : Thread(), m_device(device), m_reconnectCount(0), m_userList(opt.accessLevel), m_messages(messages),
m_address(opt.address), m_scanConfig(opt.scanConfig), m_initialScan(opt.readOnly ? ESC : opt.initialScan), m_scanHelper(scanHelper), m_address(opt.address), m_scanConfig(opt.scanConfig),
m_polling(opt.pollInterval > 0), m_enableHex(opt.enableHex), m_shutdown(false), m_runUpdateCheck(opt.updateCheck), m_initialScan(opt.readOnly ? ESC : opt.initialScan), m_polling(opt.pollInterval > 0), m_enableHex(opt.enableHex),
m_httpClient(opt.caFile, opt.caPath) { m_shutdown(false), m_runUpdateCheck(opt.updateCheck), m_httpClient(opt.caFile, opt.caPath) {
m_device->setListener(this); m_device->setListener(this);
// open Device // open Device
result_t result = m_device->open(); result_t result = m_device->open();
+4 -3
View File
@@ -21,7 +21,6 @@
#endif #endif
#include "ebusd/scan.h" #include "ebusd/scan.h"
#include "ebusd/bushandler.h"
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <iostream> #include <iostream>
@@ -30,6 +29,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <functional> #include <functional>
#include "ebusd/bushandler.h"
#include "lib/utils/log.h" #include "lib/utils/log.h"
@@ -133,7 +133,7 @@ result_t ScanHelper::collectConfigFiles(const string& relPath, const string& pre
DataFieldTemplates* ScanHelper::getTemplates(const string& filename) { DataFieldTemplates* ScanHelper::getTemplates(const string& filename) {
if (filename == "*") { if (filename == "*") {
unsigned long maxLength = 0; size_t maxLength = 0;
DataFieldTemplates* best = nullptr; DataFieldTemplates* best = nullptr;
for (auto it : m_templatesByPath) { for (auto it : m_templatesByPath) {
if (it.first.size() > maxLength) { if (it.first.size() > maxLength) {
@@ -478,7 +478,8 @@ result_t ScanHelper::loadScanConfigFile(symbol_t address, string* relativeFile)
return RESULT_OK; return RESULT_OK;
} }
bool ScanHelper::parseMessage(const string& arg, bool onlyMasterSlave, MasterSymbolString* master, SlaveSymbolString* slave) { bool ScanHelper::parseMessage(const string& arg, bool onlyMasterSlave, MasterSymbolString* master,
SlaveSymbolString* slave) {
size_t pos = arg.find_first_of('/'); size_t pos = arg.find_first_of('/');
if (pos == string::npos) { if (pos == string::npos) {
logError(lf_main, "invalid message %s: missing \"/\"", arg.c_str()); logError(lf_main, "invalid message %s: missing \"/\"", arg.c_str());
+1 -1
View File
@@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include <vector>
#include <map> #include <map>
#include "lib/ebus/data.h" #include "lib/ebus/data.h"
#include "lib/ebus/message.h" #include "lib/ebus/message.h"
@@ -40,7 +41,6 @@ class BusHandler;
* Helper class for handling device scanning and config loading. * Helper class for handling device scanning and config loading.
*/ */
class ScanHelper : public Resolver { class ScanHelper : public Resolver {
public: public:
/** /**
* Constructor. * Constructor.
+1 -1
View File
@@ -152,7 +152,7 @@ SSLSocket* SSLSocket::connect(const string& host, const uint16_t& port, bool htt
time_t until = time(nullptr) + (timeout <= 3 ? 3 : timeout); // at least 3 seconds time_t until = time(nullptr) + (timeout <= 3 ? 3 : timeout); // at least 3 seconds
if (!https) { if (!https) {
do { do {
bio = BIO_new_connect((char*)hostPort.c_str()); bio = BIO_new_connect(static_cast<const char*>(hostPort.c_str()));
if (isError("connect", bio)) { if (isError("connect", bio)) {
break; break;
} }
+1 -2
View File
@@ -132,8 +132,7 @@ class HttpClient {
m_caFile(caFile), m_caFile(caFile),
m_caPath(caPath), m_caPath(caPath),
#endif #endif
m_socket(nullptr), m_port(0), m_timeout(0), m_bufferSize(0), m_buffer(nullptr) m_socket(nullptr), m_port(0), m_timeout(0), m_bufferSize(0), m_buffer(nullptr) {
{
if (init) { if (init) {
initialize(); initialize();
} }