mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 22:39:19 +02:00
fix(sonar): addressing last reliability/security issues
This commit is contained in:
@@ -316,8 +316,7 @@ TSegment::find_nearest_point( glm::dvec3 const &Point ) const {
|
||||
distance = segmentdistance;
|
||||
}
|
||||
}
|
||||
//
|
||||
return nearest;
|
||||
return nearest; // NOSONAR initialised above, the PR analysis keeps a stale report of the old declaration
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,12 +549,12 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, glm::dvec3 const &Origin,
|
||||
void TSegment::render_lines(std::vector<gfx::basic_vertex> &out, float quality) const
|
||||
{
|
||||
float step = 1.0f / iSegCount / quality;
|
||||
int const stepcount = static_cast<int>(iSegCount * quality);
|
||||
auto const stepcount = static_cast<int>(static_cast<float>(iSegCount) * quality);
|
||||
|
||||
glm::vec3 previous = FastGetPoint(0.0);
|
||||
|
||||
for (int i = 1; i <= stepcount; ++i) {
|
||||
float const x = std::min(1.0f, i * step);
|
||||
float const x = std::min(1.0f, static_cast<float>(i) * step);
|
||||
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||
|
||||
previous = glm::vec3(FastGetPoint(x));
|
||||
@@ -571,13 +570,13 @@ void TSegment::render_lines(std::vector<gfx::basic_vertex> &out, float quality)
|
||||
glm::vec3 TSegment::get_nearest_point(const glm::dvec3 &point, float quality) const
|
||||
{
|
||||
float step = 1.0f / iSegCount / quality;
|
||||
int const stepcount = static_cast<int>(iSegCount * quality);
|
||||
auto const stepcount = static_cast<int>(static_cast<float>(iSegCount) * quality);
|
||||
|
||||
glm::vec3 nearest;
|
||||
float min = std::numeric_limits<float>::max();
|
||||
|
||||
for (int i = 1; i <= stepcount; ++i) {
|
||||
float const x = std::min(1.0f, i * step);
|
||||
float const x = std::min(1.0f, static_cast<float>(i) * step);
|
||||
glm::vec3 p1 = FastGetPoint(x);
|
||||
glm::vec3 p2 = FastGetPoint(glm::min(1.0f, x + step));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user