From c40158e40b45fd22c7a166ce1743345fb4d4a4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 26 Jul 2005 09:05:27 +0000 Subject: [PATCH] Corrections for future OW 1.4. Warning fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 5 +- include/wx/os2/metafile.h | 171 ++++++++++++++++++++------------------ include/wx/os2/setup0.h | 2 - src/common/filefn.cpp | 2 +- src/common/imagpng.cpp | 2 +- src/unix/gsocket.cpp | 16 ++-- 6 files changed, 106 insertions(+), 92 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 6da83c521e..439e76f851 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -573,7 +573,7 @@ typedef int wxWindowID; #define except(x) catch(...) #endif /* Metrowerks */ -#if defined(__WATCOMC__) +#if defined(__WATCOMC__) && (__WATCOMC__ < 1240) typedef short mode_t; #endif @@ -963,6 +963,9 @@ inline void *wxUIntToPtr(wxUIntPtr p) #if defined(__PALMOS__) && !defined(HAVE_SSIZE_T) #define HAVE_SSIZE_T #endif +#if defined(__WATCOMC__) && __WATCOMC__ > 1230 + #define HAVE_SSIZE_T +#endif #ifndef HAVE_SSIZE_T #if SIZEOF_SIZE_T == 4 typedef wxInt32 ssize_t; diff --git a/include/wx/os2/metafile.h b/include/wx/os2/metafile.h index afd4906a45..cfc3e19168 100644 --- a/include/wx/os2/metafile.h +++ b/include/wx/os2/metafile.h @@ -51,81 +51,82 @@ public: class WXDLLEXPORT wxMetafile: public wxGDIObject { - DECLARE_DYNAMIC_CLASS(wxMetafile) - public: - // Copy constructor - inline wxMetafile(const wxMetafile& metafile) - { Ref(metafile); } + DECLARE_DYNAMIC_CLASS(wxMetafile) +public: + // Copy constructor + inline wxMetafile(const wxMetafile& metafile) + { Ref(metafile); } - wxMetafile(const wxString& file = wxEmptyString); - ~wxMetafile(void); + wxMetafile(const wxString& file = wxEmptyString); + ~wxMetafile(void); - // After this is called, the metafile cannot be used for anything - // since it is now owned by the clipboard. - virtual bool SetClipboard(int width = 0, int height = 0); + // After this is called, the metafile cannot be used for anything + // since it is now owned by the clipboard. + virtual bool SetClipboard(int width = 0, int height = 0); - virtual bool Play(wxDC *dc); - inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; + virtual bool Play(wxDC *dc); + inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; - // Implementation - inline WXHANDLE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; } - void SetHMETAFILE(WXHANDLE mf) ; - inline int GetWindowsMappingMode(void) { return M_METAFILEDATA->m_windowsMappingMode; } - void SetWindowsMappingMode(int mm); + // Implementation + inline WXHANDLE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHANDLE mf) ; + inline int GetWindowsMappingMode(void) { return M_METAFILEDATA->m_windowsMappingMode; } + void SetWindowsMappingMode(int mm); - // Operators - inline wxMetafile& operator = (const wxMetafile& metafile) - { if (*this == metafile) return (*this); Ref(metafile); return *this; } - inline bool operator== (const wxMetafile& metafile) const - { return m_refData == metafile.m_refData; } - inline bool operator!= (const wxMetafile& metafile) const - { return m_refData != metafile.m_refData; } - -protected: + // Operators + inline wxMetafile& operator = (const wxMetafile& metafile) + { if (*this == metafile) return (*this); Ref(metafile); return *this; } + inline bool operator== (const wxMetafile& metafile) const + { return m_refData == metafile.m_refData; } + inline bool operator!= (const wxMetafile& metafile) const + { return m_refData != metafile.m_refData; } }; class WXDLLEXPORT wxMetafileDC: public wxDC { - DECLARE_DYNAMIC_CLASS(wxMetafileDC) + DECLARE_DYNAMIC_CLASS(wxMetafileDC) - public: - // Don't supply origin and extent - // Supply them to wxMakeMetaFilePlaceable instead. - wxMetafileDC(const wxString& file = wxEmptyString); +public: + // Don't supply origin and extent + // Supply them to wxMakeMetaFilePlaceable instead. + wxMetafileDC(const wxString& file = wxEmptyString); - // Supply origin and extent (recommended). - // Then don't need to supply them to wxMakeMetaFilePlaceable. - wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg); + // Supply origin and extent (recommended). + // Then don't need to supply them to wxMakeMetaFilePlaceable. + wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg); - ~wxMetafileDC(void); + ~wxMetafileDC(void); - // Should be called at end of drawing - virtual wxMetafile *Close(void); - virtual void SetMapMode(int mode); - virtual void GetTextExtent(const wxString& string, long *x, long *y, - long *descent = NULL, long *externalLeading = NULL, - wxFont *theFont = NULL, bool use16bit = FALSE) const; + // Should be called at end of drawing + virtual wxMetafile *Close(void); + virtual void SetMapMode(int mode); + virtual void GetTextExtent(const wxString& string, long *x, long *y, + long *descent = NULL, long *externalLeading = NULL, + wxFont *theFont = NULL, bool use16bit = false) const; - // Implementation - inline wxMetafile *GetMetaFile(void) const { return m_metaFile; } - inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } - inline int GetWindowsMappingMode(void) const { return m_windowsMappingMode; } - inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } + // Implementation + inline wxMetafile *GetMetaFile(void) const { return m_metaFile; } + inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + inline int GetWindowsMappingMode(void) const { return m_windowsMappingMode; } + inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } protected: - int m_windowsMappingMode; - wxMetafile* m_metaFile; + int m_windowsMappingMode; + wxMetafile* m_metaFile; private: - // function hiding warning supression - inline virtual void GetTextExtent( const wxString& string - ,long* width - ,long* height - ,long* descent = NULL - ,long* externalLeading = NULL - ,wxFont* theFont = NULL - ) const - { GetTextExtent( string, width, height, descent, externalLeading, theFont, FALSE);}; +#ifndef __WATCOMC__ + // function hiding warning supression + // still required ?? + inline virtual void GetTextExtent( const wxString& string + ,long* width + ,long* height + ,long* descent = NULL + ,long* externalLeading = NULL + ,wxFont* theFont = NULL + ) const + { GetTextExtent( string, width, height, descent, externalLeading, theFont, false);}; +#endif }; /* @@ -140,7 +141,14 @@ private: bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); // Optional origin and extent -bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE); +bool WXDLLEXPORT wxMakeMetaFilePlaceable( const wxString& filename + ,int x1 + ,int y1 + ,int x2 + ,int y2 + ,float scale = 1.0 + ,bool useOriginAndExtent = true + ); // ---------------------------------------------------------------------------- // wxMetafileDataObject is a specialization of wxDataObject for metafile data @@ -153,39 +161,40 @@ bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y class WXDLLEXPORT wxMetafileDataObject : public wxDataObject { public: - // ctors - wxMetafileDataObject() { m_width = 0; m_height = 0; }; - wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0): - m_metafile(metafile), m_width(width), m_height(height) { } + // ctors + wxMetafileDataObject() { m_width = 0; m_height = 0; }; + wxMetafileDataObject(const wxMetafile& metafile, int width = 0,int height = 0) + :m_metafile(metafile) + ,m_width(width) + ,m_height(height) { } - void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0) - { m_metafile = metafile; m_width = w; m_height = h; } - wxMetafile GetMetafile() const { return m_metafile; } - int GetWidth() const { return m_width; } - int GetHeight() const { return m_height; } + void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0) + { m_metafile = metafile; m_width = w; m_height = h; } + wxMetafile GetMetafile() const { return m_metafile; } + int GetWidth() const { return m_width; } + int GetHeight() const { return m_height; } - virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; } + virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; } /* ?? - // implement base class pure virtuals - virtual wxDataFormat GetPreferredFormat() const - { return (wxDataFormat) wxDataObject::Text; } - virtual bool IsSupportedFormat(wxDataFormat format) const - { return format == wxDataObject::Text || format == wxDataObject::Locale; } - virtual size_t GetDataSize() const - { return m_strText.Len() + 1; } // +1 for trailing '\0'of course - virtual void GetDataHere(void *pBuf) const - { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat() const + { return (wxDataFormat) wxDataObject::Text; } + virtual bool IsSupportedFormat(wxDataFormat format) const + { return format == wxDataObject::Text || format == wxDataObject::Locale; } + virtual size_t GetDataSize() const + { return m_strText.Len() + 1; } // +1 for trailing '\0'of course + virtual void GetDataHere(void *pBuf) const + { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } */ private: - wxMetafile m_metafile; - int m_width; - int m_height; + wxMetafile m_metafile; + int m_width; + int m_height; }; #endif #endif // wxUSE_METAFILE #endif // _WX_METAFIILE_H_ - diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index 475e5cbf57..9e92174947 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -939,8 +939,6 @@ // 0 for no interprocess comms #define wxUSE_HELP 1 // 0 for no help facility -#define wxUSE_MS_HTML_HELP 1 - // 0 for no MS HTML Help // Use wxHTML-based help controller? #define wxUSE_WXHTML_HELP 0 diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index f7161adc3f..5355dd7e09 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -546,7 +546,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) while ((*d++ = *s) != 0) { # ifndef __WXMSW__ if (*s == wxT('\\')) { - if ((*(d - 1) = *++s)) { + if ((*(d - 1) = *++s)!=0) { s++; continue; } else diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index bf3b40ab49..84c0d89c93 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -109,7 +109,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) #if wxUSE_STREAMS #ifndef PNGLINKAGEMODE - #if defined(__WATCOMC__) && defined(__WXMSW__) + #if defined(__WATCOMC__) && ( defined(__WXMSW__) || __WATCOMC__ > 1230 ) // we need an explicit cdecl for Watcom, at least according to // // http://sf.net/tracker/index.php?func=detail&aid=651492&group_id=9863&atid=109863 diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index 6e3cf62fa5..100beaa553 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -26,6 +26,10 @@ #include "wx/setup.h" #endif +#ifndef WXUNUSED +#define WXUNUSED(x) +#endif + #if defined(__VISAGECPP__) /* Seems to be needed by Visual Age C++, though I don't see how it manages to not break on including a C++ header into a plain C source file */ @@ -225,17 +229,17 @@ void GSocketGUIFunctionsTableNull::OnExit() {} bool GSocketGUIFunctionsTableNull::CanUseEventLoop() { return false; } -bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *socket) +bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *WXUNUSED(socket)) { return true; } -void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *socket) +void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *WXUNUSED(socket)) {} -void GSocketGUIFunctionsTableNull::Install_Callback(GSocket *socket, GSocketEvent event) +void GSocketGUIFunctionsTableNull::Install_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event)) {} -void GSocketGUIFunctionsTableNull::Uninstall_Callback(GSocket *socket, GSocketEvent event) +void GSocketGUIFunctionsTableNull::Uninstall_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event)) {} -void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *socket) +void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *WXUNUSED(socket)) {} -void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *socket) +void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *WXUNUSED(socket)) {} /* Global initialisers */