]> git.saurik.com Git - wxWidgets.git/commitdiff
Use wxWcslen instead of wcslen.
authorMattia Barbon <mbarbon@cpan.org>
Fri, 27 Dec 2002 21:39:58 +0000 (21:39 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Fri, 27 Dec 2002 21:39:58 +0000 (21:39 +0000)
  Work around a compiler bug: with (at least) GCC 2.95.3-5 under Cygwin,
the destructor for the global s_fileInfo is called twice (!). This does
hot happen if a function returning a reference to a static variable is
used.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/ole/dataobj.cpp
src/msw/volume.cpp

index 3c66ba49e0fab66537bf9364c1514e561053afdd..7e2d2132a85efbdeedb3744482eddef7189b8729 100644 (file)
@@ -474,7 +474,7 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc,
     || ( defined(__MWERKS__) && defined(__WXMSW__) )
                         size = std::wcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
 #else
     || ( defined(__MWERKS__) && defined(__WXMSW__) )
                         size = std::wcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
 #else
-                        size = ::wcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
+                        size = wxWcslen((const wchar_t *)pBuf) * sizeof(wchar_t);
 #endif
                         break;
 #endif
 #endif
                         break;
 #endif
index 6f4ada640da68b87de99b03a3073982d57be760d..628dc4e66ca94f85a8807e17991a5aef7f077201 100644 (file)
@@ -102,7 +102,7 @@ static WNetCloseEnumPtr s_pWNetCloseEnum;
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 static long s_cancelSearch = FALSE;
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 static long s_cancelSearch = FALSE;
 
-struct FileInfo : public wxObject
+struct FileInfo
 {
     FileInfo(unsigned flag=0, wxFSVolumeKind type=wxFS_VOL_OTHER) :
         m_flags(flag), m_type(type) {}
 {
     FileInfo(unsigned flag=0, wxFSVolumeKind type=wxFS_VOL_OTHER) :
         m_flags(flag), m_type(type) {}
@@ -119,7 +119,14 @@ struct FileInfo : public wxObject
     wxFSVolumeKind m_type;
 };
 WX_DECLARE_STRING_HASH_MAP(FileInfo, FileInfoMap);
     wxFSVolumeKind m_type;
 };
 WX_DECLARE_STRING_HASH_MAP(FileInfo, FileInfoMap);
-static FileInfoMap s_fileInfo(25);
+// Cygwin bug (?) destructor for global s_fileInfo is called twice...
+static FileInfoMap& GetFileInfoMap()
+{
+    static FileInfoMap s_fileInfo(25);
+
+    return s_fileInfo;
+}
+#define s_fileInfo (GetFileInfoMap())
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 // Other initialization.
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 // Other initialization.