From 7ee31b00ed1aff56aa22f43f65a8604f6937ca37 Mon Sep 17 00:00:00 2001
From: Gilles Depeyrot <gilles_depeyrot@mac.com>
Date: Fri, 3 May 2002 19:41:22 +0000
Subject: [PATCH] corrected warnings when compiling with -Wall -W

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/bitmap.h       |  7 ++++---
 include/wx/buffer.h       | 42 +++++++++++++++++++--------------------
 include/wx/gdicmn.h       | 19 ++++++++++--------
 include/wx/mac/checkbox.h | 25 +++++++++++++----------
 include/wx/mac/gdiobj.h   |  6 +++---
 include/wx/mac/icon.h     |  4 +++-
 include/wx/mac/metafile.h |  3 ++-
 include/wx/textctrl.h     |  8 ++++----
 8 files changed, 62 insertions(+), 52 deletions(-)

diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h
index 478697ae6b..1783afe29d 100644
--- a/include/wx/bitmap.h
+++ b/include/wx/bitmap.h
@@ -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() { }
 
diff --git a/include/wx/buffer.h b/include/wx/buffer.h
index dac2adf1bd..9415229b9c 100644
--- a/include/wx/buffer.h
+++ b/include/wx/buffer.h
@@ -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;
diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h
index d8d1bb44d6..a584536722 100644
--- a/include/wx/gdicmn.h
+++ b/include/wx/gdicmn.h
@@ -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);
 
diff --git a/include/wx/mac/checkbox.h b/include/wx/mac/checkbox.h
index d23f724525..c17a18a82d 100644
--- a/include/wx/mac/checkbox.h
+++ b/include/wx/mac/checkbox.h
@@ -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_
diff --git a/include/wx/mac/gdiobj.h b/include/wx/mac/gdiobj.h
index 9263d4d6ad..3a90093725 100644
--- a/include/wx/mac/gdiobj.h
+++ b/include/wx/mac/gdiobj.h
@@ -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; }
diff --git a/include/wx/mac/icon.h b/include/wx/mac/icon.h
index c128f242aa..e1aa18fea5 100644
--- a/include/wx/mac/icon.h
+++ b/include/wx/mac/icon.h
@@ -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);
diff --git a/include/wx/mac/metafile.h b/include/wx/mac/metafile.h
index 393cca992e..8c9de99143 100644
--- a/include/wx/mac/metafile.h
+++ b/include/wx/mac/metafile.h
@@ -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 = "");
diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h
index 141cbbe847..f3a0c2a0bd 100644
--- a/include/wx/textctrl.h
+++ b/include/wx/textctrl.h
@@ -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&);
-- 
2.47.2