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
#include "ebusd/main.h"
#include <dirent.h>
#include <sys/stat.h>
#include <csignal>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <vector>
#include <string>
#include "ebusd/datahandler.h"
#include "lib/utils/log.h"
#include "lib/utils/arg.h"
+1 -1
View File
@@ -26,7 +26,7 @@
namespace ebusd {
// copydoc
// @copydoc
MqttClient* MqttClient::create(mqtt_client_config_t config, MqttClientListener *listener) {
return new MqttClientMosquitto(config, listener);
}
+2 -2
View File
@@ -91,7 +91,7 @@ class MqttClient {
* @param config the client configuration 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) {}
/**
@@ -146,7 +146,7 @@ class MqttClient {
public:
/** the client configuration to use. */
mqtt_client_config_t m_config;
const mqtt_client_config_t m_config;
/** the @a MqttClientListener instance. */
MqttClientListener* m_listener;
+1 -1
View File
@@ -88,7 +88,7 @@ knx_addr_t parseAddress(const string &str, bool isGroup, bool* error) {
return 0;
}
// copydoc
// @copydoc
KnxConnection *KnxConnection::create(const char *url) {
#ifdef HAVE_KNXD
if (strchr(url, ':')) {
+4 -4
View File
@@ -684,12 +684,12 @@ class KnxNetConnection : public KnxConnection {
return nullptr;
}
// copydoc
// @copydoc
knx_addr_t getAddress() const override {
return m_addr;
}
// copydoc
// @copydoc
void setAddress(knx_addr_t address) override {
m_addr = address;
// flush duplication check buffers
@@ -697,12 +697,12 @@ class KnxNetConnection : public KnxConnection {
m_lastSentFrames.reset();
}
// copydoc
// @copydoc
bool isProgrammingMode() const override {
return m_programmingMode;
}
// copydoc
// @copydoc
void setProgrammingMode(bool on) override {
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->val = argDefIdx;
if (isAlpha(arg->key)) {
shortChars[shortCharsCount] = (char)arg->key;
shortChars[shortCharsCount] = static_cast<char>(arg->key);
shortIndexes[shortCharsCount++] = count;
shortOpts[shortOptsCount++] = (char)arg->key;
shortOpts[shortOptsCount++] = static_cast<char>(arg->key);
if (arg->valueName) {
shortOpts[shortOptsCount++] = ':';
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);
}
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
int *shortIndexes = (int*)calloc(shortCharsCount, sizeof(int));
char *shortOpts = (char*)calloc(2+shortOptsCount+1, sizeof(char)); // room for +, :, and \0
char *shortChars = reinterpret_cast<char*>(calloc(shortCharsCount+1, sizeof(char))); // room for \0
int *shortIndexes = reinterpret_cast<int*>(calloc(shortCharsCount, sizeof(int)));
char *shortOpts = reinterpret_cast<char*>(calloc(2+shortOptsCount+1, sizeof(char))); // room for +, :, and \0
count = 0;
shortCharsCount = 0;
shortOptsCount = 0;
@@ -144,7 +144,7 @@ int argParse(const argParseOpt *parseOpt, int argc, char **argv, int *argIndex)
}
if (isAlpha(c)) {
// short name
int idx = (int)(strchr(shortChars, c) - shortChars);
int idx = static_cast<int>(strchr(shortChars, c) - shortChars);
if (idx >= 0 && idx < shortCharsCount) {
longIdx = shortIndexes[idx];
} else {
@@ -206,7 +206,7 @@ void wrap(const char* str, size_t pos, size_t indent) {
while (*str && str < end) {
if (!first) {
if (indent) {
printf("%*c", (int)indent, ' ');
printf("%*c", static_cast<int>(indent), ' ');
}
pos = indent;
}
@@ -299,7 +299,7 @@ void printArgs(const argDef *argDefs, size_t indent) {
printf(" ");
wrap(arg->help, taken+1, indent);
} else {
printf("%*c", (int)(indent - taken), ' ');
printf("%*c", static_cast<int>(indent - taken), ' ');
wrap(arg->help, indent, indent);
}
}