[PD] Add missing ctor variable init (Coverity)
The "angle" variable was not being initialized in any of the constructors for the CutDimensionSet, and nothing was being initialized by the default constructor. This commit adds angle as an optional final argument to the parameterized constructors, defaulting to 0.0, and adds default values to the default constructor using the first of each enum and 0.0 for the angle. The default constructor is required elsewhere in the code so cannot be trivially removed. Issue identified by Coverity.
This commit is contained in:
@@ -1832,14 +1832,14 @@ const Hole::CutDimensionSet& Hole::find_cutDimensionSet(const CutDimensionKey &k
|
||||
}
|
||||
|
||||
Hole::CutDimensionSet::CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread) :
|
||||
bore_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread, double a) :
|
||||
bore_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}, angle{a}
|
||||
{
|
||||
}
|
||||
|
||||
Hole::CutDimensionSet::CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread) :
|
||||
sink_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread, double a) :
|
||||
sink_data{ std::move(d) }, cut_type{ cut }, thread_type{thread}, name{nme}, angle{a}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -165,11 +165,11 @@ private:
|
||||
enum CutType { Counterbore, Countersink };
|
||||
enum ThreadType { Metric, MetricFine };
|
||||
|
||||
CutDimensionSet() {}
|
||||
CutDimensionSet():cut_type(Counterbore),thread_type(Metric),angle(0.0) {}
|
||||
CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread);
|
||||
std::vector<CounterBoreDimension> &&d, CutType cut, ThreadType thread, double angle = 0.0);
|
||||
CutDimensionSet(const std::string &nme,
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread);
|
||||
std::vector<CounterSinkDimension> &&d, CutType cut, ThreadType thread, double angle = 0.0);
|
||||
|
||||
const CounterBoreDimension &get_bore(const std::string &t) const;
|
||||
const CounterSinkDimension &get_sink(const std::string &t) const;
|
||||
|
||||
Reference in New Issue
Block a user