Merge branch 'warnings' of https://github.com/catalinr/wxWidgets
Fix MSVS analyzer warnings about int multiplication overflow and uninitialized member variables. See https://github.com/wxWidgets/wxWidgets/pull/1606
This commit is contained in:
commit
ad7fb7f4aa
@ -41,6 +41,11 @@ union wxAnyValueBuffer
|
|||||||
|
|
||||||
void* m_ptr;
|
void* m_ptr;
|
||||||
wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];
|
wxByte m_buffer[WX_ANY_VALUE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
wxAnyValueBuffer()
|
||||||
|
{
|
||||||
|
m_ptr = NULL;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -244,7 +244,7 @@ private:
|
|||||||
wxEventFunction m_method;
|
wxEventFunction m_method;
|
||||||
|
|
||||||
// Provide a dummy default ctor for type info purposes
|
// Provide a dummy default ctor for type info purposes
|
||||||
wxObjectEventFunctor() { }
|
wxObjectEventFunctor() : m_handler(NULL), m_method(NULL) { }
|
||||||
|
|
||||||
WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
|
WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor)
|
||||||
};
|
};
|
||||||
|
@ -52,6 +52,9 @@ class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGaugeBase() : m_rangeMax(0), m_gaugePos(0),
|
wxGaugeBase() : m_rangeMax(0), m_gaugePos(0),
|
||||||
|
#if wxGAUGE_EMULATE_INDETERMINATE_MODE
|
||||||
|
m_nDirection(wxRIGHT),
|
||||||
|
#endif
|
||||||
m_appProgressIndicator(NULL) { }
|
m_appProgressIndicator(NULL) { }
|
||||||
|
|
||||||
virtual ~wxGaugeBase();
|
virtual ~wxGaugeBase();
|
||||||
|
@ -33,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxListBoxBase;
|
|||||||
class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog
|
class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxAnyChoiceDialog() { }
|
wxAnyChoiceDialog() : m_listbox(NULL) { }
|
||||||
|
|
||||||
wxAnyChoiceDialog(wxWindow *parent,
|
wxAnyChoiceDialog(wxWindow *parent,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
wxTextEntryDialog()
|
wxTextEntryDialog()
|
||||||
{
|
{
|
||||||
m_textctrl = NULL;
|
m_textctrl = NULL;
|
||||||
|
m_dialogStyle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextEntryDialog(wxWindow *parent,
|
wxTextEntryDialog(wxWindow *parent,
|
||||||
|
@ -133,7 +133,7 @@ inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const
|
|||||||
inline wxDouble wxPoint2DInt::GetVectorLength() const
|
inline wxDouble wxPoint2DInt::GetVectorLength() const
|
||||||
{
|
{
|
||||||
// cast needed MIPSpro compiler under SGI
|
// cast needed MIPSpro compiler under SGI
|
||||||
return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) );
|
return sqrt( (wxDouble)(m_x)*(m_x) + (wxDouble)(m_y)*(m_y) );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void wxPoint2DInt::SetVectorLength( wxDouble length )
|
inline void wxPoint2DInt::SetVectorLength( wxDouble length )
|
||||||
@ -155,7 +155,8 @@ inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const
|
|||||||
|
|
||||||
inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const
|
inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const
|
||||||
{
|
{
|
||||||
return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) );
|
return ( ((wxDouble)pt.m_x-m_x)*((wxDouble)pt.m_x-m_x) +
|
||||||
|
((wxDouble)pt.m_y-m_y)*((wxDouble)pt.m_y-m_y) );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const
|
inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const
|
||||||
|
@ -333,7 +333,7 @@ class WXDLLIMPEXP_BASE wxListKey
|
|||||||
public:
|
public:
|
||||||
// implicit ctors
|
// implicit ctors
|
||||||
wxListKey() : m_keyType(wxKEY_NONE)
|
wxListKey() : m_keyType(wxKEY_NONE)
|
||||||
{ }
|
{ m_key.integer = 0; }
|
||||||
wxListKey(long i) : m_keyType(wxKEY_INTEGER)
|
wxListKey(long i) : m_keyType(wxKEY_INTEGER)
|
||||||
{ m_key.integer = i; }
|
{ m_key.integer = i; }
|
||||||
wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
|
wxListKey(const wxString& s) : m_keyType(wxKEY_STRING)
|
||||||
|
@ -136,7 +136,7 @@ inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); }
|
|||||||
|
|
||||||
inline int wxRound(double x)
|
inline int wxRound(double x)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( x > INT_MIN - 0.5 && x < INT_MAX + 0.5,
|
wxASSERT_MSG( x > (double)INT_MIN - 0.5 && x < (double)INT_MAX + 0.5,
|
||||||
wxT("argument out of supported range") );
|
wxT("argument out of supported range") );
|
||||||
|
|
||||||
#if defined(HAVE_ROUND)
|
#if defined(HAVE_ROUND)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
class WXDLLIMPEXP_CORE wxCheckBox : public wxMSWOwnerDrawnButton<wxCheckBoxBase>
|
class WXDLLIMPEXP_CORE wxCheckBox : public wxMSWOwnerDrawnButton<wxCheckBoxBase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCheckBox() { }
|
wxCheckBox() : m_state(wxCHK_UNCHECKED) { }
|
||||||
wxCheckBox(wxWindow *parent,
|
wxCheckBox(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
|
@ -288,7 +288,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// the initial state is direct
|
// the initial state is direct
|
||||||
DecoderState() { mode = Direct; }
|
DecoderState() { mode = Direct; accum = bit = msb = 0; isLSB = false; }
|
||||||
|
|
||||||
// switch to/from shifted mode
|
// switch to/from shifted mode
|
||||||
void ToDirect() { mode = Direct; }
|
void ToDirect() { mode = Direct; }
|
||||||
@ -317,7 +317,7 @@ private:
|
|||||||
Mode mode;
|
Mode mode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EncoderState() { mode = Direct; }
|
EncoderState() { mode = Direct; accum = bit = 0; }
|
||||||
|
|
||||||
void ToDirect() { mode = Direct; }
|
void ToDirect() { mode = Direct; }
|
||||||
void ToShifted() { mode = Shifted; accum = bit = 0; }
|
void ToShifted() { mode = Shifted; accum = bit = 0; }
|
||||||
|
@ -3374,7 +3374,7 @@ private:
|
|||||||
{
|
{
|
||||||
// notice that there is no need to initialize m_len here as it's unused
|
// notice that there is no need to initialize m_len here as it's unused
|
||||||
// as long as m_str is NULL
|
// as long as m_str is NULL
|
||||||
ConvertedBuffer() : m_str(NULL) {}
|
ConvertedBuffer() : m_str(NULL), m_len(0) {}
|
||||||
~ConvertedBuffer()
|
~ConvertedBuffer()
|
||||||
{ free(m_str); }
|
{ free(m_str); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user