Linux: Tons of warning cleanup plus workaround a nasty crash problem in StatusBarMessage.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4234 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-09-08 21:16:05 +00:00
parent e3d505c631
commit 0a576c7508
29 changed files with 107 additions and 110 deletions

View File

@ -25,6 +25,7 @@ warnings = [
'pointer-arith',
'packed',
'no-conversion',
# 'no-unused-result', (need a newer gcc for this?)
]
compileFlags = [
'-fno-exceptions',
@ -175,7 +176,7 @@ if not env['verbose']:
env['SHLINKCOMSTR'] = "Linking shared $TARGET"
env['RANLIBCOMSTR'] = "Indexing $TARGET"
# build falvuor
# build flavor
flavour = ARGUMENTS.get('flavor')
if (flavour == 'debug'):
compileFlags.append('-g')
@ -200,7 +201,7 @@ if env['lint']:
warnings.append('float-equal')
# add the warnings to the compile flags
compileFlags += [ '-W' + warning for warning in warnings ]
compileFlags += [ ('-W' + warning) for warning in warnings ]
env['CCFLAGS'] = compileFlags
if sys.platform == 'win32':

View File

@ -91,20 +91,18 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
u8 Modifiers = 0x00;
u8 PressedKeys[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
bool GotEvent = false;
int i, j;
j = 0;
for (i = 0; i < 256; i++)
int num_pressed_keys = 0;
for (int i = 0; i < 256; i++)
{
bool KeyPressedNow = IsKeyPressed(i);
bool KeyPressedBefore = m_OldKeyBuffer[i];
u8 KeyCode;
u8 KeyCode = 0;
if (KeyPressedNow ^ KeyPressedBefore)
{
if (KeyPressedNow)
{
switch(m_KeyboardLayout)
switch (m_KeyboardLayout)
{
case KBD_LAYOUT_QWERTY:
KeyCode = m_KeyCodesQWERTY[i];
@ -115,13 +113,14 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
break;
}
if(KeyCode == 0x00)
if (KeyCode == 0x00)
continue;
PressedKeys[j] = KeyCode;
PressedKeys[num_pressed_keys] = KeyCode;
j++;
if(j == 6) break;
num_pressed_keys++;
if (num_pressed_keys == 6)
break;
}
GotEvent = true;
@ -151,7 +150,7 @@ u32 CWII_IPC_HLE_Device_usb_kbd::Update()
// TODO: modifiers for non-Windows platforms
#endif
if(Modifiers ^ m_OldModifiers)
if (Modifiers ^ m_OldModifiers)
{
GotEvent = true;
m_OldModifiers = Modifiers;

View File

@ -228,11 +228,10 @@ void EndRecordingInput()
// TODO
header.uniqueID = 0;
header.numRerecords = 0;
header.author;
header.videoPlugin;
header.audioPlugin;
header.padPlugin;
// header.author;
// header.videoPlugin;
// header.audioPlugin;
// header.padPlugin;
fwrite(&header, sizeof(DTMHeader), 1, g_recordfd);

View File

@ -47,9 +47,6 @@
// Create the plugin manager class
CPluginManager CPluginManager::m_Instance;
// The Plugin Manager Class
// ------------

View File

@ -433,7 +433,7 @@ void STACKALIGN Jit64::Jit(u32 em_address)
}
const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitBlock *b)
const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlock *b)
{
if (em_address == 0)
PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR);
@ -449,8 +449,8 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buffer, JitB
//Analyze the block, collect all instructions it is made of (including inlining,
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buffer);
PPCAnalyst::CodeOp *ops = code_buffer->codebuffer;
PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buf);
PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr
b->checkedEntry = start;

View File

@ -136,7 +136,6 @@
int a = inst.RA;
int b = inst.RB;
int crf = inst.CRFD;
int shift = crf * 4;
bool merge_branch = false;
int test_crf = js.next_inst.BI >> 2;

View File

@ -315,7 +315,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
buffer = new u8[sz];
int x;
if ((x = (int)fread(buffer, 1, sz, f)) != sz)
if ((x = (int)fread(buffer, 1, sz, f)) != (int)sz)
PanicAlert("wtf? %d %d", x, sz);
}

View File

@ -58,7 +58,6 @@ void StopTrace()
}
static int stateSize = 32*4;// + 32*16 + 6*4;
static u64 tb;
int SyncTrace()
{

View File

@ -73,8 +73,7 @@ void AnalyzeRange(int start_addr, int end_addr)
// This may not be 100% accurate in case of jump tables!
// It could get desynced, which would be bad. We'll see if that's an issue.
int addr = start_addr;
while (addr < end_addr)
for (int addr = start_addr; addr < end_addr;)
{
UDSPInstruction inst = dsp_imem_read(addr);
const DSPOPCTemplate *opcode = GetOpTemplate(inst);

View File

@ -79,7 +79,6 @@ DSPDisassembler::~DSPDisassembler()
bool DSPDisassembler::Disassemble(int start_pc, const std::vector<u16> &code, int base_addr, std::string &text)
{
const char *tmp1 = "tmp1.bin";
const char *tmp2 = "tmp.txt";
// First we have to dump the code to a bin file.
FILE *f = fopen(tmp1, "wb");

View File

@ -220,8 +220,6 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
int src, dst, srcAddr;
};
// branch branches[256]; // TODO: This is not being used
int numBranches = 0;
// TODO: Add any drawing code here...
int width = rc.width;
int numRows = (rc.height / rowHeight) / 2 + 2;
@ -292,8 +290,8 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
if (debugger->isAlive())
{
char dis[256] = {0};
u32 mem = debugger->readExtraMemory(memory, address);
float flt = *(float *)(&mem);
u32 mem_data = debugger->readExtraMemory(memory, address);
float flt = *(float *)(&mem_data);
sprintf(dis, "f: %f", flt);
char desc[256] = "";

View File

@ -154,11 +154,11 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
: wxPanel((wxWindow*)parent, id, position, size, style, name)
, Parent(parent)
, codeview(NULL)
, m_RegisterWindow(NULL)
, m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL)
, m_JitWindow(NULL)
, codeview(NULL)
{
InitBitmaps();
@ -536,7 +536,7 @@ void CCodeWindow::CreateMenuOptions(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
, wxITEM_CHECK);
automaticstart->Check(bAutomaticStart);
wxMenuItem* pFontPicker = _pMenu->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
_pMenu->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL);
}
// CPU Mode and JIT Menu

View File

@ -60,10 +60,10 @@ public:
private:
u32 m_CachedRegs[32];
u32 m_CachedSpecialRegs[6];
u32 m_CachedSpecialRegs[NUM_SPECIALS];
double m_CachedFRegs[32][2];
bool m_CachedRegHasChanged[32];
bool m_CachedSpecialRegHasChanged[6];
bool m_CachedSpecialRegHasChanged[NUM_SPECIALS];
bool m_CachedFRegHasChanged[32][2];
DECLARE_NO_COPY_CLASS(CRegTable);

View File

@ -112,7 +112,7 @@ CBannerLoaderGC::GetName(std::string _rName[])
{
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
u32 languageID = SConfig::GetInstance().m_InterfaceLanguage;
// u32 languageID = SConfig::GetInstance().m_InterfaceLanguage;
for (int i = 0; i < 6; i++)
{
char tempBuffer[65] = {0};

View File

@ -184,7 +184,7 @@ bool Scrub(const char* filename, CompressCB callback, void* arg)
if (i % (numClusters / 1000) == 0)
{
char temp[512];
sprintf(temp, "DiscScrubber: %lu/%lu (%s)", i, numClusters, m_FreeTable[i] ? "Free" : "Used");
sprintf(temp, "DiscScrubber: %u/%u (%s)", i, numClusters, m_FreeTable[i] ? "Free" : "Used");
callback(temp, (float)i / (float)numClusters, arg);
}
}

View File

@ -119,8 +119,8 @@ namespace DiscIO
bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *out_ptr)
{
u32 NotUsed;
#ifdef _WIN32
u32 NotUsed;
u64 offset = m_blocksize * block_num;
LONG off_low = (LONG)offset & 0xFFFFFFFF;
LONG off_high = (LONG)(offset >> 32);

View File

@ -630,7 +630,10 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
case IDM_UPDATESTATUSBAR:
if (m_pStatusBar != NULL)
{
// Linux doesn't like it since the message isn't coming from the GUI thread. We need to change this to post a message to the Frame.
#ifdef _WIN32
m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
#endif
}
break;
}

View File

@ -78,7 +78,7 @@ class CFrame : public wxFrame
void PostEvent(wxCommandEvent& event);
void PostMenuEvent(wxMenuEvent& event);
void PostUpdateUIEvent(wxUpdateUIEvent& event);
void StatusBarMessage(char * Text, ...);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
void OnCustomHostMessage(int Id);

View File

@ -707,7 +707,8 @@ void CFrame::ClearStatusBar()
{
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxT(""),0);
}
void CFrame::StatusBarMessage(char * Text, ...)
void CFrame::StatusBarMessage(const char * Text, ...)
{
const int MAX_BYTES = 1024*10;
char Str[MAX_BYTES];

View File

@ -30,10 +30,10 @@ struct ProjectionHack
{
}
ProjectionHack(bool enabled, float value)
ProjectionHack(bool new_enabled, float new_value)
{
ProjectionHack::enabled = enabled;
ProjectionHack::value = value;
enabled = new_enabled;
value = new_value;
}
};
@ -50,4 +50,4 @@ bool Projection_GetHack0();
ProjectionHack Projection_GetHack1();
ProjectionHack Projection_GetHack2();
bool Projection_GetFreeLook();
bool Projection_GetWidescreen();
bool Projection_GetWidescreen();

View File

@ -21,9 +21,9 @@
#include "VertexLoader_Normal.h"
#include "NativeVertexWriter.h"
#define LOG_NORM8() PRIM_LOG("norm: %f %f %f, ", ((s8*)VertexManager::s_pCurBufferPointer)[-3]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-2]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-1]/127.0f);
#define LOG_NORM16() PRIM_LOG("norm: %f %f %f, ", ((s16*)VertexManager::s_pCurBufferPointer)[-3]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-2]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-1]/32767.0f);
#define LOG_NORMF() PRIM_LOG("norm: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-3], ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
#define LOG_NORM8() // PRIM_LOG("norm: %f %f %f, ", ((s8*)VertexManager::s_pCurBufferPointer)[-3]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-2]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-1]/127.0f);
#define LOG_NORM16() // PRIM_LOG("norm: %f %f %f, ", ((s16*)VertexManager::s_pCurBufferPointer)[-3]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-2]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-1]/32767.0f);
#define LOG_NORMF() // PRIM_LOG("norm: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-3], ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
VertexLoader_Normal::Set VertexLoader_Normal::m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT];

View File

@ -24,8 +24,8 @@
#include "VertexLoader_Position.h"
#include "NativeVertexWriter.h"
#define LOG_TEX1() PRIM_LOG("tex: %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0]);
#define LOG_TEX2() PRIM_LOG("tex: %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1]);
#define LOG_TEX1() // PRIM_LOG("tex: %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0]);
#define LOG_TEX2() // PRIM_LOG("tex: %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1]);
extern int tcIndex;
extern float tcScale[8];

View File

@ -129,7 +129,9 @@ struct TargetRectangle : public MathUtil::Rectangle<int>
#define PRIM_LOG(...) {DEBUG_LOG(VIDEO, ##__VA_ARGS__)}
#endif
#define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1], ((float*)VertexManager::s_pCurBufferPointer)[2]);
// #define LOG_VTX() DEBUG_LOG(VIDEO, "vtx: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1], ((float*)VertexManager::s_pCurBufferPointer)[2]);
#define LOG_VTX()
#endif // _VIDEOCOMMON_H

View File

@ -395,7 +395,7 @@ int main(int argc, const char *argv[])
codes = new std::vector<u16>[lines];
for(int i = 0; i < lines; i++)
for (int i = 0; i < lines; i++)
{
if (!File::ReadFileToString(true, files[i].c_str(), currentSource))
{
@ -404,14 +404,15 @@ int main(int argc, const char *argv[])
}
else
{
if(!Assemble(currentSource.c_str(), codes[i], force))
if (!Assemble(currentSource.c_str(), codes[i], force))
{
printf("Assemble: Assembly of %s failed due to errors\n",
files[i].c_str());
lines--;
}
if(outputSize)
printf("%s: %d\n", files[i].c_str(), codes[i].size());
if (outputSize) {
printf("%s: %d\n", files[i].c_str(), (int)codes[i].size());
}
}
}
@ -425,13 +426,14 @@ int main(int argc, const char *argv[])
{
std::vector<u16> code;
if(!Assemble(source.c_str(), code, force)) {
if (!Assemble(source.c_str(), code, force)) {
printf("Assemble: Assembly failed due to errors\n");
return 1;
}
if(outputSize)
printf("%s: %d\n", input_name.c_str(), code.size());
if (outputSize) {
printf("%s: %d\n", input_name.c_str(), (int)code.size());
}
if (!output_name.empty())
{

View File

@ -31,68 +31,65 @@
// Externals
extern u32 m_addressPBs;
float ratioFactor;
int globaliSize;
short globalpBuffer;
u32 gLastBlock;
static float ratioFactor;
static u32 gLastBlock;
// Vectors and other things
std::vector<u32> gloopPos(64);
std::vector<u32> gsampleEnd(64);
std::vector<u32> gsamplePos(64);
std::vector<u32> gratio(64);
std::vector<u32> gratiohi(64);
std::vector<u32> gratiolo(64);
std::vector<u32> gfrac(64);
std::vector<u32> gcoef(64);
static std::vector<u32> gloopPos(64);
static std::vector<u32> gsampleEnd(64);
static std::vector<u32> gsamplePos(64);
static std::vector<u32> gratio(64);
static std::vector<u32> gratiohi(64);
static std::vector<u32> gratiolo(64);
static std::vector<u32> gfrac(64);
static std::vector<u32> gcoef(64);
// PBSampleRateConverter mixer
std::vector<u16> gvolume_left(64);
std::vector<u16> gvolume_right(64);
std::vector<u16> gmixer_control(64);
std::vector<u16> gcur_volume(64);
std::vector<u16> gcur_volume_delta(64);
static std::vector<u16> gvolume_left(64);
static std::vector<u16> gvolume_right(64);
static std::vector<u16> gmixer_control(64);
static std::vector<u16> gcur_volume(64);
static std::vector<u16> gcur_volume_delta(64);
std::vector<u16> gaudioFormat(64);
std::vector<u16> glooping(64);
std::vector<u16> gsrc_type(64);
std::vector<u16> gis_stream(64);
static std::vector<u16> gaudioFormat(64);
static std::vector<u16> glooping(64);
static std::vector<u16> gsrc_type(64);
static std::vector<u16> gis_stream(64);
// loop
std::vector<u16> gloop1(64);
std::vector<u16> gloop2(64);
std::vector<u16> gloop3(64);
std::vector<u16> gadloop1(64);
std::vector<u16> gadloop2(64);
std::vector<u16> gadloop3(64);
static std::vector<u16> gloop1(64);
static std::vector<u16> gloop2(64);
static std::vector<u16> gloop3(64);
static std::vector<u16> gadloop1(64);
static std::vector<u16> gadloop2(64);
static std::vector<u16> gadloop3(64);
// updates
std::vector<u16> gupdates1(64);
std::vector<u16> gupdates2(64);
std::vector<u16> gupdates3(64);
std::vector<u16> gupdates4(64);
std::vector<u16> gupdates5(64);
std::vector<u32> gupdates_addr(64);
static std::vector<u16> gupdates1(64);
static std::vector<u16> gupdates2(64);
static std::vector<u16> gupdates3(64);
static std::vector<u16> gupdates4(64);
static std::vector<u16> gupdates5(64);
static std::vector<u32> gupdates_addr(64);
// Other things
std::vector<u16> Jump(64); // this is 1 or 0
std::vector<int> musicLength(64);
std::vector< std::vector<int> > vector1(64, std::vector<int>(100,0));
std::vector<int> numberRunning(64);
static std::vector<u16> Jump(64); // this is 1 or 0
static std::vector<int> musicLength(64);
static std::vector< std::vector<int> > vector1(64, std::vector<int>(100,0));
static std::vector<int> numberRunning(64);
int j = 0;
int k = 0;
s64 l = 0;
int iupd = 0;
bool iupdonce = false;
std::vector<u16> viupd(15); // the length of the update frequency bar
int vectorLength = 15; // the length of the playback history bar and how long
static int j = 0;
static int k = 0;
static s64 l = 0;
static bool iupdonce = false;
static std::vector<u16> viupd(15); // the length of the update frequency bar
static int vectorLength = 15; // the length of the playback history bar and how long
// old blocks are shown
std::vector<u16> vector62(vectorLength);
std::vector<u16> vector63(vectorLength);
static std::vector<u16> vector62(vectorLength);
static std::vector<u16> vector63(vectorLength);
int ReadOutPBs(AXParamBlock * _pPBs, int _num);

View File

@ -127,7 +127,7 @@ FRAGMENTSHADER &GetOrCreateEncodingShader(u32 format)
if (!PixelShaderCache::CompilePixelShader(s_encodingPrograms[format], shader)) {
const char* error = cgGetLastListing(g_cgcontext);
ERROR_LOG(VIDEO, "Failed to create encoding fragment program");
ERROR_LOG(VIDEO, "Failed to create encoding fragment program:\n%s", error);
}
}

View File

@ -194,6 +194,7 @@ struct SDot
int Size; // Size of the IR dot (0-15)
int Order; // Increasing order from low to higher x-axis values
};
struct SIR
{
SDot Dot[4];

View File

@ -276,7 +276,7 @@ void IRData2Dots(u8 *Data)
void ReorderIRDots()
{
// Create a shortcut
struct SDot* Dot = g_Wiimote_kbd.IR.Dot;
SDot* Dot = g_Wiimote_kbd.IR.Dot;
// Variables
int i, j, order;
@ -285,6 +285,7 @@ void ReorderIRDots()
for (i = 0; i < 4; ++i)
Dot[i].Order = 0;
// is this just a weird filter+sort?
for (order = 1; order < 5; ++order)
{
i = 0;
@ -353,4 +354,4 @@ std::string CCData2Values(u8 *Data)
(Data[2] & 0x1f));
}
} // WiiMoteEmu
} // WiiMoteEmu

View File

@ -212,10 +212,10 @@ private:
u16 m_channelID;
CEventQueue m_EventReadQueue; // Read from Wiimote
CEventQueue m_EventWriteQueue; // Write to Wiimote
Common::CriticalSection* m_pCriticalSection;
bool m_LastReportValid;
SEvent m_LastReport;
wiimote_t* m_pWiiMote; // This is g_WiiMotesFromWiiUse[]
Common::CriticalSection* m_pCriticalSection;
// Send queued data to the core
void SendEvent(SEvent& _rEvent)