diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ExtractSpectra.h b/Framework/Algorithms/inc/MantidAlgorithms/ExtractSpectra.h index 60f9e65fc4f674b2fba6147f57b71c5542ed5d23..eda7d0939fa56808b607aca9dd59aba0359a3232 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/ExtractSpectra.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/ExtractSpectra.h @@ -47,8 +47,8 @@ private: void execEvent(); void checkProperties(); - std::size_t getXMin(const int wsIndex = 0); - std::size_t getXMax(const int wsIndex = 0); + std::size_t getXMin(const size_t wsIndex = 0); + std::size_t getXMax(const size_t wsIndex = 0); void cropRagged(API::MatrixWorkspace_sptr outputWorkspace, int inIndex, int outIndex); @@ -72,4 +72,4 @@ private: } // namespace Algorithms } // namespace Mantid -#endif /* MANTID_ALGORITHMS_EXTRACTSPECTRA_H_ */ \ No newline at end of file +#endif /* MANTID_ALGORITHMS_EXTRACTSPECTRA_H_ */ diff --git a/Framework/Algorithms/src/ExtractSpectra.cpp b/Framework/Algorithms/src/ExtractSpectra.cpp index 38661d69145baa798d8afe15df8a1289c19ff077..216e46bc3a6aee87acee4e45b7d6fe29d9b7df27 100644 --- a/Framework/Algorithms/src/ExtractSpectra.cpp +++ b/Framework/Algorithms/src/ExtractSpectra.cpp @@ -377,11 +377,12 @@ void ExtractSpectra::checkProperties() { m_workspaceIndexList = getProperty("WorkspaceIndexList"); if (m_workspaceIndexList.empty()) { - int minSpec = getProperty("StartWorkspaceIndex"); - const int numberOfSpectra = - static_cast<int>(m_inputWorkspace->getNumberHistograms()); - int maxSpec = getProperty("EndWorkspaceIndex"); - if (isEmpty(maxSpec)) + int minSpec_i = getProperty("StartWorkspaceIndex"); + size_t minSpec = static_cast<size_t>(minSpec_i); + const size_t numberOfSpectra = m_inputWorkspace->getNumberHistograms(); + int maxSpec_i = getProperty("EndWorkspaceIndex"); + size_t maxSpec = static_cast<size_t>(maxSpec_i); + if (isEmpty(maxSpec_i)) maxSpec = numberOfSpectra - 1; // Check 'StartSpectrum' is in range 0-numberOfSpectra @@ -409,7 +410,7 @@ void ExtractSpectra::checkProperties() { } // get the x-range from the used spectra - int spectrumIndex = 0; // default is just look at the initial spectrum + size_t spectrumIndex = 0; // default is just look at the initial spectrum if (!m_workspaceIndexList.empty()) spectrumIndex = m_workspaceIndexList.front(); // or the first one being extracted @@ -441,7 +442,7 @@ void ExtractSpectra::checkProperties() { * @param wsIndex The workspace index to check (default 0). * @return The X index corresponding to the XMin value. */ -size_t ExtractSpectra::getXMin(const int wsIndex) { +size_t ExtractSpectra::getXMin(const size_t wsIndex) { double minX_val = getProperty("XMin"); size_t xIndex = 0; if (!isEmpty(minX_val)) { // A value has been passed to the algorithm, check @@ -468,7 +469,7 @@ size_t ExtractSpectra::getXMin(const int wsIndex) { * @param wsIndex The workspace index to check (default 0). * @return The X index corresponding to the XMax value. */ -size_t ExtractSpectra::getXMax(const int wsIndex) { +size_t ExtractSpectra::getXMax(const size_t wsIndex) { const auto &X = m_inputWorkspace->x(wsIndex); size_t xIndex = X.size(); // get the value that the user entered if they entered one at all