From 1fcbbb5884bbc8751217d1808fe1982a7df423a5f3ead39fc0210102b024dae8 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 6 Jun 2020 06:52:01 +0000 Subject: [PATCH] Accepting request 811676 from home:jirislaby:branches:network - add 0001-avoid-using-deprecated-qs-rand.patch 0001-gui-datovka-annotate-fall-through-cases.patch 0001-Fixed-compilation-using-Qt-5.15.0.patch OBS-URL: https://build.opensuse.org/request/show/811676 OBS-URL: https://build.opensuse.org/package/show/network/datovka?expand=0&rev=38 --- 0001-Fixed-compilation-using-Qt-5.15.0.patch | 27 ++++ 0001-avoid-using-deprecated-qs-rand.patch | 148 ++++++++++++++++++ ...-datovka-annotate-fall-through-cases.patch | 37 +++++ datovka.changes | 8 + datovka.spec | 6 +- 5 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 0001-Fixed-compilation-using-Qt-5.15.0.patch create mode 100644 0001-avoid-using-deprecated-qs-rand.patch create mode 100644 0001-gui-datovka-annotate-fall-through-cases.patch diff --git a/0001-Fixed-compilation-using-Qt-5.15.0.patch b/0001-Fixed-compilation-using-Qt-5.15.0.patch new file mode 100644 index 0000000..6cb290c --- /dev/null +++ b/0001-Fixed-compilation-using-Qt-5.15.0.patch @@ -0,0 +1,27 @@ +From: Karel Slany +Date: Fri, 5 Jun 2020 08:55:23 +0200 +Subject: Fixed compilation using Qt-5.15.0. +Patch-mainline: yes +Git-commit: d98edca9cf17ae087b743c17e9922cbbd08f94fa +References: qt 5.15 + +Addresses #462. +--- + src/delegates/tag_item.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/delegates/tag_item.cpp b/src/delegates/tag_item.cpp +index 39aa32e60e42..c0b43d9d5166 100644 +--- a/src/delegates/tag_item.cpp ++++ b/src/delegates/tag_item.cpp +@@ -23,6 +23,7 @@ + + #include /* std::sort */ + #include ++#include + + #include "src/datovka_shared/localisation/localisation.h" + #include "src/datovka_shared/log/log.h" +-- +2.27.0 + diff --git a/0001-avoid-using-deprecated-qs-rand.patch b/0001-avoid-using-deprecated-qs-rand.patch new file mode 100644 index 0000000..9b95817 --- /dev/null +++ b/0001-avoid-using-deprecated-qs-rand.patch @@ -0,0 +1,148 @@ +From: Jiri Slaby +Date: Fri, 5 Jun 2020 09:06:29 +0200 +Subject: avoid using deprecated qs?rand +Patch-mainline: no +References: qs?rand + +Signed-off-by: Jiri Slaby +--- + src/datovka_shared/crypto/crypto_wrapped.cpp | 13 +++++++++++++ + src/datovka_shared/utility/strings.cpp | 11 +++++++++++ + src/main.cpp | 2 ++ + src/main_cli.cpp | 2 ++ + .../gui/dialogue_stored_files.cpp | 13 ++++++++++++- + 5 files changed, 40 insertions(+), 1 deletion(-) + +diff --git a/src/datovka_shared/crypto/crypto_wrapped.cpp b/src/datovka_shared/crypto/crypto_wrapped.cpp +index b875e00f9174..a5ff23a32c7d 100644 +--- a/src/datovka_shared/crypto/crypto_wrapped.cpp ++++ b/src/datovka_shared/crypto/crypto_wrapped.cpp +@@ -25,15 +25,28 @@ + #include "src/datovka_shared/crypto/crypto_pwd.h" + #include "src/datovka_shared/crypto/crypto_wrapped.h" + ++#include ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ #include ++#endif ++ + QByteArray randomSalt(unsigned int len) + { + QByteArray salt; + ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ salt.resize(len); ++ ++ Q_ASSERT((len % sizeof(quint32)) == 0); ++ ++ QRandomGenerator::global()->fillRange((quint32 *)salt.data(), len / sizeof(quint32)); ++#else + /* Make sure that random generator is initialised. */ + + for (unsigned int i = 0; i < len; ++i) { + salt.append(qrand() % 256); + } ++#endif + + return salt; + } +diff --git a/src/datovka_shared/utility/strings.cpp b/src/datovka_shared/utility/strings.cpp +index 8b6f25d4be18..01c40c1595c0 100644 +--- a/src/datovka_shared/utility/strings.cpp ++++ b/src/datovka_shared/utility/strings.cpp +@@ -23,6 +23,10 @@ + + #include /* qrand() */ + ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ #include ++#endif ++ + #include "src/datovka_shared/utility/strings.h" + + QString Utility::generateRandomString(int length) +@@ -34,9 +38,16 @@ QString Utility::generateRandomString(int length) + "!#$%&()*+,-.:=?@[]_{|}~"); + + QString randomString; ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ QRandomGenerator *rnd = QRandomGenerator::global(); ++#endif + + for (int i = 0; i < length; ++i) { ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ int index = rnd->bounded(possibleCharacters.length()); ++#else + int index = qrand() % possibleCharacters.length(); ++#endif + QChar nextChar = possibleCharacters.at(index); + randomString.append(nextChar); + } +diff --git a/src/main.cpp b/src/main.cpp +index 0d3fee1b0320..810d85ddb264 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -96,8 +96,10 @@ int main(int argc, char *argv[]) + return EXIT_FAILURE; + } + ++#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0)) + /* Set random generator. */ + qsrand(QDateTime::currentDateTime().toTime_t()); ++#endif + + /* Log warnings. */ + GlobInstcs::logPtr->setLogLevelBits(LogDevice::LF_STDERR, LOGSRC_ANY, +diff --git a/src/main_cli.cpp b/src/main_cli.cpp +index d46d93a51880..4bdf36ea8cc3 100644 +--- a/src/main_cli.cpp ++++ b/src/main_cli.cpp +@@ -61,8 +61,10 @@ int main(int argc, char *argv[]) + return EXIT_FAILURE; + } + ++#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0)) + /* Set random generator. */ + qsrand(QDateTime::currentDateTime().toTime_t()); ++#endif + + /* Log warnings. */ + GlobInstcs::logPtr->setLogLevelBits(LogDevice::LF_STDERR, LOGSRC_ANY, +diff --git a/tests/records_management_app/gui/dialogue_stored_files.cpp b/tests/records_management_app/gui/dialogue_stored_files.cpp +index b030ff3481a2..78a752bdb7cd 100644 +--- a/tests/records_management_app/gui/dialogue_stored_files.cpp ++++ b/tests/records_management_app/gui/dialogue_stored_files.cpp +@@ -27,6 +27,10 @@ + #include // qrand + #include + ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ #include ++#endif ++ + #include "src/datovka_shared/records_management/conversion.h" + #include "tests/records_management_app/gui/dialogue_stored_files.h" + #include "ui_dialogue_stored_files.h" +@@ -143,11 +147,18 @@ void generateIdentifiers(QWidget *parent, QLineEdit &lineEdit) + return; + } + +- qsrand((uint)QTime::currentTime().msec()); + QStringList strIds; ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) ++ auto rnd = QRandomGenerator::global(); ++ for (int i = 0; i < num; ++i) { ++ strIds.append(QString::number(rnd->generate())); ++ } ++#else ++ qsrand((uint)QTime::currentTime().msec()); + for (int i = 0; i < num; ++i) { + strIds.append(QString::number(qrand())); + } ++#endif + + lineEdit.setText(strIds.join(SEPARATOR)); + } +-- +2.27.0 + diff --git a/0001-gui-datovka-annotate-fall-through-cases.patch b/0001-gui-datovka-annotate-fall-through-cases.patch new file mode 100644 index 0000000..2fc591a --- /dev/null +++ b/0001-gui-datovka-annotate-fall-through-cases.patch @@ -0,0 +1,37 @@ +From: Jiri Slaby +Date: Fri, 5 Jun 2020 09:22:07 +0200 +Subject: gui/datovka: annotate fall through cases +Patch-mainline: no +References: qs?rand + +So that compiler won't complain: +warning: this statement may fall through + +Signed-off-by: Jiri Slaby +--- + src/gui/datovka.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gui/datovka.cpp b/src/gui/datovka.cpp +index b55b31acf8e7..ee28080e3ad9 100644 +--- a/src/gui/datovka.cpp ++++ b/src/gui/datovka.cpp +@@ -5843,6 +5843,7 @@ void MainWindow::showImportZFOActionDialog(void) + switch (locationType) { + case DlgImportZFO::IMPORT_FROM_SUBDIR: + includeSubdir = true; ++ /* fallthrough */ + case DlgImportZFO::IMPORT_FROM_DIR: + importDir = QFileDialog::getExistingDirectory(this, + tr("Select directory"), m_import_zfo_path, +@@ -7140,6 +7141,7 @@ void MainWindow::prepareMsgTmstmpExpir(enum DlgTimestampExpir::Action action) + + case DlgTimestampExpir::CHECK_DIR_SUB: + includeSubdir = true; ++ /* fallthrough */ + case DlgTimestampExpir::CHECK_DIR: + importDir = QFileDialog::getExistingDirectory(this, + tr("Select directory"), m_import_zfo_path, +-- +2.27.0 + diff --git a/datovka.changes b/datovka.changes index cc1b16c..f8a517a 100644 --- a/datovka.changes +++ b/datovka.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jun 5 07:25:55 UTC 2020 - Jiri Slaby + +- add + 0001-avoid-using-deprecated-qs-rand.patch + 0001-gui-datovka-annotate-fall-through-cases.patch + 0001-Fixed-compilation-using-Qt-5.15.0.patch + ------------------------------------------------------------------- Mon Mar 9 07:09:54 UTC 2020 - Jiri Slaby diff --git a/datovka.spec b/datovka.spec index 4ee6e2b..ca8aaad 100644 --- a/datovka.spec +++ b/datovka.spec @@ -27,6 +27,9 @@ Source0: https://secure.nic.cz/files/datove_schranky/%{version}/%{name}-% Source1: https://secure.nic.cz/files/datove_schranky/%{version}/%{name}-%{version}.tar.xz.sha256 # PATCH-FIX-UPSTREAM: remove some issues with current .pro file Patch0: datovka-fix-pro.patch +Patch1: 0001-Fixed-compilation-using-Qt-5.15.0.patch +Patch2: 0001-avoid-using-deprecated-qs-rand.patch +Patch3: 0001-gui-datovka-annotate-fall-through-cases.patch BuildRequires: libqt5-linguist BuildRequires: openssl-devel BuildRequires: pkgconfig @@ -57,8 +60,7 @@ Data Box Information System) SOAP services as defined in Czech ISDS Act %{?lang_package} %prep -%setup -q -%patch0 -p1 +%autosetup -p1 sed -i \ -e 's:lrelease:lrelease-qt5:g' \ %{name}.pro