]> git.saurik.com Git - wxWidgets.git/commitdiff
fix memory leak in wxGetTempFileName(const wxString&, wxString&) overload; also defin...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 19 Oct 2006 11:58:48 +0000 (11:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 19 Oct 2006 11:58:48 +0000 (11:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/filefn.cpp

index df91e1cb4e3f9a4417237f0e9af09cdefb0f7bf9..004dc02158be4dce46c5d46d0ab772a10ec1adf2 100644 (file)
@@ -1280,9 +1280,8 @@ bool wxDirExists(const wxChar *pszPathName)
 // Get a temporary filename, opening and closing the file.
 wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
 {
-#if wxUSE_FILE
-    wxString filename = wxFileName::CreateTempFileName(prefix);
-    if ( filename.empty() )
+    wxString filename;
+    if ( !wxGetTempFileName(prefix, filename) )
         return NULL;
 
     if ( buf )
@@ -1291,19 +1290,20 @@ wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
         buf = MYcopystring(filename);
 
     return buf;
-#else
-    wxUnusedVar(prefix);
-    wxUnusedVar(buf);
-    // wxFileName::CreateTempFileName needs wxFile class enabled
-    return NULL;
-#endif
 }
 
 bool wxGetTempFileName(const wxString& prefix, wxString& buf)
 {
+#if wxUSE_FILE
     buf = wxGetTempFileName(prefix);
 
     return !buf.empty();
+#else // !wxUSE_FILE
+    wxUnusedVar(prefix);
+    wxUnusedVar(buf);
+
+    return false;
+#endif // wxUSE_FILE/!wxUSE_FILE
 }
 
 // Get first file name matching given wild card.