Skip to content

Commit

Permalink
Fix coverity warnings (#135)
Browse files Browse the repository at this point in the history
IB-7930

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Mar 1, 2024
1 parent 2842d66 commit 8cf8b7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: CI
on: [push, pull_request]
env:
BUILD_NUMBER: ${{ github.run_number }}
MAKEFLAGS: -j3
CMAKE_BUILD_PARALLEL_LEVEL: 3
jobs:
macos:
name: Build on macOS
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
MACOSX_DEPLOYMENT_TARGET: 11.0
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libraries
run: brew install qt@6
- name: Build
run: |
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1 -B build -S .
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3.0 -B build -S .
cmake --build build
ubuntu:
name: Build on Ubuntu to ${{ matrix.container }}
Expand All @@ -38,7 +38,7 @@ jobs:
if: matrix.container != 'ubuntu:20.04'
run: apt update -qq && apt install --no-install-recommends -y git ca-certificates build-essential pkg-config cmake libpcsclite-dev libssl-dev libgl-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build packages
Expand All @@ -47,22 +47,22 @@ jobs:
cmake --build build
windows:
name: Build on Windows
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: openssl
vcpkgGitCommitId: a69b65229b3956b7f45abd81671b7330114bcaad
vcpkgGitCommitId: 1f619be01b436b796dab797dd1e1721c5676f8ac
vcpkgTriplet: x64-windows
- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: 6.4.2
version: 6.6.1
arch: win64_msvc2019_64
- name: Build
run: |
Expand Down
9 changes: 3 additions & 6 deletions Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Configuration::Private
void Configuration::Private::initCache(bool clear)
{
#ifndef NO_CACHE
auto readAll = [clear, this](const QUrl &url, const QString &copy) {
auto readAll = [clear, this](const QUrl &url, const QString &copy) -> QByteArray {
QFile f(cache + url.fileName());
if(clear && f.exists())
f.remove();
Expand Down Expand Up @@ -153,7 +153,7 @@ bool Configuration::Private::validate(const QByteArray &data, const QByteArray &
{QCryptographicHash::Sha512, QByteArray::fromHex("3051300d060960864801650304020305000440")},
};
if(std::none_of(list.cbegin(), list.cend(), [&](const auto &item) {
return digest.startsWith(item.second) && digest.endsWith(QCryptographicHash::hash(data, item.first));
return digest == item.second + QCryptographicHash::hash(data, item.first);
}))
return false;
QString date = headerValue(toObject(data), QLatin1String("DATE")).toString();
Expand Down Expand Up @@ -230,8 +230,7 @@ Configuration::Configuration(QObject *parent)
d->setData(data, signature);
#ifndef NO_CACHE
auto writeAll = [this](const QString &fileName, const QByteArray &data) {
QFile f(d->cache + fileName);
if(f.open(QFile::WriteOnly|QFile::Truncate))
if(QFile f(d->cache + fileName); f.open(QFile::WriteOnly|QFile::Truncate))
f.write(data);
};
writeAll(d->url.fileName(), d->data);
Expand Down Expand Up @@ -286,8 +285,6 @@ Configuration::Configuration(QObject *parent)
}
}

Q_EMIT finished(true, {});

#ifdef LAST_CHECK_DAYS
QDate lastCheck = QDate::fromString(d->s.value(QStringLiteral("LastCheck")).toString(), QStringLiteral("yyyyMMdd"));
// Clean computer
Expand Down

0 comments on commit 8cf8b7c

Please sign in to comment.