lint, docs, remove unused includes

This commit is contained in:
John
2023-10-12 21:29:31 +02:00
parent 4133c67a71
commit 6c66fd553b
6 changed files with 17 additions and 24 deletions
+1 -8
View File
@@ -21,14 +21,7 @@
#endif #endif
#include "ebusd/main.h" #include "ebusd/main.h"
#include <dirent.h> #include <string>
#include <sys/stat.h>
#include <csignal>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <vector>
#include "ebusd/datahandler.h" #include "ebusd/datahandler.h"
#include "lib/utils/log.h" #include "lib/utils/log.h"
#include "lib/utils/arg.h" #include "lib/utils/arg.h"
+1 -1
View File
@@ -26,7 +26,7 @@
namespace ebusd { namespace ebusd {
// copydoc // @copydoc
MqttClient* MqttClient::create(mqtt_client_config_t config, MqttClientListener *listener) { MqttClient* MqttClient::create(mqtt_client_config_t config, MqttClientListener *listener) {
return new MqttClientMosquitto(config, listener); return new MqttClientMosquitto(config, listener);
} }
+2 -2
View File
@@ -91,7 +91,7 @@ class MqttClient {
* @param config the client configuration to use. * @param config the client configuration to use.
* @param listener the client listener to use. * @param listener the client listener to use.
*/ */
MqttClient(mqtt_client_config_t config, MqttClientListener *listener) MqttClient(const mqtt_client_config_t config, MqttClientListener *listener)
: m_config(config), m_listener(listener) {} : m_config(config), m_listener(listener) {}
/** /**
@@ -146,7 +146,7 @@ class MqttClient {
public: public:
/** the client configuration to use. */ /** the client configuration to use. */
mqtt_client_config_t m_config; const mqtt_client_config_t m_config;
/** the @a MqttClientListener instance. */ /** the @a MqttClientListener instance. */
MqttClientListener* m_listener; MqttClientListener* m_listener;
+1 -1
View File
@@ -88,7 +88,7 @@ knx_addr_t parseAddress(const string &str, bool isGroup, bool* error) {
return 0; return 0;
} }
// copydoc // @copydoc
KnxConnection *KnxConnection::create(const char *url) { KnxConnection *KnxConnection::create(const char *url) {
#ifdef HAVE_KNXD #ifdef HAVE_KNXD
if (strchr(url, ':')) { if (strchr(url, ':')) {
+4 -4
View File
@@ -684,12 +684,12 @@ class KnxNetConnection : public KnxConnection {
return nullptr; return nullptr;
} }
// copydoc // @copydoc
knx_addr_t getAddress() const override { knx_addr_t getAddress() const override {
return m_addr; return m_addr;
} }
// copydoc // @copydoc
void setAddress(knx_addr_t address) override { void setAddress(knx_addr_t address) override {
m_addr = address; m_addr = address;
// flush duplication check buffers // flush duplication check buffers
@@ -697,12 +697,12 @@ class KnxNetConnection : public KnxConnection {
m_lastSentFrames.reset(); m_lastSentFrames.reset();
} }
// copydoc // @copydoc
bool isProgrammingMode() const override { bool isProgrammingMode() const override {
return m_programmingMode; return m_programmingMode;
} }
// copydoc // @copydoc
void setProgrammingMode(bool on) override { void setProgrammingMode(bool on) override {
m_programmingMode = on; m_programmingMode = on;
} }
+8 -8
View File
@@ -60,9 +60,9 @@ void buildOpts(const argDef *argDefs, int &count, int &shortCharsCount, int &sho
opt->flag = nullptr; opt->flag = nullptr;
opt->val = argDefIdx; opt->val = argDefIdx;
if (isAlpha(arg->key)) { if (isAlpha(arg->key)) {
shortChars[shortCharsCount] = (char)arg->key; shortChars[shortCharsCount] = static_cast<char>(arg->key);
shortIndexes[shortCharsCount++] = count; shortIndexes[shortCharsCount++] = count;
shortOpts[shortOptsCount++] = (char)arg->key; shortOpts[shortOptsCount++] = static_cast<char>(arg->key);
if (arg->valueName) { if (arg->valueName) {
shortOpts[shortOptsCount++] = ':'; shortOpts[shortOptsCount++] = ':';
if (arg->flags & af_optional) { if (arg->flags & af_optional) {
@@ -100,9 +100,9 @@ int argParse(const argParseOpt *parseOpt, int argc, char **argv, int *argIndex)
calcCounts(child->argDefs, count, shortCharsCount, shortOptsCount); calcCounts(child->argDefs, count, shortCharsCount, shortOptsCount);
} }
struct option *longOpts = (struct option*)calloc(count+1, sizeof(struct option)); // room for EOF struct option *longOpts = (struct option*)calloc(count+1, sizeof(struct option)); // room for EOF
char *shortChars = (char*)calloc(shortCharsCount+1, sizeof(char)); // room for \0 char *shortChars = reinterpret_cast<char*>(calloc(shortCharsCount+1, sizeof(char))); // room for \0
int *shortIndexes = (int*)calloc(shortCharsCount, sizeof(int)); int *shortIndexes = reinterpret_cast<int*>(calloc(shortCharsCount, sizeof(int)));
char *shortOpts = (char*)calloc(2+shortOptsCount+1, sizeof(char)); // room for +, :, and \0 char *shortOpts = reinterpret_cast<char*>(calloc(2+shortOptsCount+1, sizeof(char))); // room for +, :, and \0
count = 0; count = 0;
shortCharsCount = 0; shortCharsCount = 0;
shortOptsCount = 0; shortOptsCount = 0;
@@ -144,7 +144,7 @@ int argParse(const argParseOpt *parseOpt, int argc, char **argv, int *argIndex)
} }
if (isAlpha(c)) { if (isAlpha(c)) {
// short name // short name
int idx = (int)(strchr(shortChars, c) - shortChars); int idx = static_cast<int>(strchr(shortChars, c) - shortChars);
if (idx >= 0 && idx < shortCharsCount) { if (idx >= 0 && idx < shortCharsCount) {
longIdx = shortIndexes[idx]; longIdx = shortIndexes[idx];
} else { } else {
@@ -206,7 +206,7 @@ void wrap(const char* str, size_t pos, size_t indent) {
while (*str && str < end) { while (*str && str < end) {
if (!first) { if (!first) {
if (indent) { if (indent) {
printf("%*c", (int)indent, ' '); printf("%*c", static_cast<int>(indent), ' ');
} }
pos = indent; pos = indent;
} }
@@ -299,7 +299,7 @@ void printArgs(const argDef *argDefs, size_t indent) {
printf(" "); printf(" ");
wrap(arg->help, taken+1, indent); wrap(arg->help, taken+1, indent);
} else { } else {
printf("%*c", (int)(indent - taken), ' '); printf("%*c", static_cast<int>(indent - taken), ' ');
wrap(arg->help, indent, indent); wrap(arg->help, indent, indent);
} }
} }