Hello community,

here is the log from the commit of package fips for openSUSE:Factory checked in 
at 2019-03-11 11:15:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/fips (Old)
 and      /work/SRC/openSUSE:Factory/.fips.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fips"

Mon Mar 11 11:15:25 2019 rev:2 rq:683052 version:3.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/fips/fips.changes        2018-08-15 
10:37:22.892180853 +0200
+++ /work/SRC/openSUSE:Factory/.fips.new.28833/fips.changes     2019-03-11 
11:15:43.637332559 +0100
@@ -1,0 +2,17 @@
+Sat Mar  9 09:11:03 UTC 2019 - Matwey V. Kornilov <matwey.korni...@gmail.com>
+
+- Drop %defattr
+- Use %license for LICENSE.txt
+
+-------------------------------------------------------------------
+Tue Mar 05 08:29:56 UTC 2019 - opensuse-packag...@opensuse.org
+
+- Update to version 3.3.1:
+  * Version 3.3.1
+  * Fix Exception::what()
+  * Do not crash app when broken file is dropped via macOS Dock
+  * Remove using Utils::swap_bytes
+  * Fix makeMinMax() for images with NaNs
+  * Utils::min and max adaptive to NaN
+
+-------------------------------------------------------------------

Old:
----
  fips-3.3.0.tar.xz

New:
----
  fips-3.3.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fips.spec ++++++
--- /var/tmp/diff_new_pack.YvdaKG/_old  2019-03-11 11:15:44.713332172 +0100
+++ /var/tmp/diff_new_pack.YvdaKG/_new  2019-03-11 11:15:44.713332172 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package fips
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,10 +17,10 @@
 
 
 Name:           fips
-Version:        3.3.0
+Version:        3.3.1
 Release:        0
 Summary:        OpenGL-based FITS image viewer
-License:        LGPL-3.0
+License:        LGPL-3.0-only
 Group:          Productivity/Scientific/Astronomy
 Url:            https://github.com/matwey/fips3
 Source:         %{name}-%{version}.tar.xz
@@ -57,8 +57,8 @@
 %ctest
 
 %files
-%defattr(-,root,root)
-%doc README.md LICENSE.txt
+%doc README.md
+%license LICENSE.txt
 %{_bindir}/%{name}
 %{_datadir}/applications/space.fips.Fips.desktop
 %dir %{_datadir}/icons/hicolor

++++++ _service ++++++
--- /var/tmp/diff_new_pack.YvdaKG/_old  2019-03-11 11:15:44.733332165 +0100
+++ /var/tmp/diff_new_pack.YvdaKG/_new  2019-03-11 11:15:44.733332165 +0100
@@ -2,7 +2,7 @@
        <service name="tar_scm" mode="disabled">
                <param name="url">git://github.com/matwey/fips3.git</param>
                <param name="scm">git</param>
-               <param name="revision">3.3.0</param>
+               <param name="revision">3.3.1</param>
                <param name="versionformat">@PARENT_TAG@</param>
                <param name="filename">fips</param>
                <param name="changesgenerate">enable</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.YvdaKG/_old  2019-03-11 11:15:44.745332160 +0100
+++ /var/tmp/diff_new_pack.YvdaKG/_new  2019-03-11 11:15:44.745332160 +0100
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
             <param name="url">git://github.com/matwey/fips3.git</param>
-          <param 
name="changesrevision">b7bb88b332a1c4be8fc495d1d28a5b3bf0fa37cc</param></service></servicedata>
\ No newline at end of file
+          <param 
name="changesrevision">a8f4d2c9abf72e059d8bd9ddffd14e7b36f99dc8</param></service></servicedata>
\ No newline at end of file

++++++ fips-3.3.0.tar.xz -> fips-3.3.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/CMakeLists.txt 
new/fips-3.3.1/CMakeLists.txt
--- old/fips-3.3.0/CMakeLists.txt       2018-08-10 14:49:36.000000000 +0200
+++ new/fips-3.3.1/CMakeLists.txt       2019-03-05 09:09:51.000000000 +0100
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.0.0)
 cmake_policy(SET CMP0048 NEW)
-project(fips LANGUAGES C CXX VERSION 3.3.0)
+project(fips LANGUAGES C CXX VERSION 3.3.1)
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
@@ -172,6 +172,10 @@
 target_link_libraries(test_opengltransform Qt5::Test Qt5::Gui)
 add_test(test_opengltransform test_opengltransform)
 
+add_executable(test_utils_minmax test/utils/minmax.cpp)
+target_link_libraries(test_utils_minmax Qt5::Test)
+add_test(test_utils_minmax test_utils_minmax)
+
 add_executable(test_utils_openglrowalign test/utils/openglrowalign.cpp 
src/utils/openglrowalign.cpp)
 target_link_libraries(test_utils_openglrowalign Qt5::Test)
 add_test(test_utils_openglrowalign test_utils_openglrowalign)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/include/abstractopenglplan.h 
new/fips-3.3.1/include/abstractopenglplan.h
--- old/fips-3.3.0/include/abstractopenglplan.h 2018-08-10 14:49:36.000000000 
+0200
+++ new/fips-3.3.1/include/abstractopenglplan.h 2019-03-05 09:09:51.000000000 
+0100
@@ -19,6 +19,10 @@
 #ifndef _ABSTRACTOPENGLPLAN_H
 #define _ABSTRACTOPENGLPLAN_H
 
+#include <algorithm>
+#include <limits>
+#include <utility>
+
 #include <QOpenGLFunctions>
 #include <QOpenGLShaderProgram>
 #include <QOpenGLVertexArrayObject>
@@ -29,6 +33,8 @@
 #include <fits.h>
 #include <openglplane.h>
 #include <openglshaderprogram.h>
+#include <utils/minmax.h>
+#include <utils/swapbytes.h>
 
 class AbstractOpenGLPlan:
        protected QOpenGLFunctions {
@@ -81,28 +87,29 @@
 protected:
        template<class T>
        static inline std::pair<double, double> makeMinMax(const 
FITS::HeaderDataUnit<FITS::DataUnit<T>>& hdu) {
-               using Utils::swap_bytes;
-
                const auto& dataunit = hdu.data();
 
                const auto begin = dataunit.data();
                const auto end   = begin + dataunit.length();
 
-               using value_type = decltype(*begin);
-
-               auto e = std::minmax_element(
+               auto e = std::accumulate(
                        begin, end,
+                       std::make_pair(std::numeric_limits<T>::max(), 
std::numeric_limits<T>::lowest()),
+                       [](const std::pair<T, T>& acc, const T& element) {
 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-                       [](value_type x, value_type y) { return swap_bytes(x) < 
swap_bytes(y); }
+                               const T& x = Utils::swap_bytes(element);
 #else
-                       [](value_type x, value_type y) { return x < y; }
+                               const T& x = element;
 #endif
+                               return std::make_pair(Utils::min(acc.first, x), 
Utils::max(acc.second, x));
+                       }
                );
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-               return 
std::make_pair(hdu.FITSToInstrumental(swap_bytes(*(e.first))), 
hdu.FITSToInstrumental(swap_bytes(*(e.second))));
-#else
-               return std::make_pair(hdu.FITSToInstrumental(*(e.first)), 
hdu.FITSToInstrumental(*(e.second)));
-#endif
+               // Swap max and lowest if data contains only NaNs
+               if (e.first > e.second) {
+                       std::swap(e.first, e.second);
+               }
+
+               return std::make_pair(hdu.FITSToInstrumental(e.first), 
hdu.FITSToInstrumental(e.second));
        }
 
        template<class T>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/include/application.h 
new/fips-3.3.1/include/application.h
--- old/fips-3.3.0/include/application.h        2018-08-10 14:49:36.000000000 
+0200
+++ new/fips-3.3.1/include/application.h        2019-03-05 09:09:51.000000000 
+0100
@@ -33,7 +33,7 @@
        Application(int &argc, char **argv);
        virtual ~Application() override;
 
-       void addInstance(const QString& filename);
+       std::size_t addInstance(const QString& filename);
        inline static Application* instance() {
                return static_cast<Application*>(QCoreApplication::instance());
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/include/utils/exception.h 
new/fips-3.3.1/include/utils/exception.h
--- old/fips-3.3.0/include/utils/exception.h    2018-08-10 14:49:36.000000000 
+0200
+++ new/fips-3.3.1/include/utils/exception.h    2019-03-05 09:09:51.000000000 
+0100
@@ -20,13 +20,14 @@
 #define _EXCEPTION_H_
 
 #include <QException>
+#include <QByteArray>
 #include <QString>
 
 namespace Utils {
 
 class Exception : public QException {
 private:
-       QString what_;
+       QByteArray what_;
 public:
        explicit Exception(const QString& what);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/include/utils/minmax.h 
new/fips-3.3.1/include/utils/minmax.h
--- old/fips-3.3.0/include/utils/minmax.h       1970-01-01 01:00:00.000000000 
+0100
+++ new/fips-3.3.1/include/utils/minmax.h       2019-03-05 09:09:51.000000000 
+0100
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (C) 2017  Matwey V. Kornilov <matwey.korni...@gmail.com>
+ *                      Konstantin Malanchev <hom...@gmail.com>
+ *
+ *  This program is free software: you can redistribute it and/or modify it
+ *  under the terms of the GNU Lesser General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MINMAX_H_
+#define _MINMAX_H_
+
+#include <algorithm> // std::min, std::max
+#include <cmath> // std::fmin, std::fmax
+#include <type_traits> // std::enable_if, std::is_integral, 
std::is_floating_point
+
+namespace Utils {
+template<class T, typename std::enable_if<std::is_integral<T>::value, 
bool>::type = 0>
+const T& min(const T& x, const T& y) {
+       return std::min(x, y);
+}
+
+template<class T, typename std::enable_if<std::is_floating_point<T>::value, 
bool>::type = 0>
+T min(const T& x, const T& y) {
+       return std::fmin(x, y);
+}
+
+template<class T, typename std::enable_if<std::is_integral<T>::value, 
bool>::type = 0>
+const T& max(const T& x, const T& y) {
+       return std::max(x, y);
+}
+
+template<class T, typename std::enable_if<std::is_floating_point<T>::value, 
bool>::type = 0>
+T max(const T& x, const T& y) {
+       return std::fmax(x, y);
+}
+} // namespace Utils
+
+#endif //_MINMAX_H_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/src/application.cpp 
new/fips-3.3.1/src/application.cpp
--- old/fips-3.3.0/src/application.cpp  2018-08-10 14:49:36.000000000 +0200
+++ new/fips-3.3.1/src/application.cpp  2019-03-05 09:09:51.000000000 +0100
@@ -24,7 +24,6 @@
 
 #include <application.h>
 #include <instance.h>
-#include <mainwindow.h>
 
 Application::Application(int &argc, char **argv):
        QApplication(argc, argv) {
@@ -52,26 +51,29 @@
 }
 Application::~Application() = default;
 
-void Application::addInstance(const QString& filename) {
-       new Instance(&root_, filename);
-}
-
-std::size_t Application::openFile() {
-       QString filename = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open 
FITS file"));
-
-       if (filename.isEmpty()) return 0;
-
+std::size_t Application::addInstance(const QString& filename) {
        try {
-               Application::instance()->addInstance(filename);
+               new Instance(&root_, filename);
 
                return 1;
        } catch (const std::exception& e) {
-               QMessageBox::critical(Q_NULLPTR, "An error occured", e.what());
+               QMessageBox::critical(
+                               Q_NULLPTR, "An error occured",
+                               filename + tr("<br/><br/>") + e.what()
+               );
        }
 
        return 0;
 }
 
+std::size_t Application::openFile() {
+       QString filename = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open 
FITS file"));
+
+       if (filename.isEmpty()) return 0;
+
+       return Application::instance()->addInstance(filename);
+}
+
 #ifdef Q_OS_MAC
 bool Application::event(QEvent *event) {
        if (event->type() == QEvent::FileOpen) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/src/utils/exception.cpp 
new/fips-3.3.1/src/utils/exception.cpp
--- old/fips-3.3.0/src/utils/exception.cpp      2018-08-10 14:49:36.000000000 
+0200
+++ new/fips-3.3.1/src/utils/exception.cpp      2019-03-05 09:09:51.000000000 
+0100
@@ -20,7 +20,7 @@
 
 namespace Utils {
 
-Exception::Exception(const QString& what): what_(what) {
+Exception::Exception(const QString& what): what_(what.toLatin1()) {
 }
 
 void Exception::raise() const {
@@ -32,7 +32,7 @@
 }
 
 const char* Exception::what() const noexcept {
-       return what_.toLatin1().constData();
+       return what_.constData();
 }
 
 } //Utils
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fips-3.3.0/test/utils/minmax.cpp 
new/fips-3.3.1/test/utils/minmax.cpp
--- old/fips-3.3.0/test/utils/minmax.cpp        1970-01-01 01:00:00.000000000 
+0100
+++ new/fips-3.3.1/test/utils/minmax.cpp        2019-03-05 09:09:51.000000000 
+0100
@@ -0,0 +1,93 @@
+#include <cmath>
+#include <limits>
+#include <QtTest/QtTest>
+#include <utils/minmax.h>
+
+class TestMinMax: public QObject
+{
+       Q_OBJECT
+private slots:
+       void min8();
+       void min32_signed();
+       void min32_float();
+       void min64_float();
+       void max8();
+       void max32_signed();
+       void max32_float();
+       void max64_float();
+};
+
+void TestMinMax::min8() {
+       quint8 a = 0;
+       quint8 b = 1;
+       QCOMPARE(Utils::min(a, b), a);
+       QCOMPARE(Utils::min(b, a), a);
+}
+
+void TestMinMax::min32_signed() {
+       qint32 a = 0;
+       qint32 b = 1;
+       QCOMPARE(Utils::min(a, b), a);
+       QCOMPARE(Utils::min(b, a), a);
+}
+
+void TestMinMax::min32_float() {
+       float a = 0;
+       float b = 1;
+       float nan = NAN;
+       QCOMPARE(Utils::min(a, b), a);
+       QCOMPARE(Utils::min(b, a), a);
+       QCOMPARE(Utils::min(a, nan), a);
+       QCOMPARE(Utils::min(nan, a), a);
+       QVERIFY(std::isnan(Utils::min(nan, nan)));
+}
+
+void TestMinMax::min64_float() {
+       double a = 0;
+       double b = 1;
+       double nan = NAN;
+       QCOMPARE(Utils::min(a, b), a);
+       QCOMPARE(Utils::min(b, a), a);
+       QCOMPARE(Utils::min(a, nan), a);
+       QCOMPARE(Utils::min(nan, a), a);
+       QVERIFY(std::isnan(Utils::min(nan, nan)));
+}
+
+void TestMinMax::max8() {
+       quint8 a = 1;
+       quint8 b = 0;
+       QCOMPARE(Utils::max(a, b), a);
+       QCOMPARE(Utils::max(b, a), a);
+}
+
+void TestMinMax::max32_signed() {
+       qint32 a = 1;
+       qint32 b = 0;
+       QCOMPARE(Utils::max(a, b), a);
+       QCOMPARE(Utils::max(b, a), a);
+}
+
+void TestMinMax::max32_float() {
+       float a = 1;
+       float b = 0;
+       float nan = std::numeric_limits<float>::quiet_NaN();
+       QCOMPARE(Utils::max(a, b), a);
+       QCOMPARE(Utils::max(b, a), a);
+       QCOMPARE(Utils::max(a, nan), a);
+       QCOMPARE(Utils::max(nan, a), a);
+       QVERIFY(std::isnan(Utils::max(nan, nan)));
+}
+
+void TestMinMax::max64_float() {
+       double a = 1;
+       double b = 0;
+       double nan = std::numeric_limits<double>::quiet_NaN();
+       QCOMPARE(Utils::max(a, b), a);
+       QCOMPARE(Utils::max(b, a), a);
+       QCOMPARE(Utils::max(a, nan), a);
+       QCOMPARE(Utils::max(nan, a), a);
+       QVERIFY(std::isnan(Utils::max(nan, nan)));
+}
+
+QTEST_MAIN(TestMinMax)
+#include "minmax.moc"


Reply via email to