mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:25:20 +00:00
UI: Fix Coverity warnings
This commit is contained in:
parent
18dcb03136
commit
85aeb4f064
@ -160,15 +160,14 @@ FORT_API BOOL fort_conf_ip_included(const PFORT_CONF conf,
|
||||
const BOOL ip_excluded = exclude_all
|
||||
? TRUE
|
||||
: fort_conf_ip_included_check(fort_conf_addr_group_exclude_list_ref(addr_group),
|
||||
zone_func, ctx, remote_ip, addr_group->exclude_zones,
|
||||
addr_group->exclude_is_empty, isIPv6);
|
||||
zone_func, ctx, remote_ip, addr_group->exclude_zones,
|
||||
addr_group->exclude_is_empty, isIPv6);
|
||||
if (include_all)
|
||||
return !ip_excluded;
|
||||
|
||||
/* Exclude All */
|
||||
const BOOL ip_included = include_all
|
||||
? TRUE
|
||||
: fort_conf_ip_included_check(fort_conf_addr_group_include_list_ref(addr_group),
|
||||
const BOOL ip_included = /* include_all ? TRUE : */
|
||||
fort_conf_ip_included_check(fort_conf_addr_group_include_list_ref(addr_group),
|
||||
zone_func, ctx, remote_ip, addr_group->include_zones,
|
||||
addr_group->include_is_empty, isIPv6);
|
||||
if (exclude_all)
|
||||
@ -206,8 +205,7 @@ typedef BOOL fort_conf_app_equal_func(
|
||||
static FORT_APP_ENTRY fort_conf_app_find_loop(const PFORT_CONF conf, const PVOID path,
|
||||
UINT32 path_len, UINT32 apps_off, UINT16 apps_n, fort_conf_app_equal_func *app_equal_func)
|
||||
{
|
||||
FORT_APP_ENTRY app_data;
|
||||
app_data.flags.v = 0;
|
||||
const FORT_APP_ENTRY app_data = { 0 };
|
||||
|
||||
if (apps_n == 0)
|
||||
return app_data;
|
||||
@ -256,8 +254,7 @@ static int fort_conf_app_prefix_cmp(PFORT_APP_ENTRY app_entry, const PVOID path,
|
||||
static FORT_APP_ENTRY fort_conf_app_prefix_find(
|
||||
const PFORT_CONF conf, const PVOID path, UINT32 path_len)
|
||||
{
|
||||
FORT_APP_ENTRY app_data;
|
||||
app_data.flags.v = 0;
|
||||
const FORT_APP_ENTRY app_data = { 0 };
|
||||
|
||||
const UINT16 count = conf->prefix_apps_n;
|
||||
if (count == 0)
|
||||
|
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
@ -470,9 +470,9 @@ bool SqliteDb::createFtsTable(const FtsTable &ftsTable)
|
||||
" INSERT INTO %2(rowid, %4) VALUES (%5);"
|
||||
"END;";
|
||||
|
||||
const auto contentTableName = ftsTable.contentTable;
|
||||
const auto &contentTableName = ftsTable.contentTable;
|
||||
const auto ftsTableName = getFtsTableName(contentTableName);
|
||||
const auto contentRowidName = ftsTable.contentRowid;
|
||||
const auto &contentRowidName = ftsTable.contentRowid;
|
||||
const auto contentColumnNames = ftsTable.columns.join(',');
|
||||
const auto newTriggerColumnNames =
|
||||
makeTriggerColumnNames(contentRowidName, ftsTable.columns, "new.");
|
||||
|
4
src/ui/3rdparty/sqlite/sqlitestmt.cpp
vendored
4
src/ui/3rdparty/sqlite/sqlitestmt.cpp
vendored
@ -394,7 +394,9 @@ bool SqliteStmt::columnIsNull(int column) const
|
||||
void SqliteStmt::doList(const SqliteStmtList &stmtList)
|
||||
{
|
||||
for (SqliteStmt *stmt : stmtList) {
|
||||
stmt->step();
|
||||
const auto stepRes = stmt->step();
|
||||
Q_UNUSED(stepRes);
|
||||
|
||||
stmt->reset();
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ bool buildArgsData(QByteArray &buffer, const QVariantList &args, bool &compresse
|
||||
}
|
||||
|
||||
compressed = (data.size() > 128);
|
||||
buffer = compressed ? qCompress(data) : data;
|
||||
buffer = compressed ? qCompress(std::move(data)) : data;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -314,15 +314,13 @@ bool ControlWorker::readRequestHeader()
|
||||
{
|
||||
const int headerSize = socket()->read((char *) &m_requestHeader, sizeof(RequestHeader));
|
||||
if (headerSize != sizeof(RequestHeader)) {
|
||||
qCWarning(LC) << "Bad request header:"
|
||||
<< "size=" << headerSize;
|
||||
qCWarning(LC) << "Bad request header:" << "size=" << headerSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_requestHeader.command() == Control::CommandNone
|
||||
|| m_requestHeader.dataSize() > dataMaxSize) {
|
||||
qCWarning(LC) << "Bad request:"
|
||||
<< "command=" << m_requestHeader.command()
|
||||
qCWarning(LC) << "Bad request:" << "command=" << m_requestHeader.command()
|
||||
<< "size=" << m_requestHeader.dataSize();
|
||||
return false;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ QVector<int> TableView::selectedRows() const
|
||||
{
|
||||
QSet<int> rowsSet;
|
||||
const auto indexes = selectedIndexes();
|
||||
for (const auto index : indexes) {
|
||||
for (const auto &index : indexes) {
|
||||
rowsSet.insert(index.row());
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ QString TableView::selectedText() const
|
||||
int prevColumn = -1;
|
||||
|
||||
const auto indexes = sortedSelectedIndexes();
|
||||
for (const auto index : indexes) {
|
||||
for (const auto &index : indexes) {
|
||||
const int row = index.row();
|
||||
if (prevRow != row) {
|
||||
if (prevRow != -1) {
|
||||
|
@ -151,7 +151,7 @@ void ZonesSelector::createZonesMenu()
|
||||
|
||||
const int zoneCount = qMin(zoneListModel->rowCount(), maxZoneCount());
|
||||
for (int row = 0; row < zoneCount; ++row) {
|
||||
const auto zoneRow = zoneListModel->zoneRowAt(row);
|
||||
const auto &zoneRow = zoneListModel->zoneRowAt(row);
|
||||
|
||||
auto cb = new QCheckBox(zoneRow.zoneName, m_menuZones);
|
||||
cb->setTristate(isTristate());
|
||||
|
@ -33,7 +33,7 @@ void HomePage::onRetranslateUi()
|
||||
|
||||
void HomePage::retranslateDriverMessage()
|
||||
{
|
||||
const auto text = driverManager()->isDeviceError()
|
||||
const auto &text = driverManager()->isDeviceError()
|
||||
? driverManager()->errorMessage()
|
||||
: (driverManager()->isDeviceOpened() ? tr("Installed") : tr("Not Installed"));
|
||||
|
||||
|
@ -524,7 +524,7 @@ QVector<qint64> ProgramsWindow::selectedAppIdList() const
|
||||
|
||||
const auto rows = m_appListView->selectedRows();
|
||||
for (int row : rows) {
|
||||
const auto appRow = appListModel()->appRowAt(row);
|
||||
const auto &appRow = appListModel()->appRowAt(row);
|
||||
list.append(appRow.appId);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ void RulesWindow::editSelectedRule()
|
||||
if (RuleListModel::isIndexRoot(ruleIndex))
|
||||
return;
|
||||
|
||||
const RuleRow ruleRow = ruleListModel()->ruleRowAt(ruleIndex);
|
||||
const auto &ruleRow = ruleListModel()->ruleRowAt(ruleIndex);
|
||||
|
||||
openRuleEditForm(ruleRow);
|
||||
}
|
||||
@ -332,7 +332,7 @@ void RulesWindow::deleteSelectedRule()
|
||||
if (RuleListModel::isIndexRoot(ruleIndex))
|
||||
return;
|
||||
|
||||
const auto ruleRow = ruleListModel()->ruleRowAt(ruleIndex);
|
||||
const auto &ruleRow = ruleListModel()->ruleRowAt(ruleIndex);
|
||||
if (ruleRow.isNull())
|
||||
return;
|
||||
|
||||
|
@ -285,7 +285,7 @@ void ConnectionsPage::updateShowHostNames()
|
||||
|
||||
void ConnectionsPage::deleteConn(int row)
|
||||
{
|
||||
const auto connRow = connBlockListModel()->connRowAt(row);
|
||||
const auto &connRow = connBlockListModel()->connRowAt(row);
|
||||
if (connRow.isNull())
|
||||
return;
|
||||
|
||||
@ -299,6 +299,6 @@ int ConnectionsPage::connListCurrentIndex() const
|
||||
|
||||
QString ConnectionsPage::connListCurrentPath() const
|
||||
{
|
||||
const auto connRow = connBlockListModel()->connRowAt(connListCurrentIndex());
|
||||
const auto &connRow = connBlockListModel()->connRowAt(connListCurrentIndex());
|
||||
return connRow.isNull() ? QString() : connRow.appPath;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ QLayout *ServicesWindow::setupHeader()
|
||||
if (serviceIndex < 0)
|
||||
return;
|
||||
|
||||
const auto serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
const auto &serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
|
||||
serviceInfoManager()->trackService(serviceInfo.serviceName);
|
||||
updateServiceListModel();
|
||||
@ -177,7 +177,7 @@ QLayout *ServicesWindow::setupHeader()
|
||||
if (serviceIndex < 0)
|
||||
return;
|
||||
|
||||
const auto serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
const auto &serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
|
||||
serviceInfoManager()->revertService(serviceInfo.serviceName);
|
||||
updateServiceListModel();
|
||||
@ -187,7 +187,7 @@ QLayout *ServicesWindow::setupHeader()
|
||||
if (serviceIndex < 0)
|
||||
return;
|
||||
|
||||
const auto serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
const auto &serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
|
||||
const QString appPath = QStringLiteral(R"(\SvcHost\)") + serviceInfo.serviceName;
|
||||
|
||||
@ -247,7 +247,8 @@ void ServicesWindow::setupTableServicesChanged()
|
||||
const auto refreshTableServicesChanged = [&] {
|
||||
const int serviceIndex = serviceListCurrentIndex();
|
||||
const bool serviceSelected = (serviceIndex >= 0);
|
||||
const auto serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
const auto &serviceInfo = serviceListModel()->serviceInfoAt(serviceIndex);
|
||||
|
||||
m_actTrack->setEnabled(serviceSelected && !serviceInfo.isTracked());
|
||||
m_actRevert->setEnabled(serviceSelected && serviceInfo.isTracked());
|
||||
m_actAddProgram->setEnabled(serviceSelected);
|
||||
|
@ -282,7 +282,7 @@ void ZonesWindow::editSelectedZone()
|
||||
if (zoneIndex < 0)
|
||||
return;
|
||||
|
||||
const ZoneRow zoneRow = zoneListModel()->zoneRowAt(zoneIndex);
|
||||
const auto &zoneRow = zoneListModel()->zoneRowAt(zoneIndex);
|
||||
|
||||
openZoneEditForm(zoneRow);
|
||||
}
|
||||
@ -300,7 +300,7 @@ void ZonesWindow::openZoneEditForm(const ZoneRow &zoneRow)
|
||||
|
||||
void ZonesWindow::deleteZone(int row)
|
||||
{
|
||||
const auto zoneRow = zoneListModel()->zoneRowAt(row);
|
||||
const auto &zoneRow = zoneListModel()->zoneRowAt(row);
|
||||
if (zoneRow.isNull())
|
||||
return;
|
||||
|
||||
|
@ -175,7 +175,7 @@ bool Logger::openLastFile()
|
||||
if (fileNames.isEmpty())
|
||||
return false;
|
||||
|
||||
const auto fileName = fileNames.first();
|
||||
const auto &fileName = fileNames.first();
|
||||
if (!openFile(fileName))
|
||||
return false;
|
||||
|
||||
|
@ -87,7 +87,7 @@ void fillServiceInfoList(QVector<ServiceInfo> &infoList, const RegKey &servicesR
|
||||
info.serviceType = ServiceInfo::Type(service->ServiceStatusProcess.dwServiceType);
|
||||
info.trackFlags = trackFlags;
|
||||
info.processId = service->ServiceStatusProcess.dwProcessId;
|
||||
info.serviceName = serviceName;
|
||||
info.serviceName = std::move(serviceName);
|
||||
|
||||
if (displayName) {
|
||||
info.displayName = QString::fromUtf16((const char16_t *) service->lpDisplayName);
|
||||
|
@ -328,7 +328,7 @@ QVariant AppListModel::dataDisplay(const QModelIndex &index, int role) const
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto appRow = appRowAt(row);
|
||||
const auto &appRow = appRowAt(row);
|
||||
if (appRow.isNull())
|
||||
return QVariant();
|
||||
|
||||
@ -340,7 +340,7 @@ QVariant AppListModel::dataDecoration(const QModelIndex &index) const
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto appRow = appRowAt(row);
|
||||
const auto &appRow = appRowAt(row);
|
||||
if (appRow.isNull())
|
||||
return QVariant();
|
||||
|
||||
@ -363,7 +363,7 @@ QVariant AppListModel::dataForeground(const QModelIndex &index) const
|
||||
const int column = index.column();
|
||||
|
||||
const int row = index.row();
|
||||
const auto appRow = appRowAt(row);
|
||||
const auto &appRow = appRowAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 3:
|
||||
|
@ -134,7 +134,7 @@ QVariant AppStatModel::dataDisplay(const QModelIndex &index) const
|
||||
if (row == 0)
|
||||
return tr("All");
|
||||
|
||||
const auto appPath = list().at(row);
|
||||
const auto &appPath = list().at(row);
|
||||
return appInfoCache()->appName(appPath);
|
||||
}
|
||||
|
||||
@ -145,6 +145,6 @@ QVariant AppStatModel::dataDecoration(const QModelIndex &index) const
|
||||
return IconCache::icon(":/icons/computer-96.png");
|
||||
}
|
||||
|
||||
const auto appPath = list().at(row);
|
||||
const auto &appPath = list().at(row);
|
||||
return appInfoCache()->appIcon(appPath);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ QVariant ConnBlockListModel::dataDisplay(const QModelIndex &index, int role) con
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto connRow = connRowAt(row);
|
||||
const auto &connRow = connRowAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
@ -176,7 +176,7 @@ QVariant ConnBlockListModel::dataDecoration(const QModelIndex &index) const
|
||||
|
||||
if (column == 0 || column == 5) {
|
||||
const int row = index.row();
|
||||
const auto connRow = connRowAt(row);
|
||||
const auto &connRow = connRowAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
|
@ -223,7 +223,7 @@ QVariant RuleListModel::headerDataDisplay(int section) const
|
||||
|
||||
QVariant RuleListModel::dataDisplay(const QModelIndex &index, int role) const
|
||||
{
|
||||
const auto ruleRow = ruleRowAt(index);
|
||||
const auto &ruleRow = ruleRowAt(index);
|
||||
|
||||
switch (index.column()) {
|
||||
case 0:
|
||||
@ -237,7 +237,7 @@ QVariant RuleListModel::dataDisplay(const QModelIndex &index, int role) const
|
||||
|
||||
QVariant RuleListModel::dataDecoration(const QModelIndex &index) const
|
||||
{
|
||||
const auto ruleRow = ruleRowAt(index);
|
||||
const auto &ruleRow = ruleRowAt(index);
|
||||
if (ruleRow.isNull())
|
||||
return QVariant();
|
||||
|
||||
@ -252,7 +252,7 @@ QVariant RuleListModel::dataDecoration(const QModelIndex &index) const
|
||||
QVariant RuleListModel::dataCheckState(const QModelIndex &index) const
|
||||
{
|
||||
if (index.column() == 0) {
|
||||
const auto ruleRow = ruleRowAt(index);
|
||||
const auto &ruleRow = ruleRowAt(index);
|
||||
return ruleRow.enabled ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ bool RuleListModel::setData(const QModelIndex &index, const QVariant & /*value*/
|
||||
|
||||
switch (role) {
|
||||
case Qt::CheckStateRole:
|
||||
const auto ruleRow = ruleRowAt(index);
|
||||
const auto &ruleRow = ruleRowAt(index);
|
||||
return confRuleManager()->updateRuleEnabled(ruleRow.ruleId, !ruleRow.enabled);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ QVariant ServiceListModel::dataDisplay(const QModelIndex &index) const
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto info = serviceInfoAt(row);
|
||||
const auto &info = serviceInfoAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
@ -105,7 +105,7 @@ QVariant ServiceListModel::dataDecoration(const QModelIndex &index) const
|
||||
if (column == 0) {
|
||||
const int row = index.row();
|
||||
|
||||
const auto info = serviceInfoAt(row);
|
||||
const auto &info = serviceInfoAt(row);
|
||||
|
||||
if (info.isTracked())
|
||||
return IconCache::icon(":/icons/widgets.png");
|
||||
|
@ -104,7 +104,7 @@ QVariant ZoneListModel::dataDisplay(const QModelIndex &index) const
|
||||
const int row = index.row();
|
||||
const int column = index.column();
|
||||
|
||||
const auto zoneRow = zoneRowAt(row);
|
||||
const auto &zoneRow = zoneRowAt(row);
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
@ -127,7 +127,7 @@ QVariant ZoneListModel::dataDisplay(const QModelIndex &index) const
|
||||
QVariant ZoneListModel::dataCheckState(const QModelIndex &index) const
|
||||
{
|
||||
if (index.column() == 0) {
|
||||
const auto zoneRow = zoneRowAt(index.row());
|
||||
const auto &zoneRow = zoneRowAt(index.row());
|
||||
return zoneRow.enabled ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ bool ZoneListModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||
|
||||
switch (role) {
|
||||
case Qt::CheckStateRole:
|
||||
const auto zoneRow = zoneRowAt(index.row());
|
||||
const auto &zoneRow = zoneRowAt(index.row());
|
||||
return confZoneManager()->updateZoneEnabled(zoneRow.zoneId, !zoneRow.enabled);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ bool RpcManager::doOnServer(Control::Command cmd, const QVariantList &args, QVar
|
||||
|
||||
void RpcManager::invokeOnClients(Control::Command cmd, const QVariantList &args)
|
||||
{
|
||||
const auto clients = IoC<ControlManager>()->clients();
|
||||
const auto &clients = IoC<ControlManager>()->clients();
|
||||
if (clients.isEmpty())
|
||||
return;
|
||||
|
||||
|
@ -93,10 +93,10 @@ void TaskInfoZoneDownloader::setupNextTaskWorker()
|
||||
|
||||
void TaskInfoZoneDownloader::setupTaskWorkerByZone(TaskZoneDownloader *worker)
|
||||
{
|
||||
const auto zoneRow = zoneListModel()->zoneRowAt(m_zoneIndex);
|
||||
const auto zoneSource =
|
||||
ZoneSourceWrapper(zoneListModel()->zoneSourceByCode(zoneRow.sourceCode));
|
||||
const auto zoneType = ZoneTypeWrapper(zoneListModel()->zoneTypeByCode(zoneSource.zoneType()));
|
||||
const auto &zoneRow = zoneListModel()->zoneRowAt(m_zoneIndex);
|
||||
|
||||
const ZoneSourceWrapper zoneSource(zoneListModel()->zoneSourceByCode(zoneRow.sourceCode));
|
||||
const ZoneTypeWrapper zoneType(zoneListModel()->zoneTypeByCode(zoneSource.zoneType()));
|
||||
|
||||
worker->setZoneEnabled(zoneRow.enabled);
|
||||
worker->setSort(zoneType.sort());
|
||||
@ -173,7 +173,7 @@ void TaskInfoZoneDownloader::addSubResult(TaskZoneDownloader *worker, bool succe
|
||||
return;
|
||||
}
|
||||
|
||||
const auto zoneData = worker->zoneData();
|
||||
const auto &zoneData = worker->zoneData();
|
||||
const int size = zoneData.size();
|
||||
|
||||
if (size == 0)
|
||||
|
@ -54,7 +54,8 @@ void CALLBACK managerNotifyCallback(PVOID param)
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
monitor, [=] { monitor->onManagerNotify(createdServiceNames); }, Qt::QueuedConnection);
|
||||
monitor, [=] { monitor->onManagerNotify(std::move(createdServiceNames)); },
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -233,11 +233,11 @@ void StartupUtil::setExplorerIntegrated(bool integrate)
|
||||
if (integrate) {
|
||||
const QString wrappedPath = wrappedAppFilePath();
|
||||
|
||||
RegKey reg(regShell, APP_NAME, RegKey::DefaultCreate);
|
||||
RegKey reg(std::move(regShell), APP_NAME, RegKey::DefaultCreate);
|
||||
reg.setValue("icon", wrappedPath);
|
||||
reg.setValue("MUIVerb", APP_NAME + QLatin1String(" ..."));
|
||||
|
||||
RegKey regCommand(reg, "command", RegKey::DefaultCreate);
|
||||
RegKey regCommand(std::move(reg), "command", RegKey::DefaultCreate);
|
||||
regCommand.setDefaultValue(wrappedPath + " -c prog add \"%1\"");
|
||||
} else {
|
||||
regShell.removeRecursively(APP_NAME);
|
||||
|
Loading…
Reference in New Issue
Block a user