Merge pull request #1268 from PCSX2/coverity-uninitialized-members

Coverity uninitialized members
This commit is contained in:
Gregory Hainaut 2016-04-03 11:19:37 +02:00
commit 5bdadbc089
16 changed files with 113 additions and 80 deletions

View File

@ -53,60 +53,62 @@ public:
// x86 CPU Capabilities Section (all boolean flags!)
// ----------------------------------------------------------------------------
u32 hasFloatingPointUnit :1;
u32 hasVirtual8086ModeEnhancements :1;
u32 hasDebuggingExtensions :1;
u32 hasPageSizeExtensions :1;
u32 hasTimeStampCounter :1;
u32 hasModelSpecificRegisters :1;
u32 hasPhysicalAddressExtension :1;
u32 hasCOMPXCHG8BInstruction :1;
u32 hasAdvancedProgrammableInterruptController :1;
u32 hasSEPFastSystemCall :1;
u32 hasMemoryTypeRangeRegisters :1;
u32 hasPTEGlobalFlag :1;
u32 hasMachineCheckArchitecture :1;
u32 hasConditionalMoveAndCompareInstructions :1;
u32 hasFGPageAttributeTable :1;
u32 has36bitPageSizeExtension :1;
u32 hasProcessorSerialNumber :1;
u32 hasCFLUSHInstruction :1;
u32 hasDebugStore :1;
u32 hasACPIThermalMonitorAndClockControl :1;
u32 hasFastStreamingSIMDExtensionsSaveRestore :1;
u32 hasStreamingSIMDExtensions :1;
u32 hasStreamingSIMD2Extensions :1;
u32 hasSelfSnoop :1;
union {
struct {
u32 hasFloatingPointUnit :1;
u32 hasVirtual8086ModeEnhancements :1;
u32 hasDebuggingExtensions :1;
u32 hasPageSizeExtensions :1;
u32 hasTimeStampCounter :1;
u32 hasModelSpecificRegisters :1;
u32 hasPhysicalAddressExtension :1;
u32 hasCOMPXCHG8BInstruction :1;
u32 hasAdvancedProgrammableInterruptController :1;
u32 hasSEPFastSystemCall :1;
u32 hasMemoryTypeRangeRegisters :1;
u32 hasPTEGlobalFlag :1;
u32 hasMachineCheckArchitecture :1;
u32 hasConditionalMoveAndCompareInstructions :1;
u32 hasFGPageAttributeTable :1;
u32 has36bitPageSizeExtension :1;
u32 hasProcessorSerialNumber :1;
u32 hasCFLUSHInstruction :1;
u32 hasDebugStore :1;
u32 hasACPIThermalMonitorAndClockControl :1;
u32 hasFastStreamingSIMDExtensionsSaveRestore :1;
u32 hasStreamingSIMDExtensions :1;
u32 hasStreamingSIMD2Extensions :1;
u32 hasSelfSnoop :1;
// is TRUE for both multi-core and Hyperthreaded CPUs.
u32 hasMultiThreading :1;
// is TRUE for both multi-core and Hyperthreaded CPUs.
u32 hasMultiThreading :1;
u32 hasThermalMonitor :1;
u32 hasIntel64BitArchitecture :1;
u32 hasStreamingSIMD3Extensions :1;
u32 hasSupplementalStreamingSIMD3Extensions :1;
u32 hasStreamingSIMD4Extensions :1;
u32 hasStreamingSIMD4Extensions2 :1;
u32 hasAVX :1;
u32 hasAVX2 :1;
u32 hasBMI1 :1;
u32 hasBMI2 :1;
u32 hasFMA :1;
u32 hasThermalMonitor :1;
u32 hasIntel64BitArchitecture :1;
u32 hasStreamingSIMD3Extensions :1;
u32 hasSupplementalStreamingSIMD3Extensions :1;
u32 hasStreamingSIMD4Extensions :1;
u32 hasStreamingSIMD4Extensions2 :1;
u32 hasAVX :1;
u32 hasAVX2 :1;
u32 hasBMI1 :1;
u32 hasBMI2 :1;
u32 hasFMA :1;
// AMD-specific CPU Features
u32 hasAMD64BitArchitecture :1;
u32 hasStreamingSIMD4ExtensionsA :1;
// AMD-specific CPU Features
u32 hasAMD64BitArchitecture :1;
u32 hasStreamingSIMD4ExtensionsA :1;
};
u32 AllCapabilities;
};
// Core Counts!
u32 PhysicalCores;
u32 LogicalCores;
public:
x86capabilities()
{
isIdentified = false;
VendorID = x86Vendor_Unknown;
}
x86capabilities();
void Identify();
void CountCores();

View File

@ -172,12 +172,12 @@ void Threading::pxThread::_pt_callback_cleanup( void* handle )
Threading::pxThread::pxThread( const wxString& name )
: m_name( name )
, m_thread()
, m_native_id(0)
, m_native_handle(0)
, m_detached(true) // start out with m_thread in detached/invalid state
, m_running(false)
{
m_detached = true; // start out with m_thread in detached/invalid state
m_running = false;
m_native_id = 0;
m_native_handle = 0;
}
// This destructor performs basic "last chance" cleanup, which is a blocking join

View File

@ -24,6 +24,26 @@ __aligned16 x86capabilities x86caps;
// Recompiled code buffer for SSE and MXCSR feature testing.
static __pagealigned u8 targetFXSAVE[512];
x86capabilities::x86capabilities() :
isIdentified(false),
VendorID(x86Vendor_Unknown),
FamilyID(0),
Model(0),
TypeID(0),
StepID(0),
Flags(0),
Flags2(0),
EFlags(0),
EFlags2(0),
SEFlag(0),
AllCapabilities(0),
PhysicalCores(0),
LogicalCores(0)
{
memzero(VendorName);
memzero(FamilyName);
}
// Warning! We've had problems with the MXCSR detection code causing stack corruption in
// MSVC PGO builds. The problem was fixed when I moved the MXCSR code to this function, and
// moved the recSSE[] array to a global static (it was local to cpudetectInit). Commented
@ -146,7 +166,7 @@ void x86capabilities::CountCores()
CountLogicalCores();
}
static const char* tbl_x86vendors[] =
static const char* tbl_x86vendors[] =
{
"GenuineIntel",
"AuthenticAMD",
@ -266,7 +286,7 @@ void x86capabilities::Identify()
hasSupplementalStreamingSIMD3Extensions = ( Flags2 >> 9 ) & 1; //ssse3
hasStreamingSIMD4Extensions = ( Flags2 >> 19 ) & 1; //sse4.1
hasStreamingSIMD4Extensions2 = ( Flags2 >> 20 ) & 1; //sse4.2
if((Flags2 >> 27) & 1) // OSXSAVE
{
if((_xgetbv(0) & 6) == 6) // XFEATURE_ENABLED_MASK[2:1] = '11b' (XMM state and YMM state are enabled by OS).

View File

@ -108,12 +108,13 @@ private:
class DisassemblyMacro: public DisassemblyEntry
{
public:
DisassemblyMacro(DebugInterface* _cpu, u32 _address): cpu(_cpu), address(_address) { };
DisassemblyMacro(DebugInterface* _cpu, u32 _address):
cpu(_cpu), type(MACRO_LI), name(), immediate(0), address(_address), numOpcodes(0), rt(0), dataSize(0) { };
virtual ~DisassemblyMacro() { };
void setMacroLi(u32 _immediate, u8 _rt);
void setMacroMemory(std::string _name, u32 _immediate, u8 _rt, int _dataSize);
virtual void recheck() { };
virtual int getNumLines() { return 1; };
virtual int getLineNum(u32 address, bool findStart) { return 0; };
@ -122,7 +123,7 @@ public:
virtual bool disassemble(u32 address, DisassemblyLineInfo& dest, bool insertSymbols) ;
private:
enum MacroType { MACRO_LI, MACRO_MEMORYIMM };
DebugInterface* cpu;
MacroType type;
std::string name;
@ -139,7 +140,7 @@ class DisassemblyData: public DisassemblyEntry
public:
DisassemblyData(DebugInterface* _cpu, u32 _address, u32 _size, DataType _type);
virtual ~DisassemblyData() { };
virtual void recheck();
virtual int getNumLines() { return (int)lines.size(); };
virtual int getLineNum(u32 address, bool findStart);
@ -155,7 +156,7 @@ private:
u32 size;
int lineNum;
};
DebugInterface* cpu;
u32 address;
u32 size;
@ -170,7 +171,7 @@ class DisassemblyComment: public DisassemblyEntry
public:
DisassemblyComment(DebugInterface* _cpu, u32 _address, u32 _size, std::string name, std::string param);
virtual ~DisassemblyComment() { };
virtual void recheck() { };
virtual int getNumLines() { return 1; };
virtual int getLineNum(u32 address, bool findStart) { return 0; };

View File

@ -367,9 +367,11 @@ bool MipsCheckImmediate(const char* Source, DebugInterface* cpu, int& dest, int&
return true;
}
CMipsInstruction::CMipsInstruction(DebugInterface* cpu)
CMipsInstruction::CMipsInstruction(DebugInterface* cpu) :
Opcode(), NoCheckError(false), Loaded(false), RamPos(0),
registers(), immediateType(MIPS_NOIMMEDIATE), immediate(),
vfpuSize(0), encoding(0), error()
{
Loaded = false;
this->cpu = cpu;
}

View File

@ -43,11 +43,11 @@ struct MipsOpcodeRegisters {
MipsRegisterInfo grs; // general source reg
MipsRegisterInfo grt; // general target reg
MipsRegisterInfo grd; // general dest reg
MipsRegisterInfo frs; // float source reg
MipsRegisterInfo frt; // float target reg
MipsRegisterInfo frd; // float dest reg
MipsRegisterInfo ps2vrs; // ps2 vector source reg
MipsRegisterInfo ps2vrt; // ps2 vector target reg
MipsRegisterInfo ps2vrd; // ps2 vector dest reg

View File

@ -166,7 +166,7 @@ struct Gif_Path {
GIF_PATH_STATE state; // Path State
Gif_Path_MTVU mtvu; // Must be last for saved states
Gif_Path() {}
Gif_Path() { Reset(); }
~Gif_Path() { _aligned_free(buffer); }
void Init(GIF_PATH _idx, u32 _buffSize, u32 _buffSafeZone) {
@ -423,7 +423,7 @@ struct Gif_Unit {
tGIF_STAT& stat;
GIF_TRANSFER_TYPE lastTranType; // Last Transfer Type
Gif_Unit() : stat(gifRegs.stat) {
Gif_Unit() : gsSIGNAL(), gsFINISH(), stat(gifRegs.stat), lastTranType(GIF_TRANS_INVALID) {
gifPath[0].Init(GIF_PATH_1, _1mb*9, _1mb + _1kb);
gifPath[1].Init(GIF_PATH_2, _1mb*9, _1mb + _1kb);
gifPath[2].Init(GIF_PATH_3, _1mb*9, _1mb + _1kb);

View File

@ -832,6 +832,11 @@ static void PS2E_CALLBACK pcsx2_OSD_WriteLn( int icon, const char* msg )
// ---------------------------------------------------------------------------------
// PluginStatus_t Implementations
// ---------------------------------------------------------------------------------
SysCorePlugins::SysCorePlugins() :
m_mcdPlugin(NULL), m_SettingsFolder(), m_LogFolder(), m_mtx_PluginStatus(), m_mcdOpen(false)
{
}
SysCorePlugins::PluginStatus_t::PluginStatus_t( PluginsEnum_t _pid, const wxString& srcfile )
: Filename( srcfile )
{
@ -971,10 +976,6 @@ void SysCorePlugins::PluginStatus_t::BindOptional( PluginsEnum_t pid )
// SysCorePlugins Implementations
// =====================================================================================
SysCorePlugins::SysCorePlugins()
{
}
SysCorePlugins::~SysCorePlugins() throw()
{
try

View File

@ -148,7 +148,7 @@ void SysExecEvent::_DoInvokeEvent()
// Posts an empty result to the invoking context/thread of this message, if one exists.
// If the invoking thread posted the event in non-blocking fashion then no action is
// taken.
void SysExecEvent::PostResult() const
void SysExecEvent::PostResult() const
{
if( m_sync ) m_sync->PostResult();
}
@ -156,10 +156,9 @@ void SysExecEvent::PostResult() const
// --------------------------------------------------------------------------------------
// pxEvtQueue Implementations
// --------------------------------------------------------------------------------------
pxEvtQueue::pxEvtQueue()
pxEvtQueue::pxEvtQueue() :
m_OwnerThreadId(), m_Quitting(false), m_qpc_Start(0)
{
m_Quitting = false;
m_qpc_Start = 0;
}
// Puts the event queue into Shutdown mode, which does *not* immediately stop nor cancel

View File

@ -74,7 +74,7 @@ public:
s32 Save ( uint slot, const u8 *src, u32 adr, int size );
s32 EraseBlock ( uint slot, u32 adr );
u64 GetCRC ( uint slot );
protected:
bool Seek( wxFFile& f, u32 adr );
bool Create( const wxString& mcdFile, uint sizeInMB );
@ -143,6 +143,7 @@ wxString FileMcd_GetDefaultName(uint slot)
FileMemoryCard::FileMemoryCard()
{
memset8<0xff>( m_effeffs );
m_chkaddr = 0;
}
void FileMemoryCard::Open()

View File

@ -240,6 +240,7 @@ protected:
public:
microRegAlloc(int _index) {
index = _index;
reset();
}
// Fully resets the regalloc by clearing all cached data

View File

@ -382,6 +382,9 @@ GSCapture::GSCapture()
{
m_out_dir = theApp.GetConfig("capture_out_dir", "/tmp/GSdx_Capture");
m_threads = theApp.GetConfig("capture_threads", 4);
#ifdef __linux__
m_compression_level = theApp.GetConfig("png_compression_level", Z_BEST_SPEED);
#endif
}
GSCapture::~GSCapture()
@ -488,14 +491,9 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recomendedResolution, float a
m_size.x = theApp.GetConfig("capture_resx", 1280);
m_size.y = theApp.GetConfig("capture_resy", 1024);
m_compression_level = theApp.GetConfig("png_compression_level", Z_BEST_SPEED);
#ifdef __linux__
for(int i = 0; i < m_threads; i++) {
m_workers.push_back(new GSPng::Worker());
}
#endif
#endif
m_capturing = true;

View File

@ -40,6 +40,7 @@ GSRendererOGL::GSRendererOGL()
UserHacks_safe_fbmask = theApp.GetConfig("UserHacks_safe_fbmask", false);
m_prim_overlap = PRIM_OVERLAP_UNKNOW;
m_unsafe_fbmask = false;
if (!theApp.GetConfig("UserHacks", 0)) {
UserHacks_TCOffset = 0;

View File

@ -275,7 +275,12 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read)
m_int_alignment = 0;
m_int_shift = 0;
break;
default:
m_int_format = 0;
m_int_type = 0;
m_int_alignment = 0;
m_int_shift = 0;
ASSERT(0);
}

View File

@ -139,6 +139,8 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxFrame(
wxCommandEventHandler(GamepadConfiguration::OnCheckboxChange)
);
#endif
repopulate();
}
/**

View File

@ -38,7 +38,7 @@ class GamepadConfiguration : public wxFrame
wxCheckBox *m_cb_rumble, *m_cb_hack_sixaxis_usb, *m_cb_hack_sixaxis_pressure;
wxSlider *m_sl_rumble_intensity, *m_sl_joystick_sensibility;
wxButton *m_bt_ok, *m_bt_cancel;
wxStaticText *m_lbl_rumble_intensity, *m_lbl_joystick_sensibility;
wxStaticText *m_lbl_rumble_intensity;
int m_pad_id;
u32 m_init_rumble_intensity, m_init_joystick_sensibility;