Skip to content

Commit

Permalink
coverity uninits - Geometry, DataObjects, 1075379-1075386, re #11829
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed May 26, 2015
1 parent da2ffcc commit 03e041f
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 209 deletions.
28 changes: 14 additions & 14 deletions Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/Peak.h
Expand Up @@ -146,10 +146,10 @@ class DLLExport Peak : public API::IPeak {
Geometry::IDetector_const_sptr m_det;

/// Name of the parent bank
std::string m_BankName;
std::string m_bankName;

/// ID of the detector
int m_DetectorID;
int m_detectorID;

/// H of the peak
double m_H;
Expand All @@ -161,19 +161,19 @@ class DLLExport Peak : public API::IPeak {
double m_L;

/// Integrated peak intensity
double m_Intensity;
double m_intensity;

/// Error (sigma) on peak intensity
double m_SigmaIntensity;
double m_sigmaIntensity;

/// Count in the bin at the peak
double m_BinCount;
double m_binCount;

/// Initial energy of neutrons at the peak
double m_InitialEnergy;
double m_initialEnergy;

/// Final energy of the neutrons at peak (normally same as m_InitialEnergy)
double m_FinalEnergy;
double m_finalEnergy;

/// Orientation matrix of the goniometer angles.
Mantid::Kernel::Matrix<double> m_GoniometerMatrix;
Expand All @@ -183,16 +183,16 @@ class DLLExport Peak : public API::IPeak {
Mantid::Kernel::Matrix<double> m_InverseGoniometerMatrix;

/// Originating run number for this peak
int m_RunNumber;
int m_runNumber;

/// Integrated monitor count over TOF range for this run
double m_MonitorCount;
double m_monitorCount;

/// Cached row in the detector
int m_Row;
int m_row;

/// Cached column in the detector
int m_Col;
int m_col;

/// Cached source position
Mantid::Kernel::V3D sourcePos;
Expand All @@ -202,9 +202,9 @@ class DLLExport Peak : public API::IPeak {
Mantid::Kernel::V3D detPos;

/// save values before setHKL is called for use in SortHKL
double orig_H;
double orig_K;
double orig_L;
double m_orig_H;
double m_orig_K;
double m_orig_L;

/// List of contributing detectors IDs
std::set<int> m_detIDs;
Expand Down
380 changes: 196 additions & 184 deletions Code/Mantid/Framework/DataObjects/src/Peak.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Code/Mantid/Framework/DataObjects/src/Workspace2D.cpp
Expand Up @@ -17,7 +17,7 @@ using std::size_t;
DECLARE_WORKSPACE(Workspace2D)

/// Constructor
Workspace2D::Workspace2D() {}
Workspace2D::Workspace2D(): m_noVectors(0) {}

/// Destructor
Workspace2D::~Workspace2D() {
Expand Down
Expand Up @@ -61,7 +61,8 @@ struct GoniometerAxis {
double initangle, int initsense, int initangleunit)
: name(initname), rotationaxis(initrotationaxis), angle(initangle),
sense(initsense), angleunit(initangleunit) {}
GoniometerAxis() : name("") {}
GoniometerAxis()
: name(""), rotationaxis(), angle(0.), sense(0), angleunit(0) {}

void saveNexus(::NeXus::File *file, const std::string &group) const;
void loadNexus(::NeXus::File *file, const std::string &group);
Expand Down
Expand Up @@ -37,8 +37,8 @@ template <typename T> class MDDimensionExtents {
/** Empty constructor - reset everything.
* */
// ---- Public members ----------
MDDimensionExtents() : min(1e30f), max(-1e30f) {}
T getSize() const { return m_Size; }
MDDimensionExtents() : min(1e30f), max(-1e30f), m_size(0.0f) {}
T getSize() const { return m_size; }
T getCentre() const { return static_cast<T>(0.5 * (max + min)); }
bool outside(T x) const { return ((x < min) || (x >= max)); }
bool isUndefined() const { return (min > max); }
Expand All @@ -51,13 +51,13 @@ template <typename T> class MDDimensionExtents {
T getMax() const { return max; }
/// return the vertice in the grid, based on this extent's size
T getGridVertex(const size_t ind) const {
return min + m_Size * static_cast<T>(ind);
return min + m_size * static_cast<T>(ind);
}

void scaleExtents(double scaling, double offset) {
min = static_cast<T>(min * scaling + offset);
max = static_cast<T>(max * scaling + offset);
m_Size = static_cast<T>(m_Size * scaling);
m_size = static_cast<T>(m_size * scaling);
}
// it looks like this loses accuracy?
void expand(MDDimensionExtents &other) {
Expand All @@ -70,13 +70,13 @@ template <typename T> class MDDimensionExtents {

other.max = static_cast<T>(dMax);
other.min = static_cast<T>(dMin);
other.m_Size = static_cast<T>(dMax - dMin);
other.m_size = static_cast<T>(dMax - dMin);
}

void setExtents(double dMin, double dMax) {
min = static_cast<T>(dMin);
max = static_cast<T>(dMax);
m_Size = static_cast<T>(dMax - dMin);
m_size = static_cast<T>(dMax - dMin);
}
// private:
private:
Expand All @@ -87,7 +87,7 @@ template <typename T> class MDDimensionExtents {
/// the box size; It is important to have box size defined from doubles to
/// avoid accuracy loss
/// when extracting two large float numbers min and max
T m_Size;
T m_size;
};

#pragma pack(pop) // Return to default packing size
Expand Down
Expand Up @@ -91,7 +91,7 @@ class MANTID_GEOMETRY_DLL ConvexPolygon {

protected:
/// Default constructor
ConvexPolygon() : m_numVertices(0), m_head(NULL) {}
ConvexPolygon();
/// Setup the meta-data
void setup();
/// The size of the polygon
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/Framework/Geometry/src/Instrument/Component.cpp
Expand Up @@ -15,7 +15,8 @@ using Kernel::Quat;
* @param map :: a ParameterMap to parameterize the component
*/
Component::Component(const IComponent *base, const ParameterMap *map)
: m_base(dynamic_cast<const Component *>(base)), m_map(map) {
: m_parent(NULL), m_base(dynamic_cast<const Component *>(base)),
m_map(map) {
if (!m_base) {
throw std::invalid_argument(
"Component::Component() - Cannot construct a "
Expand Down
7 changes: 7 additions & 0 deletions Code/Mantid/Framework/Geometry/src/Math/ConvexPolygon.cpp
Expand Up @@ -68,6 +68,13 @@ ConvexPolygon::ConvexPolygon(const ConvexPolygon &rhs) {
}
}

/**
* Default (no parameters) constructor
*/
ConvexPolygon::ConvexPolygon()
: m_numVertices(0), m_head(NULL), m_lowestX(0.), m_highestX(0.),
m_lowestY(0.), m_highestY(0.) {}

/**
* Destructor
*/
Expand Down

0 comments on commit 03e041f

Please sign in to comment.