Fix warnings reported by clang/gcc

pull/778/head
Hleb Valoshka 2020-03-29 10:35:03 +03:00
parent 0e1983f48a
commit 1c668d3d7f
63 changed files with 157 additions and 129 deletions

View File

@ -293,7 +293,10 @@ void recursive_directory_iterator::pop()
void recursive_directory_iterator::pop(std::error_code& ec)
{
m_dirs->m_dirIters.pop_back();
if (m_dirs->m_dirIters.empty())
ec = std::error_code(errno, std::system_category()); // filesystem_error
else
m_dirs->m_dirIters.pop_back();
}
void recursive_directory_iterator::reset()
@ -398,7 +401,12 @@ bool is_directory(const path& p, std::error_code& ec) noexcept
return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
#else
struct stat buf;
return (stat(p.c_str(), &buf) == 0) && S_ISDIR(buf.st_mode);
if (stat(p.c_str(), &buf) != 0)
{
ec = std::error_code(errno, std::system_category());
return false;
}
return S_ISDIR(buf.st_mode);
#endif
}

View File

@ -53,13 +53,13 @@ class path
path() noexcept
{
};
}
path(const path&) = default;
path(path&& p) noexcept :
m_path(std::move(p.m_path)),
m_fmt(p.m_fmt)
{
};
}
path(string_type&& p, format fmt = auto_format) :
m_path(std::move(p)),
m_fmt(fmt)
@ -67,7 +67,7 @@ class path
#ifdef _WIN32
fixup_separators();
#endif
};
}
template<typename T> path(const T& p, format fmt = auto_format ) :
m_path(encconv(p)),
m_fmt(fmt)
@ -75,7 +75,7 @@ class path
#ifdef _WIN32
fixup_separators();
#endif
};
}
~path() = default;
path& operator=(const path& p) = default;
path& operator=(path&&) = default;
@ -207,6 +207,7 @@ class path
#ifdef _WIN32
return p;
#else
(void)p;
return ""; // FIXME
#endif
}
@ -408,5 +409,5 @@ bool exists(const path& p, std::error_code& ec) noexcept;
bool is_directory(const path& p);
bool is_directory(const path& p, std::error_code& ec) noexcept;
};
};
}
}

View File

@ -235,7 +235,7 @@ namespace astro
extern const double SOLAR_IRRADIANCE;
extern const double SOLAR_POWER; // in Watts
};
}
// Convert a date structure to a Julian date

View File

@ -18,6 +18,8 @@ class AstroObject
{
AstroCatalog::IndexNumber m_mainIndexNumber { AstroCatalog::InvalidIndex };
public:
virtual ~AstroObject() = default;
AstroCatalog::IndexNumber getIndex() const { return m_mainIndexNumber; }
void setIndex(AstroCatalog::IndexNumber);

View File

@ -56,7 +56,7 @@ static size_t initArrowAndLetters(VertexObject &vo)
// head of the arrow
vector<Vector3f> head;
for (int i = 0; i <= nSections; i++)
for (unsigned i = 0; i <= nSections; i++)
{
float c, s;
sincos((i * 2.0f * (float)PI) / nSections, c, s);

View File

@ -45,7 +45,7 @@ constexpr const float DSO_OCTREE_MAGNITUDE = 8.0f;
//constexpr const float DSO_EXTRA_ROOM = 0.01f; // Reserve 1% capacity for extra DSOs
// (useful as a complement of binary loaded DSOs)
constexpr char FILE_HEADER[] = "CEL_DSOs";
//constexpr char FILE_HEADER[] = "CEL_DSOs";
// Used to sort DSO pointers by catalog number
struct PtrCatalogNumberOrderingPredicate
@ -223,7 +223,8 @@ bool DSODatabase::load(istream& in, const fs::path& resourcePath)
Parser parser(&tokenizer);
#ifdef ENABLE_NLS
const char *d = resourcePath.string().c_str();
string s = resourcePath.string();
const char *d = s.c_str();
bindtextdomain(d, d); // domain name is the same as resource path
#endif

View File

@ -105,7 +105,7 @@ static void GalaxyTextureEval(float u, float v, float /*w*/, unsigned char *pixe
pixel[3] = pixVal;
}
static void ColorTextureEval(float u, float v, float /*w*/, unsigned char *pixel)
static void ColorTextureEval(float u, float /*v*/, float /*w*/, unsigned char *pixel)
{
unsigned int i = (u*0.5f + 0.5f)*255.99f; // [-1, 1] -> [0, 255]
@ -286,7 +286,7 @@ void Galaxy::render(const Vector3f& offset,
struct GalaxyVertex
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Vector4f position;
Matrix<GLshort, 4, 1> texCoord; // texCoord.x = x, texCoord.y = y, texCoord.z = color index, texCoord.w = alpha

View File

@ -21,7 +21,9 @@ class Body;
class Location : public AstroObject
{
public:
virtual Selection toSelection();
~Location() override = default;
Selection toSelection() override;
std::string getName(bool i18n = false) const;
void setName(const std::string&);

View File

@ -6,7 +6,7 @@ uint32_t NameDatabase::getNameCount() const
return nameIndex.size();
}
void NameDatabase::add(const AstroCatalog::IndexNumber catalogNumber, const std::string& name, bool replaceGreek)
void NameDatabase::add(const AstroCatalog::IndexNumber catalogNumber, const std::string& name, bool /*replaceGreek*/)
{
if (name.length() != 0)
{

View File

@ -82,7 +82,7 @@ bool Nebula::load(AssociativeArray* params, const fs::path& resPath)
}
void Nebula::render(const Vector3f& offset,
void Nebula::render(const Vector3f& /*offset*/,
const Quaternionf& /*unused*/,
float /*unused*/,
float pixelSize,

View File

@ -120,7 +120,7 @@ Observer& Observer::operator=(const Observer& o)
double Observer::getTime() const
{
return simTime;
};
}
/*! Get the current real time. The time returned is a Julian date,
@ -129,7 +129,7 @@ double Observer::getTime() const
double Observer::getRealTime() const
{
return realTime;
};
}
/*! Set the simulation time (Julian date, TDB time standard)
@ -1263,7 +1263,7 @@ void Observer::gotoSurface(const Selection& sel, double duration)
UniversalCoord nearSurfacePoint = UniversalCoord::Zero().offsetKm(dir);
gotoLocation(nearSurfacePoint, q, duration);
};
}
void Observer::cancelMotion()

View File

@ -92,9 +92,18 @@ private:
ObjectList* _objects;
};
// make clang happy
#ifndef _MSC_VER
template<> DynamicOctree<Star, float>::ExclusionFactorDecayFunction* DynamicOctree<Star, float>::decayFunction;
template<> DynamicOctree<Star, float>::LimitingFactorPredicate* DynamicOctree<Star, float>::limitingFactorPredicate;
template<> DynamicOctree<Star, float>::StraddlingPredicate* DynamicOctree<Star, float>::straddlingPredicate;
template<> unsigned int DynamicOctree<Star, float>::SPLIT_THRESHOLD;
template<> DynamicOctree<DeepSkyObject*, double>::ExclusionFactorDecayFunction* DynamicOctree<DeepSkyObject*, double>::decayFunction;
template<> DynamicOctree<DeepSkyObject*, double>::LimitingFactorPredicate* DynamicOctree<DeepSkyObject *, double>::limitingFactorPredicate;
template<> DynamicOctree<DeepSkyObject*, double>::StraddlingPredicate* DynamicOctree<DeepSkyObject *, double>::straddlingPredicate;
template<> unsigned int DynamicOctree<DeepSkyObject*, double>::SPLIT_THRESHOLD;
#endif
template <class OBJ, class PREC> class StaticOctree
{

View File

@ -226,7 +226,7 @@ void Overlay::restorePos()
OverlayStreamBuf::OverlayStreamBuf()
{
setbuf(nullptr, 0);
};
}
void OverlayStreamBuf::setOverlay(Overlay* o)

View File

@ -92,8 +92,6 @@ class Overlay : public std::ostream
float xoffset{ 0.0f };
float yoffset{ 0.0f };
float lineWidth { 1.0f };
OverlayStreamBuf sbuf;
Renderer& renderer;

View File

@ -1831,7 +1831,7 @@ void renderPoint(const Renderer &renderer,
// object to smooth things out, making it dimmer as the disc size exceeds the
// max disc size.
void Renderer::renderObjectAsPoint(const Vector3f& position,
float radius,
float /*radius*/,
float appMag,
float _faintestMag,
float discSizeInPixels,

View File

@ -40,7 +40,7 @@ class FramebufferObject;
namespace celmath
{
class Frustum;
};
}
struct Matrices
{

View File

@ -42,11 +42,8 @@ using namespace celestia;
static
void renderGeometryShadow_GLSL(Geometry* geometry,
FramebufferObject* shadowFbo,
const RenderInfo& ri,
const LightingState& ls,
int lightIndex,
float geometryScale,
const Quaternionf& planetOrientation,
double tsec,
const Renderer* renderer,
Matrix4f *lightMatrix);
@ -337,9 +334,7 @@ void renderGeometry_GLSL(Geometry* geometry,
fmt::printf("bias: %f bits: %f clear: %f range: %f - %f, scale:%f\n", bias, bits, clear, range[0], range[1], scale);
#endif
renderGeometryShadow_GLSL(geometry, shadowBuffer,
ri, ls, 0, geometryScale,
planetOrientation,
renderGeometryShadow_GLSL(geometry, shadowBuffer, ls, 0,
tsec, renderer, &lightMatrix);
renderer->setViewport(viewport);
#ifdef DEPTH_BUFFER_DEBUG
@ -916,11 +911,8 @@ Matrix4f directionalLightMatrix(const Vector3f& lightDirection)
static
void renderGeometryShadow_GLSL(Geometry* geometry,
FramebufferObject* shadowFbo,
const RenderInfo& ri,
const LightingState& ls,
int lightIndex,
float geometryScale,
const Quaternionf& planetOrientation,
double tsec,
const Renderer* renderer,
Eigen::Matrix4f *lightMatrix)

View File

@ -467,7 +467,7 @@ ShaderTypeString(ShaderVariableType type)
default:
return "unknown";
}
};
}
static string
IndexedParameter(const char* name, unsigned int index0)
@ -485,8 +485,8 @@ IndexedParameter(const char* name, unsigned int index0, unsigned int index1)
class Sh_ExpressionContents
{
protected:
Sh_ExpressionContents() {}
virtual ~Sh_ExpressionContents() = default;;
Sh_ExpressionContents() = default;
virtual ~Sh_ExpressionContents() = default;
public:
virtual string toString() const = 0;
@ -769,64 +769,64 @@ private:
Sh_Expression vec2(const Sh_Expression& x, const Sh_Expression& y)
{
return new Sh_BinaryFunctionExpression("vec2", x, y);
};
}
Sh_Expression vec3(const Sh_Expression& x, const Sh_Expression& y, const Sh_Expression& z)
{
return new Sh_TernaryFunctionExpression("vec3", x, y, z);
};
}
Sh_Expression dot(const Sh_Expression& v0, const Sh_Expression& v1)
{
return new Sh_BinaryFunctionExpression("dot", v0, v1);
};
}
Sh_Expression cross(const Sh_Expression& v0, const Sh_Expression& v1)
{
return new Sh_BinaryFunctionExpression("cross", v0, v1);
};
}
Sh_Expression sqrt(const Sh_Expression& v0)
{
return new Sh_UnaryFunctionExpression("sqrt", v0);
};
}
Sh_Expression length(const Sh_Expression& v0)
{
return new Sh_UnaryFunctionExpression("length", v0);
};
}
Sh_Expression normalize(const Sh_Expression& v0)
{
return new Sh_UnaryFunctionExpression("normalize", v0);
};
}
Sh_Expression step(const Sh_Expression& f, const Sh_Expression& v)
{
return new Sh_BinaryFunctionExpression("step", f, v);
};
}
Sh_Expression mix(const Sh_Expression& v0, const Sh_Expression& v1, const Sh_Expression& alpha)
{
return new Sh_TernaryFunctionExpression("mix", v0, v1, alpha);
};
}
Sh_Expression texture2D(const Sh_Expression& sampler, const Sh_Expression& texCoord)
{
return new Sh_BinaryFunctionExpression("texture2D", sampler, texCoord);
};
}
Sh_Expression texture2DLod(const Sh_Expression& sampler, const Sh_Expression& texCoord, const Sh_Expression& lod)
{
return new Sh_TernaryFunctionExpression("texture2DLod", sampler, texCoord, lod);
};
}
Sh_Expression texture2DLodBias(const Sh_Expression& sampler, const Sh_Expression& texCoord, const Sh_Expression& lodBias)
{
// Use the optional third argument to texture2D to specify the LOD bias. Implemented with
// a different function name here for clarity when it's used in a shader.
return new Sh_TernaryFunctionExpression("texture2D", sampler, texCoord, lodBias);
};
}
Sh_Expression sampler2D(const string& name)
{
@ -3346,7 +3346,7 @@ CelestiaGLProgram::CelestiaGLProgram(GLProgram& _program,
{
initParameters();
initSamplers();
};
}
CelestiaGLProgram::CelestiaGLProgram(GLProgram& _program) :

View File

@ -324,7 +324,7 @@ void Simulation::getSelectionLongLat(double& distance,
void Simulation::gotoSurface(double duration)
{
activeObserver->gotoSurface(selection, duration);
};
}
void Simulation::cancelMotion()

View File

@ -1084,7 +1084,8 @@ bool LoadSolarSystemObjects(istream& in,
Parser parser(&tokenizer);
#ifdef ENABLE_NLS
const char* d = directory.string().c_str();
string s = directory.string();
const char* d = s.c_str();
bindtextdomain(d, d); // domain name is the same as resource path
#endif

View File

@ -33,11 +33,13 @@ using namespace celmath;
constexpr const char HDCatalogPrefix[] = "HD ";
constexpr const char HIPPARCOSCatalogPrefix[] = "HIP ";
constexpr const char TychoCatalogPrefix[] = "TYC ";
constexpr const char SAOCatalogPrefix[] = "SAO ";
#if 0
constexpr const char GlieseCatalogPrefix[] = "Gliese ";
constexpr const char RossCatalogPrefix[] = "Ross ";
constexpr const char LacailleCatalogPrefix[] = "Lacaille ";
constexpr const char TychoCatalogPrefix[] = "TYC ";
constexpr const char SAOCatalogPrefix[] = "SAO ";
#endif
// The size of the root star octree node is also the maximum distance
// distance from the Sun at which any star may be located. The current
@ -1165,7 +1167,8 @@ bool StarDatabase::load(istream& in, const fs::path& resourcePath)
Parser parser(&tokenizer);
#ifdef ENABLE_NLS
const char *d = resourcePath.string().c_str();
string s = resourcePath.string();
const char *d = s.c_str();
bindtextdomain(d, d); // domain name is the same as resource path
#endif

View File

@ -428,7 +428,6 @@ ImageTexture::ImageTexture(Image& img,
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
#endif
int internalFormat = getInternalFormat(img.getFormat());
bool genMipmaps = mipmap && !precomputedMipMaps;
#if !defined(GL_ES) && defined(NO_GLU)
@ -448,7 +447,7 @@ ImageTexture::ImageTexture(Image& img,
LoadMiplessTexture(img, GL_TEXTURE_2D);
#else
gluBuild2DMipmaps(GL_TEXTURE_2D,
internalFormat,
getInternalFormat(img.getFormat()),
getWidth(), getHeight(),
(GLenum) img.getFormat(),
GL_UNSIGNED_BYTE,
@ -546,7 +545,6 @@ TiledTexture::TiledTexture(Image& img,
mipmap = false;
GLenum texAddress = GetGLTexAddressMode(EdgeClamp);
int internalFormat = getInternalFormat(img.getFormat());
int components = img.getComponents();
// Create a temporary image which we'll use for the tile texels
@ -667,7 +665,7 @@ TiledTexture::TiledTexture(Image& img,
#endif
#else
gluBuild2DMipmaps(GL_TEXTURE_2D,
internalFormat,
getInternalFormat(img.getFormat()),
tileWidth, tileHeight,
(GLenum) tile->getFormat(),
GL_UNSIGNED_BYTE,
@ -781,7 +779,6 @@ CubeMap::CubeMap(Image* faces[]) :
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER,
mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR);
int internalFormat = getInternalFormat(format);
bool genMipmaps = mipmap && !precomputedMipMaps;
#if !defined(GL_ES) && defined(NO_GLU)
@ -806,7 +803,7 @@ CubeMap::CubeMap(Image* faces[]) :
LoadMiplessTexture(*face, targetFace);
#else
gluBuild2DMipmaps(targetFace,
internalFormat,
getInternalFormat(format),
getWidth(), getHeight(),
(GLenum) face->getFormat(),
GL_UNSIGNED_BYTE,

View File

@ -22,8 +22,8 @@ VertexObject::VertexObject(GLenum bufferType) :
}
VertexObject::VertexObject(GLenum bufferType, GLsizeiptr bufferSize, GLenum streamType) :
m_bufferType(bufferType),
m_bufferSize(bufferSize),
m_bufferType(bufferType),
m_streamType(streamType)
{
}
@ -191,4 +191,4 @@ void VertexObject::setVertexAttribArray(GLint location, GLint count, GLenum type
PtrParams p = { offset, stride, count, type, normalized };
(*m_attribParams)[location] = p;
}
}; // namespace
} // namespace

View File

@ -91,4 +91,4 @@ class VertexObject
GLenum m_streamType{ 0 };
std::map<GLint, PtrParams>* m_attribParams{ nullptr };
};
}; // namespace
} // namespace

View File

@ -2723,7 +2723,7 @@ static UranianSatelliteOrbit* CreateUranianSatelliteOrbit(int n)
uran_z_theta[n], uran_z_phi[n],
uran_zeta_k[n], uran_zeta_theta[n],
uran_zeta_phi[n]);
};
}
/*! Orbit of Triton, from Seidelmann, _Explanatory Supplement to the
@ -2985,13 +2985,12 @@ class HTC20Orbit : public CachingOrbit
public:
HTC20Orbit(int _nTerms, const double* _args, const double* _amplitudes,
const HTC20Angles& _angles,
double _period, double _boundingRadius) :
double _period, double /*_boundingRadius*/) :
nTerms(_nTerms),
args(_args),
amplitudes(_amplitudes),
angles(_angles),
period(_period),
boundingRadius(_boundingRadius)
period(_period)
{
}
@ -3034,7 +3033,6 @@ class HTC20Orbit : public CachingOrbit
const double* amplitudes;
HTC20Angles angles;
double period;
double boundingRadius;
public:
static HTC20Orbit* CreateHeleneOrbit()

View File

@ -22,4 +22,4 @@ struct NutationAngles
extern NutationAngles Nutation_IAU2000B(double T);
};
}

View File

@ -184,9 +184,11 @@ EllipticalOrbit::EllipticalOrbit(double _pericenterDistance,
double _epoch) :
pericenterDistance(_pericenterDistance),
eccentricity(_eccentricity),
#if 0
inclination(_inclination),
ascendingNode(_ascendingNode),
argOfPeriapsis(_argOfPeriapsis),
#endif
meanAnomalyAtEpoch(_meanAnomalyAtEpoch),
period(_period),
epoch(_epoch)

View File

@ -76,9 +76,11 @@ class EllipticalOrbit : public Orbit
double pericenterDistance;
double eccentricity;
#if 0
double inclination;
double ascendingNode;
double argOfPeriapsis;
#endif
double meanAnomalyAtEpoch;
double period;
double epoch;

View File

@ -64,4 +64,4 @@ extern EclipticAngles EclipticPrecessionAngles_P03(double T);
extern PrecessionAngles PrecObliquity_P03(double T);
extern EquatorialPrecessionAngles EquatorialPrecessionAngles_P03(double T);
};
}

View File

@ -11009,7 +11009,7 @@ static double SumSeries(const VSOPSeries& series, double t)
x += term->A * cos(term->B + term->C * t);
return x;
};
}
class VSOP87Orbit : public CachingOrbit
{

View File

@ -141,7 +141,6 @@ float ComputeRotationCoarseness(Simulation& sim)
CelestiaCore::CelestiaCore() :
oldFOV(stdFOV),
/* Get a renderer here so it may be queried for capabilities of the
underlying engine even before rendering is enabled. It's initRenderer()
routine will be called much later. */
@ -151,7 +150,8 @@ CelestiaCore::CelestiaCore() :
#ifdef CELX
m_luaPlugin(make_unique<LuaScriptPlugin>(this)),
#endif
m_scriptMaps(make_shared<ScriptMaps>())
m_scriptMaps(make_shared<ScriptMaps>()),
oldFOV(stdFOV)
{
for (int i = 0; i < KeyCount; i++)
@ -3190,7 +3190,7 @@ void CelestiaCore::renderOverlay()
// Skip displaying the English name if a localized version is present.
string starName = sim->getUniverse()->getStarCatalog()->getStarName(*sel.star());
string locStarName = sim->getUniverse()->getStarCatalog()->getStarName(*sel.star(), true);
if (sel.star()->getIndex() == 0 && selectionNames.find("Sun") != string::npos && (const char*) "Sun" != _("Sun"))
if (sel.star()->getIndex() == 0 && selectionNames.find("Sun") != string::npos && strcmp("Sun", _("Sun")) != 0)
{
string::size_type startPos = selectionNames.find("Sun");
string::size_type endPos = selectionNames.find(_("Sun"));

View File

@ -36,7 +36,7 @@ EclipseFinder::EclipseFinder(Body* _body,
body(_body),
watcher(_watcher)
{
};
}
bool testEclipse(const Body& receiver, const Body& caster, double now)

View File

@ -41,6 +41,7 @@ class EclipseFinderWatcher
};
virtual Status eclipseFinderProgressUpdate(double t) = 0;
virtual ~EclipseFinderWatcher() = default;
};
class EclipseFinder

View File

@ -27,6 +27,7 @@ class CelestiaCore;
class ModelHelper
{
public:
virtual ~ModelHelper() = default;
virtual Selection itemForInfoPanel(const QModelIndex&) = 0;
};

View File

@ -706,15 +706,19 @@ void PreferencesDialog::on_featureSizeEdit_textEdited(const QString& text)
}
#ifdef USE_GLCONTEXT
void PreferencesDialog::on_renderPathBox_currentIndexChanged(int index)
{
#ifdef USE_GLCONTEXT
GLContext* glContext = appCore->getRenderer()->getGLContext();
QVariant itemData = ui.renderPathBox->itemData(index, Qt::UserRole);
GLContext::GLRenderPath renderPath = (GLContext::GLRenderPath) itemData.toInt();
glContext->setRenderPath(renderPath);
#endif
}
#else
void PreferencesDialog::on_renderPathBox_currentIndexChanged(int /*index*/)
{
}
#endif
void PreferencesDialog::on_antialiasLinesCheck_stateChanged(int state)

View File

@ -75,8 +75,16 @@ ScanScriptsDirectory(const fs::path& scriptsDir, bool deep)
{
vector<ScriptMenuItem>* scripts = new vector<ScriptMenuItem>;
for (const auto& p : fs::recursive_directory_iterator(scriptsDir))
process(p, scripts);
if (deep)
{
for (const auto& p : fs::recursive_directory_iterator(scriptsDir))
process(p, scripts);
}
else
{
for (const auto& p : fs::directory_iterator(scriptsDir))
process(p, scripts);
}
return scripts;
}

View File

@ -28,5 +28,5 @@ template<class T> T distance(const Eigen::Matrix<T, 3, 1>& p, const Ray3<T>& r)
else
return (p - r.point(t)).norm();
}
};
}
#endif // _CELMATH_DISTANCE_H_

View File

@ -65,6 +65,6 @@ template<class T> class Ellipsoid
typedef Ellipsoid<float> Ellipsoidf;
typedef Ellipsoid<double> Ellipsoidd;
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_ELLIPSOID_H_

View File

@ -188,4 +188,4 @@ Frustum::transform(const Matrix4f& m)
}
}
};
}

View File

@ -63,6 +63,6 @@ class Frustum
bool infinite;
};
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_FRUSTUM_H_

View File

@ -148,5 +148,5 @@ Ortho2D(T left, T right, T bottom, T top)
return Ortho(left, right, bottom, top, T(-1), T(1));
}
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_GEOMUTIL_H_

View File

@ -124,6 +124,6 @@ template<class T> bool testIntersection(const Ray3<T>& ray,
}
return false;
}
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_INTERSECT_H_

View File

@ -152,13 +152,13 @@ ellipsoidTangent(const Eigen::Matrix<T, 3, 1>& recipSemiAxes,
return e + v * t1;
}
}; // namespace celmath
} // namespace celmath
#if __cplusplus < 201703L
namespace std
{
using celmath::clamp;
};
}
#endif
constexpr long double operator"" _deg (long double deg)

View File

@ -64,6 +64,6 @@ template<class T> Eigen::Matrix<T, 3, 1> Ray3<T>::point(T t) const
return origin + direction * t;
}
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_RAY_H_

View File

@ -79,4 +79,4 @@ template<class T, class F> std::pair<T, T> solve_iteration_fixed(F f,
return std::make_pair(x2, x2 - x);
}
}; // namespace celmath
} // namespace celmath

View File

@ -46,6 +46,6 @@ template<class T> class Sphere
typedef Sphere<float> Spheref;
typedef Sphere<double> Sphered;
}; // namespace celmath
} // namespace celmath
#endif // _CELMATH_SPHERE_H_

View File

@ -147,9 +147,6 @@ class Model
virtual ~OpacityComparator() = default;
virtual bool operator()(const Mesh&, const Mesh&) const;
private:
int unused;
};
private:

View File

@ -14,7 +14,7 @@ namespace celestia
namespace scripts
{
bool IScript::handleMouseButtonEvent(float x, float y, int button, bool down)
bool IScript::handleMouseButtonEvent(float /*x*/, float /*y*/, int /*button*/, bool /*down*/)
{
return false;
}
@ -24,12 +24,12 @@ bool IScript::charEntered(const char*)
return false;
}
bool IScript::handleKeyEvent(const char* key)
bool IScript::handleKeyEvent(const char* /*key*/)
{
return false;
}
bool IScript::handleTickEvent(double dt)
bool IScript::handleTickEvent(double /*dt*/)
{
return false;
}

View File

@ -117,7 +117,7 @@ class CommandGotoLongLat : public InstantaneousCommand
class CommandGotoLocation : public InstantaneousCommand
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
CommandGotoLocation(double t,
const Eigen::Vector3d& translation,
@ -365,7 +365,7 @@ class CommandSetPosition : public InstantaneousCommand
class CommandSetOrientation : public InstantaneousCommand
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
CommandSetOrientation(const Eigen::Quaternionf&);
void process(ExecutionEnvironment&);

View File

@ -64,7 +64,7 @@ LegacyScript::LegacyScript(CelestiaCore *core) :
{
}
bool LegacyScript::load(ifstream &scriptfile, const fs::path &path, string &errorMsg)
bool LegacyScript::load(ifstream &scriptfile, const fs::path &/*path*/, string &errorMsg)
{
CommandParser parser(scriptfile, m_appCore->scriptMaps());
CommandSequence* script = parser.parse();

View File

@ -179,7 +179,7 @@ public:
celx.push(i);
lua_replace(l, CelxLua::localIndex(2));
return celx.pushClass(ret);
};
}
template<typename V, typename K> static V value(std::pair<const K, V> &v)
{
return v.second;

View File

@ -180,8 +180,6 @@ void TextureFontPrivate::initCommonGlyphs()
void TextureFontPrivate::computeTextureSize()
{
FT_GlyphSlot g = m_face->glyph;
int roww = 0;
int rowh = 0;
int w = 0;
@ -322,7 +320,7 @@ Glyph& TextureFontPrivate::getGlyph(wchar_t ch, wchar_t fallback)
return g.ch == ch ? g : getGlyph(fallback);
}
Glyph g_badGlyph = {0};
Glyph g_badGlyph = {0, 0, 0, 0, 0, 0, 0, 0.0f, 0.0f};
Glyph& TextureFontPrivate::getGlyph(wchar_t ch)
{
auto pos = toPos(ch);

View File

@ -10,12 +10,12 @@ template<typename T> T* aligned_addr(T* addr)
{
size_t align = std::alignment_of<T>::value;
return (T*) (((size_t(addr) - 1) / align + 1) * align);
};
}
template<typename T> T* aligned_addr(T* addr, size_t align)
{
return (T*) (((size_t(addr) - 1) / align + 1) * align);
};
}
/*! Returns size large enough so an object of type T can be placed
* inside allocated unalligned memory region with its address aligned.
@ -23,4 +23,4 @@ template<typename T> T* aligned_addr(T* addr, size_t align)
template<typename T> size_t aligned_sizeof()
{
return sizeof(T) + std::alignment_of<T>::value - 1;
};
}

View File

@ -28,7 +28,7 @@
#define LOG_LEVEL_DEBUG 4
#if !defined(_DEBUG) && !defined(DEBUG)
#define DPRINTF(level, format, ...) static_cast<void>(level);
#define DPRINTF(level, ...) static_cast<void>(level);
#else
extern int debugVerbosity;
template <typename... T>

View File

@ -920,7 +920,9 @@ ReplaceGreekLetterAbbr(char *dst, unsigned int dstSize, const char* src, unsigne
#endif
static int findGreekNameIndexBySubstr(const std::string &, int = 0, unsigned int = UINT_MAX);
#if 0
static std::string firstGreekAbbrCompletion(const std::string &);
#endif
bool inline isSubstringIgnoringCase(const std::string &s0, const std::string &s1, size_t n)
{
@ -966,6 +968,7 @@ static size_t greekChunkLength(const std::string& str)
return sp;
}
#if 0
static std::string firstGreekAbbrCompletion(const std::string &s)
{
std::string ret;
@ -984,6 +987,7 @@ static std::string firstGreekAbbrCompletion(const std::string &s)
return ret;
}
#endif
std::vector<std::string> getGreekCompletion(const std::string &s)
{

View File

@ -113,8 +113,8 @@ fs::path PathExp(const fs::path& filename)
case 0: // successful
break;
case WRDE_NOSPACE:
// If the error was `WRDE_NOSPACE',
// then perhaps part of the result was allocated.
// If the error was `WRDE_NOSPACE',
// then perhaps part of the result was allocated.
wordfree(&result);
default: // some other error
return filename;

View File

@ -348,7 +348,7 @@ public:
void setPixel(unsigned int x, unsigned int y, const Color& color)
{
if (x >= 0 && x < width && y >= 0 && y < height)
if (x < width && y < height)
{
unsigned int pix = (x + y * width) * 3;
pixels[pix + 0] = floatToByte(color.r);

View File

@ -83,6 +83,7 @@ class VertexComparator
{
public:
virtual bool compare(const Vertex& a, const Vertex& b) const = 0;
virtual ~VertexComparator() = default;
bool operator()(const Vertex& a, const Vertex& b) const
{
@ -528,7 +529,7 @@ copyVertex(void* newVertexData,
for (uint32_t i = 0; i < newDesc.nAttributes; i++)
{
if (fromOffsets[i] != ~0)
if (fromOffsets[i] != ~0u)
{
memcpy(newVertex + newDesc.attributes[i].offset,
oldVertex + fromOffsets[i],
@ -1030,7 +1031,7 @@ generateTangents(Mesh& mesh,
}
uint32_t posOffset = desc.getAttribute(Mesh::Position).offset;
uint32_t normOffset = desc.getAttribute(Mesh::Normal).offset;
//uint32_t normOffset = desc.getAttribute(Mesh::Normal).offset;
uint32_t texCoordOffset = desc.getAttribute(Mesh::Texture0).offset;
const void* vertexData = mesh.getVertexData();

View File

@ -156,7 +156,7 @@ private:
template<typename SCALAR, int ROWS, int COLS> inline void
glsh_setUniformValue(GLhandleARB id, const char* name, const SCALAR* data)
glsh_setUniformValue(GLhandleARB /*id*/, const char* /*name*/, const SCALAR* /*data*/)
{
}

View File

@ -27,6 +27,7 @@ using namespace std;
struct VertexComparator
{
virtual bool compare(const Vertex& a, const Vertex& b) const = 0;
virtual ~VertexComparator() = default;
bool operator()(const Vertex& a, const Vertex& b) const
{
@ -66,8 +67,6 @@ private:
class PointOrderingPredicate : public VertexComparator
{
public:
PointOrderingPredicate() = default;
bool compare(const Vertex& a, const Vertex& b) const override
{
const Vector3f* p0 = reinterpret_cast<const Vector3f*>(a.attributes);

View File

@ -447,7 +447,7 @@ bool CheckStarRecord(istream& in)
in.read(buf, TycStarRecordLength);
lineno++;
if (sscanf(buf + 210, "%d", &star.HIPCatalogNumber) != 1)
if (sscanf(buf + 210, "%u", &star.HIPCatalogNumber) != 1)
{
// Not in Hipparcos, skip it.
if (verbose>1)
@ -472,7 +472,7 @@ bool CheckStarRecord(istream& in)
hipstar->tycline=lineno;
tested++;
sscanf(buf + 309, "%d", &star.HDCatalogNumber);
sscanf(buf + 309, "%u", &star.HDCatalogNumber);
if (sscanf(buf + 224, "%f", &star.e_Mag) != 1)
/* Tycho Database gives no error in for VMag, so we use error on BTmag
@ -649,13 +649,13 @@ bool ReadStarRecord(istream& in)
in.read(buf, HipStarRecordLength);
if (sscanf(buf + 8, "%d", &star.HIPCatalogNumber) != 1)
if (sscanf(buf + 8, "%u", &star.HIPCatalogNumber) != 1)
{
cout << "Error reading catalog number.\n";
return false;
}
sscanf(buf + 390, "%d", &star.HDCatalogNumber);
sscanf(buf + 390, "%u", &star.HDCatalogNumber);
star.tycline=0;
if (sscanf(buf + 41, "%f", &star.appMag) != 1)
@ -875,7 +875,7 @@ bool ReadComponentRecord(istream& in)
components.push_back(component);
return true;
};
}
void BuildMultistarSystemCatalog()

View File

@ -108,7 +108,6 @@ static void writeShort(ostream& out, int16_t n)
bool WriteStarDatabase(istream& in, ostream& out, bool sphericalCoords)
{
unsigned int record = 0;
unsigned int nStarsInFile = 0;
in >> nStarsInFile;

View File

@ -170,7 +170,7 @@ bool DumpOldStarDatabase(istream& in, ostream& out, ofstream& hdOut,
float parallax = readFloat(in);
int16_t appMag = readShort(in);
uint16_t stellarClass = readUshort(in);
uint8_t parallaxError = readUbyte(in);
/*uint8_t parallaxError = */readUbyte(in); // not used yet
// Compute distance based on parallax
double distance = LY_PER_PARSEC / (parallax > 0.0 ? parallax / 1000.0 : 1e-6);
@ -198,7 +198,7 @@ bool DumpOldStarDatabase(istream& in, ostream& out, ofstream& hdOut,
out << '\n';
// Dump HD catalog cross reference
if (hdOut.is_open() && HDCatalogNum != ~0)
if (hdOut.is_open() && HDCatalogNum != ~0u)
hdOut << HDCatalogNum << ' ' << catalogNum << '\n';
}
@ -250,7 +250,7 @@ bool DumpStarDatabase(istream& in, ostream& out, bool spherical)
out << catalogNum << ' ';
out << setprecision(7);
if (spherical)
{
Eigen::Vector3d eclipticpos = {(double) x, (double) y, (double) z};
@ -263,7 +263,7 @@ bool DumpStarDatabase(istream& in, ostream& out, bool spherical)
double ra = theta - 180 + 360;
double dec = phi + 90;
float appMag = float (absMag / 256.0 - 5 + 5 * log10(distance / LY_PER_PARSEC));
out << fixed << setprecision(9) << (float) ra << ' ' << (float) dec << ' ';
out << setprecision(6) << (float) distance << ' ';
out << setprecision(2);
@ -275,7 +275,7 @@ bool DumpStarDatabase(istream& in, ostream& out, bool spherical)
out << setprecision(4);
out << ((float) absMag / 256.0f) << ' ';
}
printStellarClass(stellarClass, out);
out << '\n';
}