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: public:
wxBitmapHandlerBase() wxBitmapHandlerBase()
{ : m_name()
m_type = wxBITMAP_TYPE_INVALID; , m_extension()
} , m_type(wxBITMAP_TYPE_INVALID)
{ }
virtual ~wxBitmapHandlerBase() { } virtual ~wxBitmapHandlerBase() { }

View File

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

View File

@ -205,8 +205,8 @@ public:
int x, y; int x, y;
// constructors // constructors
wxSize() { x = y = 0; } wxSize() : x(0), y(0) { }
wxSize(int xx, int yy) { Set(xx, yy); } wxSize(int xx, int yy) : x(xx), y(yy) { }
// no copy ctor or assignment operator - the defaults are ok // no copy ctor or assignment operator - the defaults are ok
@ -240,8 +240,8 @@ public:
double x; double x;
double y; double y;
wxRealPoint() { x = y = 0.0; }; wxRealPoint() : x(0.0), y(0.0) { }
wxRealPoint(double xx, double yy) { x = xx; y = yy; }; 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); }
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: public:
int x, y; int x, y;
wxPoint() { x = y = 0; }; wxPoint() : x(0), y(0) { }
wxPoint(int xx, int yy) { x = xx; y = yy; }; wxPoint(int xx, int yy) : x(xx), y(yy) { }
// no copy ctor or assignment operator - the defaults are ok // no copy ctor or assignment operator - the defaults are ok
@ -283,9 +283,12 @@ public:
class WXDLLEXPORT wxRect class WXDLLEXPORT wxRect
{ {
public: 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) 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& topLeft, const wxPoint& bottomRight);
wxRect(const wxPoint& pos, const wxSize& size); wxRect(const wxPoint& pos, const wxSize& size);

View File

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

View File

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

View File

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

View File

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

View File

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