From b60fae44701ddc1cfa7fc970fd5aaf21a0838e7d Mon Sep 17 00:00:00 2001 From: James Crook Date: Sat, 7 Apr 2018 20:28:27 +0100 Subject: [PATCH] Fix some warnings on mac These are mostly missing 'overrides' --- src/AudacityApp.h | 2 +- src/AudioIO.cpp | 4 ++-- src/LabelDialog.h | 2 +- src/Menus.cpp | 2 +- src/Project.h | 2 +- src/WaveTrack.h | 4 ++-- src/blockfile/ODPCMAliasBlockFile.h | 4 ++-- src/blockfile/SimpleBlockFile.cpp | 4 ++-- src/commands/AudacityCommand.h | 4 ++-- src/commands/Command.h | 2 +- src/commands/Validators.h | 2 +- src/effects/NoiseReduction.cpp | 4 ++-- src/effects/Phaser.h | 2 +- src/effects/Reverb.h | 4 ++-- src/effects/ToneGen.h | 2 +- src/effects/VST/VSTEffect.h | 3 ++- src/export/ExportMP3.cpp | 2 +- src/export/ExportPCM.cpp | 2 +- src/import/ImportFLAC.cpp | 6 +++--- src/import/ImportMP3.cpp | 4 ++-- src/import/ImportOGG.cpp | 4 ++-- src/import/ImportPCM.cpp | 4 ++-- src/ondemand/ODDecodeFlacTask.cpp | 2 +- src/toolbars/ToolBar.h | 2 +- .../notetrack/ui/NoteTrackVZoomHandle.cpp | 2 +- .../wavetrack/ui/WaveTrackVZoomHandle.cpp | 4 ++-- src/widgets/ASlider.h | 2 +- src/widgets/Grid.h | 18 +++++++----------- src/widgets/Ruler.h | 4 ++-- 29 files changed, 50 insertions(+), 53 deletions(-) diff --git a/src/AudacityApp.h b/src/AudacityApp.h index a16274819..4809c8c0b 100644 --- a/src/AudacityApp.h +++ b/src/AudacityApp.h @@ -65,7 +65,7 @@ class AudacityApp final : public wxApp { void OnFatalException() override; bool OnExceptionInMainLoop() override; - int FilterEvent(wxEvent & event); + int FilterEvent(wxEvent & event) override; // Returns the language actually used which is not lang if lang cannot be found. wxString InitLang( const wxString & lang ); diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index a01302cf7..2bcc5d975 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -992,7 +992,7 @@ static double SystemTime(bool usingAlsa) return (now.tv_sec + now.tv_nsec * 0.000000001) - streamStartTime; } #else - usingAlsa;//compiler food. + static_cast(usingAlsa);//compiler food. #endif return PaUtil_GetTime() - streamStartTime; @@ -4421,7 +4421,7 @@ void AudioIO::AllNotesOff(bool looping) bool doDelay = !looping; #else bool doDelay = false; - looping;// compiler food. + static_cast(looping);// compiler food. #endif // to keep track of when MIDI should all be delivered, diff --git a/src/LabelDialog.h b/src/LabelDialog.h index bf1692f26..3c914351f 100644 --- a/src/LabelDialog.h +++ b/src/LabelDialog.h @@ -64,7 +64,7 @@ class LabelDialog final : public wxDialogWrapper bool TransferDataToWindow() override; bool TransferDataFromWindow() override; - bool Validate(); + bool Validate() override; void FindAllLabels(); void AddLabels(const LabelTrack *t); void FindInitialRow(); diff --git a/src/Menus.cpp b/src/Menus.cpp index 1593a5aef..917b46412 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -6820,7 +6820,7 @@ void AudacityProject::OnZoomToggle(const CommandContext &WXUNUSED(context) ) double Zoom1 = GetZoomOfPreset( TracksPrefs::Zoom1Choice() ); double Zoom2 = GetZoomOfPreset( TracksPrefs::Zoom2Choice() ); double Z = mViewInfo.GetZoom();// Current Zoom. - double ChosenZoom = abs(log(Zoom1 / Z)) > abs(log( Z / Zoom2)) ? Zoom1:Zoom2; + double ChosenZoom = fabs(log(Zoom1 / Z)) > fabs(log( Z / Zoom2)) ? Zoom1:Zoom2; Zoom(ChosenZoom); mTrackPanel->Refresh(false); diff --git a/src/Project.h b/src/Project.h index a1a759796..f33d0c222 100644 --- a/src/Project.h +++ b/src/Project.h @@ -226,7 +226,7 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, bool IsAudioActive() const; void SetAudioIOToken(int token); - bool IsActive(); + bool IsActive() override; // File I/O diff --git a/src/WaveTrack.h b/src/WaveTrack.h index 63bf2bedb..d1245b884 100644 --- a/src/WaveTrack.h +++ b/src/WaveTrack.h @@ -105,14 +105,14 @@ private: * * @return time in seconds, or zero if there are no clips in the track */ - double GetStartTime() const; + double GetStartTime() const override; /** @brief Get the time at which the last clip in the track ends, plus * recorded stuff * * @return time in seconds, or zero if there are no clips in the track. */ - double GetEndTime() const; + double GetEndTime() const override; // // Identifying the type of track diff --git a/src/blockfile/ODPCMAliasBlockFile.h b/src/blockfile/ODPCMAliasBlockFile.h index 04752955f..9f295fb77 100644 --- a/src/blockfile/ODPCMAliasBlockFile.h +++ b/src/blockfile/ODPCMAliasBlockFile.h @@ -96,10 +96,10 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile sampleCount GetStart() const {return mStart;} /// Locks the blockfile only if it has a file that exists. - void Lock(); + void Lock() override; /// Unlocks the blockfile only if it has a file that exists. - void Unlock(); + void Unlock() override; ///sets the amount of samples the clip associated with this blockfile is offset in the wavetrack (non effecting) void SetClipOffset(sampleCount numSamples){mClipOffset= numSamples;} diff --git a/src/blockfile/SimpleBlockFile.cpp b/src/blockfile/SimpleBlockFile.cpp index 39d5f53c0..59d199133 100644 --- a/src/blockfile/SimpleBlockFile.cpp +++ b/src/blockfile/SimpleBlockFile.cpp @@ -543,11 +543,11 @@ auto SimpleBlockFile::GetSpaceUsage() const -> DiskByteCount file.Close(); } - return { + return ( sizeof(auHeader) + mSummaryInfo.totalSummaryBytes + (GetLength() * SAMPLE_SIZE_DISK(mFormat)) - }; + ); } void SimpleBlockFile::Recover(){ diff --git a/src/commands/AudacityCommand.h b/src/commands/AudacityCommand.h index 04e0a2270..f4bf6edb1 100644 --- a/src/commands/AudacityCommand.h +++ b/src/commands/AudacityCommand.h @@ -70,9 +70,9 @@ class AUDACITY_DLL_API AudacityCommand /* not final */ : public wxEvtHandler, // virtual wxString GetFamily(); //These two must be implemented by instances. - virtual wxString GetSymbol() + virtual wxString GetSymbol() override { wxFAIL_MSG( "Implement a Symbol for this command");return "FAIL";}; - virtual wxString GetDescription() + virtual wxString GetDescription() override {wxFAIL_MSG( "Implement a Description for this command");return "FAIL";}; // Name of page in the Audacity alpha manual diff --git a/src/commands/Command.h b/src/commands/Command.h index 9798321cb..062f9db57 100644 --- a/src/commands/Command.h +++ b/src/commands/Command.h @@ -105,7 +105,7 @@ public: virtual ~CommandImplementation(); /// An instance method for getting the command name (for consistency) - wxString GetName(); + wxString GetName() override; /// Get the signature of the command CommandSignature &GetSignature() override; diff --git a/src/commands/Validators.h b/src/commands/Validators.h index e2c63603a..2b06802f0 100644 --- a/src/commands/Validators.h +++ b/src/commands/Validators.h @@ -153,7 +153,7 @@ public: class BoolArrayValidator final : public Validator { public: - virtual bool Validate(const wxVariant &v) + virtual bool Validate(const wxVariant &v) override { wxString val; // Validate a string of chars containing only 0, 1 and x. if (!v.Convert(&val)) diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index 6b8496a20..e82d56e61 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -366,7 +366,7 @@ public: wxWindow *parent, bool bHasProfile, bool bAllowTwiddleSettings); - void PopulateOrExchange(ShuttleGui & S); + void PopulateOrExchange(ShuttleGui & S) override; bool TransferDataToWindow() override; bool TransferDataFromWindow() override; @@ -386,7 +386,7 @@ private: #ifdef ADVANCED_SETTINGS void OnMethodChoice(wxCommandEvent &); #endif - void OnPreview(wxCommandEvent &event); + void OnPreview(wxCommandEvent &event) override; void OnReduceNoise( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event ); void OnHelp( wxCommandEvent &event ); diff --git a/src/effects/Phaser.h b/src/effects/Phaser.h index 8e3f090ab..512b0d0f7 100644 --- a/src/effects/Phaser.h +++ b/src/effects/Phaser.h @@ -80,7 +80,7 @@ public: // Effect implementation - void PopulateOrExchange(ShuttleGui & S); + void PopulateOrExchange(ShuttleGui & S) override; bool TransferDataToWindow() override; bool TransferDataFromWindow() override; diff --git a/src/effects/Reverb.h b/src/effects/Reverb.h index b91c05c98..85c7cadd5 100644 --- a/src/effects/Reverb.h +++ b/src/effects/Reverb.h @@ -71,8 +71,8 @@ public: // Effect implementation - bool Startup(); - void PopulateOrExchange(ShuttleGui & S); + bool Startup() override; + void PopulateOrExchange(ShuttleGui & S) override; bool TransferDataToWindow() override; bool TransferDataFromWindow() override; diff --git a/src/effects/ToneGen.h b/src/effects/ToneGen.h index ac1f97c5f..e52e2b88b 100644 --- a/src/effects/ToneGen.h +++ b/src/effects/ToneGen.h @@ -52,7 +52,7 @@ public: // Effect implementation - void PopulateOrExchange(ShuttleGui & S); + void PopulateOrExchange(ShuttleGui & S) override; bool TransferDataFromWindow() override; bool TransferDataToWindow() override; diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h index ccf4e12b7..145ca278a 100644 --- a/src/effects/VST/VSTEffect.h +++ b/src/effects/VST/VSTEffect.h @@ -247,7 +247,8 @@ private: // VST methods - intptr_t callDispatcher(int opcode, int index, intptr_t value, void *ptr, float opt); + intptr_t callDispatcher(int opcode, int index, + intptr_t value, void *ptr, float opt) override; void callProcessReplacing(float **inputs, float **outputs, int sampleframes); void callSetParameter(int index, float value); float callGetParameter(int index); diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 96e19b9c6..f23b95ca5 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -1599,7 +1599,7 @@ class ExportMP3 final : public ExportPlugin public: ExportMP3(); - bool CheckFileName(wxFileName & filename, int format); + bool CheckFileName(wxFileName & filename, int format) override; // Required diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index dfb5166fd..e4fd3bb1e 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -329,7 +329,7 @@ public: const Tags *metadata = NULL, int subformat = 0) override; // optional - wxString GetExtension(int index); + wxString GetExtension(int index) override; bool CheckFileName(wxFileName &filename, int format) override; private: diff --git a/src/import/ImportFLAC.cpp b/src/import/ImportFLAC.cpp index 20e1f2ffa..7a5a3043f 100644 --- a/src/import/ImportFLAC.cpp +++ b/src/import/ImportFLAC.cpp @@ -139,8 +139,8 @@ class FLACImportPlugin final : public ImportPlugin ~FLACImportPlugin() { } - wxString GetPluginStringID() { return wxT("libflac"); } - wxString GetPluginFormatDescription(); + wxString GetPluginStringID() override { return wxT("libflac"); } + wxString GetPluginFormatDescription() override; std::unique_ptr Open(const wxString &Filename) override; }; @@ -225,7 +225,7 @@ void MyFLACFile::metadata_callback(const FLAC__StreamMetadata *metadata) // FIXME: not declared when compiling on Ubuntu. //case FLAC__MAX_METADATA_TYPE: // quiet compiler warning with this line - + default: break; } } diff --git a/src/import/ImportMP3.cpp b/src/import/ImportMP3.cpp index 42bca3f08..f4c42b0a5 100644 --- a/src/import/ImportMP3.cpp +++ b/src/import/ImportMP3.cpp @@ -116,8 +116,8 @@ public: ~MP3ImportPlugin() { } - wxString GetPluginStringID() { return wxT("libmad"); } - wxString GetPluginFormatDescription(); + wxString GetPluginStringID() override { return wxT("libmad"); } + wxString GetPluginFormatDescription() override; std::unique_ptr Open(const wxString &Filename) override; }; diff --git a/src/import/ImportOGG.cpp b/src/import/ImportOGG.cpp index 587b1c92f..c0065250b 100644 --- a/src/import/ImportOGG.cpp +++ b/src/import/ImportOGG.cpp @@ -92,8 +92,8 @@ public: ~OggImportPlugin() { } - wxString GetPluginStringID() { return wxT("liboggvorbis"); } - wxString GetPluginFormatDescription(); + wxString GetPluginStringID() override { return wxT("liboggvorbis"); } + wxString GetPluginFormatDescription() override; std::unique_ptr Open(const wxString &Filename) override; }; diff --git a/src/import/ImportPCM.cpp b/src/import/ImportPCM.cpp index bacec2f36..82e861399 100644 --- a/src/import/ImportPCM.cpp +++ b/src/import/ImportPCM.cpp @@ -80,8 +80,8 @@ public: ~PCMImportPlugin() { } - wxString GetPluginStringID() { return wxT("libsndfile"); } - wxString GetPluginFormatDescription(); + wxString GetPluginStringID() override { return wxT("libsndfile"); } + wxString GetPluginFormatDescription() override; std::unique_ptr Open(const wxString &Filename) override; }; diff --git a/src/ondemand/ODDecodeFlacTask.cpp b/src/ondemand/ODDecodeFlacTask.cpp index d3362d60e..2145f3fbe 100644 --- a/src/ondemand/ODDecodeFlacTask.cpp +++ b/src/ondemand/ODDecodeFlacTask.cpp @@ -83,7 +83,7 @@ void ODFLACFile::metadata_callback(const FLAC__StreamMetadata *metadata) // FIXME: not declared when compiling on Ubuntu. //case FLAC__MAX_METADATA_TYPE: // quiet compiler warning with this line - + default: break; } } diff --git a/src/toolbars/ToolBar.h b/src/toolbars/ToolBar.h index 34ebf3a13..c7935a429 100644 --- a/src/toolbars/ToolBar.h +++ b/src/toolbars/ToolBar.h @@ -109,7 +109,7 @@ class ToolBar /* not final */ : public wxPanelWrapper wxString GetSection(); ToolDock *GetDock(); - void SetLabel(const wxString & label); + void SetLabel(const wxString & label) override; void SetDock( ToolDock *dock); void SetDocked(ToolDock *dock, bool pushed); diff --git a/src/tracks/playabletrack/notetrack/ui/NoteTrackVZoomHandle.cpp b/src/tracks/playabletrack/notetrack/ui/NoteTrackVZoomHandle.cpp index 76fc6dd66..8c54af355 100644 --- a/src/tracks/playabletrack/notetrack/ui/NoteTrackVZoomHandle.cpp +++ b/src/tracks/playabletrack/notetrack/ui/NoteTrackVZoomHandle.cpp @@ -194,7 +194,7 @@ private: mpData = nullptr; } - virtual void InitMenu(Menu *pMenu, void *pUserData); + virtual void InitMenu(Menu *pMenu, void *pUserData) override; void OnWaveformScaleType(wxCommandEvent &evt); }; diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackVZoomHandle.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackVZoomHandle.cpp index 9a6fb872c..c4f2afd68 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackVZoomHandle.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackVZoomHandle.cpp @@ -412,7 +412,7 @@ public: static WaveformVRulerMenuTable &Instance(); private: - virtual void InitMenu(Menu *pMenu, void *pUserData); + virtual void InitMenu(Menu *pMenu, void *pUserData) override; void OnWaveformScaleType(wxCommandEvent &evt); }; @@ -499,7 +499,7 @@ public: static SpectrumVRulerMenuTable &Instance(); private: - void InitMenu(Menu *pMenu, void *pUserData); + void InitMenu(Menu *pMenu, void *pUserData) override; void OnSpectrumScaleType(wxCommandEvent &evt); }; diff --git a/src/widgets/ASlider.h b/src/widgets/ASlider.h index 0a43e1c08..cd054a420 100644 --- a/src/widgets/ASlider.h +++ b/src/widgets/ASlider.h @@ -307,7 +307,7 @@ class ASlider /* not final */ : public wxPanel void OnTimer(wxTimerEvent & event); // Overrides of the wxWindow functions with the same semantics - bool Enable(bool enable = true); + bool Enable(bool enable = true) override; bool IsEnabled() const; private: diff --git a/src/widgets/Grid.h b/src/widgets/Grid.h index 6a8ecf00b..173796e4b 100644 --- a/src/widgets/Grid.h +++ b/src/widgets/Grid.h @@ -140,22 +140,18 @@ public: wxWindowID id, wxEvtHandler *evtHandler) override; - void SetSize(const wxRect &rect); - - void BeginEdit(int row, int col, wxGrid *grid); - + void SetSize(const wxRect &rect) override; + void BeginEdit(int row, int col, wxGrid *grid) override; bool EndEdit(int row, int col, wxGrid *grid); - - bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); - - void ApplyEdit(int row, int col, wxGrid *grid); - - void Reset(); + bool EndEdit(int row, int col, const wxGrid *grid, + const wxString &oldval, wxString *newval) override; + void ApplyEdit(int row, int col, wxGrid *grid) override; + void Reset() override; wxGridCellEditor *Clone() const override; void SetChoices(const wxArrayString &choices); - wxString GetValue() const; + wxString GetValue() const override; protected: diff --git a/src/widgets/Ruler.h b/src/widgets/Ruler.h index 875713a3f..40d70f8ac 100644 --- a/src/widgets/Ruler.h +++ b/src/widgets/Ruler.h @@ -297,9 +297,9 @@ class AUDACITY_DLL_API RulerPanel final : public wxPanelWrapper { void SetTickColour( wxColour & c){ ruler.SetTickColour( c );} // We don't need or want to accept focus. - bool AcceptsFocus() const { return false; } + bool AcceptsFocus() const override { return false; } // So that wxPanel is not included in Tab traversal - see wxWidgets bug 15581 - bool AcceptsFocusFromKeyboard() const { return false; } + bool AcceptsFocusFromKeyboard() const override { return false; } public: