get rid of piForeach

apply some code analyzer recommendations
ICU flag now check if libicu exists
prepare for more accurate growth of containers (limited PoT, then constantly increase size)
This commit is contained in:
2024-11-20 20:01:47 +03:00
parent 24112498ce
commit caa7880cc4
40 changed files with 415 additions and 320 deletions

View File

@@ -229,7 +229,7 @@ PIString PIEthernet::macFromBytes(const PIByteArray & mac) {
PIByteArray PIEthernet::macToBytes(const PIString & mac) {
PIByteArray r;
PIStringList sl = mac.split(PIStringAscii(":"));
piForeachC(PIString & i, sl)
for (const auto & i: sl)
r << uchar(i.toInt(16));
return r;
}
@@ -997,7 +997,7 @@ PIString PIEthernet::constructFullPathDevice() const {
ret += ":" + readIP() + ":" + PIString::fromNumber(readPort());
if (type() == PIEthernet::UDP) {
ret += ":" + sendIP() + ":" + PIString::fromNumber(sendPort());
piForeachC(PIString & m, multicastGroups())
for (const auto & m: multicastGroups())
ret += ":mcast:" + m;
}
return ret;
@@ -1067,7 +1067,7 @@ void PIEthernet::configureFromVariantDevice(const PIPropertyStorage & d) {
setSendIP(d.propertyValueByName("send IP").toString());
setSendPort(d.propertyValueByName("send port").toInt());
PIStringList mcgl = d.propertyValueByName("multicast").toStringList();
piForeachC(PIString & g, mcgl) {
for (const auto & g: mcgl) {
joinMulticastGroup(g);
}
}
@@ -1260,8 +1260,8 @@ PIVector<PINetworkAddress> PIEthernet::allAddresses() {
PIEthernet::InterfaceList il = interfaces();
PIVector<PINetworkAddress> ret;
bool has_127 = false;
piForeachC(PIEthernet::Interface & i, il) {
if (i.address == "127.0.0.1") has_127 = true;
for (const auto & i: il) {
if (i.address.startsWith("127.0.0.")) has_127 = true;
PINetworkAddress a(i.address);
if (a.ip() == 0) continue;
ret << a;