Fix some cases of variables being used uninitialized. Also some unused

variables, writeable strings and dangerously shadowed variables.

index(), gamma(), exp() and y0() are POSIX functions and using those
names can cause namespace confusion.

A number of C files were missing the final newline required by ANSI C
and some versions of GCC are pedantic enough to complain about this.

These changes simply the scons build, allowing us to get rid of
filterWarnings which is simply more trouble than it's worth.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5574 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang
2010-06-02 20:35:12 +00:00
parent 03d1438be8
commit 30e437f9e3
85 changed files with 212 additions and 284 deletions
-1
View File
@@ -12,7 +12,6 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
if acenv['HAVE_OPENAL']:
files += [ 'OpenALStream.cpp', 'aldlist.cpp' ]
+1 -1
View File
@@ -93,7 +93,7 @@ public:
x.clear();
while (number > 0)
{
unsigned int first;
unsigned int first = 0;
Do(first);
std::string second;
Do(second);
+1 -1
View File
@@ -64,4 +64,4 @@ private:
int num_entries_;
};
#endif // _LINEAR_DISKCACHE
#endif // _LINEAR_DISKCACHE
-1
View File
@@ -49,5 +49,4 @@ if sys.platform == 'win32':
files += [ "stdafx.cpp" ]
env_common = env.Clone()
env_common.Append(CXXFLAGS = [ '-fPIC' ])
env_common.StaticLibrary(env['local_libs'] + "common", files)
+19 -19
View File
@@ -40,7 +40,7 @@ extern "C" {
#include "lstate.h"
};
// TODO Count: 7
// TODO Count: 7
#if defined(DEBUG) || defined(DEBUGFAST)
bool Debug = true;
@@ -1111,7 +1111,7 @@ DEFINE_LUA_FUNCTION(emulua_wait, "")
// we're only calling this to run user events. (a windows-only example of what that means is the canonical Peek/Translate/Dispatch loop)
// hopefully this won't actually advance the emulation state in any non-user-input-driven way when called in this context...
CoreTiming::Advance();
CoreTiming::Advance();
return 0;
}
@@ -1167,7 +1167,7 @@ void LuaRescueHook(lua_State* L, lua_Debug *dbg)
{
//lua_sethook(L, NULL, 0, 0);
assert(L->errfunc || L->errorJmp);
luaL_error(L, info.panic ? info.panicMessage : "terminated by user");
luaL_error(L, info.panic ? info.panicMessage : "terminated by user");
}
info.panic = false;
@@ -1382,7 +1382,7 @@ DEFINE_LUA_FUNCTION(emulua_frameadvance, "")
if(info.speedMode == SPEEDMODE_MAXIMUM)
CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true);
Frame::SetFrameStopping(false);
*PowerPC::GetStatePtr() = PowerPC::CPU_RUNNING;
*PowerPC::GetStatePtr() = PowerPC::CPU_RUNNING;
return 0;
}
@@ -1410,7 +1410,7 @@ DEFINE_LUA_FUNCTION(emulua_redraw, "")
DEFINE_LUA_FUNCTION(memory_readbyte, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned char value = Memory::Read_U8(address);
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1418,7 +1418,7 @@ DEFINE_LUA_FUNCTION(memory_readbyte, "address")
}
DEFINE_LUA_FUNCTION(memory_readbytesigned, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
signed char value = (signed char)(Memory::Read_U8(address));
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1426,7 +1426,7 @@ DEFINE_LUA_FUNCTION(memory_readbytesigned, "address")
}
DEFINE_LUA_FUNCTION(memory_readword, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned short value = Memory::Read_U16(address);
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1434,7 +1434,7 @@ DEFINE_LUA_FUNCTION(memory_readword, "address")
}
DEFINE_LUA_FUNCTION(memory_readwordsigned, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
signed short value = (signed short)(Memory::Read_U16(address));
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1442,7 +1442,7 @@ DEFINE_LUA_FUNCTION(memory_readwordsigned, "address")
}
DEFINE_LUA_FUNCTION(memory_readdword, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned long value = Memory::Read_U32(address);
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1450,7 +1450,7 @@ DEFINE_LUA_FUNCTION(memory_readdword, "address")
}
DEFINE_LUA_FUNCTION(memory_readdwordsigned, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
signed long value = (signed long)(Memory::Read_U32(address));
lua_settop(L,0);
lua_pushinteger(L, value);
@@ -1458,7 +1458,7 @@ DEFINE_LUA_FUNCTION(memory_readdwordsigned, "address")
}
DEFINE_LUA_FUNCTION(memory_readqword, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned long long value = Memory::Read_U64(address);
lua_settop(L,0);
lua_pushinteger(L, (lua_Integer)value);
@@ -1466,7 +1466,7 @@ DEFINE_LUA_FUNCTION(memory_readqword, "address")
}
DEFINE_LUA_FUNCTION(memory_readqwordsigned, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
signed long long value = (signed long long)(Memory::Read_U64(address));
lua_settop(L,0);
lua_pushinteger(L, (lua_Integer)value);
@@ -1475,28 +1475,28 @@ DEFINE_LUA_FUNCTION(memory_readqwordsigned, "address")
DEFINE_LUA_FUNCTION(memory_writebyte, "address,value")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned char value = (unsigned char)(luaL_checkinteger(L,2) & 0xFF);
Memory::Write_U8(value, address);
return 0;
}
DEFINE_LUA_FUNCTION(memory_writeword, "address,value")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned short value = (unsigned short)(luaL_checkinteger(L,2) & 0xFFFF);
Memory::Write_U16(value, address);
return 0;
}
DEFINE_LUA_FUNCTION(memory_writedword, "address,value")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned long value = (unsigned long)(luaL_checkinteger(L,2));
Memory::Write_U32(value, address);
return 0;
}
DEFINE_LUA_FUNCTION(memory_writeqword, "address,value")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
unsigned long value = (unsigned long)(luaL_checkinteger(L,2));
Memory::Write_U64(value, address);
return 0;
@@ -1504,7 +1504,7 @@ DEFINE_LUA_FUNCTION(memory_writeqword, "address,value")
DEFINE_LUA_FUNCTION(memory_readbyterange, "address,length")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
int length = (int)luaL_checkinteger(L,2);
if(length < 0)
@@ -1533,7 +1533,7 @@ DEFINE_LUA_FUNCTION(memory_readbyterange, "address,length")
DEFINE_LUA_FUNCTION(memory_isvalid, "address")
{
unsigned long address = luaL_checkinteger(L,1);
unsigned long address = luaL_checkinteger(L,1);
lua_settop(L,0);
lua_pushboolean(L, Memory::IsRAMAddress(address));
return 1;
@@ -2790,7 +2790,7 @@ DEFINE_LUA_FUNCTION(emulua_loadrom, "filename")
// Load game specific settings
IniFile game_ini;
std::string unique_id = StartUp.GetUniqueID();
StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini";
StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini";
if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str()))
{
// General settings
@@ -141,4 +141,4 @@ void JitIL::fsign(UGeckoInstruction inst)
PanicAlert("fsign bleh");
break;
}
}
}
+1 -1
View File
@@ -22,4 +22,4 @@
extern const unsigned int frsqrtex_lut[65536];
#endif //_LUT_frsqrtex_h_
#endif //_LUT_frsqrtex_h_
+1 -1
View File
@@ -15,4 +15,4 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "stdafx.h"
#include "stdafx.h"
-1
View File
@@ -30,6 +30,5 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'dspcore', files, LIBS = [ 'common'] )
@@ -13,6 +13,5 @@ files = [
]
acenv = env.Clone()
acenv.Append(CXXFLAGS = [ '-fPIC' ])
acenv.StaticLibrary(env['local_libs'] + 'debugger_ui_util', files)
-2
View File
@@ -21,8 +21,6 @@
#ifndef _WIN32
#include <sys/param.h>
#else
#endif
#include "Common.h"
@@ -238,8 +238,8 @@ ControlState ControllerInterface::InputReference::State( const ControlState igno
if ( NULL == device )
return 0;
ControlState state;
// this mode thing will be turned into a switch statement
ControlState state = 0;
switch ( mode )
{
// OR
@@ -171,4 +171,5 @@
{ kHIDUsage_KeyboardRightShift, "Right Shift" },
{ kHIDUsage_KeyboardRightAlt, "Right Alt" },
{ kHIDUsage_KeyboardRightGUI, "Right GUI" },
/* 0x4E - 0xFFFF Reserved */
/* 0x4E - 0xFFFF Reserved */
-1
View File
@@ -39,5 +39,4 @@ if sys.platform == 'linux2':
'ControllerInterface/Xlib/Xlib.cpp'
]
icenv.Append(CXXFLAGS = [ '-fPIC' ])
icenv.StaticLibrary(env['local_libs'] + "inputcommon", files)
+1 -1
View File
@@ -121,4 +121,4 @@ bool IsConnected(int Controller)
} // XInput
#endif
#endif
-1
View File
@@ -45,5 +45,4 @@ if env_vcommon['HAVE_OPENCL']:
'OpenCL/OCLTextureDecoder.cpp',
]
env_vcommon.Append(CXXFLAGS = [ '-fPIC' ])
env_vcommon.StaticLibrary(env['local_libs'] + "videocommon", files)
+1 -2
View File
@@ -15,8 +15,7 @@ libs = [
]
dtenv.Append(CXXFLAGS = [ '-fPIC' ],
LIBS = libs)
dtenv.Append(LIBS = libs)
if sys.platform == 'darwin':
dtenv['FRAMEWORKS'] = ['CoreFoundation', 'Cocoa', 'System']
@@ -17,5 +17,4 @@ if env['HAVE_WX']:
env_inputpc = env.Clone()
env_inputpc.Append(CXXFLAGS = [ '-fPIC' ])
env_inputpc.StaticLibrary(env['local_libs'] + "inputplugincommon", files)
+1 -1
View File
@@ -46,4 +46,4 @@ void CConfig::Save()
ac_Config.Set(file);
file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
}
}
@@ -79,11 +79,11 @@ void CMailHandler::DoState(PointerWrap &p)
if (p.GetMode() == PointerWrap::MODE_READ)
{
Clear();
int sz;
int sz = 0;
p.Do(sz);
for (int i = 0; i < sz; i++)
{
u32 mail;
u32 mail = 0;
p.Do(mail);
m_Mails.push(mail);
}
@@ -31,7 +31,6 @@ if dspenv['HAVE_WX']:
]
dspenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common', 'audiocommon' ],
)
if sys.platform == 'darwin':
@@ -26,12 +26,10 @@ if env['HAVE_WX']:
lleenv = env.Clone()
if env['HAVE_WX']:
lleenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'dspcore', 'audiocommon', 'common', 'debugger_ui_util' ],
)
else:
lleenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'dspcore', 'audiocommon', 'common' ],
)
if sys.platform == 'darwin':
@@ -178,4 +178,4 @@ void DoState(unsigned char **ptr, int mode)
} // Recording
#endif // RERECORDING
#endif // RERECORDING
@@ -151,4 +151,4 @@ void SetInterlacingMode(const BPCmd &bp)
// TODO
}
};
};
+1 -1
View File
@@ -140,4 +140,4 @@ int GetNumAdapters();
} // namespace
#endif
#endif
@@ -31,4 +31,4 @@ namespace D3D
// Utility functions
LPDIRECT3DVERTEXSHADER9 CompileAndCreateVertexShader(const char *code, int len);
LPDIRECT3DPIXELSHADER9 CompileAndCreatePixelShader(const char *code, int len);
}
}
@@ -465,4 +465,4 @@ void DListCache::Cleanup()
SETSTAT(stats.numDListsAlive,(int)dlists.size());
}
#endif
#endif
@@ -69,4 +69,4 @@ public:
static void Call(u32 _addr, u32 _size);
};
#endif
#endif
@@ -17,4 +17,4 @@
#pragma once
void DlgSettings_Show(HINSTANCE hInstance, HWND parent);
void DlgSettings_Show(HINSTANCE hInstance, HWND parent);
@@ -519,4 +519,4 @@ const XFBSource** FramebufferManager::getVirtualXFBSource(u32 xfbAddr, u32 fbWid
}
return &m_overlappingXFBArray[0];
}
}
+1 -1
View File
@@ -28,4 +28,4 @@
// A global plugin specification
extern PLUGIN_GLOBALS* globals;
#endif // _GLOBALS_H_
#endif // _GLOBALS_H_
@@ -170,4 +170,4 @@ void D3DVertexFormat::SetupVertexPointers() const
D3D::SetVertexDeclaration(d3d_decl);
else
ERROR_LOG(VIDEO, "invalid d3d decl");
}
}
@@ -81,4 +81,4 @@ struct RGBAFloat
}
};
#endif
#endif
@@ -86,4 +86,4 @@ public:
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect);
};
#endif
#endif
@@ -145,4 +145,4 @@ namespace W32Util
{
Write(&i,sizeof(char));
}
}
}
@@ -58,4 +58,4 @@ namespace W32Util
}
#endif //__LAMEFILE_H__
#endif //__LAMEFILE_H__
@@ -99,4 +99,4 @@ namespace W32Util
CloseClipboard();
return TRUE;
}
}
}
@@ -6,4 +6,4 @@ namespace W32Util
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h);
void NiceSizeFormat(size_t size, char * out);
BOOL CopyTextToClipboard(HWND hwnd, char * text);
}
}
@@ -224,4 +224,4 @@ namespace W32Util
}
return 0;
}
}
}
@@ -84,4 +84,4 @@ namespace W32Util
}
}
@@ -12,4 +12,4 @@ namespace W32Util
std::string& _strFileName);
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
}
}
@@ -79,4 +79,4 @@ namespace W32Util
if (_handle != NULL)
SuspendThread(_handle);
}
}
}
@@ -27,4 +27,4 @@ void XFUpdatePJ();
void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
void LoadIndexedXF(u32 val, int array);
#endif
#endif
+1 -1
View File
@@ -24,4 +24,4 @@ int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout );
int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout );
#endif
#endif
@@ -15,4 +15,4 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "stdafx.h"
#include "stdafx.h"
@@ -25,8 +25,7 @@ files = [
'PostProcessing.cpp',
'FramebufferManager.cpp',
]
compileFlags = [
'-fPIC',
compileFlags = [
]
linkFlags = [
]
@@ -15,4 +15,4 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "stdafx.h"
#include "stdafx.h"
@@ -226,7 +226,7 @@ inline void CalculateLOD(s32 &lod, bool &linear, u32 texmap, u32 texcoord)
bias >>= 1;
lod += bias;
linear = (lod > 0 && (tm0.min_filter & 4) || lod <= 0 && tm0.mag_filter);
linear = ((lod > 0 && (tm0.min_filter & 4)) || (lod <= 0 && tm0.mag_filter));
// order of checks matters
// should be:
@@ -36,9 +36,6 @@ files = [
'VideoConfig.cpp',
'XFMemLoader.cpp',
]
compileFlags = [
'-fPIC',
]
linkFlags = [
]
libs = [
@@ -56,7 +53,7 @@ conf = gfxenv.Configure(custom_tests = tests,
if sys.platform == 'darwin':
gfxenv['FRAMEWORKS'] = ['CoreFoundation', 'System', 'OpenGL', 'Cocoa', 'Cg']
compileFlags += ['-x','objective-c++',]
compileFlags = ['-x','objective-c++',]
files += [ 'cocoaGL.m', ]
conf.CheckPKG('OpenGL')
@@ -94,7 +91,6 @@ if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']:
print "Must have wx to use wxgl"
Return()
gfxenv.Append(
CXXFLAGS = compileFlags,
LINKFLAGS = linkFlags,
)
@@ -15,4 +15,4 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "stdafx.h"
#include "stdafx.h"
+1 -2
View File
@@ -30,8 +30,7 @@ if wmenv['HAVE_WX']:
]
libs = [ 'common', 'inputcommon' ]
cxxflags = [ '-fPIC' ]
cxxflags = [ ]
if wmenv['HAVE_WIIUSE']:
libs += [ 'wiiuse' ]
@@ -41,4 +41,4 @@ private:
int err;
static int noinst;
};
#endif
#endif
@@ -63,7 +63,7 @@ wiimote_t** g_WiiMotesFromWiiUse = NULL;
Common::Thread* g_pReadThread = NULL;
int g_NumberOfWiiMotes;
CWiiMote* g_WiiMotes[MAX_WIIMOTES];
bool g_Shutdown = false;
volatile bool g_Shutdown = false;
Common::Event g_StartThread;
Common::Event g_StopThreadTemporary;
bool g_LocalThread = true;
@@ -193,4 +193,4 @@ void DoState(unsigned char **ptr, int mode)
} // Recording
#endif // RERECORDING
#endif // RERECORDING
+30 -31
View File
@@ -1,31 +1,30 @@
# -*- python -*-
Import('env')
import sys
name = "Plugin_nJoy_SDL"
padenv = env.Clone()
if not env['HAVE_SDL']:
print name + " must have SDL to be build"
Return()
files = [
'Config.cpp',
'nJoy.cpp',
'Rumble.cpp',
]
if padenv['HAVE_WX']:
files += [
'GUI/AboutBox.cpp',
'GUI/ConfigAdvanced.cpp',
'GUI/ConfigJoypad.cpp',
'GUI/ConfigBox.cpp',
]
padenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common', 'inputcommon' ],
)
padenv.SharedLibrary(env['plugin_dir']+name, files)
# -*- python -*-
Import('env')
import sys
name = "Plugin_nJoy_SDL"
padenv = env.Clone()
if not env['HAVE_SDL']:
print name + " must have SDL to be build"
Return()
files = [
'Config.cpp',
'nJoy.cpp',
'Rumble.cpp',
]
if padenv['HAVE_WX']:
files += [
'GUI/AboutBox.cpp',
'GUI/ConfigAdvanced.cpp',
'GUI/ConfigJoypad.cpp',
'GUI/ConfigBox.cpp',
]
padenv.Append(
LIBS = [ 'common', 'inputcommon' ],
)
padenv.SharedLibrary(env['plugin_dir']+name, files)
+1 -1
View File
@@ -5,4 +5,4 @@
#define u8 unsigned char
#define s8 signed char
#define s16 signed short
#define s32 signed int
#define s32 signed int
+1 -1
View File
@@ -56,4 +56,4 @@ u32 GetXER()
: "=&r"(var)
);
return var;
}
}
+1 -1
View File
@@ -2,4 +2,4 @@
u32 GetCR0();
u32 GetCR(u32 num);
u32 GetXER();
u32 GetXER();
+1 -1
View File
@@ -17,4 +17,4 @@ void divwoRC(u32 *a, u32 *b, u32 *c, u32 *d);
void fsqrt(float *a, float *b, float *c, float *d);
void fsqrtRC(float *a, float *b, float *c, float *d);
void fsqrtRC(float *a, float *b, float *c, float *d);
+1 -1
View File
@@ -13,4 +13,4 @@ void fsqrtRC(float *a, float *b, float *c, float *d)
"fsqrt. fr0,%0"
: "=&r"(*a)
);*/
}
}
+1 -1
View File
@@ -71,4 +71,4 @@ void divwoRC(u32 *a, u32 *b, u32 *c, u32 *d)
: "r"(*b), "r"(*c)
: "cc"
);
}
}
+1 -1
View File
@@ -185,4 +185,4 @@ void RunInstruction(u32 inst)
}
if(f)
fclose(f);
}
}
+1 -1
View File
@@ -49,4 +49,4 @@ static inst instructions[] = {
};
void RunInstruction(u32 inst);
void RunInstruction(u32 inst);
@@ -25,17 +25,6 @@
#include "asm_tables.h"
#include "Helpers.h"
#ifdef __APPLE__
void die(char *msg){}
void initialise_fat(){}
void init_crap(){}
void end(){}
#endif
FILE *f = NULL;
int main(int argc, char **argv) {
init_crap();
+1 -1
View File
@@ -1,2 +1,2 @@
all:
g++ -g -arch ppc dolphintest_asm.cpp asm_tables.cpp Helpers.cpp asm_integer.cpp asm_float.cpp -o Test
g++ -g -arch ppc dolphintest_asm.cpp asm_tables.cpp Helpers.cpp asm_integer.cpp asm_float.cpp -o Test
+1 -1
View File
@@ -112,4 +112,4 @@ public:
static void Initialize();
};
#endif
#endif