Skip to content

Commit

Permalink
Merge pull request #579 from degasus/statics
Browse files Browse the repository at this point in the history
Mark unexported global variables and functions as statics.
  • Loading branch information
delroth committed Jul 11, 2014
2 parents 326af09 + 7e79806 commit 84bf097
Show file tree
Hide file tree
Showing 169 changed files with 596 additions and 22,553 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -197,6 +197,8 @@ if(NOT MSVC)
check_and_add_flag(LOGICAL_OP -Wlogical-op)
check_and_add_flag(SHADOW -Wshadow)
check_and_add_flag(INIT_SELF -Winit-self)
check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations)
check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
endif(NOT MSVC)

# gcc uses some optimizations which might break stuff without this flag
Expand Down
38 changes: 19 additions & 19 deletions Source/Core/AudioCommon/DPL2Decoder.cpp
Expand Up @@ -23,18 +23,18 @@
#define M_SQRT1_2 0.70710678118654752440
#endif

int olddelay = -1;
unsigned int oldfreq = 0;
unsigned int dlbuflen;
int cyc_pos;
float l_fwr, r_fwr, lpr_fwr, lmr_fwr;
std::vector<float> fwrbuf_l, fwrbuf_r;
float adapt_l_gain, adapt_r_gain, adapt_lpr_gain, adapt_lmr_gain;
std::vector<float> lf, rf, lr, rr, cf, cr;
float LFE_buf[256];
unsigned int lfe_pos;
float *filter_coefs_lfe;
unsigned int len125;
static int olddelay = -1;
static unsigned int oldfreq = 0;
static unsigned int dlbuflen;
static int cyc_pos;
static float l_fwr, r_fwr, lpr_fwr, lmr_fwr;
static std::vector<float> fwrbuf_l, fwrbuf_r;
static float adapt_l_gain, adapt_r_gain, adapt_lpr_gain, adapt_lmr_gain;
static std::vector<float> lf, rf, lr, rr, cf, cr;
static float LFE_buf[256];
static unsigned int lfe_pos;
static float *filter_coefs_lfe;
static unsigned int len125;

template<class T,class _ftype_t> static _ftype_t dotproduct(int count,const T *buf,const _ftype_t *coefficients)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ template<class T> static T firfilter(const T *buf, int pos, int len, int count,
// n window length
// w buffer for the window parameters
*/
void hamming(int n, float* w)
static void hamming(int n, float* w)
{
int i;
float k = float(2*M_PI/((float)(n-1))); // 2*pi/(N-1)
Expand All @@ -110,7 +110,7 @@ opt beta constant used only when designing using kaiser windows
returns 0 if OK, -1 if fail
*/
float* design_fir(unsigned int *n, float* fc, float opt)
static float* design_fir(unsigned int *n, float* fc, float opt)
{
unsigned int o = *n & 1; // Indicator for odd filter length
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
Expand Down Expand Up @@ -165,7 +165,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
return w;
}

void onSeek(void)
static void onSeek(void)
{
l_fwr = r_fwr = lpr_fwr = lmr_fwr = 0;
std::fill(fwrbuf_l.begin(), fwrbuf_l.end(), 0.0f);
Expand All @@ -181,7 +181,7 @@ void onSeek(void)
memset(LFE_buf, 0, sizeof(LFE_buf));
}

void done(void)
static void done(void)
{
onSeek();
if (filter_coefs_lfe)
Expand All @@ -191,7 +191,7 @@ void done(void)
filter_coefs_lfe = nullptr;
}

float* calc_coefficients_125Hz_lowpass(int rate)
static float* calc_coefficients_125Hz_lowpass(int rate)
{
len125 = 256;
float f = 125.0f / (rate / 2);
Expand All @@ -204,15 +204,15 @@ float* calc_coefficients_125Hz_lowpass(int rate)
return coeffs;
}

float passive_lock(float x)
static float passive_lock(float x)
{
static const float MATAGCLOCK = 0.2f; /* AGC range (around 1) where the matrix behaves passively */
const float x1 = x - 1;
const float ax1s = fabs(x - 1) * (1.0f / MATAGCLOCK);
return x1 - x1 / (1 + ax1s * ax1s) + 1;
}

void matrix_decode(const float *in, const int k, const int il,
static void matrix_decode(const float *in, const int k, const int il,
const int ir, bool decode_rear,
const int _dlbuflen,
float _l_fwr, float _r_fwr,
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Common/ArmEmitter.cpp
Expand Up @@ -916,7 +916,7 @@ u32 EncodeVm(ARMReg Vm)
}

// Double/single, Neon
extern const VFPEnc VFPOps[16][2] = {
static const VFPEnc VFPOps[16][2] = {
{{0xE0, 0xA0}, { -1, -1}}, // 0: VMLA
{{0xE1, 0xA4}, { -1, -1}}, // 1: VNMLA
{{0xE0, 0xA4}, { -1, -1}}, // 2: VMLS
Expand All @@ -934,7 +934,7 @@ extern const VFPEnc VFPOps[16][2] = {
{{ -1, -1}, {0x3B, 0x30}}, // 14: VABSi
};

const char *VFPOpNames[16] = {
static const char *VFPOpNames[16] = {
"VMLA",
"VNMLA",
"VMLS",
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Common/ArmEmitter.h
Expand Up @@ -720,7 +720,4 @@ struct VFPEnc {
s16 opc1;
s16 opc2;
};
extern const VFPEnc VFPOps[16][2];
extern const char *VFPOpNames[16];

} // namespace
2 changes: 1 addition & 1 deletion Source/Core/Common/CDUtils.cpp
Expand Up @@ -155,7 +155,7 @@ static struct
};

// Returns true if a device is a block or char device and not a symbolic link
bool is_device(const std::string& source_name)
static bool is_device(const std::string& source_name)
{
struct stat buf;
if (0 != lstat(source_name.c_str(), &buf))
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/ColorUtil.cpp
Expand Up @@ -16,7 +16,7 @@ const int lut4to8[] = { 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF };
const int lut3to8[] = { 0x00,0x24,0x48,0x6D,0x91,0xB6,0xDA,0xFF };

u32 Decode5A3(u16 val)
static u32 Decode5A3(u16 val)
{
const u32 bg_color = 0x00000000;

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Common/Crypto/bn.cpp
Expand Up @@ -6,6 +6,7 @@
#include <string.h>

#include "Common/Common.h"
#include "Common/Crypto/bn.h"

static void bn_zero(u8 *d, u32 n)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Common/ExtendedTrace.cpp
Expand Up @@ -411,8 +411,8 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
if (hThread != GetCurrentThread())
ResumeThread(hThread);
}

char g_uefbuf[2048];
#define UEFBUFSIZE 2048
static char g_uefbuf[UEFBUFSIZE];

void etfprintf(FILE *file, const char *format, ...)
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Common/ExtendedTrace.h
Expand Up @@ -36,8 +36,6 @@ void StackTrace(HANDLE, char const* msg, FILE *file, DWORD eip, DWORD esp, DWORD
// functions by Masken
void etfprintf(FILE *file, const char *format, ...);
void etfprint(FILE *file, const std::string &text);
#define UEFBUFSIZE 2048
extern char g_uefbuf[UEFBUFSIZE];

#else // not WIN32

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Common/MemoryUtil.cpp
Expand Up @@ -7,6 +7,7 @@
#include <string>

#include "Common/Common.h"
#include "Common/MemoryUtil.h"

#ifdef _WIN32
#include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/MsgHandler.h
Expand Up @@ -22,7 +22,7 @@ typedef std::string (*StringTranslator)(const char* text);
void RegisterMsgAlertHandler(MsgAlertHandler handler);
void RegisterStringTranslator(StringTranslator translator);

extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
bool MsgAlert(bool yes_no, int Style, const char* format, ...)
#ifdef __GNUC__
__attribute__((format(printf, 3, 4)))
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/SysConf.cpp
Expand Up @@ -154,7 +154,7 @@ bool SysConf::LoadFromFileInternal(FILE *fh)
}

// Returns the size of the item in file
unsigned int create_item(SSysConfEntry &item, SysconfType type, const std::string &name,
static unsigned int create_item(SSysConfEntry &item, SysconfType type, const std::string &name,
const int data_length, unsigned int offset)
{
item.offset = offset;
Expand Down
30 changes: 15 additions & 15 deletions Source/Core/Core/ARDecrypt.cpp
Expand Up @@ -18,9 +18,9 @@ namespace ActionReplay
{

// Alphanumeric filter for text<->bin conversion
const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS";
static const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS";

u32 genseeds[0x20];
static u32 genseeds[0x20];

const u8 gentable0[0x38] = {
0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01,
Expand Down Expand Up @@ -143,7 +143,7 @@ const u32 table7[0x40] = {
};


void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
static void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
{
u32 tmp3;
u8 array0[0x38],array1[0x38],array2[0x08];
Expand Down Expand Up @@ -208,24 +208,24 @@ void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
}
}

void buildseeds()
static void buildseeds()
{
generateseeds(genseeds,gensubtable,0);
}

void getcode(u32 *src, u32 *addr, u32 *val)
static void getcode(u32 *src, u32 *addr, u32 *val)
{
*addr = Common::swap32(src[0]);
*val = Common::swap32(src[1]);
}

void setcode(u32 *dst, u32 addr, u32 val)
static void setcode(u32 *dst, u32 addr, u32 val)
{
dst[0] = Common::swap32(addr);
dst[1] = Common::swap32(val);
}

u16 gencrc16(u32 *codes, u16 size)
static u16 gencrc16(u32 *codes, u16 size)
{
u16 ret = 0;

Expand All @@ -243,13 +243,13 @@ u16 gencrc16(u32 *codes, u16 size)
return ret;
}

u8 verifycode(u32 *codes, u16 size)
static u8 verifycode(u32 *codes, u16 size)
{
u16 tmp = gencrc16(codes,size);
return (((tmp>>12)^(tmp>>8)^(tmp>>4)^tmp)&0x0F);
}

void unscramble1(u32 *addr, u32 *val)
static void unscramble1(u32 *addr, u32 *val)
{
u32 tmp;

Expand All @@ -276,7 +276,7 @@ void unscramble1(u32 *addr, u32 *val)
*val ^= tmp;
}

void unscramble2(u32 *addr, u32 *val)
static void unscramble2(u32 *addr, u32 *val)
{
u32 tmp;

Expand All @@ -303,7 +303,7 @@ void unscramble2(u32 *addr, u32 *val)
*addr = _rotr((*addr^tmp),4);
}

void decryptcode(u32 *seeds, u32 *code)
static void decryptcode(u32 *seeds, u32 *code)
{
u32 addr,val;
u32 tmp,tmp2;
Expand All @@ -325,7 +325,7 @@ void decryptcode(u32 *seeds, u32 *code)
setcode(code,val,addr);
}

bool getbitstring(u32 *ctrl, u32 *out, u8 len)
static bool getbitstring(u32 *ctrl, u32 *out, u8 len)
{
u32 tmp=(ctrl[0]+(ctrl[1]<<2));

Expand All @@ -348,7 +348,7 @@ bool getbitstring(u32 *ctrl, u32 *out, u8 len)
return true;
}

bool batchdecrypt(u32 *codes, u16 size)
static bool batchdecrypt(u32 *codes, u16 size)
{
u32 tmp,*ptr=codes;
u32 tmparray[4] = { 0 },tmparray2[8] = { 0 };
Expand Down Expand Up @@ -391,7 +391,7 @@ bool batchdecrypt(u32 *codes, u16 size)
// Unfinished (so says Parasyte :p )
}

int GetVal(const char *flt, char chr)
static int GetVal(const char *flt, char chr)
{
int ret = (int)(strchr(flt,chr) - flt);
switch (ret)
Expand All @@ -410,7 +410,7 @@ int GetVal(const char *flt, char chr)
return ret;
}

int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
static int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
{
int j = 0;
int ret = 0;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Boot/ElfReader.cpp
Expand Up @@ -11,8 +11,8 @@
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/PPCSymbolDB.h"

void bswap(Elf32_Word &w) {w = Common::swap32(w);}
void bswap(Elf32_Half &w) {w = Common::swap16(w);}
static void bswap(Elf32_Word &w) {w = Common::swap32(w);}
static void bswap(Elf32_Half &w) {w = Common::swap16(w);}

static void byteswapHeader(Elf32_Ehdr &ELF_H)
{
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/CMakeLists.txt
Expand Up @@ -148,7 +148,6 @@ set(SRCS ActionReplay.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
IPC_HLE/WII_IPC_HLE_WiiMote.cpp
IPC_HLE/WiiMote_HID_Attr.cpp
PowerPC/LUT_frsqrtex.cpp
PowerPC/PowerPC.cpp
PowerPC/PPCAnalyst.cpp
PowerPC/PPCCache.cpp
Expand Down
24 changes: 12 additions & 12 deletions Source/Core/Core/Core.cpp
Expand Up @@ -66,9 +66,9 @@ namespace Core
{

// Declarations and definitions
Common::Timer Timer;
volatile u32 DrawnFrame = 0;
u32 DrawnVideo = 0;
static Common::Timer Timer;
static volatile u32 DrawnFrame = 0;
static u32 DrawnVideo = 0;

// Function forwarding
const char *Callback_ISOName(void);
Expand All @@ -77,12 +77,12 @@ void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _
// Function declarations
void EmuThread();

bool g_bStopping = false;
bool g_bHwInit = false;
bool g_bStarted = false;
void *g_pWindowHandle = nullptr;
std::string g_stateFileName;
std::thread g_EmuThread;
static bool g_bStopping = false;
static bool g_bHwInit = false;
static bool g_bStarted = false;
static void *g_pWindowHandle = nullptr;
static std::string g_stateFileName;
static std::thread g_EmuThread;
static StoppedCallbackFunc s_onStoppedCb = nullptr;

static std::thread g_cpu_thread;
Expand Down Expand Up @@ -139,7 +139,7 @@ void DisplayMessage(const std::string& message, int time_in_ms)
}
}

void Callback_DebuggerBreak()
static void Callback_DebuggerBreak()
{
CCPU::Break();
}
Expand Down Expand Up @@ -264,7 +264,7 @@ void Stop() // - Hammertime!
}

// Create the CPU thread, which is a CPU + Video thread in Single Core mode.
void CpuThread()
static void CpuThread()
{
const SCoreStartupParameter& _CoreParameter =
SConfig::GetInstance().m_LocalCoreStartupParameter;
Expand Down Expand Up @@ -310,7 +310,7 @@ void CpuThread()
return;
}

void FifoPlayerThread()
static void FifoPlayerThread()
{
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;

Expand Down

0 comments on commit 84bf097

Please sign in to comment.