From 28e9f0ca734145ce03a7cdf5782a32a1c1ac0000 Mon Sep 17 00:00:00 2001 From: "RichardAsh1981@gmail.com" Date: Sat, 21 Sep 2013 19:15:42 +0000 Subject: [PATCH] make many functions which do not require access to class member variables static so they can be called without an object to do so with. Based on part of a patch by Campbell Barton --- src/Envelope.cpp | 6 +++--- src/HelpText.cpp | 14 +++++++------- src/LabelTrack.cpp | 2 +- src/Languages.cpp | 2 +- src/Legacy.cpp | 2 +- src/Snap.cpp | 2 +- src/TrackArtist.cpp | 2 +- src/WaveClip.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Envelope.cpp b/src/Envelope.cpp index 89dad2602..379d0d38f 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -163,7 +163,7 @@ void Envelope::CopyFrom(const Envelope *e, double t0, double t1) /// Limit() limits a double value to a range. /// TODO: Move to a general utilities source file. -double Limit( double Lo, double Value, double Hi ) +static double Limit( double Lo, double Value, double Hi ) { if( Value < Lo ) return Lo; @@ -201,7 +201,7 @@ double Envelope::fromDB(double value) const } /// TODO: This should probably move to track artist. -void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top) +static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top) { if (y >= 0 && y <= r.height) { wxRect circle(r.x + x, r.y + (top ? y - 1: y - 2), 4, 4); @@ -1495,7 +1495,7 @@ void Envelope::print() printf( "(%.2f, %.2f)\n", mEnv[i]->GetT(), mEnv[i]->GetVal() ); } -void checkResult( int n, double a, double b ) +static void checkResult( int n, double a, double b ) { if( (a-b > 0 ? a-b : b-a) > 0.0000001 ) { diff --git a/src/HelpText.cpp b/src/HelpText.cpp index 945855181..d37dd8ffd 100644 --- a/src/HelpText.cpp +++ b/src/HelpText.cpp @@ -21,7 +21,7 @@ -wxString WrapText( const wxString & Text ) +static wxString WrapText( const wxString & Text ) { return wxString(wxT(""))+ wxT("") + @@ -30,7 +30,7 @@ wxString WrapText( const wxString & Text ) wxT(""); } -wxString Link( const wxString &Key, const wxString& Text ) +static wxString Link( const wxString &Key, const wxString& Text ) { return wxString(wxT("")) + wxT(""); } -wxString FileLink( const wxString &Key, const wxString& Text ) +static wxString FileLink( const wxString &Key, const wxString& Text ) { return wxString(wxT("")) + wxT(""); } -wxString LinkExpand( const wxString & Text ) +static wxString LinkExpand( const wxString & Text ) { wxString Temp = Text; int i,j,k; @@ -177,7 +177,7 @@ wxString TitleText( const wxString & Key ) return Key; } -wxString HelpTextBuiltIn( const wxString & Key ) +static wxString HelpTextBuiltIn( const wxString & Key ) { if(Key==wxT("welcome")) { diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index c52b90461..f0c2887fb 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -1345,7 +1345,7 @@ void LabelTrack::MayMoveLabel( int iLabel, int iEdge, double fNewTime) // Constrain function, as in processing/arduino. // returned value will be between min and max (inclusive). -int Constrain( int value, int min, int max ) +static int Constrain( int value, int min, int max ) { wxASSERT( min <= max ); int result=value; diff --git a/src/Languages.cpp b/src/Languages.cpp index 376549264..4b19ff513 100644 --- a/src/Languages.cpp +++ b/src/Languages.cpp @@ -42,7 +42,7 @@ WX_DECLARE_STRING_HASH_MAP(wxString, LangHash); -bool TranslationExists(wxArrayString &audacityPathList, wxString code) +static bool TranslationExists(wxArrayString &audacityPathList, wxString code) { wxArrayString results; wxGetApp().FindFilesInPathList(wxString::Format(wxT("%s/audacity.mo"), diff --git a/src/Legacy.cpp b/src/Legacy.cpp index 5b43c45d1..182b4d69a 100644 --- a/src/Legacy.cpp +++ b/src/Legacy.cpp @@ -82,7 +82,7 @@ public: FILE *mNewFile; }; -bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) +static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile) { wxString line; wxString kind; diff --git a/src/Snap.cpp b/src/Snap.cpp index 32ffba240..a16d23319 100644 --- a/src/Snap.cpp +++ b/src/Snap.cpp @@ -18,7 +18,7 @@ #include "WaveTrack.h" #include "widgets/TimeTextCtrl.h" -int CompareSnapPoints(SnapPoint *s1, SnapPoint *s2) +static int CompareSnapPoints(SnapPoint *s1, SnapPoint *s2) { return (s1->t - s2->t > 0? 1 : -1); } diff --git a/src/TrackArtist.cpp b/src/TrackArtist.cpp index 1b69e3725..696732c6b 100644 --- a/src/TrackArtist.cpp +++ b/src/TrackArtist.cpp @@ -1707,7 +1707,7 @@ void TrackArtist::DrawSpectrum(WaveTrack *track, } } -float sumFreqValues(float *freq, int x0, float bin0, float bin1) +static float sumFreqValues(float *freq, int x0, float bin0, float bin1) { float value; if (int(bin1) == int(bin0)) { diff --git a/src/WaveClip.cpp b/src/WaveClip.cpp index c39924705..3c839dbbe 100644 --- a/src/WaveClip.cpp +++ b/src/WaveClip.cpp @@ -263,7 +263,7 @@ public: #ifdef EXPERIMENTAL_USE_REALFFTF #include "FFT.h" -void ComputeSpectrumUsingRealFFTf(float *buffer, HFFT hFFT, float *window, int len, float *out) +static void ComputeSpectrumUsingRealFFTf(float *buffer, HFFT hFFT, float *window, int len, float *out) { int i; if(len > hFFT->Points*2)