corrected warnings when compiling with -Wall -W

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot 2002-05-03 19:41:22 +00:00
parent 4285fbcab9
commit 7ee31b00ed
8 changed files with 62 additions and 52 deletions

View File

@ -45,9 +45,10 @@ class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
{
public:
wxBitmapHandlerBase()
{
m_type = wxBITMAP_TYPE_INVALID;
}
: m_name()
, m_extension()
, m_type(wxBITMAP_TYPE_INVALID)
{ }
virtual ~wxBitmapHandlerBase() { }

View File

@ -27,12 +27,14 @@ class wxCharBuffer
{
public:
wxCharBuffer(const char *str)
: m_str(NULL)
{
wxASSERT_MSG( str, wxT("NULL string in wxCharBuffer") );
m_str = str ? strdup(str) : (char *)NULL;
}
wxCharBuffer(size_t len)
: m_str(NULL)
{
m_str = (char *)malloc(len+1);
m_str[len] = '\0';
@ -41,17 +43,17 @@ public:
~wxCharBuffer() { free(m_str); }
wxCharBuffer(const wxCharBuffer& src)
: m_str(src.m_str)
{
m_str = src.m_str;
// no reference count yet...
((wxCharBuffer*)&src)->m_str = (char *)NULL;
// no reference count yet...
((wxCharBuffer*)&src)->m_str = (char *)NULL;
}
wxCharBuffer& operator=(const wxCharBuffer& src)
{
m_str = src.m_str;
// no reference count yet...
((wxCharBuffer*)&src)->m_str = (char *)NULL;
return *this;
m_str = src.m_str;
// no reference count yet...
((wxCharBuffer*)&src)->m_str = (char *)NULL;
return *this;
}
const char *data() const { return m_str; }
@ -67,6 +69,7 @@ class wxWCharBuffer
{
public:
wxWCharBuffer(const wchar_t *wcs)
: m_wcs((wchar_t *)NULL)
{
wxASSERT_MSG( wcs, wxT("NULL string in wxWCharBuffer") );
@ -80,9 +83,9 @@ public:
m_wcs = (wchar_t *)malloc(siz);
memcpy(m_wcs, wcs, siz);
}
else m_wcs = (wchar_t *)NULL;
}
wxWCharBuffer(size_t len)
: m_wcs((wchar_t *)NULL)
{
m_wcs = (wchar_t *)malloc((len+1)*sizeof(wchar_t));
m_wcs[len] = L'\0';
@ -92,17 +95,17 @@ public:
~wxWCharBuffer() { free(m_wcs); }
wxWCharBuffer(const wxWCharBuffer& src)
: m_wcs(src.m_wcs)
{
m_wcs = src.m_wcs;
// no reference count yet...
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
// no reference count yet...
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
}
wxWCharBuffer& operator=(const wxWCharBuffer& src)
{
m_wcs = src.m_wcs;
// no reference count yet...
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
return *this;
m_wcs = src.m_wcs;
// no reference count yet...
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
return *this;
}
const wchar_t *data() const { return m_wcs; }
@ -137,12 +140,12 @@ class wxMemoryBuffer
public:
enum { BLOCK_SIZE = 1024 };
wxMemoryBuffer(size_t size=wxMemoryBuffer::BLOCK_SIZE)
: m_data(NULL), m_size(0), m_len(0)
{
wxASSERT(size > 0);
m_data = malloc(size);
wxASSERT(m_data != NULL);
m_size = size;
m_len = 0;
}
~wxMemoryBuffer() { free(m_data); }
@ -193,11 +196,8 @@ public:
// Copy and assignment
wxMemoryBuffer(const wxMemoryBuffer& src)
: m_data(src.m_data), m_size(src.m_size), m_len(src.m_len)
{
m_data = src.m_data;
m_size = src.m_size;
m_len = src.m_len;
// no reference count yet...
((wxMemoryBuffer*)&src)->m_data = NULL;
((wxMemoryBuffer*)&src)->m_size = 0;
@ -209,7 +209,7 @@ public:
m_data = src.m_data;
m_size = src.m_size;
m_len = src.m_len;
// no reference count yet...
((wxMemoryBuffer*)&src)->m_data = NULL;
((wxMemoryBuffer*)&src)->m_size = 0;

View File

@ -205,8 +205,8 @@ public:
int x, y;
// constructors
wxSize() { x = y = 0; }
wxSize(int xx, int yy) { Set(xx, yy); }
wxSize() : x(0), y(0) { }
wxSize(int xx, int yy) : x(xx), y(yy) { }
// no copy ctor or assignment operator - the defaults are ok
@ -240,8 +240,8 @@ public:
double x;
double y;
wxRealPoint() { x = y = 0.0; };
wxRealPoint(double xx, double yy) { x = xx; y = yy; };
wxRealPoint() : x(0.0), y(0.0) { }
wxRealPoint(double xx, double yy) : x(xx), y(yy) { }
wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); }
wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); }
@ -254,8 +254,8 @@ class WXDLLEXPORT wxPoint
public:
int x, y;
wxPoint() { x = y = 0; };
wxPoint(int xx, int yy) { x = xx; y = yy; };
wxPoint() : x(0), y(0) { }
wxPoint(int xx, int yy) : x(xx), y(yy) { }
// no copy ctor or assignment operator - the defaults are ok
@ -283,9 +283,12 @@ public:
class WXDLLEXPORT wxRect
{
public:
wxRect() { x = y = width = height = 0; }
wxRect()
: x(0), y(0), width(0), height(0)
{ }
wxRect(int xx, int yy, int ww, int hh)
{ x = xx; y = yy; width = ww; height = hh; }
: x(xx), y(yy), width(ww), height(hh)
{ }
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRect(const wxPoint& pos, const wxSize& size);

View File

@ -50,18 +50,21 @@ class WXDLLEXPORT wxCheckBox: public wxControl
class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
{
DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox)
DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox)
public:
int checkWidth ;
int checkHeight ;
public:
int checkWidth ;
int checkHeight ;
inline wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; }
inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr)
wxBitmapCheckBox()
: checkWidth(-1), checkHeight(-1)
{ }
wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr)
{
Create(parent, id, label, pos, size, style, validator, name);
}
@ -75,7 +78,7 @@ class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
virtual bool GetValue() const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void SetLabel(const wxBitmap *bitmap);
virtual void SetLabel( const wxString &name ) {}
virtual void SetLabel( const wxString & WXUNUSED(name) ) {}
};
#endif
// _WX_CHECKBOX_H_

View File

@ -31,10 +31,10 @@ class WXDLLEXPORT wxGDIObject: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxGDIObject)
public:
inline wxGDIObject() { m_visible = FALSE; };
inline ~wxGDIObject() {};
wxGDIObject() : m_visible(FALSE) { }
~wxGDIObject() { }
inline bool IsNull() const { return (m_refData == 0); }
bool IsNull() const { return (m_refData == 0); }
virtual bool GetVisible() { return m_visible; }
virtual void SetVisible(bool v) { m_visible = v; }

View File

@ -27,7 +27,9 @@ public:
wxIcon();
// Copy constructors
inline wxIcon(const wxIcon& icon) { Ref(icon); }
wxIcon(const wxIcon& icon)
: wxBitmap()
{ Ref(icon); }
wxIcon(const char **data);
wxIcon(char **data);

View File

@ -51,7 +51,8 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
DECLARE_DYNAMIC_CLASS(wxMetafile)
public:
// Copy constructor
inline wxMetafile(const wxMetafile& metafile)
wxMetafile(const wxMetafile& metafile)
: wxGDIObject()
{ Ref(metafile); }
wxMetafile(const wxString& file = "");

View File

@ -318,9 +318,9 @@ class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent
public:
wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
long start, long end)
: wxCommandEvent(wxEVT_COMMAND_TEXT_URL, id),
m_evtMouse(evtMouse)
{ m_start = start; m_end = end; }
: wxCommandEvent(wxEVT_COMMAND_TEXT_URL, id)
, m_evtMouse(evtMouse), m_start(start), m_end(end)
{ }
// get the mouse event which happend over the URL
const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; }
@ -344,7 +344,7 @@ private:
public:
// for wxWin RTTI only, don't use
wxTextUrlEvent() { }
wxTextUrlEvent() : m_evtMouse(), m_start(0), m_end(0) { }
};
typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&);