From: Mattia Basaglia Date: Mon, 20 Jul 2015 17:07:28 +0000 (+0200) Subject: Remove most of the compiler warning in radiant X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=11018d4c7a79bf63ed40f942ec89620a1b0c6ad7;p=xonotic%2Fnetradiant.git Remove most of the compiler warning in radiant --- diff --git a/contrib/bobtoolz/DMap.cpp b/contrib/bobtoolz/DMap.cpp index 72356946..18edc3b1 100644 --- a/contrib/bobtoolz/DMap.cpp +++ b/contrib/bobtoolz/DMap.cpp @@ -58,7 +58,7 @@ DMap::~DMap(){ ClearEntities(); } -DEntity* DMap::AddEntity( char *classname, int ID ){ +DEntity* DMap::AddEntity( const char *classname, int ID ){ DEntity* newEntity; if ( ID == -1 ) { newEntity = new DEntity( classname, m_nNextEntity++ ); diff --git a/contrib/bobtoolz/DMap.h b/contrib/bobtoolz/DMap.h index b4a3f79b..f527d04d 100644 --- a/contrib/bobtoolz/DMap.h +++ b/contrib/bobtoolz/DMap.h @@ -45,7 +45,7 @@ DEntity* GetWorldSpawn(); void ClearEntities(); DEntity* GetEntityForID( int ID ); -DEntity* AddEntity( char* classname = "worldspawn", int ID = -1 ); +DEntity* AddEntity( const char* classname = "worldspawn", int ID = -1 ); std::list entityList; diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 2228b23b..2d023967 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -302,7 +302,7 @@ DPatch* DPatch::MergePatches( patch_merge_t merge_info, DPatch *p1, DPatch *p2 ) int newHeight = p1->height + p2->height - 1; if ( newHeight > MAX_PATCH_HEIGHT ) { - return false; + return NULL; } DPatch* newPatch = new DPatch(); @@ -483,8 +483,6 @@ std::list DPatch::SplitRows(){ std::list DPatch::Split(){ std::list patchList; - int i; - int x, y; if ( width >= 5 ) { std::list patchColList = SplitCols(); diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index d7893955..c4a057bd 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -57,10 +57,10 @@ void BobToolz_destroy(){ } // plugin name -char* PLUGIN_NAME = "bobToolz"; +const char* PLUGIN_NAME = "bobToolz"; // commands in the menu -static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge"; +static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge"; // globals GtkWidget *g_pRadiantWnd = NULL; @@ -284,11 +284,11 @@ class BobToolzPluginDependencies : public: BobToolzPluginDependencies() : GlobalEntityModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entities" ) ), + GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ), GlobalShadersModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "shaders" ) ), GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) ), - GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ), - GlobalEntityClassManagerModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "entityclass" ) ){ -} + GlobalPatchModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "patchtypes" ) ) + {} }; class BobToolzPluginModule : public TypeSystemRef diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index b596f059..4f84838d 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -115,7 +115,7 @@ static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){ Data validation Routines ---------------------------------*/ -bool ValidateTextFloat( const char* pData, char* error_title, float* value ){ +bool ValidateTextFloat( const char* pData, const char* error_title, float* value ){ if ( pData ) { float testNum = (float)atof( pData ); @@ -134,7 +134,7 @@ bool ValidateTextFloat( const char* pData, char* error_title, float* value ){ return FALSE; } -bool ValidateTextFloatRange( const char* pData, float min, float max, char* error_title, float* value ){ +bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){ char error_buffer[256]; sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max ); @@ -156,7 +156,7 @@ bool ValidateTextFloatRange( const char* pData, float min, float max, char* erro return FALSE; } -bool ValidateTextIntRange( const char* pData, int min, int max, char* error_title, int* value ){ +bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){ char error_buffer[256]; sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max ); @@ -178,7 +178,7 @@ bool ValidateTextIntRange( const char* pData, int min, int max, char* error_titl return FALSE; } -bool ValidateTextInt( const char* pData, char* error_title, int* value ){ +bool ValidateTextInt( const char* pData, const char* error_title, int* value ){ if ( pData ) { int testNum = atoi( pData ); @@ -597,7 +597,7 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ EMessageBoxReturn ret; int loop = 1; - char *text = "Please set a value in the boxes below and press 'OK' to build the stairs"; + const gchar *text = "Please set a value in the boxes below and press 'OK' to build the stairs"; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); @@ -1909,7 +1909,7 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ EMessageBoxReturn ret; int loop = 1; - char *text = "Please set a value in the boxes below and press 'OK' to make a chain"; + const gchar *text = "Please set a value in the boxes below and press 'OK' to make a chain"; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); @@ -2012,4 +2012,4 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ gtk_widget_destroy( window ); return ret; -} \ No newline at end of file +} diff --git a/contrib/bobtoolz/misc.cpp b/contrib/bobtoolz/misc.cpp index 977879f5..202065fc 100644 --- a/contrib/bobtoolz/misc.cpp +++ b/contrib/bobtoolz/misc.cpp @@ -129,7 +129,7 @@ char* TranslateString( char *buf ){ std::size_t l = strlen( buf ); char* out = buf2; - for ( int i = 0 ; i < l ; i++ ) + for ( std::size_t i = 0 ; i < l ; i++ ) { if ( buf[i] == '\n' ) { *out++ = '\r'; diff --git a/contrib/prtview/portals.cpp b/contrib/prtview/portals.cpp index a896fcd4..b85945bc 100644 --- a/contrib/prtview/portals.cpp +++ b/contrib/prtview/portals.cpp @@ -37,10 +37,10 @@ CPortalsRender render; int compare( const void *arg1, const void *arg2 ){ - if ( portals.portal[*( (int *)arg1 )].dist > portals.portal[*( (int *)arg2 )].dist ) { + if ( portals.portal[*( (const int *)arg1 )].dist > portals.portal[*( (const int *)arg2 )].dist ) { return -1; } - else if ( portals.portal[*( (int *)arg1 )].dist < portals.portal[*( (int *)arg2 )].dist ) { + else if ( portals.portal[*( (const int *)arg1 )].dist < portals.portal[*( (const int *)arg2 )].dist ) { return 1; } @@ -61,7 +61,7 @@ bool CBspPortal::Build( char *def ){ char *c = def; unsigned int n; int dummy1, dummy2; - int res_cnt, i; + int res_cnt = 0, i; if ( portals.hint_flags ) { res_cnt = sscanf( def, "%u %d %d %d", &point_count, &dummy1, &dummy2, (int *)&hint ); @@ -603,7 +603,7 @@ void CPortalsDrawSolid::render( RenderStateFlags state ) const { } void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const { - for ( int n = 0; n < portals.portal_count; n++ ) + for ( unsigned int n = 0; n < portals.portal_count; n++ ) { if ( portals.lines == 2 && !portals.portal[n].hint ) { continue; @@ -632,7 +632,7 @@ void CPortalsDrawSolidOutline::render( RenderStateFlags state ) const { glBegin( GL_LINE_LOOP ); - for ( int p = 0; p < portals.portal[n].point_count; p++ ) + for ( unsigned int p = 0; p < portals.portal[n].point_count; p++ ) glVertex3fv( portals.portal[n].inner_point[p].p ); glEnd(); diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index 301ac9ea..36702213 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -162,7 +162,7 @@ void SaveConfig(){ #define CONFIG_SECTION "Configuration" -int INIGetInt( char *key, int def ){ +int INIGetInt( const char *key, int def ){ char value[1024]; if ( read_var( INIfn.c_str(), CONFIG_SECTION, key, value ) ) { @@ -173,7 +173,7 @@ int INIGetInt( char *key, int def ){ } } -void INISetInt( char *key, int val, char *comment /* = NULL */ ){ +void INISetInt( const char* key, int val, const char* comment /* = NULL */ ){ char s[1000]; if ( comment ) { diff --git a/contrib/prtview/prtview.h b/contrib/prtview/prtview.h index e149ae80..df84d6a2 100644 --- a/contrib/prtview/prtview.h +++ b/contrib/prtview/prtview.h @@ -25,8 +25,8 @@ void InitInstance(); void SaveConfig(); -int INIGetInt( char *key, int def ); -void INISetInt( char *key, int val, char *comment = 0 ); +int INIGetInt( const char *key, int def ); +void INISetInt( const char *key, int val, const char *comment = 0 ); #define IDOK 1 #define IDCANCEL 2 diff --git a/contrib/shaderplug/shaderplug.cpp b/contrib/shaderplug/shaderplug.cpp index 62e9abe6..0cf2cbd0 100644 --- a/contrib/shaderplug/shaderplug.cpp +++ b/contrib/shaderplug/shaderplug.cpp @@ -118,7 +118,7 @@ void LoadTextureFile( const char* filename ){ typedef FreeCaller1 LoadTextureFileCaller; -void GetTextures( char* extension ){ +void GetTextures( const char* extension ){ GlobalFileSystem().forEachFile( "textures/", extension, LoadTextureFileCaller(), 0 ); } diff --git a/contrib/ufoaiplug/ufoai_gtk.cpp b/contrib/ufoaiplug/ufoai_gtk.cpp index c01a31fe..afbb47b2 100644 --- a/contrib/ufoaiplug/ufoai_gtk.cpp +++ b/contrib/ufoaiplug/ufoai_gtk.cpp @@ -43,23 +43,23 @@ UFOAIGtk( void* gtk_window ) : m_gtk_window( ( GtkWindow* )gtk_window ){ * This is useful for popping up 'are you sure you want to quit?' * type dialogs. */ -static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ){ +/*static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ){ return FALSE; -} +}*/ /** * @brief destroy widget if destroy signal is passed to widget */ -static void destroy( GtkWidget *widget, gpointer data ){ +/*static void destroy( GtkWidget *widget, gpointer data ){ gtk_widget_destroy( widget ); -} +}*/ /** * @brief function for close button to destroy the toplevel widget */ -static void close_window( GtkWidget *widget, gpointer data ){ +/*static void close_window( GtkWidget *widget, gpointer data ){ gtk_widget_destroy( gtk_widget_get_toplevel( widget ) ); -} +}*/ /* =============================== */ diff --git a/include/iarchive.h b/include/iarchive.h index dddf5579..197945c0 100644 --- a/include/iarchive.h +++ b/include/iarchive.h @@ -31,6 +31,7 @@ class InputStream; class ArchiveFile { public: +virtual ~ArchiveFile(){} /// \brief Destroys the file object. virtual void release() = 0; /// \brief Returns the size of the file data in bytes. @@ -50,6 +51,7 @@ class TextInputStream; class ArchiveTextFile { public: +virtual ~ArchiveTextFile(){} /// \brief Destroys the file object. virtual void release() = 0; /// \brief Returns the stream associated with this file. @@ -79,6 +81,7 @@ public: class Visitor { public: +virtual ~Visitor(){} virtual void visit( const char* name ) = 0; }; @@ -91,6 +94,7 @@ enum EMode eFilesAndDirectories = 0x03, }; +virtual ~Archive(){} /// \brief Destroys the archive object. /// Any unreleased file object associated with the archive remains valid. */ virtual void release() = 0; diff --git a/include/ientity.h b/include/ientity.h index c315b3ab..e38ce596 100644 --- a/include/ientity.h +++ b/include/ientity.h @@ -34,6 +34,7 @@ typedef Callback1 KeyObserver; class EntityKeyValue { public: +virtual ~EntityKeyValue(){} virtual const char* c_str() const = 0; virtual void assign( const char* other ) = 0; virtual void attach( const KeyObserver& observer ) = 0; @@ -48,6 +49,7 @@ STRING_CONSTANT( Name, "Entity" ); class Observer { public: +virtual ~Observer(){} virtual void insert( const char* key, EntityKeyValue& value ) = 0; virtual void erase( const char* key, EntityKeyValue& value ) = 0; virtual void clear() { }; @@ -56,9 +58,11 @@ virtual void clear() { }; class Visitor { public: +virtual ~Visitor(){} virtual void visit( const char* key, const char* value ) = 0; }; +virtual ~Entity(){} virtual const EntityClass& getEntityClass() const = 0; virtual void forEachKeyValue( Visitor& visitor ) const = 0; virtual void setKeyValue( const char* key, const char* value ) = 0; diff --git a/include/iimage.h b/include/iimage.h index c159e657..4539825c 100644 --- a/include/iimage.h +++ b/include/iimage.h @@ -29,6 +29,7 @@ typedef unsigned char byte; class Image { public: +virtual ~Image(){} virtual void release() = 0; virtual byte* getRGBAPixels() const = 0; virtual unsigned int getWidth() const = 0; diff --git a/include/imap.h b/include/imap.h index 7af4c472..05347e6e 100644 --- a/include/imap.h +++ b/include/imap.h @@ -32,7 +32,7 @@ class MapImporter { public: STRING_CONSTANT( Name, "MapImporter" ); - +virtual ~MapImporter() {} virtual bool importTokens( Tokeniser& tokeniser ) = 0; }; @@ -42,6 +42,7 @@ class MapExporter public: STRING_CONSTANT( Name, "MapExporter" ); +virtual ~MapExporter() {} virtual void exportTokens( TokenWriter& writer ) const = 0; }; @@ -63,6 +64,7 @@ INTEGER_CONSTANT( Version, 2 ); STRING_CONSTANT( Name, "map" ); mutable bool wrongFormat; +virtual ~MapFormat(){} /// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities. virtual void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable ) const = 0; /// \brief Write the map graph obtained by applying \p traverse to \p root into \p outputStream. diff --git a/include/irender.h b/include/irender.h index 51994542..282fb031 100644 --- a/include/irender.h +++ b/include/irender.h @@ -67,6 +67,7 @@ class Shader; class RendererLight { public: +virtual ~RendererLight(){} virtual Shader* getShader() const = 0; virtual const AABB& aabb() const = 0; virtual bool testAABB( const AABB& other ) const = 0; @@ -80,6 +81,7 @@ virtual const Matrix4& projection() const = 0; class LightCullable { public: +virtual ~LightCullable(){} virtual bool testLight( const RendererLight& light ) const = 0; virtual void insertLight( const RendererLight& light ){ } @@ -95,6 +97,7 @@ typedef Callback1 RendererLightCallback; class LightList { public: +virtual ~LightList(){} virtual void evaluateLights() const = 0; virtual void lightsChanged() const = 0; virtual void forEachLight( const RendererLightCallback& callback ) const = 0; @@ -107,6 +110,7 @@ const int c_attr_Binormal = 4; class OpenGLRenderable { public: +virtual ~OpenGLRenderable(){} virtual void render( RenderStateFlags state ) const = 0; }; @@ -119,6 +123,7 @@ class ModuleObserver; class Shader { public: +virtual ~Shader(){} virtual void addRenderable( const OpenGLRenderable& renderable, const Matrix4& modelview, const LightList* lights = 0 ) = 0; virtual void incrementUsed() = 0; virtual void decrementUsed() = 0; @@ -134,6 +139,7 @@ public: INTEGER_CONSTANT( Version, 1 ); STRING_CONSTANT( Name, "renderstate" ); +virtual ~ShaderCache(){} virtual Shader* capture( const char* name ) = 0; virtual void release( const char* name ) = 0; /*! Render all Shader objects. */ diff --git a/include/iscenegraph.h b/include/iscenegraph.h index 6b28b0fc..e22a4b76 100644 --- a/include/iscenegraph.h +++ b/include/iscenegraph.h @@ -76,6 +76,7 @@ STRING_CONSTANT( Name, "scenegraph" ); class Walker { public: +virtual ~Walker(){} /// \brief Called before traversing the first child-instance of 'instance'. If the return value is false, the children of the current instance are not traversed. virtual bool pre( const Path& path, Instance& instance ) const = 0; /// \brief Called after traversing the last child-instance of 'instance'. @@ -83,6 +84,7 @@ virtual void post( const Path& path, Instance& instance ) const { } }; +virtual ~Graph(){} /// \brief Returns the root-node of the graph. virtual Node& root() = 0; /// \brief Sets the root-node of the graph to be 'node'. diff --git a/include/iscriplib.h b/include/iscriplib.h index 8f645033..113f1409 100644 --- a/include/iscriplib.h +++ b/include/iscriplib.h @@ -33,6 +33,7 @@ class Tokeniser { public: +virtual ~Tokeniser(){} virtual void release() = 0; virtual void nextLine() = 0; virtual const char* getToken() = 0; @@ -46,6 +47,7 @@ class TextInputStream; class TokenWriter { public: +virtual ~TokenWriter(){} virtual void release() = 0; virtual void nextLine() = 0; virtual void writeToken( const char* token ) = 0; diff --git a/include/iselection.h b/include/iselection.h index f5c76310..48f49f8a 100644 --- a/include/iselection.h +++ b/include/iselection.h @@ -35,6 +35,7 @@ class Selectable public: STRING_CONSTANT( Name, "Selectable" ); +virtual ~Selectable(){} virtual void setSelected( bool select ) = 0; virtual bool isSelected() const = 0; }; @@ -47,6 +48,7 @@ class Instance; class InstanceSelectionObserver { public: +virtual ~InstanceSelectionObserver(){} virtual void onSelectedChanged( scene::Instance& instance ) = 0; }; @@ -90,6 +92,7 @@ enum EManipulatorMode eClip, }; +virtual ~SelectionSystem(){} virtual void SetMode( EMode mode ) = 0; virtual EMode Mode() const = 0; virtual void SetComponentMode( EComponentMode mode ) = 0; @@ -110,6 +113,7 @@ virtual void setSelectedAllComponents( bool selected ) = 0; class Visitor { public: +virtual ~Visitor(){} virtual void visit( scene::Instance& instance ) const = 0; }; virtual void foreachSelected( const Visitor& visitor ) const = 0; diff --git a/include/itextstream.h b/include/itextstream.h index 7d69c7b5..3bc7b2a5 100644 --- a/include/itextstream.h +++ b/include/itextstream.h @@ -32,6 +32,7 @@ class TextInputStream { public: +virtual ~TextInputStream(){} /// \brief Attempts to read the next \p length characters from the stream to \p buffer. /// Returns the number of characters actually stored in \p buffer. virtual std::size_t read( char* buffer, std::size_t length ) = 0; @@ -41,6 +42,7 @@ virtual std::size_t read( char* buffer, std::size_t length ) = 0; class TextOutputStream { public: +virtual ~TextOutputStream(){} /// \brief Attempts to write \p length characters to the stream from \p buffer. /// Returns the number of characters actually read from \p buffer. virtual std::size_t write( const char* buffer, std::size_t length ) = 0; diff --git a/include/itextures.h b/include/itextures.h index cc91399d..ee3d49eb 100644 --- a/include/itextures.h +++ b/include/itextures.h @@ -52,6 +52,7 @@ inline bool operator<( const LoadImageCallback& self, const LoadImageCallback& o class TexturesCacheObserver { public: +virtual ~TexturesCacheObserver(){} virtual void unrealise() = 0; virtual void realise() = 0; }; @@ -61,6 +62,7 @@ class TexturesCache public: INTEGER_CONSTANT( Version, 1 ); STRING_CONSTANT( Name, "textures" ); +virtual ~TexturesCache(){} virtual LoadImageCallback defaultLoader() const = 0; virtual Image* loadImage( const char* name ) = 0; virtual qtexture_t* capture( const char* name ) = 0; diff --git a/include/modelskin.h b/include/modelskin.h index bb5922ee..6e818b11 100644 --- a/include/modelskin.h +++ b/include/modelskin.h @@ -41,6 +41,7 @@ class ModelSkin { public: STRING_CONSTANT( Name, "ModelSkin" ); +virtual ~ModelSkin(){} /// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the skin is loaded or unloaded. virtual void attach( ModuleObserver& observer ) = 0; /// \brief Detach an \p observer previously-attached by calling \c attach. @@ -57,6 +58,7 @@ class SkinnedModel { public: STRING_CONSTANT( Name, "SkinnedModel" ); +virtual ~SkinnedModel(){} /// \brief Instructs the skinned model to update its skin. virtual void skinChanged() = 0; }; @@ -66,6 +68,7 @@ class ModelSkinCache public: INTEGER_CONSTANT( Version, 1 ); STRING_CONSTANT( Name, "modelskin" ); +virtual ~ModelSkinCache(){} /// \brief Increments the reference count of and returns a reference to the skin uniquely identified by 'name'. virtual ModelSkin& capture( const char* name ) = 0; /// \brief Decrements the reference-count of the skin uniquely identified by 'name'. diff --git a/include/renderable.h b/include/renderable.h index 8b972170..0c0e770b 100644 --- a/include/renderable.h +++ b/include/renderable.h @@ -48,7 +48,7 @@ enum EStyle virtual void PushState() = 0; virtual void PopState() = 0; virtual void SetState( Shader* state, EStyle mode ) = 0; -virtual const EStyle getStyle() const = 0; +virtual EStyle getStyle() const = 0; virtual void Highlight( EHighlightMode mode, bool bEnable = true ) = 0; virtual void setLights( const LightList& lights ){ } diff --git a/include/windowobserver.h b/include/windowobserver.h index b72d0820..8f759483 100644 --- a/include/windowobserver.h +++ b/include/windowobserver.h @@ -79,6 +79,7 @@ typedef Vector2 WindowVector; class WindowObserver { public: +virtual ~WindowObserver(){} virtual void release() = 0; virtual void onSizeChanged( int width, int height ) = 0; virtual void onMouseDown( const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers ) = 0; diff --git a/libs/profile/file.cpp b/libs/profile/file.cpp index ec230964..4ad46ea2 100644 --- a/libs/profile/file.cpp +++ b/libs/profile/file.cpp @@ -175,7 +175,7 @@ MemStream::size_type MemStream::write( const byte_type* buffer, size_type length GrowFile( m_nPosition + length ); } - memcpy( (unsigned char*)m_pBuffer + m_nPosition, (unsigned char*)buffer, length ); + memcpy( (unsigned char*)m_pBuffer + m_nPosition, (const unsigned char*)buffer, length ); m_nPosition += size_type( length ); @@ -271,7 +271,7 @@ int MemStream::Seek( offset_type lOff, int nFrom ){ lNewPos = m_nFileSize + lOff; } else{ - return ( position_type ) - 1; + return - 1; } m_nPosition = lNewPos; diff --git a/libs/profile/profile.cpp b/libs/profile/profile.cpp index 71d2ae1b..c1505e07 100644 --- a/libs/profile/profile.cpp +++ b/libs/profile/profile.cpp @@ -252,7 +252,7 @@ bool profile_load_buffer( const char * rc_path, const char *name, void *buffer, fclose( f ); } - return true; + return ret; } int profile_load_int( const char *filename, const char *section, const char *key, int default_value ){ diff --git a/libs/render.h b/libs/render.h index b53612bf..d568edb3 100644 --- a/libs/render.h +++ b/libs/render.h @@ -171,7 +171,7 @@ RenderIndex m_prev0; RenderIndex m_prev1; RenderIndex m_prev2; -const RenderIndex find_or_insert( const Vertex& vertex ){ +RenderIndex find_or_insert( const Vertex& vertex ){ RenderIndex index = 0; while ( 1 ) diff --git a/libs/str.h b/libs/str.h index 9090bf2d..47be309d 100644 --- a/libs/str.h +++ b/libs/str.h @@ -254,7 +254,6 @@ const char* Left( std::size_t n ){ } else { - g_pStrWork = ""; g_pStrWork = new char[1]; g_pStrWork[0] = '\0'; } @@ -290,7 +289,6 @@ const char* Mid( std::size_t first, std::size_t n ) const { } else { - g_pStrWork = ""; g_pStrWork = new char[1]; g_pStrWork[0] = '\0'; } @@ -429,7 +427,7 @@ bool operator >( char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr bool operator >( const char* pStr ) const { return ( m_bIgnoreCase ) ? stricmp( m_pStr, pStr ) > 0 : strcmp( m_pStr, pStr ) > 0; } char& operator []( std::size_t nIndex ) { return m_pStr[nIndex]; } const char& operator []( std::size_t nIndex ) const { return m_pStr[nIndex]; } -const char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; } +char GetAt( std::size_t nIndex ) { return m_pStr[nIndex]; } }; diff --git a/libs/stringio.h b/libs/stringio.h index ff1a3a67..8af056e6 100644 --- a/libs/stringio.h +++ b/libs/stringio.h @@ -219,7 +219,7 @@ inline bool string_parse_size( const char* string, std::size_t& i ){ } -#define RETURN_FALSE_IF_FAIL( expression ) if ( !expression ) {return false; }else +#define RETURN_FALSE_IF_FAIL( expression ) if ( !expression ) {return false; } inline void Tokeniser_unexpectedError( Tokeniser& tokeniser, const char* token, const char* expected ){ globalErrorStream() << Unsigned( tokeniser.getLine() ) << ":" << Unsigned( tokeniser.getColumn() ) << ": parse error at '" << ( token != 0 ? token : "#EOF" ) << "': expected '" << expected << "'\n"; diff --git a/libs/xml/ixml.h b/libs/xml/ixml.h index 7b86020f..7740c832 100644 --- a/libs/xml/ixml.h +++ b/libs/xml/ixml.h @@ -28,12 +28,14 @@ class XMLAttrVisitor { public: +virtual ~XMLAttrVisitor(){} virtual void visit( const char* name, const char* value ) = 0; }; class XMLElement { public: +virtual ~XMLElement(){} virtual const char* name() const = 0; virtual const char* attribute( const char* name ) const = 0; virtual void forEachAttribute( XMLAttrVisitor& visitor ) const = 0; @@ -43,7 +45,7 @@ class XMLImporter : public TextOutputStream { public: STRING_CONSTANT( Name, "XMLImporter" ); - +virtual ~XMLImporter(){} virtual void pushElement( const XMLElement& element ) = 0; virtual void popElement( const char* name ) = 0; }; @@ -52,7 +54,7 @@ class XMLExporter { public: STRING_CONSTANT( Name, "XMLExporter" ); - +virtual ~XMLExporter(){} virtual void exportXML( XMLImporter& importer ) = 0; }; diff --git a/libs/xml/xmlparser.h b/libs/xml/xmlparser.h index b11d355b..1c1bdb01 100644 --- a/libs/xml/xmlparser.h +++ b/libs/xml/xmlparser.h @@ -187,7 +187,7 @@ XMLStreamParser( TextInputStream& istream ) : m_istream( istream ){ } virtual void exportXML( XMLImporter& importer ){ - bool wellFormed = false; + //bool wellFormed = false; char chars[BUFSIZE]; std::size_t res = m_istream.read( chars, 4 ); @@ -203,7 +203,7 @@ virtual void exportXML( XMLImporter& importer ){ } xmlParseChunk( ctxt, chars, 0, 1 ); - wellFormed = ( ctxt->wellFormed == 1 ); + //wellFormed = ( ctxt->wellFormed == 1 ); xmlFreeParserCtxt( ctxt ); } diff --git a/libs/xml/xmltextags.cpp b/libs/xml/xmltextags.cpp index c9d2b06b..7baf0e5e 100644 --- a/libs/xml/xmltextags.cpp +++ b/libs/xml/xmltextags.cpp @@ -49,16 +49,16 @@ bool XmlTagBuilder::CreateXmlDocument(){ xmlTextWriterStartDocument( writer, NULL, "UTF-8", NULL ); // create the root node with stock and custom elements - xmlTextWriterStartElement( writer, (xmlChar*)"root" ); - xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); - xmlTextWriterStartElement( writer, (xmlChar*)"stock" ); - xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); + xmlTextWriterStartElement( writer, (const xmlChar*)"root" ); + xmlTextWriterWriteString( writer, (const xmlChar*)"\n " ); + xmlTextWriterStartElement( writer, (const xmlChar*)"stock" ); + xmlTextWriterWriteString( writer, (const xmlChar*)"\n " ); xmlTextWriterEndElement( writer ); - xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); - xmlTextWriterStartElement( writer, (xmlChar*)"custom" ); - xmlTextWriterWriteString( writer, (xmlChar*)"\n " ); + xmlTextWriterWriteString( writer, (const xmlChar*)"\n " ); + xmlTextWriterStartElement( writer, (const xmlChar*)"custom" ); + xmlTextWriterWriteString( writer, (const xmlChar*)"\n " ); xmlTextWriterEndElement( writer ); - xmlTextWriterWriteString( writer, (xmlChar*)"\n" ); + xmlTextWriterWriteString( writer, (const xmlChar*)"\n" ); xmlTextWriterEndElement( writer ); // end of the xml document @@ -151,26 +151,28 @@ bool XmlTagBuilder::AddShaderNode( const char* shader, TextureType textureType, switch ( nodeShaderType ) { case SHADER: - newnode = xmlNewNode( NULL, (xmlChar*)"shader" ); + newnode = xmlNewNode( NULL, (const xmlChar*)"shader" ); break; case TEXTURE: - newnode = xmlNewNode( NULL, (xmlChar*)"texture" ); + newnode = xmlNewNode( NULL, (const xmlChar*)"texture" ); + default: + return false; }; newnode = xmlDocCopyNode( newnode, doc, 1 ); - xmlSetProp( newnode, (xmlChar*)"path", (xmlChar*)shader ); - xmlNodeSetContent( newnode, (xmlChar*)"\n " ); + xmlSetProp( newnode, (const xmlChar*)"path", (const xmlChar*)shader ); + xmlNodeSetContent( newnode, (const xmlChar*)"\n " ); if ( nodePtr->nodeTab[0]->children->next == NULL ) { // there are no shaders yet // add spaces - newtext = xmlNewText( (xmlChar*)" " ); + newtext = xmlNewText( (const xmlChar*)" " ); xmlAddChild( nodeParent->children, newtext ); // add the new node xmlAddNextSibling( nodeParent->children, newnode ); // append a new line - newtext = xmlNewText( (xmlChar*)"\n " ); + newtext = xmlNewText( (const xmlChar*)"\n " ); xmlAddNextSibling( nodeParent->children->next, newtext ); } else { @@ -178,7 +180,7 @@ bool XmlTagBuilder::AddShaderNode( const char* shader, TextureType textureType, xmlAddNextSibling( nodeParent->children, newnode ); // append a new line and spaces - newtext = xmlNewText( (xmlChar*)"\n " ); + newtext = xmlNewText( (const xmlChar*)"\n " ); xmlAddNextSibling( nodeParent->children->next, newtext ); } @@ -327,26 +329,26 @@ bool XmlTagBuilder::AddShaderTag( const char* shader, const char* content, NodeT } if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { // node was found - xmlNodePtr newnode = xmlNewNode( NULL, (xmlChar*)"tag" ); + xmlNodePtr newnode = xmlNewNode( NULL, (const xmlChar*)"tag" ); xmlNodePtr nodeParent = nodePtr->nodeTab[0]; newnode = xmlDocCopyNode( newnode, doc, 1 ); - xmlNodeSetContent( newnode, (xmlChar*)content ); + xmlNodeSetContent( newnode, (const xmlChar*)content ); if ( nodePtr->nodeTab[0]->children->next == NULL ) { // shader node has NO children // add spaces - xmlNodePtr newtext = xmlNewText( (xmlChar*)" " ); + xmlNodePtr newtext = xmlNewText( (const xmlChar*)" " ); xmlAddChild( nodeParent->children, newtext ); // add new node xmlAddNextSibling( nodeParent->children, newnode ); // append a new line + spaces - newtext = xmlNewText( (xmlChar*)"\n " ); + newtext = xmlNewText( (const xmlChar*)"\n " ); xmlAddNextSibling( nodeParent->children->next, newtext ); } else { // shader node has children already - the new node will be the first sibling xmlAddNextSibling( nodeParent->children, newnode ); - xmlNodePtr newtext = xmlNewText( (xmlChar*)"\n " ); + xmlNodePtr newtext = xmlNewText( (const xmlChar*)"\n " ); xmlAddNextSibling( nodeParent->children->next, newtext ); } xmlXPathFreeObject( xpathPtr ); @@ -376,7 +378,7 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){ strcat( expression, oldtag ); strcat( expression, "']/*" ); - xmlXPathObjectPtr result = xmlXPathEvalExpression( (xmlChar*)expression, context ); + xmlXPathObjectPtr result = xmlXPathEvalExpression( (const xmlChar*)expression, context ); if ( !result ) { return 0; } @@ -388,7 +390,7 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){ char* content = (char*)xmlNodeGetContent( ptrContent ); if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content? - xmlNodeSetContent( ptrContent, (xmlChar*)newtag.c_str() ); + xmlNodeSetContent( ptrContent, (const xmlChar*)newtag.c_str() ); num++; } } @@ -422,7 +424,7 @@ bool XmlTagBuilder::DeleteShaderTag( const char* shader, const char* tag ){ for ( int i = 0; i < nodePtr->nodeNr; i++ ) { xmlNodePtr ptrContent = nodePtr->nodeTab[i]; - char* content = (char*)(xmlChar*)xmlNodeGetContent( ptrContent ); + const char* content = (const char*)xmlNodeGetContent( ptrContent ); if ( strcmp( content, tag ) == 0 ) { // find the node xmlNodePtr ptrWhitespace = nodePtr->nodeTab[i]->prev; @@ -476,7 +478,7 @@ void XmlTagBuilder::GetShaderTags( const char* shader, std::vector returns a vector containing the tags */ - char* expression; + const char* expression; if ( shader == NULL ) { // get all tags from all shaders expression = "/root/*/*/tag"; @@ -510,7 +512,7 @@ void XmlTagBuilder::GetUntagged( std::set& shaders ){ returns a set containing the shaders (with path) */ - char* expression = "/root/*/*[not(child::tag)]"; + const char* expression = "/root/*/*[not(child::tag)]"; xmlXPathObjectPtr xpathPtr = XpathEval( expression ); xmlNodeSetPtr nodePtr; @@ -527,7 +529,7 @@ void XmlTagBuilder::GetUntagged( std::set& shaders ){ for ( int i = 0; i < nodePtr->nodeNr; i++ ) { ptr = nodePtr->nodeTab[i]; - shaders.insert( (char*)xmlGetProp( ptr, (xmlChar*)"path" ) ); + shaders.insert( (char*)xmlGetProp( ptr, (const xmlChar*)"path" ) ); } } @@ -540,7 +542,7 @@ void XmlTagBuilder::GetAllTags( std::set& tags ){ returns a set containing all used tags */ - char* expression = "/root/*/*/tag"; + const char* expression = "/root/*/*/tag"; xmlXPathObjectPtr xpathPtr = XpathEval( expression ); xmlNodeSetPtr nodePtr; @@ -584,7 +586,7 @@ void XmlTagBuilder::TagSearch( const char* expression, std::set& p for ( int i = 0; i < nodePtr->nodeNr; i++ ) { ptr = nodePtr->nodeTab[i]; - xmlattrib = xmlGetProp( ptr, (xmlChar*)"path" ); + xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" ); paths.insert( (CopiedString)(char*)xmlattrib ); } } diff --git a/libs/xml/xmltextags.h b/libs/xml/xmltextags.h index 7a1bae6d..dbad5f56 100644 --- a/libs/xml/xmltextags.h +++ b/libs/xml/xmltextags.h @@ -58,7 +58,7 @@ xmlXPathContextPtr context; xmlNodeSetPtr nodePtr; xmlXPathObjectPtr XpathEval( const char* queryString ){ - xmlChar* expression = (xmlChar*)queryString; + const xmlChar* expression = (const xmlChar*)queryString; xmlXPathObjectPtr result = xmlXPathEvalExpression( expression, context ); return result; }; diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index dbde66c1..0b559893 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -649,7 +649,7 @@ void render( RenderStateFlags state ) const { points[6] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[6], 1 ) ) ); points[7] = vector4_projected( matrix4_transformed_vector4( unproject, Vector4( points[7], 1 ) ) ); Vector4 test1 = matrix4_transformed_vector4( unproject, Vector4( 0.5f, 0.5f, 0.5f, 1 ) ); - Vector3 test2 = vector4_projected( test1 ); + /*Vector3 test2 =*/ vector4_projected( test1 ); aabb_draw_wire( points ); } }; diff --git a/plugins/image/jpeg.cpp b/plugins/image/jpeg.cpp index 138151a2..31685fd8 100644 --- a/plugins/image/jpeg.cpp +++ b/plugins/image/jpeg.cpp @@ -297,13 +297,12 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c for ( count = 0; count < widthPix; count++ ) { - unsigned char iRed, iBlu, iGrn, iAlp; + unsigned char iRed, iBlu, iGrn; unsigned char *oRed, *oBlu, *oGrn, *oAlp; iRed = *( jpegline + count * 4 + 0 ); iGrn = *( jpegline + count * 4 + 1 ); iBlu = *( jpegline + count * 4 + 2 ); - iAlp = *( jpegline + count * 4 + 3 ); oRed = outBuf + offset + count * 4 + 0; oGrn = outBuf + offset + count * 4 + 1; @@ -318,7 +317,7 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c #if 1 *oAlp = 255; #else - *oAlp = iAlp; + *oAlp = *( jpegline + count * 4 + 3 ); #endif } } diff --git a/plugins/image/ktx.cpp b/plugins/image/ktx.cpp index 582d0b8b..6837a2d8 100644 --- a/plugins/image/ktx.cpp +++ b/plugins/image/ktx.cpp @@ -47,6 +47,7 @@ class KTX_Decoder { public: + virtual ~KTX_Decoder(){} virtual void Decode( PointerInputStream& istream, byte* out ) = 0; virtual unsigned int GetPixelSize() = 0; }; diff --git a/plugins/imagehl/hlw.cpp b/plugins/imagehl/hlw.cpp index 2731e15a..e82b833b 100644 --- a/plugins/imagehl/hlw.cpp +++ b/plugins/imagehl/hlw.cpp @@ -91,7 +91,7 @@ typedef struct Image* LoadHLWBuff( byte* buffer ){ byte *buf_p; unsigned long mipdatasize; - int columns, rows, numPixels; + int columns, rows; byte *pixbuf; int row, column; byte *palette; @@ -108,7 +108,7 @@ Image* LoadHLWBuff( byte* buffer ){ columns = lpMip->width; rows = lpMip->height; - numPixels = columns * rows; + //int numPixels = columns * rows; RGBAImage* image = new RGBAImage( columns, rows ); diff --git a/plugins/imagehl/mip.cpp b/plugins/imagehl/mip.cpp index 51dbfd7e..2e4f979b 100644 --- a/plugins/imagehl/mip.cpp +++ b/plugins/imagehl/mip.cpp @@ -138,7 +138,6 @@ static const byte quakepalette[768] = Image* LoadMIPBuff( byte* buffer ){ byte *buf_p; int palettelength; - unsigned long mipdatasize; int columns, rows, numPixels; byte *pixbuf; int i; @@ -158,7 +157,7 @@ Image* LoadMIPBuff( byte* buffer ){ return 0; } - mipdatasize = GET_MIP_DATA_SIZE( columns, rows ); + // unsigned long mipdatasize = GET_MIP_DATA_SIZE( columns, rows ); palettelength = vfsLoadFile( "gfx/palette.lmp", (void **) &loadedpalette ); if ( palettelength == 768 ) { diff --git a/plugins/imagehl/sprite.cpp b/plugins/imagehl/sprite.cpp index b6347ec4..0fdec869 100644 --- a/plugins/imagehl/sprite.cpp +++ b/plugins/imagehl/sprite.cpp @@ -102,7 +102,7 @@ typedef struct { Image* LoadIDSPBuff( byte *buffer ){ byte *buf_p; - int columns, rows, numPixels; + int columns, rows; byte *pixbuf; int row, column; @@ -159,7 +159,7 @@ Image* LoadIDSPBuff( byte *buffer ){ // palette = buffer+mipdatasize+2; // buf_p = buffer+lpMip->offsets[0]; - numPixels = columns * rows; + //int numPixels = columns * rows; RGBAImage* image = new RGBAImage( columns, rows ); diff --git a/plugins/mapq3/plugin.cpp b/plugins/mapq3/plugin.cpp index 2c3d99c5..e21cf22d 100644 --- a/plugins/mapq3/plugin.cpp +++ b/plugins/mapq3/plugin.cpp @@ -110,7 +110,7 @@ void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator& if ( !Tokeniser_getSize( tokeniser, version ) ) { return; } - if ( version != MapVersion() ) { + if ( version != std::size_t(MapVersion()) ) { globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n"; return; } @@ -181,7 +181,7 @@ void readGraph( scene::Node& root, TextInputStream& inputStream, EntityCreator& if ( !Tokeniser_getSize( tokeniser, version ) ) { return; } - if ( version != MapVersion() ) { + if ( version != std::size_t(MapVersion()) ) { globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << Unsigned( version ) << "\n"; return; } diff --git a/plugins/md3model/md5.cpp b/plugins/md3model/md5.cpp index 69719051..8516b9d5 100644 --- a/plugins/md3model/md5.cpp +++ b/plugins/md3model/md5.cpp @@ -29,7 +29,7 @@ #include "model.h" -#define MD5_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { globalErrorStream() << "md5 parse failed: " # expression "\n"; return false; } else +#define MD5_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { globalErrorStream() << "md5 parse failed: " # expression "\n"; return false; } bool MD5_parseToken( Tokeniser& tokeniser, const char* string ){ const char* token = tokeniser.getToken(); diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index 54df7abc..a431ef4f 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -782,7 +782,7 @@ qtexture_t* evaluateTexture( const TextureExpression& texture, const ShaderParam float evaluateFloat( const ShaderValue& value, const ShaderParameters& params, const ShaderArguments& args ){ const char* result = evaluateShaderValue( value.c_str(), params, args ); - float f; + float f = 0; if ( !string_parse_float( result, f ) ) { globalErrorStream() << "parsing float value failed: " << makeQuoted( result ) << "\n"; } diff --git a/plugins/vfspk3/vfs.cpp b/plugins/vfspk3/vfs.cpp index 893f002b..4ccc8b59 100644 --- a/plugins/vfspk3/vfs.cpp +++ b/plugins/vfspk3/vfs.cpp @@ -473,8 +473,8 @@ int GetFileCount( const char *filename, int flag ){ for ( archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i ) { - if ( ( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0 - || !( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0 ) { + if ( (( *i ).is_pakfile && ( flag & VFS_SEARCH_PAK ) != 0) + || (!( *i ).is_pakfile && ( flag & VFS_SEARCH_DIR ) != 0) ) { if ( ( *i ).archive->containsFile( fixed ) ) { ++count; } diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 4ea73c03..6aae7bb2 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -1235,7 +1235,7 @@ inline Matrix4 matrix4_reflection_for_plane45( const Plane3& plane, const Vector Vector3 first = from; Vector3 second = to; - if ( vector3_dot( from, plane.normal() ) > 0 == vector3_dot( to, plane.normal() ) > 0 ) { + if ( (vector3_dot( from, plane.normal() ) > 0) == (vector3_dot( to, plane.normal() ) > 0) ) { first = vector3_negated( first ); second = vector3_negated( second ); } @@ -1253,7 +1253,7 @@ inline Matrix4 matrix4_reflection_for_plane45( const Plane3& plane, const Vector Matrix4 swap = matrix4_swap_axes( first, second ); - Matrix4 tmp = matrix4_reflection_for_plane( plane ); + /*Matrix4 tmp =*/ matrix4_reflection_for_plane( plane ); swap.tx() = -static_cast( -2 * plane.a * plane.d ); swap.ty() = -static_cast( -2 * plane.b * plane.d ); diff --git a/radiant/build.cpp b/radiant/build.cpp index 073e0ddf..3ea279da 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -55,6 +55,7 @@ const char* build_get_variable( const char* name ){ class Evaluatable { public: +virtual ~Evaluatable(){} virtual void evaluate( StringBuffer& output ) = 0; virtual void exportXML( XMLImporter& importer ) = 0; }; diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index de2e03e0..fdd5cc58 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -319,17 +319,15 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){ } void Cam_MouseControl( camera_t& camera, int x, int y ){ - int xl, xh; - int yl, yh; float xf, yf; xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 ); yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 ); - xl = camera.width / 3; - xh = xl * 2; - yl = camera.height / 3; - yh = yl * 2; + //int xl = camera.width / 3; + //int xh = xl * 2; + //int yl = camera.height / 3; + //int yh = yl * 2; xf *= 1.0f - fabsf( yf ); if ( xf < 0 ) { @@ -1353,7 +1351,7 @@ void SetState( Shader* state, EStyle style ){ m_state_stack.back().m_state = state; } } -const EStyle getStyle() const { +EStyle getStyle() const { return eFullMaterials; } void PushState(){ diff --git a/radiant/dialog.h b/radiant/dialog.h index 2a0454eb..61e1580d 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -85,8 +85,10 @@ inline void StringExport( CopiedString& self, const StringImportCallback& import typedef ReferenceCaller1 StringExportCaller; -struct DLG_DATA +class DLG_DATA { +public: + virtual ~DLG_DATA(){} virtual void release() = 0; virtual void importData() const = 0; virtual void exportData() const = 0; diff --git a/radiant/eclass.cpp b/radiant/eclass.cpp index db65063a..c74c7b72 100644 --- a/radiant/eclass.cpp +++ b/radiant/eclass.cpp @@ -45,7 +45,7 @@ namespace typedef std::map EntityClasses; EntityClasses g_entityClasses; EntityClass *eclass_bad = 0; -char eclass_directory[1024]; +//char eclass_directory[1024]; typedef std::map ListAttributeTypes; ListAttributeTypes g_listTypes; } diff --git a/radiant/eclass_doom3.cpp b/radiant/eclass_doom3.cpp index 620cc276..6c4bb022 100644 --- a/radiant/eclass_doom3.cpp +++ b/radiant/eclass_doom3.cpp @@ -84,7 +84,7 @@ inline void printParseError( const char* message ){ globalErrorStream() << message; } -#define PARSE_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { printParseError( FILE_LINE "\nparse failed: " # expression "\n" ); return false; } else +#define PARSE_RETURN_FALSE_IF_FAIL( expression ) if ( !( expression ) ) { printParseError( FILE_LINE "\nparse failed: " # expression "\n" ); return false; } bool EntityClassDoom3_parseToken( Tokeniser& tokeniser ){ const char* token = tokeniser.getToken(); diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 5c1c330b..859050ec 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -118,6 +118,7 @@ void Scene_EntitySetKeyValue_Selected_Undoable( const char* key, const char* val class EntityAttribute { public: +virtual ~EntityAttribute(){} virtual GtkWidget* getWidget() const = 0; virtual void update() = 0; virtual void release() = 0; diff --git a/radiant/environment.cpp b/radiant/environment.cpp index 9583b90f..232b3582 100644 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@ -30,7 +30,7 @@ #include "cmdlib.h" int g_argc; -char** g_argv; +const char ** g_argv; void args_init( int argc, char* argv[] ){ int i, j, k; @@ -51,11 +51,11 @@ void args_init( int argc, char* argv[] ){ } g_argc = argc; - g_argv = argv; + g_argv = (const char **)argv; } -char *gamedetect_argv_buffer[1024]; -void gamedetect_found_game( char *game, char *path ){ +const char *gamedetect_argv_buffer[1024]; +void gamedetect_found_game( const char *game, char *path ){ int argc; static char buf[128]; @@ -79,7 +79,7 @@ void gamedetect_found_game( char *game, char *path ){ g_argv = gamedetect_argv_buffer; } -bool gamedetect_check_game( char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){ +bool gamedetect_check_game( const char *gamefile, const char *checkfile1, const char *checkfile2, char *buf /* must have 64 bytes free after bufpos */, int bufpos ){ buf[bufpos] = '/'; strcpy( buf + bufpos + 1, checkfile1 ); @@ -196,7 +196,7 @@ const char* LINK_NAME = ; /// brief Returns the filename of the executable belonging to the current process, or 0 if not found. -char* getexename( char *buf ){ +const char* getexename( char *buf ){ /* Now read the symbolic link */ int ret = readlink( LINK_NAME, buf, PATH_MAX ); diff --git a/radiant/environment.h b/radiant/environment.h index 7ee16c6f..e04565df 100644 --- a/radiant/environment.h +++ b/radiant/environment.h @@ -27,6 +27,6 @@ const char* environment_get_home_path(); const char* environment_get_app_path(); extern int g_argc; -extern char** g_argv; +extern const char** g_argv; #endif diff --git a/radiant/filetypes.cpp b/radiant/filetypes.cpp index 87cb205c..cfb3cc6f 100644 --- a/radiant/filetypes.cpp +++ b/radiant/filetypes.cpp @@ -35,7 +35,8 @@ class RadiantFileTypeRegistry : public IFileTypeRegistry struct filetype_copy_t { filetype_copy_t( const char* moduleName, const filetype_t other ) - : m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ), m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ){ + : m_can_load( other.can_load ), m_can_import( other.can_import ), m_can_save( other.can_save ), + m_moduleName( moduleName ), m_name( other.name ), m_pattern( other.pattern ) { } const char* getModuleName() const { return m_moduleName.c_str(); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 5fd58f7c..83ac42f0 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -100,7 +100,7 @@ static void OnApply( GtkWidget* widget, gpointer data ){ FindTextureDialog_apply(); } -static void OnFind( GtkWidget* widget, gpointer data ){ +/*static void OnFind( GtkWidget* widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); } @@ -109,7 +109,7 @@ static void OnOK( GtkWidget* widget, gpointer data ){ g_FindTextureDialog.exportData(); FindTextureDialog_apply(); g_FindTextureDialog.HideDlg(); -} +}*/ static void OnClose( GtkWidget* widget, gpointer data ){ g_FindTextureDialog.HideDlg(); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 34fc54c7..e35b467e 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -923,7 +923,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ // ============================================================================= // Add new shader tag dialog -EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){ +EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ ModalDialog dialog; GtkEntry* textentry; ModalDialogButton ok_button( dialog, eIDOK ); @@ -984,7 +984,7 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, char* title ){ return ret; } -EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title ){ +EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title ){ ModalDialog dialog; ModalDialogButton ok_button( dialog, eIDOK ); diff --git a/radiant/gtkdlgs.h b/radiant/gtkdlgs.h index 0ff194e6..05f8b8b9 100644 --- a/radiant/gtkdlgs.h +++ b/radiant/gtkdlgs.h @@ -35,8 +35,8 @@ #include "string/string.h" EMessageBoxReturn DoLightIntensityDlg( int *intensity ); -EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, char* title ); -EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, char* title ); +EMessageBoxReturn DoShaderTagDlg( CopiedString *tag, const char* title ); +EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const char* title ); EMessageBoxReturn DoTextureLayout( float *fx, float *fy ); void DoTextEditor( const char* filename, int cursorpos ); diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 95dba53b..7e04d46a 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2379,14 +2379,14 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){ gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - GtkButton* g_view_entities_button = toolbar_append_button( toolbar, "Entities (N)", "entities.bmp", "ToggleEntityInspector" ); + /*GtkButton* g_view_entities_button =*/ toolbar_append_button( toolbar, "Entities (N)", "entities.bmp", "ToggleEntityInspector" ); GtkButton* g_view_console_button = toolbar_append_button( toolbar, "Console (O)", "console.bmp", "ToggleConsole" ); GtkButton* g_view_textures_button = toolbar_append_button( toolbar, "Texture Browser (T)", "texture_browser.bmp", "ToggleTextures" ); // TODO: call light inspector //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.bmp", "ToggleLightInspector"); gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) ); - GtkButton* g_refresh_models_button = toolbar_append_button( toolbar, "Refresh Models", "refresh_models.bmp", "RefreshReferences" ); + /*GtkButton* g_refresh_models_button =*/ toolbar_append_button( toolbar, "Refresh Models", "refresh_models.bmp", "RefreshReferences" ); // disable the console and texture button in the regular layouts diff --git a/radiant/patch.cpp b/radiant/patch.cpp index b31def46..dca55b79 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -1357,14 +1357,13 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std // vPos[1] = aabb.origin; // vPos[2] = vector3_added(aabb.origin, aabb.extents); - int i, j; float f = 1 / cos( M_PI / n ); - for ( i = 0; i < width; ++i ) + for ( std::size_t i = 0; i < width; ++i ) { float angle = ( M_PI * i ) / n; // 0 to 2pi float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f ); float y = vPos[1][1] + ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f ); - for ( j = 0; j < height; ++j ) + for ( std::size_t j = 0; j < height; ++j ) { float z = vPos[0][2] + ( vPos[2][2] - vPos[0][2] ) * ( j / (float)( height - 1 ) ); PatchControl *v; @@ -1383,12 +1382,11 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std // vPos[1] = aabb.origin; // vPos[2] = vector3_added(aabb.origin, aabb.extents); - int i, j; float f = 1 / cos( M_PI / n ); - for ( i = 0; i < width; ++i ) + for ( std::size_t i = 0; i < width; ++i ) { float angle = ( M_PI * i ) / n; - for ( j = 0; j < height; ++j ) + for ( std::size_t j = 0; j < height; ++j ) { float x = vPos[1][0] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][0] - vPos[1][0] ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f ); float y = vPos[1][1] + ( 1.0f - ( j / (float)( height - 1 ) ) ) * ( vPos[2][1] - vPos[1][1] ) * sin( angle ) * ( ( i & 1 ) ? f : 1.0f ); @@ -1410,13 +1408,12 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std // vPos[1] = aabb.origin; // vPos[2] = vector3_added(aabb.origin, aabb.extents); - int i, j; float f = 1 / cos( M_PI / n ); float g = 1 / cos( M_PI / ( 2 * m ) ); - for ( i = 0; i < width; ++i ) + for ( std::size_t i = 0; i < width; ++i ) { float angle = ( M_PI * i ) / n; - for ( j = 0; j < height; ++j ) + for ( std::size_t j = 0; j < height; ++j ) { float angle2 = ( M_PI * j ) / ( 2 * m ); float x = vPos[1][0] + ( vPos[2][0] - vPos[1][0] ) * sin( angle2 ) * ( ( j & 1 ) ? g : 1.0f ) * cos( angle ) * ( ( i & 1 ) ? f : 1.0f ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index e306015f..963f694d 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1930,7 +1930,7 @@ void TextureBrowser_SetNotex(){ name << GlobalRadiant().getAppPath() << "bitmaps/notex.bmp"; g_notex = name.c_str(); - name = NULL; + name = StringOutputStream(); name << GlobalRadiant().getAppPath() << "bitmaps/shadernotex.bmp"; g_shadernotex = name.c_str(); } diff --git a/radiant/undo.cpp b/radiant/undo.cpp index 9910fb98..c12811b9 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -254,7 +254,7 @@ void release( Undoable* undoable ){ m_undoables.erase( undoable ); } void setLevels( std::size_t levels ){ - if ( levels > MAX_UNDO_LEVELS() ) { + if ( levels > std::size_t(MAX_UNDO_LEVELS()) ) { levels = MAX_UNDO_LEVELS(); } diff --git a/radiant/xmlstuff.h b/radiant/xmlstuff.h index a30303f4..b6f6a4e4 100644 --- a/radiant/xmlstuff.h +++ b/radiant/xmlstuff.h @@ -68,8 +68,8 @@ class IGL2DWindow; class ISAXHandler { public: -virtual void Release(){ -} +virtual ~ISAXHandler(){} +virtual void Release(){} virtual void saxStartElement( message_info_t* ctx, const xmlChar* name, const xmlChar** attrs ) = 0; virtual void saxEndElement( message_info_t* ctx, const xmlChar* name ) = 0; virtual void saxCharacters( message_info_t* ctx, const xmlChar* ch, int len ) = 0; diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index b094b774..61f3c478 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -413,6 +413,7 @@ inline unsigned int buttons_for_button_and_modifiers( ButtonIdentifier button, M case ButtonEnumeration::LEFT: buttons |= RAD_LBUTTON; break; case ButtonEnumeration::MIDDLE: buttons |= RAD_MBUTTON; break; case ButtonEnumeration::RIGHT: buttons |= RAD_RBUTTON; break; + default: break; } if ( bitfield_enabled( flags, c_modifierControl ) ) { @@ -1449,7 +1450,7 @@ void XYWnd::XY_LoadBackgroundImage( const char *name ){ globalOutputStream() << "Loaded background texture " << relative << "\n"; g_pParentWnd->ActiveXY()->m_backgroundActivated = true; - int m_ix, m_iy; + int m_ix = 0, m_iy = 0; switch ( g_pParentWnd->ActiveXY()->m_viewType ) { case XY: @@ -2064,7 +2065,7 @@ void SetState( Shader* state, EStyle style ){ m_state_stack.back().m_state = state; } } -const EStyle getStyle() const { +EStyle getStyle() const { return eWireframeOnly; } void PushState(){