Code cleanups.

This commit is contained in:
Jonathan Naylor 2018-09-10 09:11:57 +01:00
parent ad31455d8f
commit b1197eef49
3 changed files with 14 additions and 14 deletions

View file

@ -92,9 +92,9 @@ bool CConf::read()
char* value = ::strtok(NULL, "\r\n");
if (section == SECTION_GENERAL) {
if (::strcmp(key, "Callsign") == 0) {
for (int i=0; value[i]; i++) {
if (!isspace(value[i]))
m_callsign.insert(m_callsign.end(),1, value[i]);
for (unsigned int i = 0U; value[i] != '\0'; i++) {
if (!::isspace(value[i]))
m_callsign.insert(m_callsign.end(), 1, value[i]);
}
}
else if (::strcmp(key, "WhiteList") == 0) {
@ -130,9 +130,9 @@ bool CConf::read()
else if (::strcmp(key, "Port") == 0)
m_dapnetPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "AuthKey") == 0) {
for (int i=0; value[i]; i++) {
if (!isspace(value[i]))
m_dapnetAuthKey.insert(m_dapnetAuthKey.end(),1, value[i]);
for (unsigned int i = 0U; value[i] != '\0'; i++) {
if (!::isspace(value[i]))
m_dapnetAuthKey.insert(m_dapnetAuthKey.end(), 1, value[i]);
}
}
else if (::strcmp(key, "Debug") == 0)
@ -147,7 +147,7 @@ bool CConf::read()
std::string CConf::getCallsign() const
{
return m_callsign;
return m_callsign;
}
std::vector<uint32_t> CConf::getWhiteList() const
@ -192,12 +192,12 @@ unsigned int CConf::getLogFileLevel() const
std::string CConf::getLogFilePath() const
{
return m_logFilePath;
return m_logFilePath;
}
std::string CConf::getLogFileRoot() const
{
return m_logFileRoot;
return m_logFileRoot;
}
std::string CConf::getDAPNETAddress() const
@ -219,4 +219,3 @@ bool CConf::getDAPNETDebug() const
{
return m_dapnetDebug;
}

View file

@ -189,7 +189,7 @@ int CDAPNETGateway::run()
#if !defined(_WIN32) && !defined(_WIN64)
// In daemon mode there must be no output as STDOUT will be closed
if (m_daemon)
displayLevel = 0;
displayLevel = 0U;
#endif
ret = ::LogInitialise(m_conf.getLogFilePath(), m_conf.getLogFileRoot(), m_conf.getLogFileLevel(), displayLevel);

View file

@ -21,6 +21,8 @@
#include "Utils.h"
#include "Log.h"
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <cstring>
@ -58,10 +60,9 @@ bool CDAPNETNetwork::login()
{
LogMessage("Logging into DAPNET");
std::transform(m_callsign.begin(), m_callsign.end(), m_callsign.begin(), ::tolower);
char login[200U];
for(unsigned int i = 0; i < m_callsign.length(); ++i) {
m_callsign[i] = tolower(m_callsign[i]);
}
::snprintf(login, 200, "[MMDVM v%s %s %s]\r\n", m_version, m_callsign.c_str(), m_authKey.c_str());
return write((unsigned char*)login);