File fix-compile-warnings.patch of Package openms

From 71ab0a79a6d43a8098322dfc11cb6ddb577687a4 Mon Sep 17 00:00:00 2001
From: Timo Sachsenberg <timo.sachsenberg@uni-tuebingen.de>
Date: Tue, 22 Feb 2022 07:22:14 +0000
Subject: [PATCH 1/3] fix some compile warnings

---
 .../OpenMS/MATH/STATISTICS/StatisticFunctions.h       | 11 ++++-------
 .../source/VISUAL/APPLICATIONS/TOPPViewBase.cpp       |  4 ++--
 src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp     |  8 ++++----
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/openms/include/OpenMS/MATH/STATISTICS/StatisticFunctions.h b/src/openms/include/OpenMS/MATH/STATISTICS/StatisticFunctions.h
index cac8c83c465..d0b116092a6 100644
--- a/src/openms/include/OpenMS/MATH/STATISTICS/StatisticFunctions.h
+++ b/src/openms/include/OpenMS/MATH/STATISTICS/StatisticFunctions.h
@@ -671,10 +671,7 @@ namespace OpenMS
     template<typename T>
     struct SummaryStatistics
     {
-      SummaryStatistics()
-        :mean(0), variance(0), min(0), lowerq(0), median(0), upperq(0), max(0)
-      {
-      }
+      SummaryStatistics() = default;
 
       // Ctor with data
       SummaryStatistics(T& data)
@@ -698,9 +695,9 @@ namespace OpenMS
         }
       }
 
-      double mean, variance, lowerq, median, upperq;
-      typename T::value_type min, max;
-      size_t count;
+      double mean = 0, variance = 0 , lowerq = 0, median = 0, upperq = 0;
+      typename T::value_type min = 0, max = 0;
+      size_t count = 0;
     };
 
   }   // namespace Math
diff --git a/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp b/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
index cb9ebae2612..41656c98863 100644
--- a/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
+++ b/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
@@ -1489,8 +1489,8 @@ namespace OpenMS
     if (!ws_.currentSubWindow())
     {
       // TODO think about using lastActivatedSubwindow_
-      const auto id = tab_bar_.currentIndex();
-      if (id < (Size) ws_.subWindowList().size())
+      const int id = tab_bar_.currentIndex(); 
+      if (id < ws_.subWindowList().size())
       {
         return qobject_cast<PlotWidget*>(ws_.subWindowList()[id]->widget());
       }
diff --git a/src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp b/src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp
index 4902e00e8bd..568fe1bc53d 100644
--- a/src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp
+++ b/src/openms_gui/source/VISUAL/SpectraIDViewTab.cpp
@@ -251,6 +251,7 @@ namespace OpenMS
         }
       }
     }
+    return {};
   }
 
   void SpectraIDViewTab::openUniProtSiteWithAccession_(const QString& accession)
@@ -397,7 +398,7 @@ namespace OpenMS
     if (table_widget_->selectionModel()->selectedRows().empty())
     {
       // deselect whatever is currently shown
-      int last_spectrum_index = int(layer_->getCurrentSpectrumIndex());
+      layer_->getCurrentSpectrumIndex();
       // Deselecting spectrum does not do what you think it does. It still paints stuff. Without annotations..
       // so just leave it for now.
       //
@@ -1016,9 +1017,8 @@ namespace OpenMS
     }
   }
 
-  void SpectraIDViewTab::updatedSingleProteinCell_(QTableWidgetItem* item)
-  {
-    
+  void SpectraIDViewTab::updatedSingleProteinCell_(QTableWidgetItem* /*item*/)
+  {    
   }
 
   // Upon changes in the table data (only possible by checking or unchecking a checkbox right now),

From bd41ade6f196d625f76a6e3aaaee5222c0a1e5e8 Mon Sep 17 00:00:00 2001
From: Timo Sachsenberg <timo.sachsenberg@uni-tuebingen.de>
Date: Tue, 22 Feb 2022 08:13:29 +0000
Subject: [PATCH 2/3] remove from header as well

---
 src/openms_gui/include/OpenMS/VISUAL/SpectraIDViewTab.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/openms_gui/include/OpenMS/VISUAL/SpectraIDViewTab.h b/src/openms_gui/include/OpenMS/VISUAL/SpectraIDViewTab.h
index b0edfcea74d..4166878daa1 100644
--- a/src/openms_gui/include/OpenMS/VISUAL/SpectraIDViewTab.h
+++ b/src/openms_gui/include/OpenMS/VISUAL/SpectraIDViewTab.h
@@ -135,7 +135,7 @@ namespace OpenMS
     void currentSpectraSelectionChanged_();
 
     /// update ProteinHits, when data in the table changes (status of checkboxes)
-    void updatedSingleProteinCell_(QTableWidgetItem* item);
+    void updatedSingleProteinCell_(QTableWidgetItem* /*item*/);
     /// Protein Cell clicked in protein_table_widget; emits which protein (row) was clicked, and may show additional data
     void proteinCellClicked_(int row, int column);
   };

From 4945e8860ff8729dc1bb2e2fd0704a82f8282af8 Mon Sep 17 00:00:00 2001
From: Timo Sachsenberg <timo.sachsenberg@uni-tuebingen.de>
Date: Tue, 22 Feb 2022 11:53:39 +0100
Subject: [PATCH 3/3] Update TOPPViewBase.cpp

---
 .../source/VISUAL/APPLICATIONS/TOPPViewBase.cpp       | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp b/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
index 41656c98863..25e40bcbd4a 100644
--- a/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
+++ b/src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp
@@ -1489,12 +1489,11 @@ namespace OpenMS
     if (!ws_.currentSubWindow())
     {
       // TODO think about using lastActivatedSubwindow_
-      const int id = tab_bar_.currentIndex(); 
-      if (id < ws_.subWindowList().size())
-      {
-        return qobject_cast<PlotWidget*>(ws_.subWindowList()[id]->widget());
-      }
-      return nullptr;
+      const int id = tab_bar_.currentIndex();
+
+      if (id < 0 || id >= ws_.subWindowList().size()) return nullptr;
+      
+      return qobject_cast<PlotWidget*>(ws_.subWindowList()[id]->widget());
     }
     return qobject_cast<PlotWidget*>(ws_.currentSubWindow()->widget());
   }
openSUSE Build Service is sponsored by