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
This commit is contained in:
Vadim Zeitlin
2002-01-11 19:33:37 +00:00
parent 40325b2630
commit 295272bdcd
17 changed files with 116 additions and 66 deletions

View File

@@ -99,16 +99,16 @@ public :
wxInt32 m_y; wxInt32 m_y;
}; };
wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt);
wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt); inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt);
wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n);
wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n);
wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n);
wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n);
inline wxPoint2DInt::wxPoint2DInt() inline wxPoint2DInt::wxPoint2DInt()
{ {

View File

@@ -567,7 +567,6 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name)
/* Expand ~ and ~user */ /* Expand ~ and ~user */
nm = lnm; nm = lnm;
s = wxT("");
if (nm[0] == wxT('~') && !q) if (nm[0] == wxT('~') && !q)
{ {
/* prefix ~ */ /* prefix ~ */
@@ -591,7 +590,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name)
if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) { if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) {
if (was_sep) /* replace only if it was there: */ if (was_sep) /* replace only if it was there: */
*s = SEP; *s = SEP;
s = wxT(""); s = NULL;
} else { } else {
nm = nnm; nm = nnm;
s = home; s = home;

View File

@@ -205,11 +205,11 @@ bool wxHTTP::Connect(wxSockAddress& addr, bool WXUNUSED(wait))
bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req) bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
{ {
wxChar *tmp_buf; const wxChar *request;
switch (req) { switch (req) {
case wxHTTP_GET: case wxHTTP_GET:
tmp_buf = wxT("GET"); request = wxT("GET");
break; break;
default: default:
return FALSE; return FALSE;
@@ -224,7 +224,7 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
Notify(FALSE); Notify(FALSE);
wxString buf; 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); const wxWX2MBbuf pathbuf = wxConvLibc.cWX2MB(buf);
Write(pathbuf, strlen(wxMBSTRINGCAST pathbuf)); Write(pathbuf, strlen(wxMBSTRINGCAST pathbuf));
SendHeaders(); SendHeaders();

View File

@@ -69,6 +69,9 @@
# include <time.h> # include <time.h>
#include <unistd.h> #include <unistd.h>
// XPM hack: make the arrays const
#define static static const
#ifndef __DOS__ #ifndef __DOS__
#include "wx/generic/home.xpm" #include "wx/generic/home.xpm"
#endif #endif
@@ -80,6 +83,8 @@
#include "wx/generic/deffile.xpm" #include "wx/generic/deffile.xpm"
#include "wx/generic/exefile.xpm" #include "wx/generic/exefile.xpm"
#undef static
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxFileData // wxFileData
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -58,11 +58,16 @@
// XPMs // XPMs
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// XPM hack: make the arrays const
#define static static const
#ifndef __WXMSW__ #ifndef __WXMSW__
#include "wx/generic/cross.xpm" #include "wx/generic/cross.xpm"
#include "wx/generic/tick.xpm" #include "wx/generic/tick.xpm"
#endif #endif
#undef static
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// accessor functions for the bitmaps (may return NULL, check for it!) // accessor functions for the bitmaps (may return NULL, check for it!)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -198,7 +198,13 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
#if defined(__WXMSW__) || defined(__WXPM__) #if defined(__WXMSW__) || defined(__WXPM__)
wxIcon icon("wxICON_TIP"); wxIcon icon("wxICON_TIP");
#else #else
// XPM hack: make the arrays const
#define static static const
#include "wx/generic/tip.xpm" #include "wx/generic/tip.xpm"
#undef static
wxIcon icon(tipIcon); wxIcon icon(tipIcon);
#endif #endif
wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon); wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon);

View File

@@ -868,11 +868,16 @@ int wxEntry( int argc, char *argv[] )
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
// XPM hack: make the arrays const
#define static static const
#include "wx/gtk/info.xpm" #include "wx/gtk/info.xpm"
#include "wx/gtk/error.xpm" #include "wx/gtk/error.xpm"
#include "wx/gtk/question.xpm" #include "wx/gtk/question.xpm"
#include "wx/gtk/warning.xpm" #include "wx/gtk/warning.xpm"
#undef static
wxIcon wxApp::GetStdIcon(int which) const wxIcon wxApp::GetStdIcon(int which) const
{ {
switch(which) switch(which)

View File

@@ -84,7 +84,7 @@ struct wxlistbox_idle_struct
gint m_tag; 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; wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata;
gdk_threads_enter(); gdk_threads_enter();

View File

@@ -3755,7 +3755,7 @@ static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
static gint gs_pop_x = 0; static gint gs_pop_x = 0;
static gint gs_pop_y = 0; static gint gs_pop_y = 0;
static void wxPopupMenuPositionCallback( GtkMenu *menu, extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu,
gint *x, gint *y, gint *x, gint *y,
gpointer WXUNUSED(user_data) ) gpointer WXUNUSED(user_data) )
{ {

View File

@@ -868,11 +868,16 @@ int wxEntry( int argc, char *argv[] )
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
// XPM hack: make the arrays const
#define static static const
#include "wx/gtk/info.xpm" #include "wx/gtk/info.xpm"
#include "wx/gtk/error.xpm" #include "wx/gtk/error.xpm"
#include "wx/gtk/question.xpm" #include "wx/gtk/question.xpm"
#include "wx/gtk/warning.xpm" #include "wx/gtk/warning.xpm"
#undef static
wxIcon wxApp::GetStdIcon(int which) const wxIcon wxApp::GetStdIcon(int which) const
{ {
switch(which) switch(which)

View File

@@ -84,7 +84,7 @@ struct wxlistbox_idle_struct
gint m_tag; 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; wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata;
gdk_threads_enter(); gdk_threads_enter();

View File

@@ -3755,7 +3755,7 @@ static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
static gint gs_pop_x = 0; static gint gs_pop_x = 0;
static gint gs_pop_y = 0; static gint gs_pop_y = 0;
static void wxPopupMenuPositionCallback( GtkMenu *menu, extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu,
gint *x, gint *y, gint *x, gint *y,
gpointer WXUNUSED(user_data) ) gpointer WXUNUSED(user_data) )
{ {

View File

@@ -55,6 +55,9 @@
// Bitmaps: // Bitmaps:
#ifndef __WXMSW__ #ifndef __WXMSW__
// XPM hack: make the arrays const
#define static static const
#include "bitmaps/wpanel.xpm" #include "bitmaps/wpanel.xpm"
#include "bitmaps/wback.xpm" #include "bitmaps/wback.xpm"
#include "bitmaps/wforward.xpm" #include "bitmaps/wforward.xpm"
@@ -71,8 +74,9 @@
#include "bitmaps/wdown.xpm" #include "bitmaps/wdown.xpm"
#include "bitmaps/wopen.xpm" #include "bitmaps/wopen.xpm"
#include "bitmaps/wprint.xpm" #include "bitmaps/wprint.xpm"
#endif
#undef static
#endif // __WXMSW__
// what is considered "small index"? // what is considered "small index"?
#define INDEX_IS_SMALL 100 #define INDEX_IS_SMALL 100

View File

@@ -42,12 +42,17 @@ file is only left to point out the problem and will be removed r.s.n.
// Bitmaps: // Bitmaps:
#ifndef __WXMSW__ #ifndef __WXMSW__
// XPM hack: make the arrays const
#define static static const
#include "bitmaps/panel.xpm" #include "bitmaps/panel.xpm"
#include "bitmaps/back.xpm" #include "bitmaps/back.xpm"
#include "bitmaps/forward.xpm" #include "bitmaps/forward.xpm"
#include "bitmaps/book.xpm" #include "bitmaps/book.xpm"
#include "bitmaps/folder.xpm" #include "bitmaps/folder.xpm"
#include "bitmaps/page.xpm" #include "bitmaps/page.xpm"
#undef static
#endif #endif
#include "search.h" #include "search.h"
@@ -378,10 +383,11 @@ class MyProgressDlg : public wxDialog
_("Searching..."), _("Searching..."),
wxPoint(0, 0), wxPoint(0, 0),
#ifdef __WXGTK__ #ifdef __WXGTK__
wxSize(300, 110)) wxSize(300, 110)
#else #else
wxSize(300, 130)) wxSize(300, 130)
#endif #endif
)
{m_Canceled = FALSE;} {m_Canceled = FALSE;}
void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;} void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;}
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@@ -753,11 +753,16 @@ bool wxApp::Yield(bool onlyIfNeeded)
// TODO use XmGetPixmap (?) to get the really standard icons! // 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/info.xpm"
#include "wx/generic/error.xpm" #include "wx/generic/error.xpm"
#include "wx/generic/question.xpm" #include "wx/generic/question.xpm"
#include "wx/generic/warning.xpm" #include "wx/generic/warning.xpm"
#undef static
wxIcon wxIcon
wxApp::GetStdIcon(int which) const wxApp::GetStdIcon(int which) const
{ {

View File

@@ -196,10 +196,10 @@ wxString wxNativeFontInfo::ToUserString() const
return GetXFontName(); 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? // 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++ ) for ( size_t n = 0; n < WXSIZEOF(fontElements); n++ )
{ {

View File

@@ -490,13 +490,19 @@ void wxCondition::Broadcast()
// wxThread (Posix implementation) // wxThread (Posix implementation)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// the thread callback functions must have the C linkage
extern "C"
{
#if HAVE_THREAD_CLEANUP_FUNCTIONS #if HAVE_THREAD_CLEANUP_FUNCTIONS
// thread exit function // thread exit function
extern "C" void wxPthreadCleanup(void *ptr); void wxPthreadCleanup(void *ptr);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // HAVE_THREAD_CLEANUP_FUNCTIONS
void *wxPthreadStart(void *ptr);
} // extern "C"
class wxThreadInternal class wxThreadInternal
{ {
public: public:
@@ -504,7 +510,7 @@ public:
~wxThreadInternal(); ~wxThreadInternal();
// thread entry function // thread entry function
static void *PthreadStart(void *ptr); static void *PthreadStart(wxThread *thread);
// thread actions // thread actions
// start the thread // start the thread
@@ -600,9 +606,13 @@ private:
// thread startup and exit functions // 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; wxThreadInternal *pthread = thread->m_internal;
// associate the thread pointer with the newly created thread so that // 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 #if HAVE_THREAD_CLEANUP_FUNCTIONS
// install the cleanup handler which will be called if the thread is // install the cleanup handler which will be called if the thread is
// cancelled // cancelled
pthread_cleanup_push(wxPthreadCleanup, ptr); pthread_cleanup_push(wxPthreadCleanup, thread);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // HAVE_THREAD_CLEANUP_FUNCTIONS
// wait for the condition to be signaled from Run() // wait for the condition to be signaled from Run()
@@ -1042,7 +1052,7 @@ wxThreadError wxThread::Create(unsigned int WXUNUSED(stackSize))
( (
m_internal->GetIdPtr(), m_internal->GetIdPtr(),
&attr, &attr,
wxThreadInternal::PthreadStart, wxPthreadStart,
(void *)this (void *)this
); );