From 489f6cf713b6b5bd9746af238b260c7d13d1dc40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 24 Mar 2005 20:01:55 +0000 Subject: [PATCH] Fix for ambiguities which happen in STL=1 mode under DigitalMars C++. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- demos/poem/wxpoem.cpp | 2 +- src/common/filefn.cpp | 4 ++-- src/common/filename.cpp | 6 +++--- src/common/fs_inet.cpp | 4 ++-- src/common/fs_zip.cpp | 10 +++++----- src/common/variant.cpp | 4 ++-- src/msw/dcprint.cpp | 2 +- src/msw/tabctrl.cpp | 2 +- src/msw/tbar95.cpp | 6 +++--- tests/archive/archivetest.cpp | 4 ++-- utils/tex2rtf/src/tex2any.cpp | 2 +- utils/tex2rtf/src/tex2rtf.cpp | 12 ++++++------ 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp index 0b05f793cc..f4a749d17c 100644 --- a/demos/poem/wxpoem.cpp +++ b/demos/poem/wxpoem.cpp @@ -486,7 +486,7 @@ void MainWindow::Search(bool ask) if (ask || m_searchString.empty()) { wxString s = wxGetTextFromUser( _T("Enter search string"), _T("Search"), m_searchString); - if (s != wxEmptyString) + if (!s.empty()) { s.MakeLower(); m_searchString = s; diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 3434d5aaa0..55aa0e7ce8 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -673,7 +673,7 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin const wxChar *val; #ifndef __WXWINCE__ wxChar *tcp; - if (envname != WXSTRINGCAST NULL && (val = wxGetenv (WXSTRINGCAST envname)) != NULL && + if (!envname.empty() && (val = wxGetenv (WXSTRINGCAST envname)) != NULL && (tcp = wxStrstr (dest, val)) != NULL) { wxStrcpy (wxFileFunctionsBuffer, tcp + wxStrlen (val)); @@ -1734,7 +1734,7 @@ int WXDLLEXPORT wxParseCommonDialogsFilter(const wxString& filterStr, wxArrayStr // autocompletion for( size_t j = 0 ; j < descriptions.GetCount() ; j++ ) { - if ( descriptions[j] == wxEmptyString && filters[j] != wxEmptyString ) + if ( descriptions[j].empty() && !filters[j].empty() ) { descriptions[j].Printf(_("Files (%s)"), filters[j].c_str()); } diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 7582c0ef10..c85163a67c 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -1056,7 +1056,7 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe bool success = false; // Assume it's not a shortcut if it doesn't end with lnk - if (ext.Lower() != wxT("lnk")) + if (ext.CmpNoCase(wxT("lnk"))!=0) return false; // create a ShellLink object @@ -1453,7 +1453,7 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const } // convert back from ".." to nothing - if ( m_dirs[i] != wxT("..") ) + if ( !m_dirs[i].IsSameAs(wxT("..")) ) fullpath += m_dirs[i]; break; @@ -1470,7 +1470,7 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const // TODO: What to do with ".." under VMS // convert back from ".." to nothing - if ( m_dirs[i] != wxT("..") ) + if ( !m_dirs[i].IsSameAs(wxT("..")) ) fullpath += m_dirs[i]; break; } diff --git a/src/common/fs_inet.cpp b/src/common/fs_inet.cpp index f2add64583..033b1d7b55 100644 --- a/src/common/fs_inet.cpp +++ b/src/common/fs_inet.cpp @@ -67,11 +67,11 @@ protected: static wxString StripProtocolAnchor(const wxString& location) { wxString myloc(location.BeforeLast(wxT('#'))); - if (myloc.IsEmpty()) myloc = location.AfterFirst(wxT(':')); + if (myloc.empty()) myloc = location.AfterFirst(wxT(':')); else myloc = myloc.AfterFirst(wxT(':')); // fix malformed url: - if (myloc.Left(2) != wxT("//")) + if (!myloc.Left(2).IsSameAs(wxT("//"))) { if (myloc.GetChar(0) != wxT('/')) myloc = wxT("//") + myloc; else myloc = wxT("/") + myloc; diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index d2210718ce..eb61864d7c 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -83,7 +83,7 @@ wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& l wxString left = GetLeftLocation(location); wxInputStream *s; - if (GetProtocol(left) != wxT("file")) + if (!GetProtocol(left).IsSameAs(wxT("file"))) { wxLogError(_("ZIP handler currently supports only local files!")); return NULL; @@ -133,7 +133,7 @@ wxString wxZipFSHandler::FindFirst(const wxString& spec, int flags) m_Archive = NULL; } - if (GetProtocol(left) != wxT("file")) + if (!GetProtocol(left).IsSameAs(wxT("file"))) { wxLogError(_("ZIP handler currently supports only local files!")); return wxEmptyString; @@ -203,14 +203,14 @@ wxString wxZipFSHandler::DoFind() if (m_AllowDirs) { dir = namestr.BeforeLast(wxT('/')); - while (!dir.IsEmpty()) + while (!dir.empty()) { if( m_DirsFound->find(dir) == m_DirsFound->end() ) { (*m_DirsFound)[dir] = 1; filename = dir.AfterLast(wxT('/')); dir = dir.BeforeLast(wxT('/')); - if (!filename.IsEmpty() && m_BaseDir == dir && + if (!filename.empty() && m_BaseDir == dir && wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename; } @@ -221,7 +221,7 @@ wxString wxZipFSHandler::DoFind() filename = namestr.AfterLast(wxT('/')); dir = namestr.BeforeLast(wxT('/')); - if (m_AllowFiles && !filename.IsEmpty() && m_BaseDir == dir && + if (m_AllowFiles && !filename.empty() && m_BaseDir == dir && wxMatchWild(m_Pattern, filename, false)) match = m_ZipFile + wxT("#zip:") + namestr; } diff --git a/src/common/variant.cpp b/src/common/variant.cpp index bbfd8f4688..466d359830 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -304,7 +304,7 @@ bool wxVariantDataStringList::Read(wxString& WXUNUSED(str)) return false; } -#endif //2.4 compat +#endif //2.4 compat /* * wxVariantDataLong @@ -1994,7 +1994,7 @@ void wxVariant::ClearList() } else { - if (GetType() != wxT("list")) + if (!GetType().IsSameAs(wxT("list"))) { delete m_data; m_data = NULL; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index bbfd69e358..5c90a1f9e5 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -275,7 +275,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) GlobalFree(pd.hDevMode); pd.hDevMode=NULL; } - return ( deviceName != wxEmptyString ); + return ( !deviceName.empty() ); } // Gets an HDC for the specified printer configuration diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index 686f25018d..ed230ba329 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -297,7 +297,7 @@ bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* da TC_ITEM tcItem; tcItem.mask = TCIF_PARAM; tcItem.lParam = (long) data; - if (text != wxEmptyString) + if (!text.empty()) { tcItem.mask |= TCIF_TEXT; wxStrcpy(buf, (const wxChar*) text); diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 2dfd130a58..b6403a3b85 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -583,7 +583,7 @@ bool wxToolBar::Realize() dcAllButtons.SetBackground(*wxTRANSPARENT_BRUSH); else dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH); -#endif +#endif dcAllButtons.Clear(); m_hBitmap = bitmap.GetHBITMAP(); @@ -1088,7 +1088,7 @@ wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, { wxToolBarToolsList::compatibility_iterator current = tools.GetFirst(); - for ( ; current != 0; current = current->GetNext() ) + for ( ; current ; current = current->GetNext() ) { if ( index == 0 ) return current->GetData(); @@ -1251,7 +1251,7 @@ void wxToolBar::OnEraseBackground(wxEraseEvent& event) event.Skip(); return; } - + // notice that this 'dumb' implementation may cause flicker for some of the // controls in which case they should intercept wxEraseEvent and process it // themselves somehow diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index 39ac515f25..dd04edd3aa 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -320,7 +320,7 @@ private: TempDir::TempDir() { wxString tmp = wxFileName::CreateTempFileName(_T("arctest-")); - if (tmp != wxEmptyString) { + if (!tmp.empty()) { wxRemoveFile(tmp); m_original = wxGetCwd(); CPPUNIT_ASSERT(wxMkdir(tmp, 0700)); @@ -331,7 +331,7 @@ TempDir::TempDir() TempDir::~TempDir() { - if (m_tmp != wxEmptyString) { + if (!m_tmp.empty()) { wxSetWorkingDirectory(m_original); RemoveDir(m_tmp); } diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 9823d10e4b..24eb931520 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -813,7 +813,7 @@ bool read_a_line(wxChar *buf) if (checkSyntax) { wxString bufStr = buf; - for (int index=0; syntaxTokens[index] != wxEmptyString; index++) + for (int index=0; !syntaxTokens[index].empty(); index++) { size_t pos = bufStr.find(syntaxTokens[index]); if (pos != wxString::npos && pos != 0) diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 9cd01d893f..83b624cab4 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -398,7 +398,7 @@ bool MyApp::OnInit() */ wxString path = TexPathList.FindValidPath(MacroFile); - if (path != _T("")) + if (!path.empty()) ReadCustomMacros((wxChar *)path.c_str()); #if wxUSE_STATUSBAR @@ -434,7 +434,7 @@ bool MyApp::OnInit() */ wxString path = TexPathList.FindValidPath(MacroFile); - if (path != _T("")) + if (!path.empty()) ReadCustomMacros((wxChar*)path.c_str()); Go(); @@ -743,7 +743,7 @@ void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event)) { textWindow->Clear(); wxString s = wxFileSelector(_T("Choose custom macro file"), wxPathOnly(MacroFile), wxFileNameFromPath(MacroFile), _T("ini"), _T("*.ini")); - if (s != _T("") && wxFileExists(s)) + if (!s.empty() && wxFileExists(s)) { MacroFile = copystring(s); ReadCustomMacros((wxChar *)s.c_str()); @@ -862,7 +862,7 @@ void ChooseInputFile(bool force) if (force || !InputFile) { wxString s = wxFileSelector(_T("Choose LaTeX input file"), wxPathOnly(InputFile), wxFileNameFromPath(InputFile), _T("tex"), _T("*.tex")); - if (s != _T("")) + if (!s.empty()) { // Different file, so clear index entries. ClearKeyWordTable(); @@ -916,7 +916,7 @@ void ChooseOutputFile(bool force) { wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile), extensionBuf, wildBuf); - if (s != _T("")) + if (!s.empty()) OutputFile = copystring(s); } } @@ -971,7 +971,7 @@ bool Go(void) if (!bulletFile) { wxString s = TexPathList.FindValidPath(_T("bullet.bmp")); - if (s != _T("")) + if (!s.empty()) { wxString str = wxFileNameFromPath(s); bulletFile = copystring(str); -- 2.45.2