diff --git a/src/celcompat/fs.cpp b/src/celcompat/fs.cpp index 0f853dba4..18fa31305 100644 --- a/src/celcompat/fs.cpp +++ b/src/celcompat/fs.cpp @@ -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 } diff --git a/src/celcompat/fs.h b/src/celcompat/fs.h index 94e75d046..a4d1a6b69 100644 --- a/src/celcompat/fs.h +++ b/src/celcompat/fs.h @@ -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 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; -}; -}; +} +} diff --git a/src/celengine/astro.h b/src/celengine/astro.h index f9b2c38c5..f4660d26c 100644 --- a/src/celengine/astro.h +++ b/src/celengine/astro.h @@ -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 diff --git a/src/celengine/astroobj.h b/src/celengine/astroobj.h index 3922948a9..6494676fe 100644 --- a/src/celengine/astroobj.h +++ b/src/celengine/astroobj.h @@ -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); diff --git a/src/celengine/axisarrow.cpp b/src/celengine/axisarrow.cpp index 9d2dad920..0ac1fb1a5 100644 --- a/src/celengine/axisarrow.cpp +++ b/src/celengine/axisarrow.cpp @@ -56,7 +56,7 @@ static size_t initArrowAndLetters(VertexObject &vo) // head of the arrow vector 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); diff --git a/src/celengine/dsodb.cpp b/src/celengine/dsodb.cpp index cfd2c39f6..bad0a5b05 100644 --- a/src/celengine/dsodb.cpp +++ b/src/celengine/dsodb.cpp @@ -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 diff --git a/src/celengine/galaxy.cpp b/src/celengine/galaxy.cpp index 0aa2add79..84cdf4a26 100644 --- a/src/celengine/galaxy.cpp +++ b/src/celengine/galaxy.cpp @@ -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 texCoord; // texCoord.x = x, texCoord.y = y, texCoord.z = color index, texCoord.w = alpha diff --git a/src/celengine/location.h b/src/celengine/location.h index 71bd24354..490712e23 100644 --- a/src/celengine/location.h +++ b/src/celengine/location.h @@ -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&); diff --git a/src/celengine/name.cpp b/src/celengine/name.cpp index 83f8b526e..2a519942e 100644 --- a/src/celengine/name.cpp +++ b/src/celengine/name.cpp @@ -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) { diff --git a/src/celengine/nebula.cpp b/src/celengine/nebula.cpp index d77565a96..81ee3f2fd 100644 --- a/src/celengine/nebula.cpp +++ b/src/celengine/nebula.cpp @@ -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, diff --git a/src/celengine/observer.cpp b/src/celengine/observer.cpp index 28af7c647..020d9ed63 100644 --- a/src/celengine/observer.cpp +++ b/src/celengine/observer.cpp @@ -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() diff --git a/src/celengine/octree.h b/src/celengine/octree.h index 50b4a6ad5..e997f25c0 100644 --- a/src/celengine/octree.h +++ b/src/celengine/octree.h @@ -92,9 +92,18 @@ private: ObjectList* _objects; }; +// make clang happy +#ifndef _MSC_VER +template<> DynamicOctree::ExclusionFactorDecayFunction* DynamicOctree::decayFunction; +template<> DynamicOctree::LimitingFactorPredicate* DynamicOctree::limitingFactorPredicate; +template<> DynamicOctree::StraddlingPredicate* DynamicOctree::straddlingPredicate; +template<> unsigned int DynamicOctree::SPLIT_THRESHOLD; - - +template<> DynamicOctree::ExclusionFactorDecayFunction* DynamicOctree::decayFunction; +template<> DynamicOctree::LimitingFactorPredicate* DynamicOctree::limitingFactorPredicate; +template<> DynamicOctree::StraddlingPredicate* DynamicOctree::straddlingPredicate; +template<> unsigned int DynamicOctree::SPLIT_THRESHOLD; +#endif template class StaticOctree { diff --git a/src/celengine/overlay.cpp b/src/celengine/overlay.cpp index 9c3369cb5..50a810666 100644 --- a/src/celengine/overlay.cpp +++ b/src/celengine/overlay.cpp @@ -226,7 +226,7 @@ void Overlay::restorePos() OverlayStreamBuf::OverlayStreamBuf() { setbuf(nullptr, 0); -}; +} void OverlayStreamBuf::setOverlay(Overlay* o) diff --git a/src/celengine/overlay.h b/src/celengine/overlay.h index 0056f1485..43fd4f573 100644 --- a/src/celengine/overlay.h +++ b/src/celengine/overlay.h @@ -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; diff --git a/src/celengine/render.cpp b/src/celengine/render.cpp index 629f70fed..2668e62f3 100644 --- a/src/celengine/render.cpp +++ b/src/celengine/render.cpp @@ -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, diff --git a/src/celengine/render.h b/src/celengine/render.h index d5d0c10bb..a1f088c8c 100644 --- a/src/celengine/render.h +++ b/src/celengine/render.h @@ -40,7 +40,7 @@ class FramebufferObject; namespace celmath { class Frustum; -}; +} struct Matrices { diff --git a/src/celengine/renderglsl.cpp b/src/celengine/renderglsl.cpp index b00cf09a5..662902241 100644 --- a/src/celengine/renderglsl.cpp +++ b/src/celengine/renderglsl.cpp @@ -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) diff --git a/src/celengine/shadermanager.cpp b/src/celengine/shadermanager.cpp index 299f6d77b..efd6a95fd 100644 --- a/src/celengine/shadermanager.cpp +++ b/src/celengine/shadermanager.cpp @@ -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) : diff --git a/src/celengine/simulation.cpp b/src/celengine/simulation.cpp index 91c9a68f6..f8f4d65d5 100644 --- a/src/celengine/simulation.cpp +++ b/src/celengine/simulation.cpp @@ -324,7 +324,7 @@ void Simulation::getSelectionLongLat(double& distance, void Simulation::gotoSurface(double duration) { activeObserver->gotoSurface(selection, duration); -}; +} void Simulation::cancelMotion() diff --git a/src/celengine/solarsys.cpp b/src/celengine/solarsys.cpp index c02e4f6ab..879ac3186 100644 --- a/src/celengine/solarsys.cpp +++ b/src/celengine/solarsys.cpp @@ -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 diff --git a/src/celengine/stardb.cpp b/src/celengine/stardb.cpp index ec8e97ae3..628fb4c11 100644 --- a/src/celengine/stardb.cpp +++ b/src/celengine/stardb.cpp @@ -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 diff --git a/src/celengine/texture.cpp b/src/celengine/texture.cpp index e3a75ec62..50e8c0239 100644 --- a/src/celengine/texture.cpp +++ b/src/celengine/texture.cpp @@ -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, diff --git a/src/celengine/vertexobject.cpp b/src/celengine/vertexobject.cpp index 316706548..c13daaa7e 100644 --- a/src/celengine/vertexobject.cpp +++ b/src/celengine/vertexobject.cpp @@ -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 diff --git a/src/celengine/vertexobject.h b/src/celengine/vertexobject.h index 12df6e70e..363f83ff3 100644 --- a/src/celengine/vertexobject.h +++ b/src/celengine/vertexobject.h @@ -91,4 +91,4 @@ class VertexObject GLenum m_streamType{ 0 }; std::map* m_attribParams{ nullptr }; }; -}; // namespace +} // namespace diff --git a/src/celephem/customorbit.cpp b/src/celephem/customorbit.cpp index efff52e26..a3c132a04 100644 --- a/src/celephem/customorbit.cpp +++ b/src/celephem/customorbit.cpp @@ -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() diff --git a/src/celephem/nutation.h b/src/celephem/nutation.h index 4d91a8ee6..05921cb0b 100644 --- a/src/celephem/nutation.h +++ b/src/celephem/nutation.h @@ -22,4 +22,4 @@ struct NutationAngles extern NutationAngles Nutation_IAU2000B(double T); -}; +} diff --git a/src/celephem/orbit.cpp b/src/celephem/orbit.cpp index 9d4b5fce7..a856f2224 100644 --- a/src/celephem/orbit.cpp +++ b/src/celephem/orbit.cpp @@ -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) diff --git a/src/celephem/orbit.h b/src/celephem/orbit.h index c92313b7b..d628b66b5 100644 --- a/src/celephem/orbit.h +++ b/src/celephem/orbit.h @@ -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; diff --git a/src/celephem/precession.h b/src/celephem/precession.h index 6feea79ea..3eb31b3b7 100644 --- a/src/celephem/precession.h +++ b/src/celephem/precession.h @@ -64,4 +64,4 @@ extern EclipticAngles EclipticPrecessionAngles_P03(double T); extern PrecessionAngles PrecObliquity_P03(double T); extern EquatorialPrecessionAngles EquatorialPrecessionAngles_P03(double T); -}; +} diff --git a/src/celephem/vsop87.cpp b/src/celephem/vsop87.cpp index d291170f0..2796b3a5a 100644 --- a/src/celephem/vsop87.cpp +++ b/src/celephem/vsop87.cpp @@ -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 { diff --git a/src/celestia/celestiacore.cpp b/src/celestia/celestiacore.cpp index cda5b7465..ac265c317 100644 --- a/src/celestia/celestiacore.cpp +++ b/src/celestia/celestiacore.cpp @@ -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(this)), #endif - m_scriptMaps(make_shared()) + m_scriptMaps(make_shared()), + 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")); diff --git a/src/celestia/eclipsefinder.cpp b/src/celestia/eclipsefinder.cpp index df082b1cb..da0237181 100644 --- a/src/celestia/eclipsefinder.cpp +++ b/src/celestia/eclipsefinder.cpp @@ -36,7 +36,7 @@ EclipseFinder::EclipseFinder(Body* _body, body(_body), watcher(_watcher) { -}; +} bool testEclipse(const Body& receiver, const Body& caster, double now) diff --git a/src/celestia/eclipsefinder.h b/src/celestia/eclipsefinder.h index c648e53bc..69efcebe4 100644 --- a/src/celestia/eclipsefinder.h +++ b/src/celestia/eclipsefinder.h @@ -41,6 +41,7 @@ class EclipseFinderWatcher }; virtual Status eclipseFinderProgressUpdate(double t) = 0; + virtual ~EclipseFinderWatcher() = default; }; class EclipseFinder diff --git a/src/celestia/qt/qtinfopanel.h b/src/celestia/qt/qtinfopanel.h index 3b0df2cb7..192631db4 100644 --- a/src/celestia/qt/qtinfopanel.h +++ b/src/celestia/qt/qtinfopanel.h @@ -27,6 +27,7 @@ class CelestiaCore; class ModelHelper { public: + virtual ~ModelHelper() = default; virtual Selection itemForInfoPanel(const QModelIndex&) = 0; }; diff --git a/src/celestia/qt/qtpreferencesdialog.cpp b/src/celestia/qt/qtpreferencesdialog.cpp index 84c1f5a4c..8db3f9756 100644 --- a/src/celestia/qt/qtpreferencesdialog.cpp +++ b/src/celestia/qt/qtpreferencesdialog.cpp @@ -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) diff --git a/src/celestia/scriptmenu.cpp b/src/celestia/scriptmenu.cpp index 25dc714c3..4395c8ace 100644 --- a/src/celestia/scriptmenu.cpp +++ b/src/celestia/scriptmenu.cpp @@ -75,8 +75,16 @@ ScanScriptsDirectory(const fs::path& scriptsDir, bool deep) { vector* scripts = new vector; - 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; } diff --git a/src/celmath/distance.h b/src/celmath/distance.h index 8f17481f1..439a00633 100644 --- a/src/celmath/distance.h +++ b/src/celmath/distance.h @@ -28,5 +28,5 @@ template T distance(const Eigen::Matrix& p, const Ray3& r) else return (p - r.point(t)).norm(); } -}; +} #endif // _CELMATH_DISTANCE_H_ diff --git a/src/celmath/ellipsoid.h b/src/celmath/ellipsoid.h index 0f79450ec..50dd7466e 100644 --- a/src/celmath/ellipsoid.h +++ b/src/celmath/ellipsoid.h @@ -65,6 +65,6 @@ template class Ellipsoid typedef Ellipsoid Ellipsoidf; typedef Ellipsoid Ellipsoidd; -}; // namespace celmath +} // namespace celmath #endif // _CELMATH_ELLIPSOID_H_ diff --git a/src/celmath/frustum.cpp b/src/celmath/frustum.cpp index f6eba2782..50b6ee55f 100644 --- a/src/celmath/frustum.cpp +++ b/src/celmath/frustum.cpp @@ -188,4 +188,4 @@ Frustum::transform(const Matrix4f& m) } } -}; +} diff --git a/src/celmath/frustum.h b/src/celmath/frustum.h index d6cc3337b..d09edec7c 100644 --- a/src/celmath/frustum.h +++ b/src/celmath/frustum.h @@ -63,6 +63,6 @@ class Frustum bool infinite; }; -}; // namespace celmath +} // namespace celmath #endif // _CELMATH_FRUSTUM_H_ diff --git a/src/celmath/geomutil.h b/src/celmath/geomutil.h index efe99c59b..d713ffc75 100644 --- a/src/celmath/geomutil.h +++ b/src/celmath/geomutil.h @@ -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_ diff --git a/src/celmath/intersect.h b/src/celmath/intersect.h index 36f16d900..93135278a 100644 --- a/src/celmath/intersect.h +++ b/src/celmath/intersect.h @@ -124,6 +124,6 @@ template bool testIntersection(const Ray3& ray, } return false; } -}; // namespace celmath +} // namespace celmath #endif // _CELMATH_INTERSECT_H_ diff --git a/src/celmath/mathlib.h b/src/celmath/mathlib.h index e076d6ba9..5dec8eabd 100644 --- a/src/celmath/mathlib.h +++ b/src/celmath/mathlib.h @@ -152,13 +152,13 @@ ellipsoidTangent(const Eigen::Matrix& 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) diff --git a/src/celmath/ray.h b/src/celmath/ray.h index 756325e7a..fa688dd67 100644 --- a/src/celmath/ray.h +++ b/src/celmath/ray.h @@ -64,6 +64,6 @@ template Eigen::Matrix Ray3::point(T t) const return origin + direction * t; } -}; // namespace celmath +} // namespace celmath #endif // _CELMATH_RAY_H_ diff --git a/src/celmath/solve.h b/src/celmath/solve.h index f339cb4fc..9aa98f3ba 100644 --- a/src/celmath/solve.h +++ b/src/celmath/solve.h @@ -79,4 +79,4 @@ template std::pair solve_iteration_fixed(F f, return std::make_pair(x2, x2 - x); } -}; // namespace celmath +} // namespace celmath diff --git a/src/celmath/sphere.h b/src/celmath/sphere.h index 9c3317f62..dbf76aa90 100644 --- a/src/celmath/sphere.h +++ b/src/celmath/sphere.h @@ -46,6 +46,6 @@ template class Sphere typedef Sphere Spheref; typedef Sphere Sphered; -}; // namespace celmath +} // namespace celmath #endif // _CELMATH_SPHERE_H_ diff --git a/src/celmodel/model.h b/src/celmodel/model.h index 10f9b36e0..aa04f857a 100644 --- a/src/celmodel/model.h +++ b/src/celmodel/model.h @@ -147,9 +147,6 @@ class Model virtual ~OpacityComparator() = default; virtual bool operator()(const Mesh&, const Mesh&) const; - - private: - int unused; }; private: diff --git a/src/celscript/common/script.cpp b/src/celscript/common/script.cpp index 039f4f93b..d0355460a 100644 --- a/src/celscript/common/script.cpp +++ b/src/celscript/common/script.cpp @@ -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; } diff --git a/src/celscript/legacy/command.h b/src/celscript/legacy/command.h index ac63433e1..651903579 100644 --- a/src/celscript/legacy/command.h +++ b/src/celscript/legacy/command.h @@ -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&); diff --git a/src/celscript/legacy/legacyscript.cpp b/src/celscript/legacy/legacyscript.cpp index 73f3eef59..343c38fb2 100644 --- a/src/celscript/legacy/legacyscript.cpp +++ b/src/celscript/legacy/legacyscript.cpp @@ -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(); diff --git a/src/celscript/lua/celx_internal.h b/src/celscript/lua/celx_internal.h index 0498e74b4..9aa9fdb95 100644 --- a/src/celscript/lua/celx_internal.h +++ b/src/celscript/lua/celx_internal.h @@ -179,7 +179,7 @@ public: celx.push(i); lua_replace(l, CelxLua::localIndex(2)); return celx.pushClass(ret); - }; + } template static V value(std::pair &v) { return v.second; diff --git a/src/celttf/truetypefont.cpp b/src/celttf/truetypefont.cpp index d1581808b..8a2371482 100644 --- a/src/celttf/truetypefont.cpp +++ b/src/celttf/truetypefont.cpp @@ -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); diff --git a/src/celutil/align.h b/src/celutil/align.h index 742051291..d1c7682d1 100644 --- a/src/celutil/align.h +++ b/src/celutil/align.h @@ -10,12 +10,12 @@ template T* aligned_addr(T* addr) { size_t align = std::alignment_of::value; return (T*) (((size_t(addr) - 1) / align + 1) * align); -}; +} template 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 T* aligned_addr(T* addr, size_t align) template size_t aligned_sizeof() { return sizeof(T) + std::alignment_of::value - 1; -}; +} diff --git a/src/celutil/debug.h b/src/celutil/debug.h index 9fb8869bb..1f1e042cd 100644 --- a/src/celutil/debug.h +++ b/src/celutil/debug.h @@ -28,7 +28,7 @@ #define LOG_LEVEL_DEBUG 4 #if !defined(_DEBUG) && !defined(DEBUG) -#define DPRINTF(level, format, ...) static_cast(level); +#define DPRINTF(level, ...) static_cast(level); #else extern int debugVerbosity; template diff --git a/src/celutil/utf8.cpp b/src/celutil/utf8.cpp index 9381b1a3d..3601bbb66 100644 --- a/src/celutil/utf8.cpp +++ b/src/celutil/utf8.cpp @@ -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 getGreekCompletion(const std::string &s) { diff --git a/src/celutil/util.cpp b/src/celutil/util.cpp index 7c0e06ce1..75dbaf7b3 100644 --- a/src/celutil/util.cpp +++ b/src/celutil/util.cpp @@ -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; diff --git a/src/tools/atmosphere/scattersim.cpp b/src/tools/atmosphere/scattersim.cpp index 3401c9d9d..91ed5cab5 100644 --- a/src/tools/atmosphere/scattersim.cpp +++ b/src/tools/atmosphere/scattersim.cpp @@ -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); diff --git a/src/tools/cmod/cmodfix/cmodfix.cpp b/src/tools/cmod/cmodfix/cmodfix.cpp index f27fd21d2..890e0bb7f 100644 --- a/src/tools/cmod/cmodfix/cmodfix.cpp +++ b/src/tools/cmod/cmodfix/cmodfix.cpp @@ -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(); diff --git a/src/tools/cmod/cmodview/glshader.h b/src/tools/cmod/cmodview/glshader.h index eb4827fb7..192fe9378 100644 --- a/src/tools/cmod/cmodview/glshader.h +++ b/src/tools/cmod/cmodview/glshader.h @@ -156,7 +156,7 @@ private: template inline void -glsh_setUniformValue(GLhandleARB id, const char* name, const SCALAR* data) +glsh_setUniformValue(GLhandleARB /*id*/, const char* /*name*/, const SCALAR* /*data*/) { } diff --git a/src/tools/cmod/common/cmodops.cpp b/src/tools/cmod/common/cmodops.cpp index 904fe11b9..4d032b54e 100644 --- a/src/tools/cmod/common/cmodops.cpp +++ b/src/tools/cmod/common/cmodops.cpp @@ -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(a.attributes); diff --git a/src/tools/stardb/buildstardb.cpp b/src/tools/stardb/buildstardb.cpp index 08b6cbc0c..bf1824553 100644 --- a/src/tools/stardb/buildstardb.cpp +++ b/src/tools/stardb/buildstardb.cpp @@ -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() diff --git a/src/tools/stardb/makestardb.cpp b/src/tools/stardb/makestardb.cpp index 020abfd81..a850c6a2a 100644 --- a/src/tools/stardb/makestardb.cpp +++ b/src/tools/stardb/makestardb.cpp @@ -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; diff --git a/src/tools/stardb/startextdump.cpp b/src/tools/stardb/startextdump.cpp index dd34411e1..86cc6ecc2 100644 --- a/src/tools/stardb/startextdump.cpp +++ b/src/tools/stardb/startextdump.cpp @@ -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'; }