From 6164d85e896743b16a0cf8b0610f5d17ceb47f36 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 25 Nov 1998 12:01:23 +0000 Subject: [PATCH] Various fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/confbase.h | 10 +--------- include/wx/list.h | 23 +++++------------------ include/wx/msw/setup.h | 14 +------------- include/wx/msw/taskbar.h | 2 +- include/wx/textfile.h | 15 ++------------- src/common/config.cpp | 10 ++++++++++ src/common/list.cpp | 17 +++++++++++++++++ src/common/string.cpp | 10 ++++++++++ src/common/textfile.cpp | 15 +++++++++++++++ src/msw/makefile.b32 | 5 +++-- src/msw/makefile.nt | 2 +- utils/ogl/src/misc.cpp | 4 ++-- 12 files changed, 68 insertions(+), 59 deletions(-) diff --git a/include/wx/confbase.h b/include/wx/confbase.h index e7ed119cb8..2ce903fec7 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -208,15 +208,7 @@ public: void SetRecordDefaults(bool bDoIt = TRUE) { m_bRecordDefaults = bDoIt; } bool IsRecordingDefaults() const { return m_bRecordDefaults; } // does expansion only if needed - wxString ExpandEnvVars(const wxString& str) const - { - wxString tmp; // Required for BC++ - if (IsExpandingEnvVars()) - tmp = wxExpandEnvVars(str); - else - tmp = str; - return tmp; - } + wxString ExpandEnvVars(const wxString& str) const; // misc accessors inline wxString GetAppName() const { return m_appName; } diff --git a/include/wx/list.h b/include/wx/list.h index afda75ffce..dc52fc248c 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -106,23 +106,10 @@ public: long GetNumber() const { wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; } - // comparaison - bool operator==(wxListKeyValue value) const - { - switch ( m_keyType ) - { - default: - wxFAIL_MSG("bad key type."); - // let compiler optimize the line above away in release build - // by not putting return here... - - case wxKEY_STRING: - return strcmp(m_key.string, value.string) == 0; - - case wxKEY_INTEGER: - return m_key.integer == value.integer; - } - } + // comparison + // Note: implementation moved to list.cpp to prevent BC++ inline + // expansion warning. + bool operator==(wxListKeyValue value) const ; // dtor ~wxListKey() @@ -267,7 +254,7 @@ protected: // this function allows the sorting of arbitrary lists by giving // a function to compare two list elements. The list is sorted in place. - void Sort(wxSortCompareFunction compfunc); + void Sort(const wxSortCompareFunction compfunc); // functions for iterating over the list void *FirstThat(wxListIterateFunction func); diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index d8db707bba..5aacae2c3c 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -78,16 +78,10 @@ #define wxUSE_SCROLLBAR 1 // Define 1 to compile contributed wxScrollBar class -#define wxUSE_XPM_IN_X 1 -#define wxUSE_XPM_IN_MSW 1 +#define wxUSE_XPM_IN_MSW 0 // Define 1 to support the XPM package in wxBitmap, // separated by platform. If 1, you must link in // the XPM library to your applications. -#define wxUSE_IMAGE_LOADING_IN_X 1 - // Use dynamic icon/bitmap loading/saving code in utils/image under X. - // If this is 1, you will need to link your applications - // with image_X.lib. where X is motif, ol, or hp. - #define wxUSE_IMAGE_LOADING_IN_MSW 1 // Use dynamic DIB loading/saving code in utils/dib under MSW. #define wxUSE_RESOURCE_LOADING_IN_MSW 1 @@ -96,12 +90,6 @@ #define wxUSE_WX_RESOURCES 1 // Use .wxr resource mechanism (requires PrologIO library) -#define wxUSE_GNU_WXSTRING 0 - // Define 1 to use modified GNU wxString class - // from (stefan.hammes@urz.uni-heidelberg.de) in contrib\string - // TODO: why does this give an unresolved 'wxRegex::Search' - // symbol if 1? - #define HAVE_SOCKET 1 // Use WinSock if 1 #define wxUSE_DOC_VIEW_ARCHITECTURE 1 diff --git a/include/wx/msw/taskbar.h b/include/wx/msw/taskbar.h index 4e0abf0d70..6b177b4697 100644 --- a/include/wx/msw/taskbar.h +++ b/include/wx/msw/taskbar.h @@ -61,7 +61,7 @@ protected: static bool sm_registeredClass; static unsigned int sm_taskbarMsg; - DECLARE_EVENT_TABLE(); + DECLARE_EVENT_TABLE() }; diff --git a/include/wx/textfile.h b/include/wx/textfile.h index 2433f02c58..3ac74cfc2a 100644 --- a/include/wx/textfile.h +++ b/include/wx/textfile.h @@ -108,19 +108,8 @@ public: bool Write(Type typeNew = Type_None); // get the file termination string - inline static const char *GetEOL(Type type = typeDefault) - { - switch ( type ) { - case Type_None: return ""; - case Type_Unix: return "\n"; - case Type_Dos: return "\r\n"; - case Type_Mac: return "\r"; - - default: - wxFAIL_MSG("bad file type in wxTextFile::GetEOL."); - return (const char *) NULL; - } - } + // Note: implementation moved to textfile to prevent warning due to switch. + static const char *GetEOL(Type type = typeDefault); // dtor ~wxTextFile(); diff --git a/src/common/config.cpp b/src/common/config.cpp index 5aac22351b..6a4eff0b33 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -210,6 +210,16 @@ bool wxConfigBase::Write(const wxString& key, bool value) return Write(key, l); } +wxString wxConfigBase::ExpandEnvVars(const wxString& str) const + { + wxString tmp; // Required for BC++ + if (IsExpandingEnvVars()) + tmp = wxExpandEnvVars(str); + else + tmp = str; + return tmp; + } + // ---------------------------------------------------------------------------- // wxConfigPathChanger diff --git a/src/common/list.cpp b/src/common/list.cpp index 730134ae7d..f7b1ab0543 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -440,6 +440,23 @@ void wxListBase::Sort(const wxSortCompareFunction compfunc) delete[] objArray; } +bool wxListKey::operator==(wxListKeyValue value) const + { + switch ( m_keyType ) + { + default: + wxFAIL_MSG("bad key type."); + // let compiler optimize the line above away in release build + // by not putting return here... + + case wxKEY_STRING: + return strcmp(m_key.string, value.string) == 0; + + case wxKEY_INTEGER: + return m_key.integer == value.integer; + } + } + // ----------------------------------------------------------------------------- // wxList (a.k.a. wxObjectList) // ----------------------------------------------------------------------------- diff --git a/src/common/string.cpp b/src/common/string.cpp index 84b2bb5549..cb949eb688 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -923,6 +923,15 @@ int wxString::Printf(const char *pszFormat, ...) int wxString::PrintfV(const char* pszFormat, va_list argptr) { +#ifdef __BORLANDC__ + static char s_szScratch[1024]; + + int iLen = vsprintf(s_szScratch, pszFormat, argptr); + AllocBeforeWrite(iLen); + strcpy(m_pchData, s_szScratch); + + return iLen; +#else #ifdef __WXMSW__ #ifdef _MSC_VER #define wxVsprintf _vsnprintf @@ -972,6 +981,7 @@ int wxString::PrintfV(const char* pszFormat, va_list argptr) free(buffer); return iLen; +#endif } // ---------------------------------------------------------------------------- diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index 711b8de6ef..c09b7e8647 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -232,3 +232,18 @@ bool wxTextFile::Write(Type typeNew) // replace the old file with this one return fileTmp.Commit(); } + +const char *wxTextFile::GetEOL(Type type) + { + switch ( type ) { + case Type_None: return ""; + case Type_Unix: return "\n"; + case Type_Dos: return "\r\n"; + case Type_Mac: return "\r"; + + default: + wxFAIL_MSG("bad file type in wxTextFile::GetEOL."); + return (const char *) NULL; + } + } + diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index f0429cb5e6..ae581ed5f8 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -79,8 +79,6 @@ GENERICOBJS= \ $(MSWDIR)\laywin.obj \ $(MSWDIR)\msgdlgg.obj \ $(MSWDIR)\panelg.obj \ - $(MSWDIR)\printps.obj \ - $(MSWDIR)\prntdlgg.obj \ $(MSWDIR)\sashwin.obj \ $(MSWDIR)\scrolwin.obj \ $(MSWDIR)\splitter.obj \ @@ -88,6 +86,9 @@ GENERICOBJS= \ $(MSWDIR)\tabg.obj \ $(MSWDIR)\textdlgg.obj +# $(MSWDIR)\printps.obj \ +# $(MSWDIR)\prntdlgg.obj \ + COMMONOBJS = \ $(MSWDIR)\config.obj \ $(MSWDIR)\cmndata.obj \ diff --git a/src/msw/makefile.nt b/src/msw/makefile.nt index a8eb8fa988..efc18040c8 100644 --- a/src/msw/makefile.nt +++ b/src/msw/makefile.nt @@ -309,7 +309,7 @@ $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ $(MSWDIR)/app.obj: $*.$(SRCSUFF) cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ +$(CPPFLAGS) /D__NO_VC_CRTDBG__ /c /Tp $*.$(SRCSUFF) /Fo$@ << $(MSWDIR)/bitmap.obj: $*.$(SRCSUFF) diff --git a/utils/ogl/src/misc.cpp b/utils/ogl/src/misc.cpp index 4c0008ea14..50ed2669dc 100644 --- a/utils/ogl/src/misc.cpp +++ b/utils/ogl/src/misc.cpp @@ -444,12 +444,12 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double { word[j] = 0; j = 0; - word_list.Append((wxObject *)copystring(word)); + word_list.Add(word); end_word = FALSE; } if (new_line) { - word_list.Append((wxObject *)NULL); + word_list.Append(NULL); new_line = FALSE; } } -- 2.47.2