Commit e7fd720e authored by Laurent Montel's avatar Laurent Montel 😁

GIT_SILENT: coding style

parent 48f6d9ed
......@@ -181,7 +181,7 @@ static IataCode iataCodeForUniqueFragment(const QStringList &fragments)
if (iataIdx > 0) {
return iata_table[iataIdx];
}
return {};
return {};
}
IataCode iataCodeFromName(const QString &name)
......@@ -196,12 +196,12 @@ IataCode iataCodeFromName(const QString &name)
QSet<uint16_t> iataIdxs;
for (const auto &s : fragments) {
const auto it = std::lower_bound(nameNIndexBegin(), nameNIndexEnd(), s.toUtf8(), [](const NameNIndex &lhs, const QByteArray &rhs) {
const auto cmp = strncmp(nameN_string_table + lhs.strOffset, rhs.constData(), std::min<int>(lhs.strLength, rhs.size()));
if (cmp == 0) {
return lhs.strLength < rhs.size();
}
return cmp < 0;
});
const auto cmp = strncmp(nameN_string_table + lhs.strOffset, rhs.constData(), std::min<int>(lhs.strLength, rhs.size()));
if (cmp == 0) {
return lhs.strLength < rhs.size();
}
return cmp < 0;
});
if (it == nameNIndexEnd() || it->strLength != s.toUtf8().size() || strncmp(nameN_string_table + it->strOffset, s.toUtf8().constData(), it->strLength) != 0) {
continue;
}
......
......@@ -61,7 +61,6 @@ struct NameNIndex
static_assert(sizeof(NameNIndex) == 8, "NameNIndex size changed!");
static_assert(sizeof(NameNIndex) % alignof(NameNIndex) == 0, "NameNIndex is not properly aligned!");
}
#endif
......@@ -289,7 +289,7 @@ int main(int argc, char **argv)
}
// step 3 index the names for reverse lookup
QMap<QString, QVector<QString>> labelMap;
QMap<QString, QVector<QString> > labelMap;
for (auto it = airportMap.begin(); it != airportMap.end(); ++it) {
auto l = (it.value().label + QLatin1Char(' ') + it.value().alias)
.split(QRegularExpression(QStringLiteral("[ 0-9/'\"\\(\\)&\\,.–„-]")), QString::SkipEmptyParts);
......@@ -307,7 +307,7 @@ int main(int argc, char **argv)
labelMap[s].push_back(it.value().iataCode);
}
}
for (auto it = labelMap.begin(); it != labelMap.end(); ++it) {
for (auto it = labelMap.begin(); it != labelMap.end(); ++it) {
std::sort(it.value().begin(), it.value().end());
}
......
......@@ -57,7 +57,10 @@ QByteArray Timezones::timezoneForCoordinate(float longitude, float latitude) con
}
// search the vicinity, helps with costal/island airports
const struct { int x; int y; } offsets[] = { {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1} };
const struct {
int x;
int y;
} offsets[] = { {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1} };
QSet<QByteArray> tzs;
for (int i = 0; i < 8; ++i) {
const auto tz = timezoneForPixel(x + offsets[i].x, y + offsets[i].y);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment