From 6758caa5e1a805c0a900e9f3bafc2d1d5c83c4fe Mon Sep 17 00:00:00 2001 From: "RichardAsh1981@gmail.com" Date: Sat, 21 Sep 2013 19:11:41 +0000 Subject: [PATCH] Make a large number of global variables static so they only have file scope when that is all they need. Part of a patch by Campbell Barton --- src/AudacityApp.cpp | 2 +- src/BatchCommands.cpp | 2 +- src/BlockFile.cpp | 4 ++-- src/FFT.cpp | 4 ++-- src/FileFormats.cpp | 2 +- src/LoadModules.cpp | 4 ++-- src/PitchName.cpp | 4 ++-- src/ondemand/ODManager.cpp | 10 +++++----- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 0b11acbbf..417c69f9f 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -232,7 +232,7 @@ static void wxOnAssert(const wxChar *fileName, int lineNumber, const wxChar *msg static wxFrame *gParentFrame = NULL; -bool gInited = false; +static bool gInited = false; bool gIsQuitting = false; void QuitAudacity(bool bForce) diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index 3d4cf9e93..e0bb39142 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -51,7 +51,7 @@ enum eCommandType { CtEffect, CtMenu, CtSpecial }; // TIDY-ME: Not currently translated, // but there are issues to address if we do. // CLEANSPEECH remnant -wxString SpecialCommands[] = { +static wxString SpecialCommands[] = { wxT("NoAction"), // wxT("Import"), // non-functioning wxT("ExportMP3_56k_before"), diff --git a/src/BlockFile.cpp b/src/BlockFile.cpp index cabae2cdb..790d6ebc3 100644 --- a/src/BlockFile.cpp +++ b/src/BlockFile.cpp @@ -65,8 +65,8 @@ out. #define BLOCKFILE_DEBUG_OUTPUT(op, i) #endif -const int headerTagLen = 20; -char headerTag[headerTagLen + 1] = "AudacityBlockFile112"; +static const int headerTagLen = 20; +static char headerTag[headerTagLen + 1] = "AudacityBlockFile112"; SummaryInfo::SummaryInfo(sampleCount samples) { diff --git a/src/FFT.cpp b/src/FFT.cpp index 009f1f656..81e384277 100644 --- a/src/FFT.cpp +++ b/src/FFT.cpp @@ -46,8 +46,8 @@ #include "FFT.h" -int **gFFTBitTable = NULL; -const int MaxFastBits = 16; +static int **gFFTBitTable = NULL; +static const int MaxFastBits = 16; /* Declare Static functions */ static int IsPowerOfTwo(int x); diff --git a/src/FileFormats.cpp b/src/FileFormats.cpp index 746f5971e..acba1da3e 100644 --- a/src/FileFormats.cpp +++ b/src/FileFormats.cpp @@ -175,7 +175,7 @@ int sf_num_simple_formats() return count; } -SF_FORMAT_INFO g_format_info; +static SF_FORMAT_INFO g_format_info; SF_FORMAT_INFO *sf_simple_format(int i) { diff --git a/src/LoadModules.cpp b/src/LoadModules.cpp index e21e068ce..09cfa69a0 100644 --- a/src/LoadModules.cpp +++ b/src/LoadModules.cpp @@ -51,7 +51,7 @@ typedef pwxWindow (*tPanelFn)(int); // This variable will hold the address of a subroutine in // a DLL that can hijack the normal panel. -tPanelFn pPanelHijack=NULL; +static tPanelFn pPanelHijack=NULL; // Next two commented out lines are handy when investigating // strange DLL behaviour. Instead of dynamic linking, @@ -75,7 +75,7 @@ wxWindow * MakeHijackPanel() // This variable will hold the address of a subroutine in a DLL that // starts a thread and reads script commands. -tpRegScriptServerFunc scriptFn; +static tpRegScriptServerFunc scriptFn; #ifdef EXPERIMENTAL_MODULE_PREFS bool IsAllowedModule( wxString fname ) diff --git a/src/PitchName.cpp b/src/PitchName.cpp index c15b56792..a05ae2f3e 100644 --- a/src/PitchName.cpp +++ b/src/PitchName.cpp @@ -54,8 +54,8 @@ int PitchOctave(const double dMIDInote) } -wxChar gPitchName[10]; -wxChar * pPitchName; +static wxChar gPitchName[10]; +static wxChar * pPitchName; wxChar * PitchName(const double dMIDInote, const bool bWantFlats /* = false */) { diff --git a/src/ondemand/ODManager.cpp b/src/ondemand/ODManager.cpp index 01fd00772..a2b352ce3 100644 --- a/src/ondemand/ODManager.cpp +++ b/src/ondemand/ODManager.cpp @@ -25,11 +25,11 @@ ODTask requests and internals. #include #include -ODLock gODInitedMutex; -bool gManagerCreated=false; -bool gPause=false; //to be loaded in and used with Pause/Resume before ODMan init. +static ODLock gODInitedMutex; +static bool gManagerCreated=false; +static bool gPause=false; //to be loaded in and used with Pause/Resume before ODMan init. /// a flag that is set if we have loaded some OD blockfiles from PCM. -bool sHasLoadedOD=false; +static bool sHasLoadedOD=false; ODManager* ODManager::pMan=NULL; //init the accessor function pointer - use the first time version of the interface fetcher @@ -38,7 +38,7 @@ typedef ODManager* (*pfodman)(); pfodman ODManager::Instance = &(ODManager::InstanceFirstTime); //libsndfile is not threadsafe - this deals with it -ODLock sLibSndFileMutex; +static ODLock sLibSndFileMutex; DEFINE_EVENT_TYPE(EVT_ODTASK_UPDATE)