fix warnings

pull/3/head
Li Linfeng 2019-10-13 18:33:13 +08:00
parent f46c51d387
commit 7cff1728a3
9 changed files with 47 additions and 20 deletions

View File

@ -59,7 +59,7 @@ Body::~Body()
if(altSurfaces)
{
for (const auto s : *altSurfaces)
for (const auto &s : *altSurfaces)
delete s.second;
delete altSurfaces;
}

View File

@ -673,7 +673,7 @@ CurvePlot::setDuration(double duration)
* @param nearZ z coordinate of the near plane
* @param farZ z coordinate of the far plane
* @param viewFrustumPlaneNormals array of four normals (top, bottom, left, and right frustum planes)
* @param subdivisionThreshold
* @param subdivisionThreshold the threashhold for subdivision
*/
void
CurvePlot::render(const Affine3d& modelview,
@ -813,7 +813,7 @@ CurvePlot::render(const Affine3d& modelview,
* @param nearZ z coordinate of the near plane
* @param farZ z coordinate of the far plane
* @param viewFrustumPlaneNormals array of four normals (top, bottom, left, and right frustum planes)
* @param subdivisionThreshold
* @param subdivisionThreshold the threashhold for subdivision
* @param startTime the beginning of the time interval
* @param endTime the end of the time interval
*/
@ -977,7 +977,7 @@ CurvePlot::render(const Affine3d& modelview,
* @param nearZ z coordinate of the near plane
* @param farZ z coordinate of the far plane
* @param viewFrustumPlaneNormals array of four normals (top, bottom, left, and right frustum planes)
* @param subdivisionThreshold
* @param subdivisionThreshold the threashhold for subdivision
* @param startTime the beginning of the time interval
* @param endTime the end of the time interval
* @param fadeStartTime points on the curve before this time are drawn with full opacity

View File

@ -110,7 +110,7 @@ FrameTree::markUpdated()
if (m_changed)
{
m_changed = false;
for (const auto child : children)
for (const auto &child : children)
child->body()->markUpdated();
}
}
@ -132,7 +132,7 @@ FrameTree::recomputeBoundingSphere()
m_containsSecondaryIlluminators = false;
m_childClassMask = 0;
for (const auto phase : children)
for (const auto &phase : children)
{
double bodyRadius = phase->body()->getRadius();
double r = phase->body()->getCullingRadius() + phase->orbit()->getBoundingRadius();

View File

@ -314,7 +314,7 @@ AssociativeArray::~AssociativeArray()
iter++;
}
#endif
for (const auto iter : assoc)
for (const auto &iter : assoc)
delete iter.second;
}

View File

@ -25,7 +25,7 @@ class Rect
Filled = 0x0002,
};
Rect() = default;
Rect() = delete;
Rect(float _x, float _y, float _w, float _h) :
x(_x), y(_y), w(_w), h(_h)
{

View File

@ -6567,7 +6567,7 @@ void PointStarRenderer::process(const Star& star, float distance, float appMag)
Vector3d hPos = astrocentricPosition(observer->getPosition(),
star,
observer->getTime());
relPos = hPos.cast<float>() * -astro::kilometersToLightYears(1.0f),
relPos = hPos.cast<float>() * -astro::kilometersToLightYears(1.0f);
distance = relPos.norm();
// Recompute apparent magnitude using new distance computation

View File

@ -127,7 +127,7 @@ Timeline::markChanged()
}
else
{
for (const auto phase : phases)
for (const auto &phase : phases)
phase->getFrameTree()->markChanged();
}
}

View File

@ -2286,7 +2286,7 @@ class TitanOrbit : public CachingOrbit
double g = W4 - Om_ - psi;
// Three successive approximations will always be enough
double om;
double om = 0.0;
for (int n = 0; n < 3; n++)
{
om = W4 + 0.37515 * (sinD(2 * g) - sinD(2 * g0));

View File

@ -2586,13 +2586,25 @@ static void displayRotationPeriod(Overlay& overlay, double days)
const char *p;
if (days > 1.0)
n = FormattedNumber(days, 3, FormattedNumber::GroupThousands), p = _("days");
{
n = FormattedNumber(days, 3, FormattedNumber::GroupThousands);
p = _("days");
}
else if (days > 1.0 / 24.0)
n = FormattedNumber(days * 24.0, 3, FormattedNumber::GroupThousands), p = _("hours");
{
n = FormattedNumber(days * 24.0, 3, FormattedNumber::GroupThousands);
p = _("hours");
}
else if (days > 1.0 / (24.0 * 60.0))
n = FormattedNumber(days * 24.0 * 60.0, 3, FormattedNumber::GroupThousands), p = _("minutes");
{
n = FormattedNumber(days * 24.0 * 60.0, 3, FormattedNumber::GroupThousands);
p = _("minutes");
}
else
n = FormattedNumber(days * 24.0 * 60.0 * 60.0, 3, FormattedNumber::GroupThousands), p = _("seconds");
{
n = FormattedNumber(days * 24.0 * 60.0 * 60.0, 3, FormattedNumber::GroupThousands);
p = _("seconds");
}
fmt::fprintf(overlay, _("Rotation period: %s %s\n"), n, p);
}
@ -2603,15 +2615,30 @@ static void displaySpeed(Overlay& overlay, float speed)
const char *u;
if (speed < 1.0f)
n = SigDigitNum(speed * 1000.0f, 3), u = _("m/s");
{
n = SigDigitNum(speed * 1000.0f, 3);
u = _("m/s");
}
else if (speed < 10000.0f)
n = SigDigitNum(speed, 3), u = _("km/s");
{
n = SigDigitNum(speed, 3);
u = _("km/s");
}
else if (speed < (float) astro::speedOfLight * 100.0f)
n = SigDigitNum(speed / astro::speedOfLight, 3), u = "c";
{
n = SigDigitNum(speed / astro::speedOfLight, 3);
u = "c";
}
else if (speed < astro::AUtoKilometers(1000.0f))
n = SigDigitNum(astro::kilometersToAU(speed), 3), u = _("AU/s");
{
n = SigDigitNum(astro::kilometersToAU(speed), 3);
u = _("AU/s");
}
else
n = SigDigitNum(astro::kilometersToLightYears(speed), 3), u = _("ly/s");
{
n = SigDigitNum(astro::kilometersToLightYears(speed), 3);
u = _("ly/s");
}
fmt::fprintf(overlay, _("Speed: %s %s\n"), n, u);
}