Linux cleanups.

This commit is contained in:
Jonathan Naylor
2025-03-17 14:29:13 +00:00
parent 4ff688045f
commit a2e2ea3675
2 changed files with 12 additions and 12 deletions

View File

@@ -252,22 +252,22 @@ bool CConf::read()
if (value == nullptr)
continue;
// Remove quotes from the value
size_t len = ::strlen(value);
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
value[len - 1U] = '\0';
value++;
} else {
char *p;
// Remove quotes from the value
size_t len = ::strlen(value);
if (len > 1U && *value == '"' && value[len - 1U] == '"') {
value[len - 1U] = '\0';
value++;
} else {
char *p;
// if value is not quoted, remove after # (to make comment)
if ((p = strchr(value, '#')) != nullptr)
*p = '\0';
// remove trailing tab/space
for (p = value + strlen(value) - 1U; p >= value && (*p == '\t' || *p == ' '); p--)
*p = '\0';
}
// remove trailing tab/space
for (p = value + strlen(value) - 1U; p >= value && (*p == '\t' || *p == ' '); p--)
*p = '\0';
}
if (section == SECTION::GENERAL) {
if (::strcmp(key, "Daemon") == 0)

View File

@@ -49,7 +49,7 @@ CMQTTConnection::~CMQTTConnection()
bool CMQTTConnection::open()
{
char name[50U];
::sprintf(name, "DMRGateway.%lld", ::time(nullptr));
::sprintf(name, "DMRGateway.%ld", ::time(nullptr));
::fprintf(stdout, "DMRGateway (%s) connecting to MQTT as %s\n", m_name.c_str(), name);