diff --git a/Makefile b/Makefile index 02f55340..1a7c69e7 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ ifeq ($(OS),Windows_NT) OS = Win32 endif -CFLAGS_COMMON = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fno-strict-aliasing +CFLAGS_COMMON = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -Wno-unused-function -fno-strict-aliasing CPPFLAGS_COMMON = LDFLAGS_COMMON = LIBS_COMMON = @@ -630,7 +630,13 @@ libpicomodel.$(A): \ libs/picomodel/pm_terrain.o \ $(INSTALLDIR)/libassimp_.$(DLL): LIBS_EXTRA := $(LIBS_ZLIB) -$(INSTALLDIR)/libassimp_.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) -Ilibs/assimp/include -Ilibs/assimp/code -Ilibs/assimp/contrib/pugixml/src -Ilibs/assimp/contrib/unzip -Ilibs/assimp -Ilibs/assimp/contrib/openddlparser/include -Ilibs/assimp/contrib/rapidjson/include -Ilibs/assimp/contrib -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_EXPORT -DASSIMP_BUILD_NO_IFC_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -DWIN32_LEAN_AND_MEAN -Dassimp_EXPORTS -fvisibility=hidden -Wno-long-long -fexceptions -frtti +$(INSTALLDIR)/libassimp_.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) \ + -Ilibs/assimp/include -Ilibs/assimp/code -Ilibs/assimp/contrib/pugixml/src -Ilibs/assimp/contrib/unzip \ + -Ilibs/assimp -Ilibs/assimp/contrib/openddlparser/include -Ilibs/assimp/contrib/rapidjson/include -Ilibs/assimp/contrib \ + -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_EXPORT -DASSIMP_BUILD_NO_IFC_IMPORTER \ + -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD \ + -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -DWIN32_LEAN_AND_MEAN -Dassimp_EXPORTS \ + -fvisibility=hidden -Wno-long-long -fexceptions -frtti -Wno-cast-qual $(INSTALLDIR)/libassimp_.$(DLL): \ libs/assimp/code/Common/Assimp.o \ libs/assimp/code/CApi/CInterfaceIOWrapper.o \ @@ -1146,7 +1152,7 @@ $(INSTALLDIR)/plugins/sunplug.$(DLL): \ contrib/sunplug/sunplug.o \ $(INSTALLDIR)/qdata3.$(EXE): LIBS_EXTRA := $(LIBS_XML) -$(INSTALLDIR)/qdata3.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude +$(INSTALLDIR)/qdata3.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude -Wno-format-overflow $(INSTALLDIR)/qdata3.$(EXE): \ tools/quake2/common/bspfile.o \ tools/quake2/common/cmdlib.o \ @@ -1170,7 +1176,7 @@ $(INSTALLDIR)/qdata3.$(EXE): \ $(if $(findstring Win32,$(OS)),icons/qdata3.o,) \ $(INSTALLDIR)/q2map.$(EXE): LIBS_EXTRA := $(LIBS_XML) -$(INSTALLDIR)/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude +$(INSTALLDIR)/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude -Wno-format-overflow $(INSTALLDIR)/q2map.$(EXE): \ tools/quake2/common/bspfile.o \ tools/quake2/common/cmdlib.o \ @@ -1240,7 +1246,8 @@ $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \ contrib/bkgrnd2d/plugin.o \ $(INSTALLDIR)/h2data.$(EXE): LIBS_EXTRA := $(LIBS_XML) -$(INSTALLDIR)/h2data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/qdata_heretic2/common -Itools/quake2/qdata_heretic2/qcommon -Itools/quake2/qdata_heretic2 -Itools/quake2/common -Ilibs -Iinclude +$(INSTALLDIR)/h2data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Wno-format-overflow \ + -Itools/quake2/qdata_heretic2/common -Itools/quake2/qdata_heretic2/qcommon -Itools/quake2/qdata_heretic2 -Itools/quake2/common -Ilibs -Iinclude $(INSTALLDIR)/h2data.$(EXE): \ tools/quake2/qdata_heretic2/common/bspfile.o \ tools/quake2/qdata_heretic2/common/cmdlib.o \ @@ -1275,7 +1282,7 @@ $(INSTALLDIR)/h2data.$(EXE): \ libl_net.$(A) \ $(if $(findstring Win32,$(OS)),icons/h2data.o,) \ -$(INSTALLDIR)/mbspc.$(EXE): CPPFLAGS_EXTRA := -Wstrict-prototypes -DNDEBUG -DBSPC -DBSPCINCLUDE -Ilibs +$(INSTALLDIR)/mbspc.$(EXE): CPPFLAGS_EXTRA := -Wstrict-prototypes -Wno-format-overflow -DNDEBUG -DBSPC -DBSPCINCLUDE -Ilibs $(INSTALLDIR)/mbspc.$(EXE): \ tools/mbspc/botlib/be_aas_bspq3.o \ tools/mbspc/botlib/be_aas_cluster.o \ diff --git a/libs/archivelib.h b/libs/archivelib.h index 46d0d0ae..b61c63f3 100644 --- a/libs/archivelib.h +++ b/libs/archivelib.h @@ -93,7 +93,7 @@ public: }; /// \brief An ArchiveFile which is stored uncompressed as part of a larger archive file. -class StoredArchiveFile : public ArchiveFile +class StoredArchiveFile final : public ArchiveFile { CopiedString m_name; FileInputStream m_filestream; @@ -111,22 +111,22 @@ public: return New().scalar( name, archiveName, position, stream_size, file_size ); } - void release(){ + void release() override { Delete().scalar( this ); } - size_type size() const { + size_type size() const override { return m_size; } - const char* getName() const { + const char* getName() const override { return m_name.c_str(); } - InputStream& getInputStream(){ + InputStream& getInputStream() override { return m_substream; } }; /// \brief An ArchiveTextFile which is stored uncompressed as part of a larger archive file. -class StoredArchiveTextFile : public ArchiveTextFile +class StoredArchiveTextFile final : public ArchiveTextFile { CopiedString m_name; FileInputStream m_filestream; @@ -144,13 +144,13 @@ public: return New().scalar( name, archiveName, position, stream_size ); } - void release(){ + void release() override { Delete().scalar( this ); } const char* getName() const { return m_name.c_str(); } - TextInputStream& getInputStream(){ + TextInputStream& getInputStream() override { return m_textStream; } }; diff --git a/libs/modulesystem/singletonmodule.h b/libs/modulesystem/singletonmodule.h index ce3a2dc2..870dc780 100644 --- a/libs/modulesystem/singletonmodule.h +++ b/libs/modulesystem/singletonmodule.h @@ -65,7 +65,7 @@ class NullDependencies template > -class SingletonModule : public APIConstructor, public Module, public ModuleRegisterable +class SingletonModule final : public APIConstructor, public Module, public ModuleRegisterable { Dependencies* m_dependencies; API* m_api; @@ -85,20 +85,20 @@ public: ASSERT_MESSAGE( m_refcount == 0, "module still referenced at shutdown" ); } - void selfRegister(){ + void selfRegister() override { globalModuleServer().registerModule( Type::Name, Type::Version, APIConstructor::getName(), *this ); } Dependencies& getDependencies(){ return *m_dependencies; } - void* getTable(){ + void* getTable() override { if ( m_api != 0 ) { return m_api->getTable(); } return 0; } - void capture(){ + void capture() override { if ( ++m_refcount == 1 ) { globalOutputStream() << "Module Initialising: '" << Type::Name << "' '" << APIConstructor::getName() << "'\n"; m_dependencies = new Dependencies(); @@ -116,7 +116,7 @@ public: ASSERT_MESSAGE( m_cycleCheck, "cyclic dependency detected" ); } - void release(){ + void release() override { if ( --m_refcount == 0 ) { if ( m_dependencyCheck ) { APIConstructor::destroyAPI( m_api ); diff --git a/libs/selectionlib.h b/libs/selectionlib.h index 8bb732db..601169ab 100644 --- a/libs/selectionlib.h +++ b/libs/selectionlib.h @@ -34,15 +34,15 @@ public: : m_selected( false ) {} - void setSelected( bool select = true ){ + void setSelected( bool select = true ) override { m_selected = select; } - bool isSelected() const { + bool isSelected() const override { return m_selected; } }; -class ObservedSelectable : public Selectable +class ObservedSelectable final : public Selectable { SelectionChangeCallback m_onchanged; bool m_selected; @@ -60,14 +60,14 @@ public: setSelected( false ); } - void setSelected( bool select ){ + void setSelected( bool select ) override { if ( select ^ m_selected ) { m_selected = select; m_onchanged( *this ); } } - bool isSelected() const { + bool isSelected() const override { return m_selected; } }; diff --git a/libs/stream/stringstream.h b/libs/stream/stringstream.h index 46757fe3..810745f8 100644 --- a/libs/stream/stringstream.h +++ b/libs/stream/stringstream.h @@ -95,7 +95,7 @@ public: /// \brief A TextOutputStream which writes to a StringBuffer. /// Similar to std::stringstream. -class StringOutputStream : public TextOutputStream +class StringOutputStream final : public TextOutputStream { StringBuffer m_string; public: @@ -106,7 +106,7 @@ public: } explicit StringOutputStream( std::size_t capacity ) : m_string( capacity ){ } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { m_string.push_range( buffer, buffer + length ); return length; } diff --git a/libs/undolib.h b/libs/undolib.h index e0ed3b50..d046da61 100644 --- a/libs/undolib.h +++ b/libs/undolib.h @@ -55,7 +55,7 @@ class ObservedUndoableObject : public Undoable MapFile* m_map; public: - ObservedUndoableObject( Copyable & object, const ImportCallback &importCallback ) + ObservedUndoableObject( Copyable & object, const ImportCallback &importCallback ) : m_object( object ), m_importCallback( importCallback ), m_undoQueue( 0 ), m_map( 0 ) { } diff --git a/plugins/assmodel/model.cpp b/plugins/assmodel/model.cpp index 9659451c..de919d8b 100644 --- a/plugins/assmodel/model.cpp +++ b/plugins/assmodel/model.cpp @@ -47,7 +47,7 @@ #include "os/path.h" #include "stream/stringstream.h" -class VectorLightList : public LightList +class VectorLightList final : public LightList { typedef std::vector Lights; Lights m_lights; @@ -58,11 +58,11 @@ public: void clear(){ m_lights.clear(); } - void evaluateLights() const { + void evaluateLights() const override { } - void lightsChanged() const { + void lightsChanged() const override { } - void forEachLight( const RendererLightCallback& callback ) const { + void forEachLight( const RendererLightCallback& callback ) const override { for ( Lights::const_iterator i = m_lights.begin(); i != m_lights.end(); ++i ) { callback( *( *i ) ); diff --git a/plugins/entity/filters.cpp b/plugins/entity/filters.cpp index 0db78e0b..109d3817 100644 --- a/plugins/entity/filters.cpp +++ b/plugins/entity/filters.cpp @@ -25,15 +25,18 @@ #include -class EntityFilterWrapper : public Filter +class EntityFilterWrapper final : public Filter { bool m_active; bool m_invert; EntityFilter& m_filter; public: - EntityFilterWrapper( EntityFilter& filter, bool invert ) : m_invert( invert ), m_filter( filter ){ + EntityFilterWrapper( EntityFilter& filter, bool invert ) : + m_active( false ), // suppress uninitialized warning + m_invert( invert ), + m_filter( filter ){ } - void setActive( bool active ){ + void setActive( bool active ) override { m_active = active; } bool active(){ diff --git a/plugins/mapxml/xmlparse.cpp b/plugins/mapxml/xmlparse.cpp index c9b7d34a..7e4367b8 100644 --- a/plugins/mapxml/xmlparse.cpp +++ b/plugins/mapxml/xmlparse.cpp @@ -66,27 +66,27 @@ public: virtual TreeXMLImporter& child() = 0; }; -class SubPrimitiveImporter : public TreeXMLImporter +class SubPrimitiveImporter final : public TreeXMLImporter { XMLImporter* m_importer; public: SubPrimitiveImporter( XMLImporter* importer ) : m_importer( importer ){ } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { m_importer->pushElement( element ); } - void popElement( const char* name ){ + void popElement( const char* name ) override { m_importer->popElement( name ); } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { return m_importer->write( buffer, length ); } - SubPrimitiveImporter& child(){ + SubPrimitiveImporter& child() override { return *this; } }; -class PrimitiveImporter : public TreeXMLImporter +class PrimitiveImporter final : public TreeXMLImporter { scene::Node& m_parent; XMLImporter* m_importer; @@ -98,7 +98,7 @@ class PrimitiveImporter : public TreeXMLImporter public: PrimitiveImporter( scene::Node& parent ) : m_parent( parent ), m_importer( 0 ){ } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { if ( string_equal( element.name(), "epair" ) ) { ASSERT_MESSAGE( string_equal( element.name(), "epair" ), PARSE_ERROR ); Node_getEntity( m_parent )->setKeyValue( element.attribute( "key" ), element.attribute( "value" ) ); @@ -116,7 +116,7 @@ public: Node_getTraversable( m_parent )->insert( node ); } } - void popElement( const char* name ){ + void popElement( const char* name ) override { if ( string_equal( name, "epair" ) ) { } else @@ -127,15 +127,15 @@ public: m_importer = 0; } } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { return m_importer->write( buffer, length ); } - TreeXMLImporter& child(){ + TreeXMLImporter& child() override { return subprimitive(); } }; -class EntityImporter : public TreeXMLImporter +class EntityImporter final : public TreeXMLImporter { scene::Node& m_parent; char m_node[sizeof( NodeSmartReference )]; @@ -152,12 +152,12 @@ class EntityImporter : public TreeXMLImporter public: EntityImporter( scene::Node& parent, EntityCreator& entityTable ) : m_parent( parent ), m_entityTable( entityTable ){ } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { ASSERT_MESSAGE( string_equal( element.name(), "entity" ), PARSE_ERROR ); constructor( node(), NodeSmartReference( m_entityTable.createEntity( GlobalEntityClassManager().findOrInsert( "", true ) ) ) ); constructor( primitive(), makeReference( node().get() ) ); } - void popElement( const char* name ){ + void popElement( const char* name ) override { ASSERT_MESSAGE( string_equal( name, "entity" ), PARSE_ERROR ); NodeSmartReference entity( m_entityTable.createEntity( GlobalEntityClassManager().findOrInsert( Node_getEntity( node() )->getClassName(), node_is_group( node() ) ) ) ); @@ -175,15 +175,15 @@ public: destructor( primitive() ); destructor( node() ); } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { return length; } - TreeXMLImporter& child(){ + TreeXMLImporter& child() override { return primitive(); } }; -class MapDoom3Importer : public TreeXMLImporter +class MapDoom3Importer final : public TreeXMLImporter { scene::Node& m_root; char m_child[sizeof( EntityImporter )]; @@ -195,38 +195,38 @@ class MapDoom3Importer : public TreeXMLImporter public: MapDoom3Importer( scene::Node& root, EntityCreator& entityTable ) : m_root( root ), m_entityTable( entityTable ){ } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { ASSERT_MESSAGE( string_equal( element.name(), "mapdoom3" ), PARSE_ERROR ); constructor( getEntity(), makeReference( m_root ), makeReference( m_entityTable ) ); } - void popElement( const char* name ){ + void popElement( const char* name ) override { ASSERT_MESSAGE( string_equal( name, "mapdoom3" ), PARSE_ERROR ); destructor( getEntity() ); } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } - TreeXMLImporter& child(){ + TreeXMLImporter& child() override { return getEntity(); } }; -class TreeXMLImporterStack : public XMLImporter +class TreeXMLImporterStack final : public XMLImporter { std::vector< Reference > m_importers; public: TreeXMLImporterStack( TreeXMLImporter& importer ){ m_importers.push_back( makeReference( importer ) ); } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { m_importers.back().get().pushElement( element ); m_importers.push_back( makeReference( m_importers.back().get().child() ) ); } - void popElement( const char* name ){ + void popElement( const char* name ) override { m_importers.pop_back(); m_importers.back().get().popElement( name ); } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { return ( *( m_importers.end() - 2 ) ).get().write( buffer, length ); } }; diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index 9ef75764..25947e58 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -1046,7 +1046,7 @@ public: m_Name = name; } - class MapLayer : public ShaderLayer + class MapLayer final : public ShaderLayer { qtexture_t* m_texture; BlendFunc m_blendFunc; @@ -1059,16 +1059,16 @@ public: m_clampToBorder( false ), m_alphaTest( alphaTest ){ } - qtexture_t* texture() const { + qtexture_t* texture() const override { return m_texture; } - BlendFunc blendFunc() const { + BlendFunc blendFunc() const override { return m_blendFunc; } - bool clampToBorder() const { + bool clampToBorder() const override { return m_clampToBorder; } - float alphaTest() const { + float alphaTest() const override { return m_alphaTest; } }; diff --git a/radiant/brush.cpp b/radiant/brush.cpp index c76237b5..de348e1c 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -318,17 +318,18 @@ void Brush::buildBRep(){ } -class FaceFilterWrapper : public Filter +class FaceFilterWrapper final : public Filter { - FaceFilter& m_filter; bool m_active; bool m_invert; + FaceFilter& m_filter; public: FaceFilterWrapper( FaceFilter& filter, bool invert ) : - m_filter( filter ), - m_invert( invert ){ + m_active( false ), // suppress uninitialized warning + m_invert( invert ), + m_filter( filter ){ } - void setActive( bool active ){ + void setActive( bool active ) override { m_active = active; } bool active(){ @@ -359,15 +360,18 @@ bool face_filtered( Face& face ){ } -class BrushFilterWrapper : public Filter +class BrushFilterWrapper final : public Filter { bool m_active; bool m_invert; BrushFilter& m_filter; public: - BrushFilterWrapper( BrushFilter& filter, bool invert ) : m_invert( invert ), m_filter( filter ){ + BrushFilterWrapper( BrushFilter& filter, bool invert ) : + m_active( false ), // suppress uninitialized warning + m_invert( invert ), + m_filter( filter ){ } - void setActive( bool active ){ + void setActive( bool active ) override { m_active = active; } bool active(){ diff --git a/radiant/brush.h b/radiant/brush.h index abfdba72..717bee90 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -1492,16 +1492,12 @@ public: SelectableEdge( Faces& faces, FaceVertexId faceVertex ) : m_faces( faces ), m_faceVertex( faceVertex ){ } - SelectableEdge& operator=( const SelectableEdge& other ){ - m_faceVertex = other.m_faceVertex; - return *this; - } Face& getFace() const { return *m_faces[m_faceVertex.getFace()]; } - void testSelect( SelectionTest& test, SelectionIntersection& best ){ + void testSelect( SelectionTest& test, SelectionIntersection& best ) const { test.TestPoint( getEdge(), best ); } }; @@ -1519,10 +1515,6 @@ public: SelectableVertex( Faces& faces, FaceVertexId faceVertex ) : m_faces( faces ), m_faceVertex( faceVertex ){ } - SelectableVertex& operator=( const SelectableVertex& other ){ - m_faceVertex = other.m_faceVertex; - return *this; - } Face& getFace() const { return *m_faces[m_faceVertex.getFace()]; @@ -3142,7 +3134,7 @@ inline void Face_addLight( const FaceInstance& face, const Matrix4& localToWorld typedef std::vector FaceInstances; typedef std::vector FaceInstances_ptrs; -class EdgeInstance : public Selectable +class EdgeInstance final : public Selectable { FaceInstances& m_faceInstances; SelectableEdge* m_edge; @@ -3170,15 +3162,11 @@ public: EdgeInstance( FaceInstances& faceInstances, SelectableEdge& edge ) : m_faceInstances( faceInstances ), m_edge( &edge ){ } - EdgeInstance& operator=( const EdgeInstance& other ){ - m_edge = other.m_edge; - return *this; - } - void setSelected( bool select ){ + void setSelected( bool select ) override { select_edge( select ); } - bool isSelected() const { + bool isSelected() const override { return selected_edge(); } @@ -3238,7 +3226,7 @@ public: } }; -class VertexInstance : public Selectable +class VertexInstance final : public Selectable { FaceInstances& m_faceInstances; SelectableVertex* m_vertex; @@ -3269,15 +3257,11 @@ public: VertexInstance( FaceInstances& faceInstances, SelectableVertex& vertex ) : m_faceInstances( faceInstances ), m_vertex( &vertex ){ } - VertexInstance& operator=( const VertexInstance& other ){ - m_vertex = other.m_vertex; - return *this; - } - void setSelected( bool select ){ + void setSelected( bool select ) override { select_vertex( select ); } - bool isSelected() const { + bool isSelected() const override { return selected_vertex(); } diff --git a/radiant/commands.cpp b/radiant/commands.cpp index 99ced45a..f9cccc2e 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -378,12 +378,12 @@ void DoCommandListDlg(){ auto commandLine = new QLineEdit; grid->addWidget( commandLine, 0, 0 ); commandLine->setClearButtonEnabled( true ); - commandLine->setPlaceholderText( QString::fromUtf8( u8"🔍 by command name" ) ); + commandLine->setPlaceholderText( QString::fromUtf8( "🔍 by command name" ) ); auto keyLine = new QLineEdit; grid->addWidget( keyLine, 0, 1 ); keyLine->setClearButtonEnabled( true ); - keyLine->setPlaceholderText( QString::fromUtf8( u8"🔍 by keys" ) ); + keyLine->setPlaceholderText( QString::fromUtf8( "🔍 by keys" ) ); const auto filter = [tree]( const int column, const QString& text ){ for( QTreeWidgetItemIterator it( tree ); *it; ++it ) diff --git a/radiant/eclass_xml.cpp b/radiant/eclass_xml.cpp index 99f5ceb4..1a9dd6a5 100644 --- a/radiant/eclass_xml.cpp +++ b/radiant/eclass_xml.cpp @@ -168,7 +168,7 @@ public: } }; -class BreakImporter : public TreeXMLImporter +class BreakImporter final : public TreeXMLImporter { public: BreakImporter( StringOutputStream& comment ){ @@ -177,19 +177,19 @@ public: static const char* name(){ return "n"; } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { ERROR_MESSAGE( PARSE_ERROR( element.name(), name() ) ); return *this; } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { ERROR_MESSAGE( PARSE_ERROR( elementName, name() ) ); } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } }; -class AttributeImporter : public TreeXMLImporter +class AttributeImporter final : public TreeXMLImporter { StringOutputStream& m_comment; @@ -232,14 +232,14 @@ public: } ~AttributeImporter(){ } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { ERROR_MESSAGE( PARSE_ERROR( element.name(), "attribute" ) ); return *this; } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { ERROR_MESSAGE( PARSE_ERROR( elementName, "attribute" ) ); } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { CopiedString& desc = m_attribute->m_description; if( desc.empty() ){ desc = StringRange( data, length ); @@ -281,7 +281,7 @@ bool listAttributeSupported( ListAttributeTypes& listTypes, const char* name ){ } -class ClassImporter : public TreeXMLImporter +class ClassImporter final : public TreeXMLImporter { EntityClassCollector& m_collector; EntityClass* m_eclass; @@ -329,7 +329,7 @@ public: static const char* name(){ return "class"; } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { if ( attributeSupported( element.name() ) || listAttributeSupported( m_listTypes, element.name() ) ) { constructor( m_attribute.get(), makeReference( m_comment ), m_eclass, element ); return m_attribute.get(); @@ -340,7 +340,7 @@ public: return *this; } } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { if ( attributeSupported( elementName ) || listAttributeSupported( m_listTypes, elementName ) ) { destructor( m_attribute.get() ); } @@ -349,12 +349,12 @@ public: ERROR_MESSAGE( PARSE_ERROR( elementName, name() ) ); } } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return m_comment.write( data, length ); } }; -class ItemImporter : public TreeXMLImporter +class ItemImporter final : public TreeXMLImporter { public: ItemImporter( ListAttributeType& list, const XMLElement& element ){ @@ -362,14 +362,14 @@ public: const char* value = element.attribute( "value" ); list.push_back( name, value ); } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { ERROR_MESSAGE( PARSE_ERROR( element.name(), "item" ) ); return *this; } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { ERROR_MESSAGE( PARSE_ERROR( elementName, "item" ) ); } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } }; @@ -378,7 +378,7 @@ bool isItem( const char* name ){ return string_equal( name, "item" ); } -class ListAttributeImporter : public TreeXMLImporter +class ListAttributeImporter final : public TreeXMLImporter { ListAttributeType* m_listType; Storage m_item; @@ -387,7 +387,7 @@ public: const char* name = element.attribute( "name" ); m_listType = &listTypes[name]; } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { if ( isItem( element.name() ) ) { constructor( m_item.get(), makeReference( *m_listType ), element ); return m_item.get(); @@ -398,7 +398,7 @@ public: return *this; } } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { if ( isItem( elementName ) ) { destructor( m_item.get() ); } @@ -407,7 +407,7 @@ public: ERROR_MESSAGE( PARSE_ERROR( elementName, "list" ) ); } } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } }; @@ -421,7 +421,7 @@ bool listSupported( const char* name ){ return string_equal( name, "list" ); } -class ClassesImporter : public TreeXMLImporter +class ClassesImporter final : public TreeXMLImporter { EntityClassCollector& m_collector; Storage m_class; @@ -434,7 +434,7 @@ public: static const char* name(){ return "classes"; } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { if ( classSupported( element.name() ) ) { constructor( m_class.get(), makeReference( m_collector ), makeReference( m_listTypes ), element ); return m_class.get(); @@ -449,7 +449,7 @@ public: return *this; } } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { if ( classSupported( elementName ) ) { destructor( m_class.get() ); } @@ -461,12 +461,12 @@ public: ERROR_MESSAGE( PARSE_ERROR( elementName, name() ) ); } } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } }; -class EclassXMLImporter : public TreeXMLImporter +class EclassXMLImporter final : public TreeXMLImporter { EntityClassCollector& m_collector; Storage m_classes; @@ -477,7 +477,7 @@ public: static const char* name(){ return "classes"; } - TreeXMLImporter& pushElement( const XMLElement& element ){ + TreeXMLImporter& pushElement( const XMLElement& element ) override { if ( string_equal( element.name(), ClassesImporter::name() ) ) { constructor( m_classes.get(), makeReference( m_collector ) ); return m_classes.get(); @@ -488,7 +488,7 @@ public: return *this; } } - void popElement( const char* elementName ){ + void popElement( const char* elementName ) override { if ( string_equal( elementName, ClassesImporter::name() ) ) { destructor( m_classes.get() ); } @@ -497,26 +497,26 @@ public: ERROR_MESSAGE( PARSE_ERROR( elementName, name() ) ); } } - std::size_t write( const char* data, std::size_t length ){ + std::size_t write( const char* data, std::size_t length ) override { return length; } }; -class TreeXMLImporterStack : public XMLImporter +class TreeXMLImporterStack final : public XMLImporter { std::vector< Reference > m_importers; public: TreeXMLImporterStack( TreeXMLImporter& importer ){ m_importers.push_back( makeReference( importer ) ); } - void pushElement( const XMLElement& element ){ + void pushElement( const XMLElement& element ) override { m_importers.push_back( makeReference( m_importers.back().get().pushElement( element ) ) ); } - void popElement( const char* name ){ + void popElement( const char* name ) override { m_importers.pop_back(); m_importers.back().get().popElement( name ); } - std::size_t write( const char* buffer, std::size_t length ){ + std::size_t write( const char* buffer, std::size_t length ) override { return m_importers.back().get().write( buffer, length ); } }; diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 4e679f54..79b65363 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1357,7 +1357,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ { auto b = g_focusToggleButton = new QToolButton; hbox->addWidget( b ); - b->setText( u8"👀" ); + b->setText( "👀" ); b->setToolTip( "AutoFocus on Selection" ); b->setCheckable( true ); QObject::connect( b, &QAbstractButton::clicked, []( bool checked ){ if( checked ) FocusAllViews(); } ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index ce89807f..94193340 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -1583,7 +1583,7 @@ class QLineEdit_search : public QLineEdit QPlainTextEdit& m_textEdit; public: QLineEdit_search( QPlainTextEdit& textEdit ) : m_textEdit( textEdit ){ - setPlaceholderText( QString::fromUtf8( u8"🔍" ) ); + setPlaceholderText( QString::fromUtf8( "🔍" ) ); QObject::connect( this, &QLineEdit::textEdited, [this]( const QString &text ){ // when typing, we do not want jumping to next occurence on each letter input, set cursor to selection start if( auto cursor = m_textEdit.textCursor(); cursor.hasSelection() ){ diff --git a/radiant/patch.cpp b/radiant/patch.cpp index 38e20be8..bc993b93 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -3278,15 +3278,18 @@ void Patch::createThickenedWall(const Patch& sourcePatch, } -class PatchFilterWrapper : public Filter +class PatchFilterWrapper final : public Filter { bool m_active; bool m_invert; PatchFilter& m_filter; public: - PatchFilterWrapper( PatchFilter& filter, bool invert ) : m_invert( invert ), m_filter( filter ){ + PatchFilterWrapper( PatchFilter& filter, bool invert ) : + m_active( false ), // suppress uninitialized warning + m_invert( invert ), + m_filter( filter ){ } - void setActive( bool active ){ + void setActive( bool active ) override { m_active = active; } bool active(){ diff --git a/radiant/referencecache.cpp b/radiant/referencecache.cpp index c332d2b0..e3488e72 100644 --- a/radiant/referencecache.cpp +++ b/radiant/referencecache.cpp @@ -320,7 +320,7 @@ const char* rootPath( const char* name ){ } } -struct ModelResource : public Resource +struct ModelResource final : public Resource { NodeSmartReference m_model; const CopiedString m_originalName; @@ -389,7 +389,7 @@ struct ModelResource : public Resource mapSave(); } - bool load(){ + bool load() override { ASSERT_MESSAGE( realised(), "resource not realised" ); if ( m_model == g_nullModel ) { loadModel(); @@ -397,7 +397,7 @@ struct ModelResource : public Resource return m_model != g_nullModel; } - bool save(){ + bool save() override { if ( !mapSaved() ) { const char* moduleName = findModuleName( GetFileTypeRegistry(), MapFormat::Name, m_type.c_str() ); if ( string_not_empty( moduleName ) ) { @@ -410,19 +410,19 @@ struct ModelResource : public Resource } return false; } - void flush(){ + void flush() override { if ( realised() ) { ModelCache_flush( m_path.c_str(), m_name.c_str() ); } } - scene::Node* getNode(){ + scene::Node* getNode() override { //if(m_model != g_nullModel) { return m_model.get_pointer(); } //return 0; } - void setNode( scene::Node* node ){ + void setNode( scene::Node* node ) override { ModelCache::iterator i = ModelCache_find( m_path.c_str(), m_name.c_str() ); if ( i != g_modelCache.end() ) { ( *i ).value = NodeSmartReference( *node ); @@ -431,13 +431,13 @@ struct ModelResource : public Resource connectMap(); } - void attach( ModuleObserver& observer ){ + void attach( ModuleObserver& observer ) override { if ( realised() ) { observer.realise(); } m_observers.attach( observer ); } - void detach( ModuleObserver& observer ){ + void detach( ModuleObserver& observer ) override { if ( realised() ) { observer.unrealise(); } @@ -446,7 +446,7 @@ struct ModelResource : public Resource bool realised(){ return m_unrealised == 0; } - void realise(){ + void realise() override { ASSERT_MESSAGE( m_unrealised != 0, "ModelResource::realise: already realised" ); if ( --m_unrealised == 0 ) { m_path = rootPath( m_originalName.c_str() ); @@ -457,7 +457,7 @@ struct ModelResource : public Resource m_observers.realise(); } } - void unrealise(){ + void unrealise() override { if ( ++m_unrealised == 1 ) { m_observers.unrealise(); @@ -496,7 +496,7 @@ struct ModelResource : public Resource && m_modified != modified() ) // AND disk timestamp changed || !path_equal( rootPath( m_originalName.c_str() ), m_path.c_str() ) ); // OR absolute vfs-root changed } - void refresh(){ + void refresh() override { if ( isModified() ) { flush(); unrealise(); diff --git a/radiant/selection.cpp b/radiant/selection.cpp index bab0c5ad..365320d2 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -2336,9 +2336,9 @@ public: } bool isSelected() const override { return m_selectable_x.isSelected() - | m_selectable_y.isSelected() - | m_selectable_z.isSelected() - | m_selectable_screen.isSelected(); + || m_selectable_y.isSelected() + || m_selectable_z.isSelected() + || m_selectable_screen.isSelected(); } }; @@ -2489,9 +2489,9 @@ public: } bool isSelected() const override { return m_selectable_x.isSelected() - | m_selectable_y.isSelected() - | m_selectable_z.isSelected() - | m_selectable_screen.isSelected(); + || m_selectable_y.isSelected() + || m_selectable_z.isSelected() + || m_selectable_screen.isSelected(); } }; @@ -7678,8 +7678,8 @@ public: bool endMove(); void freezeTransforms(); - void renderSolid( Renderer& renderer, const VolumeTest& volume ) const; - void renderWireframe( Renderer& renderer, const VolumeTest& volume ) const { + void renderSolid( Renderer& renderer, const VolumeTest& volume ) const override; + void renderWireframe( Renderer& renderer, const VolumeTest& volume ) const override { renderSolid( renderer, volume ); } @@ -8592,7 +8592,7 @@ public: m_manipulator( m_epsilon, m_state ), m_texmanipulator( m_epsilon, m_state ){ } - void release(){ + void release() override { delete this; } void setView( const View& view ) override { @@ -8606,12 +8606,12 @@ public: void updateEpsilon(){ m_epsilon = DeviceVector( g_SELECT_EPSILON / static_cast( m_width ), g_SELECT_EPSILON / static_cast( m_height ) ); } - void onSizeChanged( int width, int height ){ + void onSizeChanged( int width, int height ) override { m_width = width; m_height = height; updateEpsilon(); } - void onMouseDown( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ){ + void onMouseDown( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ) override { updateEpsilon(); /* could have changed, as it is user setting */ const DeviceVector devicePosition( device( position ) ); @@ -8649,7 +8649,7 @@ public: m_moveStart = devicePosition; m_movePressed = 0.f; } - void onMouseMotion( const WindowVector& position, ModifierFlags modifiers ){ + void onMouseMotion( const WindowVector& position, ModifierFlags modifiers ) override { m_selector.m_mouseMoved = mouse_moved_epsilon( position, m_moveEnd, m_move ); if ( m_mouse_down && !g_mouseMovedCallback.empty() ) { m_manipulator.m_mouseMovedWhilePressed = m_selector.m_mouseMovedWhilePressed = mouse_moved_epsilon( position, m_moveStart, m_movePressed ); @@ -8659,7 +8659,7 @@ public: m_manipulator.highlight( device( position ) ); } } - void onMouseUp( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ){ + void onMouseUp( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ) override { if ( ( button == c_button_select || button == c_button_select2 || button == c_button_texture ) && !g_mouseUpCallback.empty() ) { g_mouseUpCallback.get() ( device( position ) ); m_mouse_down = false; @@ -8683,11 +8683,11 @@ public: m_moveEnd = device( position ); m_move = 0.f; } - void onModifierDown( ModifierFlags type ){ + void onModifierDown( ModifierFlags type ) override { g_modifiers = m_state = bitfield_enable( m_state, type ); m_selector.setState( m_state ); } - void onModifierUp( ModifierFlags type ){ + void onModifierUp( ModifierFlags type ) override { g_modifiers = m_state = bitfield_disable( m_state, type ); m_selector.setState( m_state ); } diff --git a/radiant/treemodel.cpp b/radiant/treemodel.cpp index 67f7f4c7..4ab86ffc 100644 --- a/radiant/treemodel.cpp +++ b/radiant/treemodel.cpp @@ -51,7 +51,13 @@ const char* node_get_name( scene::Node& node ){ } const char* node_get_name_safe( scene::Node& node ){ - volatile intptr_t n = (intptr_t)&node; // see the comment on line 650 + // https://github.com/TTimo/GtkRadiant/issues/289 + // Reference cannot be bound to dereferenced null pointer in well-defined + // C++ code, and Clang will assume that comparison below always evaluates + // to true, resulting in a segmentation fault. Use a dirty hack to force + // Clang to check those "bad" references for null nonetheless. + // At least here check is vital , 0 is g_null_node + volatile intptr_t n = (intptr_t)&node; // see the comment on line 54 if ( n == 0 ) { return ""; } @@ -59,7 +65,7 @@ const char* node_get_name_safe( scene::Node& node ){ } void node_attach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ - volatile intptr_t n = (intptr_t)&node; // see the comment on line 650 + volatile intptr_t n = (intptr_t)&node; // see the comment on line 54 if ( n != 0 ) { Nameable* nameable = Node_getNameable( node ); if ( nameable != 0 ) { @@ -68,7 +74,7 @@ void node_attach_name_changed_callback( scene::Node& node, const NameCallback& c } } void node_detach_name_changed_callback( scene::Node& node, const NameCallback& callback ){ - volatile intptr_t n = (intptr_t)&node; // see the comment on line 650 + volatile intptr_t n = (intptr_t)&node; // see the comment on line 54 if ( n != 0 ) { Nameable* nameable = Node_getNameable( node ); if ( nameable != 0 ) { diff --git a/tools/mbspc/mbspc/l_log.c b/tools/mbspc/mbspc/l_log.c index 57797660..8a9695f2 100644 --- a/tools/mbspc/mbspc/l_log.c +++ b/tools/mbspc/mbspc/l_log.c @@ -62,7 +62,7 @@ void Log_Open(char *filename) printf("can't open the log file %s\n", filename); return; } //end if - strncpy(logfile.filename, filename, MAX_LOGFILENAMESIZE); + strncpy(logfile.filename, filename, MAX_LOGFILENAMESIZE - 1); printf("Opened log %s\n", logfile.filename); } //end of the function Log_Create //=========================================================================== diff --git a/tools/quake2/q2map/main.c b/tools/quake2/q2map/main.c index 4bbeb3b4..869fc275 100644 --- a/tools/quake2/q2map/main.c +++ b/tools/quake2/q2map/main.c @@ -590,7 +590,7 @@ int main( int argc, char **argv ){ } else if ( !strcmp( argv[ i ], "-game" ) ) { i++; - strncpy( game, argv[ i ], 64 ); + strncpy( game, argv[ i ], sizeof( game ) - 1 ); strLower( game ); } } diff --git a/tools/quake2/qdata_heretic2/svdcmp.c b/tools/quake2/qdata_heretic2/svdcmp.c index 63811395..b36a80b4 100644 --- a/tools/quake2/qdata_heretic2/svdcmp.c +++ b/tools/quake2/qdata_heretic2/svdcmp.c @@ -42,7 +42,7 @@ void ntrerror( char *s ){ double *allocVect( int sz ){ double *ret; - ret = calloc( sizeof( double ), (size_t)sz ); + ret = calloc( (size_t)sz, sizeof( double ) ); return ret; } @@ -53,7 +53,7 @@ void freeVect( double *ret ){ double **allocMatrix( int r,int c ){ double **ret; - ret = calloc( sizeof( double ), (size_t)( r * c ) ); + ret = calloc( (size_t)( r * c ), sizeof( double ) ); return ret; } @@ -323,7 +323,7 @@ void DOsvd( float *a,float *res,float *comp,float *values,int nframes,int frames svdcmp( da,usedfs,nframes,w,v ); - remap = calloc( sizeof( int ), (size_t)nframes ); + remap = calloc( (size_t)nframes, sizeof( int ) ); for ( i = 0; i < nframes; i++ ) diff --git a/tools/quake3/common/stringfixedsize.h b/tools/quake3/common/stringfixedsize.h index bb0fe106..568f770b 100644 --- a/tools/quake3/common/stringfixedsize.h +++ b/tools/quake3/common/stringfixedsize.h @@ -29,7 +29,7 @@ /// \brief A TextOutputStream which writes to a null terminated fixed length char array. /// Similar to std::stringstream. template -class StringFixedSize : public TextOutputStream +class StringFixedSize final : public TextOutputStream { char m_string[SIZE]; std::size_t m_length; diff --git a/tools/quake3/q3map2/image.cpp b/tools/quake3/q3map2/image.cpp index a21388f3..b0f715c5 100644 --- a/tools/quake3/q3map2/image.cpp +++ b/tools/quake3/q3map2/image.cpp @@ -285,15 +285,15 @@ const image_t *ImageLoad( const char *name ){ bool alphaHack = false; /* attempt to load various formats */ - if ( sprintf( filename, "%s.tga", name ); buffer = vfsLoadFile( filename ) ) // StripExtension( name ); already + if ( sprintf( filename, "%s.tga", name ); ( buffer = vfsLoadFile( filename ) ) ) // StripExtension( name ); already { LoadTGABuffer( buffer.data(), buffer.size(), &pixels, &width, &height ); } - else if( path_set_extension( filename, ".png" ); buffer = vfsLoadFile( filename ) ) + else if( path_set_extension( filename, ".png" ); ( buffer = vfsLoadFile( filename ) ) ) { LoadPNGBuffer( buffer.data(), buffer.size(), &pixels, &width, &height ); } - else if( path_set_extension( filename, ".jpg" ); buffer = vfsLoadFile( filename ) ) + else if( path_set_extension( filename, ".jpg" ); ( buffer = vfsLoadFile( filename ) ) ) { if ( LoadJPGBuff( buffer.data(), buffer.size(), &pixels, &width, &height ) == -1 && pixels != nullptr ) { // On error, LoadJPGBuff might store a pointer to the error message in pixels @@ -302,7 +302,7 @@ const image_t *ImageLoad( const char *name ){ } alphaHack = true; } - else if( path_set_extension( filename, ".dds" ); buffer = vfsLoadFile( filename ) ) + else if( path_set_extension( filename, ".dds" ); ( buffer = vfsLoadFile( filename ) ) ) { LoadDDSBuffer( buffer.data(), buffer.size(), &pixels, &width, &height ); /* debug code */ @@ -318,7 +318,7 @@ const image_t *ImageLoad( const char *name ){ } #endif } - else if( path_set_extension( filename, ".ktx" ); buffer = vfsLoadFile( filename ) ) + else if( path_set_extension( filename, ".ktx" ); ( buffer = vfsLoadFile( filename ) ) ) { LoadKTXBufferFirstImage( buffer.data(), buffer.size(), &pixels, &width, &height ); } @@ -334,7 +334,7 @@ const image_t *ImageLoad( const char *name ){ image_t& image = *images.emplace_after( images.cbegin(), name, filename, width, height, pixels ); if ( alphaHack ) { - if ( path_set_extension( filename, "_alpha.jpg" ); buffer = vfsLoadFile( filename ) ) { + if ( path_set_extension( filename, "_alpha.jpg" ); ( buffer = vfsLoadFile( filename ) ) ) { if ( LoadJPGBuff( buffer.data(), buffer.size(), &pixels, &width, &height ) == -1 ) { if ( pixels ) { // On error, LoadJPGBuff might store a pointer to the error message in pixels diff --git a/tools/quake3/q3map2/light_trace.cpp b/tools/quake3/q3map2/light_trace.cpp index ddbc0a35..d339daf7 100644 --- a/tools/quake3/q3map2/light_trace.cpp +++ b/tools/quake3/q3map2/light_trace.cpp @@ -436,6 +436,8 @@ void ClipTraceWinding( traceWinding_t *tw, const Plane3f& plane, traceWinding_t front->v[ front->numVerts++ ] = *a; back->v[ back->numVerts++ ] = *a; continue; + case eSideCross: // unused here, suppress warning + break; } /* check next point to see if we need to split the edge */ diff --git a/tools/quake3/q3map2/light_ydnar.cpp b/tools/quake3/q3map2/light_ydnar.cpp index bdf5a6b2..908ba1e7 100644 --- a/tools/quake3/q3map2/light_ydnar.cpp +++ b/tools/quake3/q3map2/light_ydnar.cpp @@ -3901,7 +3901,7 @@ static void FloodLightRawLightmapPass( rawLightmap_t *lm, Vector3& lmFloodLightR // int sx, sy; // float samples, average, *floodlight2; - memset( &trace,0,sizeof( trace_t ) ); + memset( &trace, 0, sizeof( trace_t ) ); /* setup trace */ trace.testOcclusion = true; diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index 3c3d346a..cab4e24f 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -190,7 +190,7 @@ struct ModelNameFrame }; struct AssModel { - struct AssModelMesh : public AssMeshWalker + struct AssModelMesh final : public AssMeshWalker { const aiMesh *m_mesh; CopiedString m_shader; diff --git a/tools/quake3/q3map2/tjunction.cpp b/tools/quake3/q3map2/tjunction.cpp index 69495a8e..5950a4dc 100644 --- a/tools/quake3/q3map2/tjunction.cpp +++ b/tools/quake3/q3map2/tjunction.cpp @@ -87,7 +87,7 @@ int c_broken; ==================== */ static void InsertPointOnEdge( const Vector3 &v, edgeLine_t& e ) { - const edgePoint_t p = { .intercept = vector3_dot( v - e.origin, e.dir ), .xyz = v }; + const edgePoint_t p = { .intercept = static_cast( vector3_dot( v - e.origin, e.dir ) ), .xyz = v }; for ( auto it = e.points.cbegin(); it != e.points.cend(); ++it ) { if ( float_equal_epsilon( p.intercept, it->intercept, LINE_POSITION_EPSILON ) ) {