Commit 13cdcd07 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Start Fixing cpp-check 1.71 warnings.

parent 17e1e07b
......@@ -41,7 +41,8 @@ const std::string WORKSPACE_TYPES_SEPARATOR = ";";
class WorkspacePropertyValueIs {
public:
WorkspacePropertyValueIs(const std::string &value) : m_value(value){};
explicit WorkspacePropertyValueIs(const std::string &value)
: m_value(value){};
bool operator()(IWorkspaceProperty *property) {
Property *prop = dynamic_cast<Property *>(property);
if (!prop)
......@@ -1427,7 +1428,7 @@ struct AsyncFlagHolder {
/** Constructor
* @param A :: reference to the running flag
*/
AsyncFlagHolder(bool &running_flag) : m_running_flag(running_flag) {
explicit AsyncFlagHolder(bool &running_flag) : m_running_flag(running_flag) {
m_running_flag = true;
}
/// Destructor
......
......@@ -308,7 +308,7 @@ namespace {
*/
class AttValue : public IFunction::ConstAttributeVisitor<std::string> {
public:
AttValue(bool quoteString = false)
explicit AttValue(bool quoteString = false)
: IFunction::ConstAttributeVisitor<std::string>(),
m_quoteString(quoteString) {}
......@@ -539,7 +539,7 @@ public:
* Constructor
* @param value :: The value to set
*/
SetValue(const std::string &value) : m_value(value) {}
explicit SetValue(const std::string &value) : m_value(value) {}
protected:
/// Apply if string
......
......@@ -14,7 +14,7 @@ Mantid::Kernel::Logger g_log("NumericAxis");
class EqualWithinTolerance {
public:
EqualWithinTolerance(double tolerance) : m_tolerance(tolerance){};
explicit EqualWithinTolerance(double tolerance) : m_tolerance(tolerance){};
bool operator()(double a, double b) {
if (boost::math::isnan(a) && boost::math::isnan(b))
return true;
......
......@@ -333,7 +333,7 @@ class ReferenceEqual {
public:
/** Constructor
*/
ReferenceEqual(size_t i) : m_i(i) {}
explicit ReferenceEqual(size_t i) : m_i(i) {}
/**Bracket operator
* @param p :: the parameter you are looking for
* @return True if found
......
......@@ -30,7 +30,7 @@ namespace { // anonymous namespace
/// Applies the equation d=(TOF-tzero)/difc
struct func_difc_only {
func_difc_only(const double difc) : factor(1. / difc) {}
explicit func_difc_only(const double difc) : factor(1. / difc) {}
double operator()(const double tof) const { return factor * tof; }
......@@ -77,7 +77,7 @@ struct func_difa {
class ConversionFactors {
public:
ConversionFactors(ITableWorkspace_const_sptr table) {
explicit ConversionFactors(ITableWorkspace_const_sptr table) {
m_difcCol = table->getColumn("difc");
m_difaCol = table->getColumn("difa");
m_tzeroCol = table->getColumn("tzero");
......
......@@ -134,7 +134,7 @@ void FilterByLogValue::exec() {
// Find the start and stop times of the run, but handle it if they are not
// found.
DateAndTime run_start(0), run_stop("2100-01-01T00:00:00");
double handle_edge_values = false;
bool handle_edge_values = false;
try {
run_start = inputWS->getFirstPulseTime() - tolerance;
run_stop = inputWS->getLastPulseTime() + tolerance;
......
......@@ -532,11 +532,11 @@ double GetEi2::calculatePeakWidthAtHalfHeight(
int64_t ipk_int = static_cast<int64_t>(iPeak) -
im; // ! peak position in internal array
double hby2 = 0.5 * peak_y[ipk_int];
int64_t ip1(0), ip2(0);
double xp_hh(0);
int64_t nyvals = static_cast<int64_t>(peak_y.size());
if (peak_y[nyvals - 1] < hby2) {
int64_t ip1(0), ip2(0);
for (int64_t i = ipk_int; i < nyvals; ++i) {
if (peak_y[i] < hby2) {
// after this point the intensity starts to go below half-height
......@@ -569,9 +569,9 @@ double GetEi2::calculatePeakWidthAtHalfHeight(
xp_hh = peak_x[nyvals - 1];
}
int64_t im1(0), im2(0);
double xm_hh(0);
if (peak_y[0] < hby2) {
int64_t im1(0), im2(0);
for (int64_t i = ipk_int; i >= 0; --i) {
if (peak_y[i] < hby2) {
im1 = i + 1; // ! after this point the intensity starts to go below
......
......@@ -67,7 +67,8 @@ private:
std::vector<int> m_indexes;
public:
AdditionCommand(const std::vector<int> &indexes) : m_indexes(indexes) {}
explicit AdditionCommand(const std::vector<int> &indexes)
: m_indexes(indexes) {}
virtual MatrixWorkspace_sptr execute(MatrixWorkspace_sptr inputWS) const {
MatrixWorkspace_sptr outWS;
......@@ -97,7 +98,7 @@ private:
std::vector<int> m_indexes;
public:
CropCommand(const std::vector<int> &indexes) : m_indexes(indexes) {}
explicit CropCommand(const std::vector<int> &indexes) : m_indexes(indexes) {}
MatrixWorkspace_sptr execute(MatrixWorkspace_sptr inputWS) const {
......
......@@ -24,7 +24,7 @@ private:
double m_offSet;
public:
ConvertToRelativeTime(const DateAndTime &offSet)
explicit ConvertToRelativeTime(const DateAndTime &offSet)
: m_offSet(static_cast<double>(offSet.totalNanoseconds()) * 1e-9) {}
MantidVec::value_type operator()(const MantidVec::value_type &absTNanoSec) {
return (absTNanoSec * 1e-9) - m_offSet;
......
......@@ -50,6 +50,7 @@ void Segfault::exec() {
if (!dryrun) {
// NULL pointer dereference
int *ptr = NULL;
// cppcheck-suppress nullPointer
*ptr = 1;
}
}
......
......@@ -10,7 +10,7 @@ private:
size_t m_label;
public:
Comparitor(const size_t &label) : m_label(label) {}
explicit Comparitor(const size_t &label) : m_label(label) {}
bool operator()(
const boost::shared_ptr<Mantid::Crystal::ICluster> &pCluster) const {
return pCluster->containsLabel(m_label);
......
......@@ -36,7 +36,7 @@ void Abragam::function1D(double *out, const double *xValues,
for (size_t i = 0; i < nData; i++) {
double A1 = A * cos(w * xValues[i] + phi);
double A2 =
-(sig * sig * t * t) * (exp(-xValues[i] / t) - 1 + (xValues[i] / t));
-(sig * sig * t * t) * (expm1(-xValues[i] / t) + (xValues[i] / t));
double A3 = exp(A2);
out[i] = A1 * A3;
......
......@@ -677,9 +677,8 @@ public:
file.closeData();
// determine the range of pixel ids
uint32_t temp;
for (auto i = 0; i < m_loadSize[0]; ++i) {
temp = m_event_id[i];
uint32_t temp = m_event_id[i];
if (temp < m_min_id)
m_min_id = temp;
if (temp > m_max_id)
......
......@@ -457,11 +457,8 @@ void LoadISISNexus2::checkOptionalProperties(
m_load_selected_spectra = true;
}
int64_t spec_min(0);
int64_t spec_max(EMPTY_INT());
//
spec_min = getProperty("SpectrumMin");
spec_max = getProperty("SpectrumMax");
int64_t spec_min = getProperty("SpectrumMin");
int64_t spec_max = getProperty("SpectrumMax");
// default spectra ID-s would not work if spectraID_min!=1
if (m_loadBlockInfo.spectraID_min != 1) {
......
......@@ -1044,7 +1044,6 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) {
// Coordinates - Older versions did not have the separate field but used a log
// value
uint32_t loadCoord(0);
const std::string peaksWSName = "peaks_workspace";
try {
m_cppFile->openGroup(peaksWSName, "NXentry");
......@@ -1055,6 +1054,7 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) {
peaksWSName + ". Lower level error description: " + re.what());
}
try {
uint32_t loadCoord(0);
m_cppFile->readData("coordinate_system", loadCoord);
peakWS->setCoordinateSystem(
static_cast<Kernel::SpecialCoordinateSystem>(loadCoord));
......
......@@ -343,7 +343,7 @@ public:
int size_check();
ISISRAW();
virtual ~ISISRAW();
ISISRAW(ISISCRPT_STRUCT *crpt);
explicit ISISRAW(ISISCRPT_STRUCT *crpt);
ISISRAW(ISISCRPT_STRUCT *crpt, bool doUpdateFromCRPT);
int updateFromCRPT();
......
......@@ -22,7 +22,7 @@ DECLARE_ALGORITHM(SaveGSASInstrumentFile)
class ChopperConfiguration {
public:
ChopperConfiguration(vector<int> bankids);
explicit ChopperConfiguration(vector<int> bankids);
ChopperConfiguration(const int freq, const std::string &bankidstr,
const std::string &cwlstr, const std::string &mndspstr,
const std::string &mxdspstr,
......
......@@ -4051,7 +4051,6 @@ void EventList::splitByFullTimeHelper(Kernel::TimeSplitterType &splitter,
// 1. Prepare to Iterate through the splitter at the same time
Kernel::TimeSplitterType::iterator itspl = splitter.begin();
Kernel::TimeSplitterType::iterator itspl_end = splitter.end();
int64_t start, stop;
// 2. Prepare to Iterate through all events (sorted by tof)
typename std::vector<T>::iterator itev = events.begin();
......@@ -4060,8 +4059,8 @@ void EventList::splitByFullTimeHelper(Kernel::TimeSplitterType &splitter,
// 3. This is the time of the first section. Anything before is thrown out.
while (itspl != itspl_end) {
// Get the splitting interval times and destination
start = itspl->start().totalNanoseconds();
stop = itspl->stop().totalNanoseconds();
int64_t start = itspl->start().totalNanoseconds();
int64_t stop = itspl->stop().totalNanoseconds();
const int index = itspl->index();
// a) Skip the events before the start of the time
......
......@@ -72,7 +72,7 @@ public:
* @param criteria : a vector with a list of pairs: column name, bool;
* where bool = true for ascending, false for descending sort.
*/
PeakComparator(std::vector<std::pair<std::string, bool>> &criteria)
explicit PeakComparator(std::vector<std::pair<std::string, bool>> &criteria)
: criteria(criteria) {}
/** Compare two peaks using the stored criteria */
......
......@@ -11,7 +11,7 @@ using namespace Kernel;
/// Small helper functor to calculate d-Values from a unit cell.
class LatticeSpacingCalculator {
public:
LatticeSpacingCalculator(const UnitCell &cell) : m_cell(cell) {}
explicit LatticeSpacingCalculator(const UnitCell &cell) : m_cell(cell) {}
double operator()(const V3D &hkl) { return m_cell.d(hkl); }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment