apply some code analyzer recommendations

This commit is contained in:
2024-11-20 20:01:58 +03:00
parent b65bf5e640
commit a3e88f792d
8 changed files with 24 additions and 38 deletions

View File

@@ -112,7 +112,7 @@ void CDCore::cd_read(CDSection * cd, PIIODevice * d) {
initRoot(cd);
raiseChangedGlobal(cd->cd_type_);
/*PIVector<PIIODevice * > ds = connection.allDevices();
piForeach(PIIODevice * d, ds) {
for (PIIODevice * d: ds) {
if (d)
piCoutObj << d->constructFullPath() << d->isOpened();
}*/
@@ -377,7 +377,7 @@ void CDCore::xTimerTick() {
} else {
ba = makeHeader(CD_XValues, 0);
ba << x_selected;
piForeachC(PIDeque<int> & p, x_selected) {
for (const auto & p: x_selected) {
x_[p].writeX(ba);
}
// piCout << "x app" << x_selected.size();
@@ -471,7 +471,7 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
ba >> x_selected;
// piCout << "X req" << x_selected.size();
x_.setSelectedX(false);
piForeachC(PIDeque<int> & p, x_selected) {
for (const auto & p: x_selected) {
x_[p].x_enabled = true;
}
x_mutex.unlock();
@@ -481,7 +481,7 @@ void CDCore::procReceivedPacket(PIByteArray & ba) {
PIVector<PIDeque<int>> x_vals;
ba >> x_vals;
x_mutex.lock();
piForeachC(PIDeque<int> & p, x_vals) {
for (const auto & p: x_vals) {
x_[p].readX(ba);
}
x_mutex.unlock();
@@ -558,7 +558,7 @@ PIString CDCore::pathToString(const PIDeque<int> & p) {
PIDeque<int> CDCore::stringToPath(const PIString & p) {
PIDeque<int> ret;
PIStringList sl = p.split(".");
piForeachC(PIString & s, sl)
for (const auto & s: sl)
ret << s.toInt();
return ret;
}
@@ -568,7 +568,7 @@ void CDUtils::CDCore::dataReceived(const PIString & from, const PIByteArray & da
// piCoutObj << "dataReceived" << from << data.size();
PIIODevice * d = connection.deviceByName("cd");
if (d && d == connection.deviceByFullPath(from)) {
if (data.size() >= sizeof(4)) {
if (data.size() >= sizeof(int)) {
PIByteArray ba = data;
uchar header = ba.take_front();
if (header == header_transfer) {