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:
@@ -457,7 +457,7 @@ void PIPluginLoader::mergeStatic() {
|
||||
PIStringList PIPluginLoader::pluginsDirectories(const PIString & name) {
|
||||
static PIStringList dl({".", "./plugins", "../PlugIns"});
|
||||
PIString ret;
|
||||
piForeachC(PIString d, dl) {
|
||||
for (const auto & d: dl) {
|
||||
PIString dp = d + "/" + name;
|
||||
if (PIDir::isExists(dp)) ret += dp;
|
||||
}
|
||||
@@ -470,8 +470,8 @@ PIString PIPluginLoader::findLibrary(const PIString & path) {
|
||||
static const PIStringList suffixes({"", libExtension()});
|
||||
PIFile::FileInfo fi(path);
|
||||
PIString dir = fi.dir(), name = fi.name();
|
||||
piForeachC(PIString & p, prefixes) {
|
||||
piForeachC(PIString & s, suffixes) {
|
||||
for (const auto & p: prefixes) {
|
||||
for (const auto & s: suffixes) {
|
||||
PIString fn = dir + p + name + s;
|
||||
if (PIFile::isExists(fn)) return fn;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo(bool ignore_cache) {
|
||||
}
|
||||
if (l_df.size_s() < 2) return ret;
|
||||
l_df.pop_front();
|
||||
piForeachC(PIString & s, l_df) {
|
||||
for (const auto & s: l_df) {
|
||||
PIStringList ml(s.replacedAll(" ", " ").split(" "));
|
||||
if (ml.size_s() < 2) continue;
|
||||
if (ml.front() == "none") continue;
|
||||
@@ -234,17 +234,10 @@ PIString PISystemInfo::machineKey() {
|
||||
PISystemInfo * si = instance();
|
||||
PIByteArray salt;
|
||||
PIString conf = confDir() + "/.pip_machine_salt";
|
||||
if (PIFile::isExists(conf)) {
|
||||
PIFile f(conf, PIIODevice::ReadOnly);
|
||||
f.open();
|
||||
salt = f.readAll();
|
||||
}
|
||||
if (PIFile::isExists(conf)) salt = PIFile::readAll(conf, false);
|
||||
if (salt.size_s() != SALT_SIZE) {
|
||||
salt = generateSalt();
|
||||
PIFile f(conf, PIIODevice::ReadWrite);
|
||||
f.open();
|
||||
f.clear();
|
||||
f.write(salt);
|
||||
PIFile::writeAll(conf, salt);
|
||||
}
|
||||
ret = si->OS_name + "_" + si->architecture + "_" + si->hostname + "_" + salt.toHex();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user