s/wxGetTempFileName/wxFileName::CreateTempFileName

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-07 01:01:35 +00:00
parent 0b52925bf9
commit a51e601e17
4 changed files with 19 additions and 22 deletions

View File

@@ -30,6 +30,7 @@
#endif
#include "wx/metafile.h"
#include "wx/filename.h"
#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH)
@@ -392,9 +393,11 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i
FILE *fd = wxFopen(filename.fn_str(), _T("rb"));
if (!fd) return false;
wxChar tempFileBuf[256];
wxGetTempFileName(wxT("mf"), tempFileBuf);
FILE *fHandle = wxFopen(wxFNCONV(tempFileBuf), _T("wb"));
wxString tempFileBuf = wxFileName::CreateTempFileName(wxT("mf"));
if (tempFileBuf.empty())
return false;
FILE *fHandle = wxFopen(tempFileBuf.fn_str(), _T("wb"));
if (!fHandle)
return false;
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);

View File

@@ -5905,7 +5905,7 @@ wxRichTextFileHandler *wxRichTextBuffer::FindHandlerFilenameOrType(const wxStrin
else if (!filename.IsEmpty())
{
wxString path, file, ext;
wxSplitPath(filename, & path, & file, & ext);
wxFileName::SplitPath(filename, & path, & file, & ext);
return FindHandler(ext, imageType);
}
else
@@ -7303,7 +7303,7 @@ bool wxRichTextFileHandler::SaveFile(wxRichTextBuffer *buffer, const wxString& f
bool wxRichTextFileHandler::CanHandle(const wxString& filename) const
{
wxString path, file, ext;
wxSplitPath(filename, & path, & file, & ext);
wxFileName::SplitPath(filename, & path, & file, & ext);
return (ext.Lower() == GetExtension());
}
@@ -7424,12 +7424,10 @@ bool wxRichTextImageBlock::MakeImageBlock(const wxString& filename, wxBitmapType
if ((imageType != wxBITMAP_TYPE_JPEG) && convertToJPEG)
{
wxString tempFile;
bool success = wxGetTempFileName(_("image"), tempFile) ;
wxString tempFile =
wxFileName::CreateTempFileName(_("image"));
wxASSERT(success);
wxUnusedVar(success);
wxASSERT(!tempFile.IsEmpty());
image.SaveFile(tempFile, wxBITMAP_TYPE_JPEG);
filenameToRead = tempFile;
@@ -7464,11 +7462,8 @@ bool wxRichTextImageBlock::MakeImageBlock(wxImage& image, wxBitmapType imageType
if (imageType == wxBITMAP_TYPE_INVALID)
return false; // Could not determine image type
wxString tempFile;
bool success = wxGetTempFileName(_("image"), tempFile) ;
wxASSERT(success);
wxUnusedVar(success);
wxString tempFile = wxFileName::CreateTempFileName(_("image")) ;
wxASSERT(!tempFile.IsEmpty());
if (!image.SaveFile(tempFile, m_imageType))
{
@@ -7535,9 +7530,8 @@ bool wxRichTextImageBlock::Load(wxImage& image)
wxMemoryInputStream mstream(m_data, m_dataSize);
bool success = image.LoadFile(mstream, GetImageType());
#else
wxString tempFile;
bool success = wxGetTempFileName(_("image"), tempFile) ;
wxASSERT(success);
wxString tempFile = wxFileName::CreateTempFileName(_("image"));
wxASSERT(!tempFile.IsEmpty());
if (!WriteBlock(tempFile, m_data, m_dataSize))
{

View File

@@ -26,7 +26,7 @@
#include "wx/timer.h"
#endif // !PCH
#include "wx/filefn.h"
#include "wx/filename.h"
#include "wx/ffile.h"
#include "wx/process.h"
#include "wx/crt.h"
@@ -673,7 +673,7 @@ wxDialUpManagerImpl::CheckIfconfig()
wxASSERT_MSG( m_IfconfigPath.length(),
_T("can't use ifconfig if it wasn't found") );
wxString tmpfile = wxGetTempFileName( wxT("_wxdialuptest") );
wxString tmpfile = wxFileName::CreateTempFileName( wxT("_wxdialuptest") );
wxString cmd = wxT("/bin/sh -c \'");
cmd << m_IfconfigPath;
#if defined(__AIX__) || \

View File

@@ -21,7 +21,7 @@
#include "wx/event.h"
#include "wx/net.h"
#include "wx/timer.h"
#include "wx/filefn.h"
#include "wx/filename.h"
#include "wx/utils.h"
#include "wx/log.h"
#include "wx/file.h"
@@ -323,7 +323,7 @@ wxDialUpManagerImpl::CheckStatusInternal(void)
{
wxASSERT(m_IfconfigPath.length());
wxString tmpfile = wxGetTempFileName("_wxdialuptest");
wxString tmpfile = wxFileName::CreateTempFileName("_wxdialuptest");
wxString cmd = "/bin/sh -c \'";
cmd << m_IfconfigPath << " >" << tmpfile << '\'';
/* I tried to add an option to wxExecute() to not close stdout,