V1028 Possible overflow. Consider casting operands, not the result
This commit is contained in:
@@ -661,7 +661,7 @@ std::size_t PlyReader::readHeader(std::istream& in,
|
||||
{
|
||||
std::string line, element;
|
||||
std::vector<std::string> list;
|
||||
std::size_t points = 0;
|
||||
std::size_t numPoints = 0;
|
||||
// a pair of numbers of elements and the total size of the properties
|
||||
std::vector<std::pair<std::size_t, std::size_t> > count_props;
|
||||
|
||||
@@ -720,11 +720,11 @@ std::size_t PlyReader::readHeader(std::istream& in,
|
||||
std::size_t count = boost::lexical_cast<std::size_t>(list[2]);
|
||||
if (name == "vertex") {
|
||||
element = name;
|
||||
points = count;
|
||||
numPoints = count;
|
||||
}
|
||||
else {
|
||||
// if another element than 'vertex' comes first then calculate the offset
|
||||
if (points == 0) {
|
||||
if (numPoints == 0) {
|
||||
count_props.push_back(std::make_pair(count, 0));
|
||||
}
|
||||
else {
|
||||
@@ -817,7 +817,7 @@ std::size_t PlyReader::readHeader(std::istream& in,
|
||||
}
|
||||
}
|
||||
|
||||
return points;
|
||||
return numPoints;
|
||||
}
|
||||
|
||||
void PlyReader::readAscii(std::istream& inp, std::size_t offset, Eigen::MatrixXd& data)
|
||||
@@ -1169,10 +1169,13 @@ std::size_t PcdReader::readHeader(std::istream& in,
|
||||
}
|
||||
}
|
||||
|
||||
std::size_t w = static_cast<std::size_t>(this->width);
|
||||
std::size_t h = static_cast<std::size_t>(this->height);
|
||||
std::size_t size = w * h;
|
||||
if (fields.size() != sizes.size() ||
|
||||
fields.size() != types.size() ||
|
||||
fields.size() != counts.size() ||
|
||||
points != static_cast<std::size_t>(this->width * this->height)) {
|
||||
points != size) {
|
||||
throw Base::BadFormatError("");
|
||||
}
|
||||
|
||||
|
||||
@@ -819,7 +819,9 @@ void BSplineParameterCorrection::Init()
|
||||
|
||||
void BSplineParameterCorrection::SetUKnots(const std::vector<double>& afKnots)
|
||||
{
|
||||
if (afKnots.size() != static_cast<std::size_t>(_usUCtrlpoints+_usUOrder))
|
||||
std::size_t numPoints = static_cast<std::size_t>(_usUCtrlpoints);
|
||||
std::size_t order = static_cast<std::size_t>(_usUOrder);
|
||||
if (afKnots.size() != (numPoints + order))
|
||||
return;
|
||||
|
||||
unsigned usUMax = _usUCtrlpoints-_usUOrder+1;
|
||||
@@ -837,7 +839,9 @@ void BSplineParameterCorrection::SetUKnots(const std::vector<double>& afKnots)
|
||||
|
||||
void BSplineParameterCorrection::SetVKnots(const std::vector<double>& afKnots)
|
||||
{
|
||||
if (afKnots.size() != static_cast<std::size_t>(_usVCtrlpoints+_usVOrder))
|
||||
std::size_t numPoints = static_cast<std::size_t>(_usVCtrlpoints);
|
||||
std::size_t order = static_cast<std::size_t>(_usVOrder);
|
||||
if (afKnots.size() != (numPoints + order))
|
||||
return;
|
||||
|
||||
unsigned usVMax = _usVCtrlpoints-_usVOrder+1;
|
||||
|
||||
Reference in New Issue
Block a user