Merge pull request #209 from unknownbrackets/warnings

Fix a bunch of warnings
This commit is contained in:
Hykem 2014-04-28 17:15:12 +01:00
commit 90896560bb
30 changed files with 72 additions and 81 deletions

View File

@ -421,7 +421,7 @@ bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
}
// Write section headers.
if(self_hdr.se_shdroff != NULL)
if(self_hdr.se_shdroff != 0)
{
e.Seek(elf32_hdr.e_shoff);
@ -482,7 +482,7 @@ bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
}
// Write section headers.
if(self_hdr.se_shdroff != NULL)
if(self_hdr.se_shdroff != 0)
{
e.Seek(elf64_hdr.e_shoff);

View File

@ -12,7 +12,7 @@ private:
ALuint m_buffers[g_al_buffers_count];
ALCdevice* m_device;
ALCcontext* m_context;
u32 m_buffer_size;
ALsizei m_buffer_size;
public:
~OpenALThread();

View File

@ -10,7 +10,7 @@
#include <intrin.h>
#else
#include <x86intrin.h>
#define _rotl64(x,r) (((u64)x << r) | ((u64)x >> (64 - r)))
#define _rotl64(x,r) (((u64)(x) << (r)) | ((u64)(x) >> (64 - (r))))
#endif
#define UNIMPLEMENTED() UNK(__FUNCTION__)

View File

@ -44,7 +44,7 @@ s64 FindOp(const std::string& text, const std::string& op, s64 from)
{
if (text.length() < op.length()) return -1;
for (s64 i = from; i<text.length(); ++i)
for (s64 i = from; i < (s64)text.length(); ++i)
{
if(i - 1 < 0 || text[(size_t)i - 1] == '\n' || CompilePPUProgram::IsSkip(text[(size_t)i - 1]))
{
@ -156,11 +156,11 @@ void CompilePPUProgram::WriteError(const std::string& error)
bool CompilePPUProgram::IsSkip(const char c) { return c == ' ' || c == '\t'; }
bool CompilePPUProgram::IsCommit(const char c) { return c == '#'; }
bool CompilePPUProgram::IsEnd() const { return p >= m_asm.length(); }
bool CompilePPUProgram::IsEndLn(const char c) const { return c == '\n' || p - 1 >= m_asm.length(); }
bool CompilePPUProgram::IsEnd() const { return p >= (s64)m_asm.length(); }
bool CompilePPUProgram::IsEndLn(const char c) const { return c == '\n' || p - 1 >= (s64)m_asm.length(); }
char CompilePPUProgram::NextChar() { return *m_asm.substr(p++, 1).c_str(); }
void CompilePPUProgram::NextLn() { while( !IsEndLn(NextChar()) ); if(!IsEnd()) m_line++; }
void CompilePPUProgram::NextLn() { while( !IsEndLn(NextChar()) ) continue; if(!IsEnd()) m_line++; }
void CompilePPUProgram::EndLn()
{
NextLn();

View File

@ -827,7 +827,7 @@ public:
return true;
}
}
catch (std::invalid_argument& e)//if any of the stoull conversion fail
catch (std::invalid_argument&)//if any of the stoull conversion fail
{
return false;
}

View File

@ -178,6 +178,10 @@ public:
case 1:
return this->low >> 22 & 0x3;
default:
ConLog.Error("Unexpected slice value in FPSCR::checkSliceRounding(): %d", slice);
return 0;
}
}

View File

@ -521,7 +521,7 @@ MemoryBlock* VirtualMemoryBlock::SetRange(const u64 start, const u32 size)
bool VirtualMemoryBlock::IsInMyRange(const u64 addr)
{
return addr >= GetStartAddr() && addr < GetStartAddr() + GetSize() - GetResevedAmount();
return addr >= GetStartAddr() && addr < GetStartAddr() + GetSize() - GetReservedAmount();
}
bool VirtualMemoryBlock::IsInMyRange(const u64 addr, const u32 size)
@ -554,7 +554,7 @@ u64 VirtualMemoryBlock::Map(u64 realaddr, u32 size, u64 addr)
}
else
{
for(u64 addr = GetStartAddr(); addr <= GetEndAddr() - GetResevedAmount() - size;)
for(u64 addr = GetStartAddr(); addr <= GetEndAddr() - GetReservedAmount() - size;)
{
bool is_good_addr = true;
@ -718,7 +718,7 @@ void VirtualMemoryBlock::Delete()
bool VirtualMemoryBlock::Reserve(u32 size)
{
if(size + GetResevedAmount() > GetEndAddr() - GetStartAddr())
if(size + GetReservedAmount() > GetEndAddr() - GetStartAddr())
return false;
m_reserve_size += size;
@ -727,14 +727,14 @@ bool VirtualMemoryBlock::Reserve(u32 size)
bool VirtualMemoryBlock::Unreserve(u32 size)
{
if(size > GetResevedAmount())
if(size > GetReservedAmount())
return false;
m_reserve_size -= size;
return true;
}
u32 VirtualMemoryBlock::GetResevedAmount()
u32 VirtualMemoryBlock::GetReservedAmount()
{
return m_reserve_size;
}

View File

@ -532,6 +532,7 @@ public:
bool Unmap(const u64 addr)
{
bool result = false;
for(uint i=0; i<MemoryBlocks.size(); ++i)
{
if(MemoryBlocks[i]->IsMirror())
@ -540,9 +541,11 @@ public:
{
delete MemoryBlocks[i];
MemoryBlocks.erase(MemoryBlocks.begin() + i);
return true;
}
}
}
return false;
}
u8* operator + (const u64 vaddr)

View File

@ -28,7 +28,7 @@ struct MemBlockInfo : public MemInfo
{
if(!mem)
{
ConLog.Error("Not enought free memory.");
ConLog.Error("Not enough free memory.");
assert(0);
}
memset(mem, 0, size);
@ -267,7 +267,7 @@ public:
virtual bool Unreserve(u32 size);
// Return the total amount of reserved memory
virtual u32 GetResevedAmount();
virtual u32 GetReservedAmount();
virtual bool Read8(const u64 addr, u8* value);
virtual bool Read16(const u64 addr, u16* value);

View File

@ -14,7 +14,7 @@ std::vector<SFunc *> g_static_funcs_list;
struct ModuleInfo
{
u32 id;
char* name;
const char* name;
}
static const g_module_list[] =
{

View File

@ -31,7 +31,7 @@ struct SFunc
{
func_caller* func;
void* ptr;
char* name;
const char* name;
std::vector<SFuncOp> ops;
u64 group;
u32 found;
@ -117,7 +117,7 @@ public:
template<typename T> __forceinline void AddFunc(u32 id, T func);
template<typename T> __forceinline void AddFuncSub(const char group[8], const u64 ops[], char* name, T func);
template<typename T> __forceinline void AddFuncSub(const char group[8], const u64 ops[], const char* name, T func);
};
template<typename T>
@ -127,7 +127,7 @@ __forceinline void Module::AddFunc(u32 id, T func)
}
template<typename T>
__forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], char* name, T func)
__forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], const char* name, T func)
{
if (!ops[0]) return;

View File

@ -512,7 +512,7 @@ bool adecCheckType(AudioCodecType type)
{
switch (type)
{
case CELL_ADEC_TYPE_ATRACX: ConLog.Write("*** (???) type: ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX: ConLog.Write("*** (?) type: ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX_2CH: ConLog.Write("*** type: ATRAC3plus 2ch"); break;
case CELL_ADEC_TYPE_ATRACX_6CH:

View File

@ -219,7 +219,7 @@ struct CCellFontInternal //Module cellFont
bool m_bFontGcmInitialized;
CCellFontInternal()
: m_buffer_addr(NULL)
: m_buffer_addr(0)
, m_buffer_size(0)
, m_bInitialized(false)
, m_bFontGcmInitialized(false)
@ -301,7 +301,7 @@ int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32
if (!stbtt_InitFont(&(font->stbfont), (unsigned char*)Memory.VirtualToRealAddr(fontAddr), 0))
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
font->renderer_addr = NULL;
font->renderer_addr = 0;
font->fontdata_addr = fontAddr;
font->origin = CELL_FONT_OPEN_MEMORY;
return CELL_FONT_OK;
@ -531,7 +531,7 @@ int cellFontUnbindRenderer(mem_ptr_t<CellFont> font)
if (!font->renderer_addr)
return CELL_FONT_ERROR_RENDERER_UNBIND;
font->renderer_addr = NULL;
font->renderer_addr = 0;
return CELL_FONT_OK;
}

View File

@ -9,7 +9,7 @@ void cellGcmSys_unload();
Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload);
u32 local_size = 0;
u32 local_addr = NULL;
u32 local_addr = 0;
enum
{
@ -562,7 +562,7 @@ int32_t cellGcmAddressToOffset(u64 address, mem32_t offset)
uint32_t cellGcmGetMaxIoMapSize()
{
return Memory.RSXIOMem.GetEndAddr() - Memory.RSXIOMem.GetStartAddr() - Memory.RSXIOMem.GetResevedAmount();
return Memory.RSXIOMem.GetEndAddr() - Memory.RSXIOMem.GetStartAddr() - Memory.RSXIOMem.GetReservedAmount();
}
void cellGcmGetOffsetTable(mem_ptr_t<gcm_offset> table)
@ -681,8 +681,8 @@ int32_t cellGcmReserveIoMapSize(const u32 size)
int32_t cellGcmUnmapEaIoAddress(u64 ea)
{
u32 size;
if (size = Memory.RSXIOMem.UnmapRealAddress(ea))
u32 size = Memory.RSXIOMem.UnmapRealAddress(ea);
if (size)
{
u64 io;
ea = ea >> 20;
@ -704,8 +704,8 @@ int32_t cellGcmUnmapEaIoAddress(u64 ea)
int32_t cellGcmUnmapIoAddress(u64 io)
{
u32 size;
if (size = Memory.RSXIOMem.UnmapAddress(io))
u32 size = Memory.RSXIOMem.UnmapAddress(io);
if (size)
{
u64 ea;
io = io >> 20;
@ -730,7 +730,7 @@ int32_t cellGcmUnreserveIoMapSize(u32 size)
if (size & 0xFFFFF)
return CELL_GCM_ERROR_INVALID_ALIGNMENT;
if (size > Memory.RSXIOMem.GetResevedAmount())
if (size > Memory.RSXIOMem.GetReservedAmount())
return CELL_GCM_ERROR_INVALID_VALUE;
Memory.RSXIOMem.Unreserve(size);
@ -956,10 +956,10 @@ void cellGcmSys_init()
void cellGcmSys_load()
{
current_config.ioAddress = NULL;
current_config.localAddress = NULL;
current_config.ioAddress = 0;
current_config.localAddress = 0;
local_size = 0;
local_addr = NULL;
local_addr = 0;
}
void cellGcmSys_unload()

View File

@ -57,7 +57,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDec
// Get file descriptor
MemoryAllocator<be_t<u32>> fd;
int ret = cellFsOpen(src->fileName, 0, fd, NULL, 0);
int ret = cellFsOpen(src->fileName, 0, fd, 0, 0);
current_subHandle->fd = fd->ToLE();
if(ret != CELL_OK) return CELL_GIFDEC_ERROR_OPEN_FILE;

View File

@ -37,7 +37,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> s
// Get file descriptor
MemoryAllocator<be_t<u32>> fd;
int ret = cellFsOpen(src->fileName, 0, fd, NULL, 0);
int ret = cellFsOpen(src->fileName, 0, fd, 0, 0);
current_subHandle->fd = fd->ToLE();
if(ret != CELL_OK) return CELL_JPGDEC_ERROR_OPEN_FILE;

View File

@ -29,7 +29,7 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
CellPngDecSubHandle *current_subHandle = new CellPngDecSubHandle;
current_subHandle->fd = NULL;
current_subHandle->fd = 0;
current_subHandle->src = *src;
switch(src->srcSelect.ToBE())
@ -41,7 +41,7 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
case const_se_t<u32, CELL_PNGDEC_FILE>::value:
// Get file descriptor
MemoryAllocator<be_t<u32>> fd;
int ret = cellFsOpen(src->fileName_addr, 0, fd.GetAddr(), NULL, 0);
int ret = cellFsOpen(src->fileName_addr, 0, fd.GetAddr(), 0, 0);
current_subHandle->fd = fd->ToLE();
if(ret != CELL_OK) return CELL_PNGDEC_ERROR_OPEN_FILE;

View File

@ -517,7 +517,7 @@ int cellRescSetDisplayMode(u32 displayMode)
videocfg->aspect = CELL_VIDEO_OUT_ASPECT_AUTO;
videocfg->pitch = s_rescInternalInstance->m_dstPitch;
cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg.GetAddr(), NULL, 0);
cellVideoOutConfigure(CELL_VIDEO_OUT_PRIMARY, videocfg.GetAddr(), 0, 0);
if (IsPalInterpolate())
{
@ -527,7 +527,7 @@ int cellRescSetDisplayMode(u32 displayMode)
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ);
//cellGcmSetVBlankHandler(CCellRescInternal::IntrHandler50);
//cellGcmSetSecondVHandler(CCellRescInternal::IntrHandler60);
cellGcmSetFlipHandler(NULL);
cellGcmSetFlipHandler(0);
}
else if (IsPalDrop())
{
@ -535,7 +535,7 @@ int cellRescSetDisplayMode(u32 displayMode)
cellGcmSetSecondVFrequency(CELL_GCM_DISPLAY_FREQUENCY_59_94HZ);
//cellGcmSetVBlankHandler(NULL);
//cellGcmSetSecondVHandler(CCellRescInternal::IntrHandler60Drop);
cellGcmSetFlipHandler(NULL);
cellGcmSetFlipHandler(0);
}
else if (IsPal60Hsync())
{

View File

@ -366,12 +366,6 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
// TODO: There are other returns in this function that doesn't free the memory. Fix it (without using goto's, please).
for (auto& entry : saveEntries) {
delete[] entry.iconBuf;
entry.iconBuf = nullptr;
}
return ret;
}
@ -457,12 +451,6 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
// TODO: There are other returns in this function that doesn't free the memory. Fix it (without using goto's, please).
for (auto& entry : saveEntries) {
delete[] entry.iconBuf;
entry.iconBuf = nullptr;
}
return ret;
}
@ -535,12 +523,6 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
// TODO: There are other returns in this function that doesn't free the memory. Fix it (without using goto's, please).
for (auto& entry : saveEntries) {
delete[] entry.iconBuf;
entry.iconBuf = nullptr;
}
return ret;
}
@ -613,12 +595,6 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
// Enter the loop where the save files are read/created/deleted.
s32 ret = modifySaveDataFiles(funcFile, result.GetAddr(), saveBaseDir + (char*)statGet->dir.dirName);
// TODO: There are other returns in this function that doesn't free the memory. Fix it (without using goto's, please).
for (auto& entry : saveEntries) {
delete[] entry.iconBuf;
entry.iconBuf = nullptr;
}
return ret;
}

View File

@ -19,7 +19,7 @@ extern "C"
void sys_net_init();
Module sys_net((u16)0x0000, sys_net_init);
mem32_t g_lastError(NULL);
mem32_t g_lastError(0);
// Auxiliary Functions
@ -476,7 +476,7 @@ int sys_net_finalize_network()
{
sys_net.Warning("sys_net_initialize_network_ex()");
Memory.Free(g_lastError.GetAddr());
g_lastError.SetAddr(NULL);
g_lastError.SetAddr(0);
#ifdef _WIN32
WSACleanup();
#endif

View File

@ -230,8 +230,8 @@ int sys_spu_thread_group_start(u32 id)
for (u32 i = 0; i < group_info->list.size(); i++)
{
CPUThread* t;
if (t = Emu.GetCPU().GetThread(group_info->list[i]))
CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]);
if (t)
{
t->Exec();
}

View File

@ -27,6 +27,10 @@ u64 get_time()
struct timespec ts;
if (!clock_gettime(CLOCK_MONOTONIC, &ts))
return ts.tv_sec * (s64)10000000 + (s64)ts.tv_nsec / (s64)100;
// Should never occur.
assert(0);
return 0;
#endif
}

View File

@ -212,7 +212,7 @@ void MemoryViewerPanel::ShowMemory()
t_mem_ascii->SetValue(t_mem_ascii_str);
}
void MemoryViewerPanel::ShowImage(wxWindow* parent, u32 addr, int mode, int width, int height, bool flipv)
void MemoryViewerPanel::ShowImage(wxWindow* parent, u32 addr, int mode, u32 width, u32 height, bool flipv)
{
wxString title = wxString::Format("Raw Image @ 0x%x", addr);

View File

@ -41,5 +41,5 @@ public:
void SetPC(const uint pc) { m_addr = pc; }
//Static methods
static void ShowImage(wxWindow* parent, u32 addr, int mode, int sizex, int sizey, bool flipv);
static void ShowImage(wxWindow* parent, u32 addr, int mode, u32 sizex, u32 sizey, bool flipv);
};

View File

@ -780,7 +780,7 @@ wxString RSXDebugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
{
wxString disasm = wxEmptyString;
#define DISASM(string, ...) if(disasm.IsEmpty()) disasm = wxString::Format((string), ##__VA_ARGS__); else disasm += (wxString(' ') + wxString::Format((string), ##__VA_ARGS__))
#define DISASM(string, ...) { if(disasm.IsEmpty()) disasm = wxString::Format((string), ##__VA_ARGS__); else disasm += (wxString(' ') + wxString::Format((string), ##__VA_ARGS__)); }
if(cmd & CELL_GCM_METHOD_FLAG_JUMP)
{
u32 jumpAddr = cmd & ~(CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT);

View File

@ -96,9 +96,9 @@ void VFSEntrySettingsDialog::OnSelectDevPath(wxCommandEvent& event)
void VFSEntrySettingsDialog::OnOk(wxCommandEvent& event)
{
m_entry.device_path = strdup( m_tctrl_dev_path->GetValue().c_str());
m_entry.path = strdup(m_tctrl_path->GetValue().c_str());
m_entry.mount = strdup(m_tctrl_mount->GetValue().c_str());
m_entry.device_path = m_tctrl_dev_path->GetValue().ToStdString();
m_entry.path = m_tctrl_path->GetValue().ToStdString();
m_entry.mount = m_tctrl_mount->GetValue().ToStdString();
m_entry.device = (vfsDeviceType)m_ch_type->GetSelection();
EndModal(wxID_OK);

View File

@ -64,7 +64,7 @@ bool TRPLoader::LoadHeader(bool show)
return true;
}
bool TRPLoader::ContainsEntry(char *filename)
bool TRPLoader::ContainsEntry(const char *filename)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, filename))
@ -73,7 +73,7 @@ bool TRPLoader::ContainsEntry(char *filename)
return false;
}
void TRPLoader::RemoveEntry(char *filename)
void TRPLoader::RemoveEntry(const char *filename)
{
std::vector<TRPEntry>::iterator i = m_entries.begin();
while (i != m_entries.end()) {
@ -84,7 +84,7 @@ void TRPLoader::RemoveEntry(char *filename)
}
}
void TRPLoader::RenameEntry(char *oldname, char *newname)
void TRPLoader::RenameEntry(const char *oldname, const char *newname)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, oldname))

View File

@ -34,9 +34,9 @@ public:
virtual bool Install(std::string dest, bool show = false);
virtual bool LoadHeader(bool show = false);
virtual bool ContainsEntry(char *filename);
virtual void RemoveEntry(char *filename);
virtual void RenameEntry(char *oldname, char *newname);
virtual bool ContainsEntry(const char *filename);
virtual void RemoveEntry(const char *filename);
virtual void RenameEntry(const char *oldname, const char *newname);
virtual bool Close();
};

View File

@ -584,6 +584,7 @@
<ClInclude Include="Emu\SysCalls\SC_FUNC.h" />
<ClInclude Include="Emu\SysCalls\SysCalls.h" />
<ClInclude Include="Emu\System.h" />
<ClInclude Include="Gui\AboutDialog.h" />
<ClInclude Include="Gui\CompilerELF.h" />
<ClInclude Include="Gui\ConLog.h" />
<ClInclude Include="Gui\Debugger.h" />

View File

@ -987,5 +987,8 @@
<ClInclude Include="Crypto\lz.h">
<Filter>Crypto</Filter>
</ClInclude>
<ClInclude Include="Gui\AboutDialog.h">
<Filter>Gui</Filter>
</ClInclude>
</ItemGroup>
</Project>