formatting, remove unused

This commit is contained in:
john30
2022-09-17 23:57:24 +02:00
parent bb6a05190e
commit ce6ea68f22
20 changed files with 199 additions and 179 deletions
+1 -1
View File
@@ -1011,7 +1011,7 @@ result_t NumberDataType::getRawValueFromFloat(float val, unsigned int* output) c
} else {
if (m_divisor == 1) {
if (hasFlag(SIG)) {
long signedValue = static_cast<long>(val); // TODO static_c?
long signedValue = static_cast<long>(val); // TODO static_c?
if (signedValue < 0 && m_bitCount != 32) {
value = (unsigned int)(signedValue + (1 << m_bitCount));
} else {
+9 -8
View File
@@ -465,7 +465,8 @@ bool Device::available() {
ch = m_buffer[(pos+m_bufPos+1)%m_bufSize];
if (!(ch&ENH_BYTE_FLAG) || (ch&ENH_BYTE_MASK) != ENH_BYTE2) {
#ifdef DEBUG_RAW_TRAFFIC
fprintf(stdout, "raw avail enhanced following bad @%d+%d %2.2x %2.2x\n", m_bufPos, pos, m_buffer[(pos+m_bufPos)%m_bufSize], ch);
fprintf(stdout, "raw avail enhanced following bad @%d+%d %2.2x %2.2x\n", m_bufPos, pos,
m_buffer[(pos+m_bufPos)%m_bufSize], ch);
fflush(stdout);
#endif
if (m_listener != nullptr) {
@@ -654,17 +655,17 @@ bool Device::read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrati
ostringstream stream;
switch ((m_infoLen << 8) | m_infoId) {
case 0x0200:
case 0x0500: // with firmware version and jumper info
case 0x0800: // with firmware version, jumper info, and bootloader version
stream << "firmware " << static_cast<unsigned>(m_infoBuf[0]) << "." // version minor
<< std::hex << static_cast<unsigned>(m_infoBuf[1]); // features mask
if (m_infoLen>=5) {
case 0x0500: // with firmware version and jumper info
case 0x0800: // with firmware version, jumper info, and bootloader version
stream << "firmware " << static_cast<unsigned>(m_infoBuf[0]) << "." // version minor
<< std::hex << static_cast<unsigned>(m_infoBuf[1]); // features mask
if (m_infoLen >= 5) {
stream << " [" << std::setfill('0') << std::setw(2) << std::hex << static_cast<unsigned>(m_infoBuf[2])
<< std::setw(2) << static_cast<unsigned>(m_infoBuf[3]) << "]";
stream << ", jumpers 0x" << std::setw(2) << static_cast<unsigned>(m_infoBuf[4]);
stream << std::setfill(' '); // reset
}
if (m_infoLen>=8) {
if (m_infoLen >= 8) {
stream << ", bootloader " << std::dec << static_cast<unsigned>(m_infoBuf[5]);
stream << " [" << std::setfill('0') << std::setw(2) << std::hex << static_cast<unsigned>(m_infoBuf[6])
<< std::setw(2) << static_cast<unsigned>(m_infoBuf[7]) << "]";
@@ -677,7 +678,7 @@ bool Device::read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrati
for (uint8_t pos = 0; pos < m_infoPos; pos++) {
stream << " " << std::setw(2) << static_cast<unsigned>(m_infoBuf[pos]);
}
if (m_infoId == 2 && (m_infoBuf[2]&0x3f)!=0x3f) {
if (m_infoId == 2 && (m_infoBuf[2]&0x3f) != 0x3f) {
// non-default arbitration delay
val = (m_infoBuf[2]&0x3f)*10; // steps of 10us
stream << ", arbitration delay " << std::dec << static_cast<unsigned>(val) << " us";
+2 -1
View File
@@ -352,7 +352,8 @@ class SerialDevice : public Device {
*/
SerialDevice(const char* name, bool checkDevice, unsigned int extraLatency, bool readOnly, bool initialSend,
bool enhancedProto = false, bool enhancedHighSpeed = false)
: Device(name, checkDevice, extraLatency, readOnly, initialSend, enhancedProto), m_enhancedHighSpeed(enhancedHighSpeed) {
: Device(name, checkDevice, extraLatency, readOnly, initialSend, enhancedProto),
m_enhancedHighSpeed(enhancedHighSpeed) {
}
// @copydoc
+5 -2
View File
@@ -22,6 +22,7 @@
#include "lib/ebus/stringhelper.h"
#include <algorithm>
#include <stack>
namespace ebusd {
@@ -296,7 +297,8 @@ bool StringReplacer::checkMatchability() const {
return true;
}
ssize_t StringReplacer::match(const string& str, string* circuit, string* name, string* field, const string& separator) const {
ssize_t StringReplacer::match(const string& str, string* circuit, string* name, string* field,
const string& separator) const {
size_t last = 0;
size_t count = m_parts.size();
size_t idx;
@@ -442,7 +444,8 @@ StringReplacer StringReplacers::get(const string& key) const {
return StringReplacer();
}
string StringReplacers::get(const string& key, bool untilFirstEmpty, bool onlyAlphanum, const string& fallbackKey) const {
string StringReplacers::get(const string& key, bool untilFirstEmpty, bool onlyAlphanum,
const string& fallbackKey) const {
auto itc = m_constants.find(key);
if (itc != m_constants.end()) {
return itc->second;
+3 -2
View File
@@ -24,6 +24,7 @@
#include <map>
#include <string>
#include <sstream>
#include <utility>
#include <vector>
#include "lib/ebus/message.h"
@@ -34,6 +35,7 @@ namespace ebusd {
*/
using std::map;
using std::pair;
using std::ostringstream;
using std::string;
using std::vector;
@@ -172,7 +174,7 @@ class StringReplacer {
* @param isField true when it is a field.
* @return the created pair.
*/
static std::pair<string, int> makeField(const string& name, bool isField);
static pair<string, int> makeField(const string& name, bool isField);
/**
* Add a part to the list of parts.
@@ -180,7 +182,6 @@ class StringReplacer {
* @param inField 1 after '%', 2 after '%{', 0 otherwise.
*/
void addPart(ostringstream& stack, int inField);
};