From 818b31edc340d824c5fc8d6e055c0b65fb8e77c4 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Mon, 15 Jan 2007 15:27:13 +0000 Subject: [PATCH] Fixes for misc. compiler warnings. Originally committed to SVN as r797. --- aegisub/audio_spectrum.cpp | 1 - aegisub/auto4_base.cpp | 6 +++--- aegisub/auto4_base.h | 4 +++- aegisub/auto4_lua.cpp | 10 ++++++---- aegisub/auto4_lua.h | 1 + aegisub/auto4_lua_dialog.cpp | 14 ++++++++++++++ aegisub/base_grid.cpp | 3 --- aegisub/colorspace.cpp | 1 + 8 files changed, 28 insertions(+), 12 deletions(-) diff --git a/aegisub/audio_spectrum.cpp b/aegisub/audio_spectrum.cpp index fa8ff1fe6..4ccf08276 100644 --- a/aegisub/audio_spectrum.cpp +++ b/aegisub/audio_spectrum.cpp @@ -231,7 +231,6 @@ void AudioSpectrum::RenderRange(__int64 range_start, __int64 range_end, bool sel { unsigned long first_line = (unsigned long)(range_start / line_length / 2); unsigned long last_line = (unsigned long)(range_end / line_length / 2); - unsigned long lines_to_render = last_line - first_line + 1; float *power = new float[line_length]; diff --git a/aegisub/auto4_base.cpp b/aegisub/auto4_base.cpp index 83f8ebebc..c5e034710 100644 --- a/aegisub/auto4_base.cpp +++ b/aegisub/auto4_base.cpp @@ -75,7 +75,7 @@ namespace Automation4 { LOGFONTW lf; ZeroMemory(&lf, sizeof(lf)); - lf.lfHeight = fontsize; + lf.lfHeight = (LONG)fontsize; lf.lfWeight = style->bold ? FW_BOLD : FW_NORMAL; lf.lfItalic = style->italic; lf.lfUnderline = style->underline; @@ -131,7 +131,7 @@ namespace Automation4 { // USING wxTheFontList SEEMS TO CAUSE BAD LEAKS! //wxFont *thefont = wxTheFontList->FindOrCreateFont( wxFont thefont( - fontsize, + (int)fontsize, wxFONTFAMILY_DEFAULT, style->italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL, style->bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL, @@ -146,7 +146,7 @@ namespace Automation4 { for (unsigned int i = 0; i < text.length(); i++) { int a, b, c, d; thedc.GetTextExtent(text[i], &a, &b, &c, &d); - width += a + style->spacing; + width += a + (int)style->spacing; height = b > height ? b : height; descent = c > descent ? c : descent; extlead= d > extlead ? d : extlead; diff --git a/aegisub/auto4_base.h b/aegisub/auto4_base.h index 782433a11..596c70602 100644 --- a/aegisub/auto4_base.h +++ b/aegisub/auto4_base.h @@ -170,6 +170,7 @@ namespace Automation4 { public: ScriptConfigDialog() : win(0) { } + virtual ~ScriptConfigDialog() { } wxWindow* GetWindow(wxWindow *parent); void DeleteWindow(); virtual void ReadBack() = 0; @@ -245,8 +246,8 @@ namespace Automation4 { void SetTitle(const wxString &_title); void AddDebugOutput(const wxString &msg); - volatile bool has_inited; volatile bool script_finished; + volatile bool has_inited; DECLARE_EVENT_TABLE() }; @@ -327,6 +328,7 @@ namespace Automation4 { static std::vector *factories; protected: ScriptFactory() { } + virtual ~ScriptFactory() { } wxString engine_name; wxString filename_pattern; public: diff --git a/aegisub/auto4_lua.cpp b/aegisub/auto4_lua.cpp index 526556b6e..22123e2e7 100644 --- a/aegisub/auto4_lua.cpp +++ b/aegisub/auto4_lua.cpp @@ -517,9 +517,9 @@ namespace Automation4 { } LuaFeatureMacro::LuaFeatureMacro(const wxString &_name, const wxString &_description, lua_State *_L) - : LuaFeature(_L, SCRIPTFEATURE_MACRO, _name) + : Feature(SCRIPTFEATURE_MACRO, _name) , FeatureMacro(_name, _description) - , Feature(SCRIPTFEATURE_MACRO, _name) + , LuaFeature(_L, SCRIPTFEATURE_MACRO, _name) { // new table for containing the functions for this feature lua_newtable(L); @@ -590,9 +590,9 @@ namespace Automation4 { // LuaFeatureFilter LuaFeatureFilter::LuaFeatureFilter(const wxString &_name, const wxString &_description, int merit, lua_State *_L) - : LuaFeature(_L, SCRIPTFEATURE_FILTER, _name) + : Feature(SCRIPTFEATURE_FILTER, _name) , FeatureFilter(_name, _description, merit) - , Feature(SCRIPTFEATURE_FILTER, _name) + , LuaFeature(_L, SCRIPTFEATURE_FILTER, _name) { // Works the same as in LuaFeatureMacro lua_newtable(L); @@ -837,6 +837,8 @@ namespace Automation4 { Register(this); } + ~LuaScriptFactory() { } + virtual Script* Produce(const wxString &filename) const { // Just check if file extension is .lua diff --git a/aegisub/auto4_lua.h b/aegisub/auto4_lua.h index 5da02dc29..ed884d474 100644 --- a/aegisub/auto4_lua.h +++ b/aegisub/auto4_lua.h @@ -122,6 +122,7 @@ namespace Automation4 { virtual void LuaReadBack(lua_State *L) = 0; LuaConfigDialogControl(lua_State *L); + virtual ~LuaConfigDialogControl() { } }; class LuaConfigDialog : public ScriptConfigDialog { diff --git a/aegisub/auto4_lua_dialog.cpp b/aegisub/auto4_lua_dialog.cpp index f460115de..96ec9e07e 100644 --- a/aegisub/auto4_lua_dialog.cpp +++ b/aegisub/auto4_lua_dialog.cpp @@ -123,6 +123,8 @@ namespace Automation4 { lua_pop(L, 1); } + virtual ~Label() { } + wxControl *Create(wxWindow *parent) { return cw = new wxStaticText(parent, -1, label); @@ -155,6 +157,8 @@ namespace Automation4 { lua_pop(L, 1); } + virtual ~Edit() { } + wxControl *Create(wxWindow *parent) { return cw = new wxTextCtrl(parent, -1, text, wxDefaultPosition, wxDefaultSize, 0); @@ -184,6 +188,8 @@ namespace Automation4 { // Nothing more } + virtual ~Textbox() { } + wxControl *Create(wxWindow *parent) { cw = new wxTextCtrl(parent, -1, text, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); @@ -230,6 +236,8 @@ nospin: } } + virtual ~IntEdit() { } + typedef wxValidator IntTextValidator; // TODO wxControl *Create(wxWindow *parent) { @@ -278,6 +286,8 @@ nospin: // TODO: spin button support } + virtual ~FloatEdit() { } + typedef wxValidator FloatTextValidator; wxControl *Create(wxWindow *parent) { @@ -326,6 +336,8 @@ nospin: lua_pop(L, 1); } + virtual ~Dropdown() { } + wxControl *Create(wxWindow *parent) { return cw = new wxComboBox(parent, -1, value, wxDefaultPosition, wxDefaultSize, items, wxCB_READONLY); @@ -363,6 +375,8 @@ nospin: lua_pop(L, 1); } + virtual ~Checkbox() { } + wxControl *Create(wxWindow *parent) { return cw = new wxCheckBox(parent, -1, label); diff --git a/aegisub/base_grid.cpp b/aegisub/base_grid.cpp index 53e06a7fa..e1e2b29a8 100644 --- a/aegisub/base_grid.cpp +++ b/aegisub/base_grid.cpp @@ -34,9 +34,6 @@ // -#pragma once - - //////////// // Includes #include "base_grid.h" diff --git a/aegisub/colorspace.cpp b/aegisub/colorspace.cpp index f85595b28..c0175c5d9 100644 --- a/aegisub/colorspace.cpp +++ b/aegisub/colorspace.cpp @@ -241,6 +241,7 @@ void hsv_to_rgb(int H, int S, int V, unsigned char *R, unsigned char *G, unsigne b = v; break; case 5: + default: r = v; g = p; b = q;