From 295272bdcd784fbe2b33883d00cff0f5c0ca5341 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 11 Jan 2002 19:33:37 +0000 Subject: [PATCH] more Sun C++ compiler warning fixes: in particular, added an ugly but necessary workaround for avoiding warning in the .xpm files git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/geometry.h | 20 ++++++++++---------- src/common/filefn.cpp | 3 +-- src/common/http.cpp | 6 +++--- src/generic/filedlgg.cpp | 5 +++++ src/generic/proplist.cpp | 5 +++++ src/generic/tipdlg.cpp | 6 ++++++ src/gtk/app.cpp | 5 +++++ src/gtk/listbox.cpp | 2 +- src/gtk/window.cpp | 6 +++--- src/gtk1/app.cpp | 5 +++++ src/gtk1/listbox.cpp | 2 +- src/gtk1/window.cpp | 6 +++--- src/html/helpfrm.cpp | 40 ++++++++++++++++++++++------------------ src/html/htmlhelp.cpp | 36 +++++++++++++++++++++--------------- src/motif/app.cpp | 5 +++++ src/unix/fontutil.cpp | 4 ++-- src/unix/threadpsx.cpp | 26 ++++++++++++++++++-------- 17 files changed, 116 insertions(+), 66 deletions(-) diff --git a/include/wx/geometry.h b/include/wx/geometry.h index d619b6cafa..0aafb0f855 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -99,16 +99,16 @@ public : wxInt32 m_y; }; -wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); -wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); -wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); -wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); -wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt::wxPoint2DInt() { diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 79c63f4bad..13fafb9b9f 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -567,7 +567,6 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) /* Expand ~ and ~user */ nm = lnm; - s = wxT(""); if (nm[0] == wxT('~') && !q) { /* prefix ~ */ @@ -591,7 +590,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) { if (was_sep) /* replace only if it was there: */ *s = SEP; - s = wxT(""); + s = NULL; } else { nm = nnm; s = home; diff --git a/src/common/http.cpp b/src/common/http.cpp index 55b44ed76d..b98d6c83af 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -205,11 +205,11 @@ bool wxHTTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait)) bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) { - wxChar *tmp_buf; + const wxChar *request; switch (req) { case wxHTTP_GET: - tmp_buf = wxT("GET"); + request = wxT("GET"); break; default: return FALSE; @@ -224,7 +224,7 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) Notify(FALSE); wxString buf; - buf.Printf(wxT("%s %s HTTP/1.0\r\n"), tmp_buf, path.c_str()); + buf.Printf(wxT("%s %s HTTP/1.0\r\n"), request, path.c_str()); const wxWX2MBbuf pathbuf = wxConvLibc.cWX2MB(buf); Write(pathbuf, strlen(wxMBSTRINGCAST pathbuf)); SendHeaders(); diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 3132890a00..5630801c60 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -69,6 +69,9 @@ # include #include +// XPM hack: make the arrays const +#define static static const + #ifndef __DOS__ #include "wx/generic/home.xpm" #endif @@ -80,6 +83,8 @@ #include "wx/generic/deffile.xpm" #include "wx/generic/exefile.xpm" +#undef static + //----------------------------------------------------------------------------- // wxFileData //----------------------------------------------------------------------------- diff --git a/src/generic/proplist.cpp b/src/generic/proplist.cpp index 55722a5c10..adff29386f 100644 --- a/src/generic/proplist.cpp +++ b/src/generic/proplist.cpp @@ -58,11 +58,16 @@ // XPMs // ---------------------------------------------------------------------------- +// XPM hack: make the arrays const +#define static static const + #ifndef __WXMSW__ #include "wx/generic/cross.xpm" #include "wx/generic/tick.xpm" #endif +#undef static + // ---------------------------------------------------------------------------- // accessor functions for the bitmaps (may return NULL, check for it!) // ---------------------------------------------------------------------------- diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp index 6f9ba6f7df..33a019fc11 100644 --- a/src/generic/tipdlg.cpp +++ b/src/generic/tipdlg.cpp @@ -198,7 +198,13 @@ wxTipDialog::wxTipDialog(wxWindow *parent, #if defined(__WXMSW__) || defined(__WXPM__) wxIcon icon("wxICON_TIP"); #else + // XPM hack: make the arrays const + #define static static const + #include "wx/generic/tip.xpm" + + #undef static + wxIcon icon(tipIcon); #endif wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon); diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index daa4e27b35..3390312177 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -868,11 +868,16 @@ int wxEntry( int argc, char *argv[] ) #ifndef __WXUNIVERSAL__ +// XPM hack: make the arrays const +#define static static const + #include "wx/gtk/info.xpm" #include "wx/gtk/error.xpm" #include "wx/gtk/question.xpm" #include "wx/gtk/warning.xpm" +#undef static + wxIcon wxApp::GetStdIcon(int which) const { switch(which) diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index de25cc767e..56089bfd2c 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -84,7 +84,7 @@ struct wxlistbox_idle_struct gint m_tag; }; -static gint wxlistbox_idle_callback( gpointer gdata ) +extern "C" gint wxlistbox_idle_callback( gpointer gdata ) { wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata; gdk_threads_enter(); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ccb09b9a12..475c60be0f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3755,9 +3755,9 @@ static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win ) static gint gs_pop_x = 0; static gint gs_pop_y = 0; -static void wxPopupMenuPositionCallback( GtkMenu *menu, - gint *x, gint *y, - gpointer WXUNUSED(user_data) ) +extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu, + gint *x, gint *y, + gpointer WXUNUSED(user_data) ) { // ensure that the menu appears entirely on screen GtkRequisition req; diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index daa4e27b35..3390312177 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -868,11 +868,16 @@ int wxEntry( int argc, char *argv[] ) #ifndef __WXUNIVERSAL__ +// XPM hack: make the arrays const +#define static static const + #include "wx/gtk/info.xpm" #include "wx/gtk/error.xpm" #include "wx/gtk/question.xpm" #include "wx/gtk/warning.xpm" +#undef static + wxIcon wxApp::GetStdIcon(int which) const { switch(which) diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index de25cc767e..56089bfd2c 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -84,7 +84,7 @@ struct wxlistbox_idle_struct gint m_tag; }; -static gint wxlistbox_idle_callback( gpointer gdata ) +extern "C" gint wxlistbox_idle_callback( gpointer gdata ) { wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata; gdk_threads_enter(); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index ccb09b9a12..475c60be0f 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -3755,9 +3755,9 @@ static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win ) static gint gs_pop_x = 0; static gint gs_pop_y = 0; -static void wxPopupMenuPositionCallback( GtkMenu *menu, - gint *x, gint *y, - gpointer WXUNUSED(user_data) ) +extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu, + gint *x, gint *y, + gpointer WXUNUSED(user_data) ) { // ensure that the menu appears entirely on screen GtkRequisition req; diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index d317e2a5b7..f35c4ce23b 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -55,24 +55,28 @@ // Bitmaps: #ifndef __WXMSW__ -#include "bitmaps/wpanel.xpm" -#include "bitmaps/wback.xpm" -#include "bitmaps/wforward.xpm" -#include "bitmaps/wbook.xpm" -#include "bitmaps/woptions.xpm" -#include "bitmaps/wfolder.xpm" -#include "bitmaps/wpage.xpm" -#include "bitmaps/whelp.xpm" -#include "bitmaps/whlproot.xpm" -#include "bitmaps/wbkadd.xpm" -#include "bitmaps/wbkdel.xpm" -#include "bitmaps/wup.xpm" -#include "bitmaps/wupnode.xpm" -#include "bitmaps/wdown.xpm" -#include "bitmaps/wopen.xpm" -#include "bitmaps/wprint.xpm" -#endif - + // XPM hack: make the arrays const + #define static static const + + #include "bitmaps/wpanel.xpm" + #include "bitmaps/wback.xpm" + #include "bitmaps/wforward.xpm" + #include "bitmaps/wbook.xpm" + #include "bitmaps/woptions.xpm" + #include "bitmaps/wfolder.xpm" + #include "bitmaps/wpage.xpm" + #include "bitmaps/whelp.xpm" + #include "bitmaps/whlproot.xpm" + #include "bitmaps/wbkadd.xpm" + #include "bitmaps/wbkdel.xpm" + #include "bitmaps/wup.xpm" + #include "bitmaps/wupnode.xpm" + #include "bitmaps/wdown.xpm" + #include "bitmaps/wopen.xpm" + #include "bitmaps/wprint.xpm" + + #undef static +#endif // __WXMSW__ // what is considered "small index"? #define INDEX_IS_SMALL 100 diff --git a/src/html/htmlhelp.cpp b/src/html/htmlhelp.cpp index da6c47706c..8ea6466640 100644 --- a/src/html/htmlhelp.cpp +++ b/src/html/htmlhelp.cpp @@ -42,12 +42,17 @@ file is only left to point out the problem and will be removed r.s.n. // Bitmaps: #ifndef __WXMSW__ -#include "bitmaps/panel.xpm" -#include "bitmaps/back.xpm" -#include "bitmaps/forward.xpm" -#include "bitmaps/book.xpm" -#include "bitmaps/folder.xpm" -#include "bitmaps/page.xpm" + // XPM hack: make the arrays const + #define static static const + + #include "bitmaps/panel.xpm" + #include "bitmaps/back.xpm" + #include "bitmaps/forward.xpm" + #include "bitmaps/book.xpm" + #include "bitmaps/folder.xpm" + #include "bitmaps/page.xpm" + + #undef static #endif #include "search.h" @@ -192,12 +197,12 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) int sz; char *buff, *lineptr; char linebuf[300]; - + wxString title = _("noname"), safetitle, start = wxEmptyString, contents = wxEmptyString, index = wxEmptyString; - + if (wxIsAbsolutePath(book)) bookFull = book; else bookFull = wxGetCwd() + "/" + book; @@ -257,7 +262,7 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) m_BookRecords.Add(bookr); if (m_IndexCnt > 0) qsort(m_Index, m_IndexCnt, sizeof(HtmlContentsItem), IndexCompareFunc); - + return TRUE; } @@ -374,14 +379,15 @@ class MyProgressDlg : public wxDialog public: bool m_Canceled; - MyProgressDlg(wxWindow *parent) : wxDialog(parent, -1, - _("Searching..."), - wxPoint(0, 0), + MyProgressDlg(wxWindow *parent) : wxDialog(parent, -1, + _("Searching..."), + wxPoint(0, 0), #ifdef __WXGTK__ - wxSize(300, 110)) + wxSize(300, 110) #else - wxSize(300, 130)) + wxSize(300, 130) #endif + ) {m_Canceled = FALSE;} void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;} DECLARE_EVENT_TABLE() @@ -392,7 +398,7 @@ END_EVENT_TABLE() #endif - + bool wxHtmlHelpController::KeywordSearch(const wxString& keyword) { int foundcnt = 0; diff --git a/src/motif/app.cpp b/src/motif/app.cpp index fbe1d763fc..8b019fdf6e 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -753,11 +753,16 @@ bool wxApp::Yield(bool onlyIfNeeded) // TODO use XmGetPixmap (?) to get the really standard icons! +// XPM hack: make the arrays const +#define static static const + #include "wx/generic/info.xpm" #include "wx/generic/error.xpm" #include "wx/generic/question.xpm" #include "wx/generic/warning.xpm" +#undef static + wxIcon wxApp::GetStdIcon(int which) const { diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 841e90bf64..0da307c8d5 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -196,10 +196,10 @@ wxString wxNativeFontInfo::ToUserString() const return GetXFontName(); } -bool wxNativeFontInfo::FromXFontName(const wxString& xFontName) +bool wxNativeFontInfo::FromXFontName(const wxString& fontname) { // TODO: we should be able to handle the font aliases here, but how? - wxStringTokenizer tokenizer(xFontName, _T("-"), wxTOKEN_STRTOK); + wxStringTokenizer tokenizer(fontname, _T("-"), wxTOKEN_STRTOK); for ( size_t n = 0; n < WXSIZEOF(fontElements); n++ ) { diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index fd9b12c731..f47319d5e3 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -490,12 +490,18 @@ void wxCondition::Broadcast() // wxThread (Posix implementation) //-------------------------------------------------------------------- +// the thread callback functions must have the C linkage +extern "C" +{ + #if HAVE_THREAD_CLEANUP_FUNCTIONS + // thread exit function + void wxPthreadCleanup(void *ptr); +#endif // HAVE_THREAD_CLEANUP_FUNCTIONS -// thread exit function -extern "C" void wxPthreadCleanup(void *ptr); +void *wxPthreadStart(void *ptr); -#endif // HAVE_THREAD_CLEANUP_FUNCTIONS +} // extern "C" class wxThreadInternal { @@ -504,7 +510,7 @@ public: ~wxThreadInternal(); // thread entry function - static void *PthreadStart(void *ptr); + static void *PthreadStart(wxThread *thread); // thread actions // start the thread @@ -600,9 +606,13 @@ private: // thread startup and exit functions // ---------------------------------------------------------------------------- -void *wxThreadInternal::PthreadStart(void *ptr) +void *wxPthreadStart(void *ptr) +{ + return wxThreadInternal::PthreadStart((wxThread *)ptr); +} + +void *wxThreadInternal::PthreadStart(wxThread *thread) { - wxThread *thread = (wxThread *)ptr; wxThreadInternal *pthread = thread->m_internal; // associate the thread pointer with the newly created thread so that @@ -622,7 +632,7 @@ void *wxThreadInternal::PthreadStart(void *ptr) #if HAVE_THREAD_CLEANUP_FUNCTIONS // install the cleanup handler which will be called if the thread is // cancelled - pthread_cleanup_push(wxPthreadCleanup, ptr); + pthread_cleanup_push(wxPthreadCleanup, thread); #endif // HAVE_THREAD_CLEANUP_FUNCTIONS // wait for the condition to be signaled from Run() @@ -1042,7 +1052,7 @@ wxThreadError wxThread::Create(unsigned int WXUNUSED(stackSize)) ( m_internal->GetIdPtr(), &attr, - wxThreadInternal::PthreadStart, + wxPthreadStart, (void *)this ); -- 2.45.2