From 129d6cf61aec0803ab070feba5e237b4d8bbbfbe Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Sat, 26 Nov 2022 15:50:26 +0000 Subject: [PATCH] reduce lint warnings --- demo/demo/GameScene.cpp | 2 +- fggl/app.cpp | 2 +- fggl/assets/types.cpp | 4 ++-- fggl/audio/openal/audio.cpp | 2 +- fggl/data/assimp/module.cpp | 1 + fggl/gfx/ogl/renderer.cpp | 9 --------- fggl/gfx/ogl4/models.cpp | 20 ++++++++++---------- fggl/gui/containers.cpp | 4 ++-- fggl/gui/widget.cpp | 2 +- fggl/util/guid.cpp | 8 ++++---- include/fggl/assets/loader.hpp | 2 +- include/fggl/assets/manager.hpp | 4 ++-- include/fggl/assets/types.hpp | 2 +- include/fggl/util/guid.hpp | 8 ++++---- 14 files changed, 31 insertions(+), 39 deletions(-) diff --git a/demo/demo/GameScene.cpp b/demo/demo/GameScene.cpp index 4923d15..feccdcd 100644 --- a/demo/demo/GameScene.cpp +++ b/demo/demo/GameScene.cpp @@ -30,7 +30,7 @@ camera_type cam_mode = cam_free; static void placeObject(fggl::entity::EntityManager& world, fggl::entity::EntityID floor, fggl::entity::EntityFactory* factory, fggl::util::GUID prototype, glm::vec3 targetPos) { #ifndef NDEBUG - fggl::debug::trace("Creating object from prototype: {}", fggl::util::guidToString(prototype)); + fggl::debug::trace("Creating object from prototype: {}", fggl::util::guid_to_string(prototype)); #endif auto obj = factory->create(prototype, world); diff --git a/fggl/app.cpp b/fggl/app.cpp index baaf206..e60b998 100644 --- a/fggl/app.cpp +++ b/fggl/app.cpp @@ -29,7 +29,7 @@ namespace fggl { m_states(), m_subsystems(services) {} - int App::run(int argc, const char **argv) { + int App::run(int /*argc*/, const char **/*argv*/) { auto *windowing = m_subsystems->get<display::WindowService>(); { diff --git a/fggl/assets/types.cpp b/fggl/assets/types.cpp index 591e0fc..a1c4418 100644 --- a/fggl/assets/types.cpp +++ b/fggl/assets/types.cpp @@ -26,7 +26,7 @@ namespace fggl::assets { } #ifndef NDEBUG - util::internString(fullPath.c_str()); + util::intern_string(fullPath.c_str()); #endif auto hash = util::hash_fnv1a_64(fullPath.c_str()); @@ -38,7 +38,7 @@ namespace fggl::assets { if (input.find(':') != std::string::npos ) { // probably fully qualified #ifndef NDEBUG - util::internString(input.c_str()); + util::intern_string(input.c_str()); #endif auto hash = util::hash_fnv1a_64(input.c_str()); return AssetID::make(hash); diff --git a/fggl/audio/openal/audio.cpp b/fggl/audio/openal/audio.cpp index 3eb308b..1529a5f 100644 --- a/fggl/audio/openal/audio.cpp +++ b/fggl/audio/openal/audio.cpp @@ -62,7 +62,7 @@ namespace fggl::audio::openal { return false; } - return false; + return true; } assets::AssetTypeID check_vorbis(std::filesystem::path path ) { diff --git a/fggl/data/assimp/module.cpp b/fggl/data/assimp/module.cpp index 97f0c6d..0530bff 100644 --- a/fggl/data/assimp/module.cpp +++ b/fggl/data/assimp/module.cpp @@ -331,6 +331,7 @@ namespace fggl::data::models { checkin->setProcessor( MIME_FBX, extract_requirements ); return false; } + return false; } } // namespace fggl::data diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp index 91e4168..e77ab86 100644 --- a/fggl/gfx/ogl/renderer.cpp +++ b/fggl/gfx/ogl/renderer.cpp @@ -64,24 +64,15 @@ constexpr auto fggl_ogl_source(GLenum source) -> const char * { constexpr auto static fggl_ogl_type(GLenum type) -> const char * { switch (type) { case GL_DEBUG_TYPE_ERROR: return "Error"; - break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Deprecated Behaviour"; - break; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Undefined Behaviour"; - break; case GL_DEBUG_TYPE_PERFORMANCE: return "Performance"; - break; case GL_DEBUG_TYPE_PORTABILITY: return "Portability"; - break; case GL_DEBUG_TYPE_MARKER: return "Marker"; - break; case GL_DEBUG_TYPE_PUSH_GROUP: return "Push Group"; - break; case GL_DEBUG_TYPE_POP_GROUP: return "Pop Group"; - break; default: case GL_DEBUG_TYPE_OTHER: return "Other"; - break; } assert(false); return "unknown"; diff --git a/fggl/gfx/ogl4/models.cpp b/fggl/gfx/ogl4/models.cpp index ff778b8..831b3a2 100644 --- a/fggl/gfx/ogl4/models.cpp +++ b/fggl/gfx/ogl4/models.cpp @@ -28,7 +28,7 @@ namespace fggl::gfx::ogl4 { - static std::shared_ptr<ogl::ArrayBuffer> setupArrayBuffer(std::shared_ptr<ogl::VertexArray> &vao, + static std::shared_ptr<ogl::ArrayBuffer> setup_array_buffer(std::shared_ptr<ogl::VertexArray> &vao, const std::vector<data::Vertex> &data) { auto buff = std::make_shared<ogl::ArrayBuffer>(); buff->write(data.size() * sizeof(data::Vertex), data.data(), ogl::BufUsage::STATIC_DRAW); @@ -45,7 +45,7 @@ namespace fggl::gfx::ogl4 { } - static std::shared_ptr<ogl::ElementBuffer> setupIndexBuffer(std::shared_ptr<ogl::VertexArray> &vao, + static std::shared_ptr<ogl::ElementBuffer> setup_index_buffer(std::shared_ptr<ogl::VertexArray> &vao, const std::vector<uint32_t> &data) { auto elementBuffer = std::make_shared<ogl::ElementBuffer>(); elementBuffer->write(data.size() * sizeof(uint32_t), @@ -53,10 +53,10 @@ namespace fggl::gfx::ogl4 { return elementBuffer; } - static void setupComponent(StaticModel &modelComp, std::shared_ptr<ogl::Shader> &shader, data::Mesh &mesh) { + static void setup_component(StaticModel &modelComp, std::shared_ptr<ogl::Shader> &shader, data::Mesh &mesh) { auto vao = std::make_shared<ogl::VertexArray>(); - auto meshBuffer = setupArrayBuffer(vao, mesh.vertexList()); - auto elementBuffer = setupIndexBuffer(vao, mesh.indexList()); + auto meshBuffer = setup_array_buffer(vao, mesh.vertexList()); + auto elementBuffer = setup_index_buffer(vao, mesh.indexList()); // set up the element attributes modelComp.vao = vao; @@ -79,8 +79,8 @@ namespace fggl::gfx::ogl4 { // the asset does not exist, we need to upload it auto* modelAsset = new StaticModel(); modelAsset->vao = std::make_shared<ogl::VertexArray>(); - modelAsset->vertexData = setupArrayBuffer(modelAsset->vao, mesh.vertexList()); - modelAsset->elements = setupIndexBuffer(modelAsset->vao, mesh.indexList()); + modelAsset->vertexData = setup_array_buffer(modelAsset->vao, mesh.vertexList()); + modelAsset->elements = setup_index_buffer(modelAsset->vao, mesh.indexList()); modelAsset->elementCount = mesh.indexCount(); modelAsset->drawType = ogl::Primitive::TRIANGLE; @@ -127,8 +127,8 @@ namespace fggl::gfx::ogl4 { auto* modelAsset = new StaticModelGPU(); modelAsset->vao = std::make_shared<ogl::VertexArray>(); - modelAsset->vertices = setupArrayBuffer(modelAsset->vao, mesh.vertexList()); - modelAsset->elements = setupIndexBuffer(modelAsset->vao, mesh.indexList()); + modelAsset->vertices = setup_array_buffer(modelAsset->vao, mesh.vertexList()); + modelAsset->elements = setup_index_buffer(modelAsset->vao, mesh.indexList()); modelAsset->elementCount = mesh.indexCount(); modelAsset->drawType = ogl::Primitive::TRIANGLE; @@ -202,7 +202,7 @@ namespace fggl::gfx::ogl4 { data::generateHeightMesh(heightmap, heightMapMesh); auto &modelComp = world.add<StaticModel>(renderable); - setupComponent(modelComp, m_phong, heightMapMesh); + setup_component(modelComp, m_phong, heightMapMesh); // we know this is a triangle strip with a restart vertex... // FIXME the model should be telling us this... diff --git a/fggl/gui/containers.cpp b/fggl/gui/containers.cpp index 089f90e..9626b7d 100644 --- a/fggl/gui/containers.cpp +++ b/fggl/gui/containers.cpp @@ -95,8 +95,8 @@ namespace fggl::gui { // populate the grid fggl::math::vec2i pos{0, 0}; - int row = 0; - int col = 0; + unsigned int row = 0; + unsigned int col = 0; for ( auto& child : m_children ) { fggl::math::vec2i size{ widths[col], heights[row] }; child->size(pos, size); diff --git a/fggl/gui/widget.cpp b/fggl/gui/widget.cpp index 1b186e2..08b92d4 100644 --- a/fggl/gui/widget.cpp +++ b/fggl/gui/widget.cpp @@ -20,7 +20,7 @@ namespace fggl::gui { - void buttonBorder(gfx::Path2D &path, glm::vec2 pos, glm::vec2 size) { + void button_border(gfx::Path2D &path, glm::vec2 pos, glm::vec2 size) { // outer box path.colour({1.0f, 0.0f, 0.0f}); path.pathTo({pos.x + size.x, pos.y}); diff --git a/fggl/util/guid.cpp b/fggl/util/guid.cpp index 1384301..5823c9a 100644 --- a/fggl/util/guid.cpp +++ b/fggl/util/guid.cpp @@ -27,7 +27,7 @@ namespace fggl::util { std::map<GUID, std::string> guidTable; } - GUID internString(const char *str) { + GUID intern_string(const char *str) { assert(str != nullptr); GUID guid = make_guid(str); @@ -40,7 +40,7 @@ namespace fggl::util { return guid; } - std::string guidToString(GUID guid) { + std::string guid_to_string(GUID guid) { auto tableValue = guidTable.find(guid); if (tableValue != guidTable.end()) { return tableValue->second; @@ -52,11 +52,11 @@ namespace fggl::util { } fggl::util::GUID operator "" _fid(const char *str) { - fggl::util::internString(str); + fggl::util::intern_string(str); return fggl::util::make_guid(str); } fggl::util::GUID operator "" _fid(const char *str, std::size_t) { - fggl::util::internString(str); + fggl::util::intern_string(str); return fggl::util::make_guid(str); } diff --git a/include/fggl/assets/loader.hpp b/include/fggl/assets/loader.hpp index 64af0e4..d7c053a 100644 --- a/include/fggl/assets/loader.hpp +++ b/include/fggl/assets/loader.hpp @@ -159,7 +159,7 @@ namespace fggl::assets { bool load(const AssetID &assetId, void* userPtr = nullptr) { if ( !m_checkin->exists(assetId) ) { #ifndef NDEBUG - debug::warning("asked to load unknown asset: {}", util::guidToString( util::GUID::make(assetId.get()) ) ); + debug::warning("asked to load unknown asset: {}", util::guid_to_string( util::GUID::make(assetId.get()) ) ); #else debug::warning("asked to load unknown asset: {}", assetId.get()); #endif diff --git a/include/fggl/assets/manager.hpp b/include/fggl/assets/manager.hpp index 125c153..de8f371 100644 --- a/include/fggl/assets/manager.hpp +++ b/include/fggl/assets/manager.hpp @@ -83,7 +83,7 @@ namespace fggl::assets { return (*ptr).asset; } - inline void require(const AssetID &guid) { + inline void require(const AssetID &/*guid*/) { //m_registry.at(guid).refCount++; } @@ -91,7 +91,7 @@ namespace fggl::assets { return m_registry.contains(guid); } - inline void release(const AssetGUID &guid) { + inline void release(const AssetGUID &/*guid*/) { //m_registry.at(guid).refCount--; } diff --git a/include/fggl/assets/types.hpp b/include/fggl/assets/types.hpp index 5ab2359..80153cb 100644 --- a/include/fggl/assets/types.hpp +++ b/include/fggl/assets/types.hpp @@ -96,7 +96,7 @@ template<> struct fmt::formatter<fggl::assets::AssetID> { template <typename FormatContext> auto format(const fggl::assets::AssetID & guid, FormatContext& ctx) const -> decltype(ctx.out()) { #ifndef NDEBUG - return fmt::format_to(ctx.out(), "ASSET[{}]", guidToString( fggl::util::GUID::make( guid.get() ) )); + return fmt::format_to(ctx.out(), "ASSET[{}]", guid_to_string( fggl::util::GUID::make( guid.get() ) )); #else return fmt::format_to(ctx.out(), "ASSET[{}]", guid.get()); #endif diff --git a/include/fggl/util/guid.hpp b/include/fggl/util/guid.hpp index 6e9eb27..25c3861 100644 --- a/include/fggl/util/guid.hpp +++ b/include/fggl/util/guid.hpp @@ -90,8 +90,8 @@ namespace fggl::util { // debug-only functions #ifndef NDEBUG - GUID internString(const char *str); - std::string guidToString(GUID guid); + GUID intern_string(const char *str); + std::string guid_to_string(GUID guid); #endif constexpr GUID make_guid(const char *str) { @@ -100,7 +100,7 @@ namespace fggl::util { inline GUID make_guid_rt(const char* str) { #ifndef NDEBUG - return internString(str); + return intern_string(str); #else return make_guid(str); #endif @@ -121,7 +121,7 @@ template<> struct fmt::formatter<fggl::util::GUID> { template <typename FormatContext> auto format(const fggl::util::GUID& guid, FormatContext& ctx) const -> decltype(ctx.out()) { #ifndef NDEBUG - return fmt::format_to(ctx.out(), "GUID[{}]", guidToString(guid)); + return fmt::format_to(ctx.out(), "GUID[{}]", guid_to_string(guid)); #else return fmt::format_to(ctx.out(), "GUID[{}]", guid.get()); #endif -- GitLab