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:
@@ -30,6 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
|
#include "wx/filename.h"
|
||||||
|
|
||||||
#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH)
|
#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"));
|
FILE *fd = wxFopen(filename.fn_str(), _T("rb"));
|
||||||
if (!fd) return false;
|
if (!fd) return false;
|
||||||
|
|
||||||
wxChar tempFileBuf[256];
|
wxString tempFileBuf = wxFileName::CreateTempFileName(wxT("mf"));
|
||||||
wxGetTempFileName(wxT("mf"), tempFileBuf);
|
if (tempFileBuf.empty())
|
||||||
FILE *fHandle = wxFopen(wxFNCONV(tempFileBuf), _T("wb"));
|
return false;
|
||||||
|
|
||||||
|
FILE *fHandle = wxFopen(tempFileBuf.fn_str(), _T("wb"));
|
||||||
if (!fHandle)
|
if (!fHandle)
|
||||||
return false;
|
return false;
|
||||||
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
|
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
|
||||||
|
@@ -5905,7 +5905,7 @@ wxRichTextFileHandler *wxRichTextBuffer::FindHandlerFilenameOrType(const wxStrin
|
|||||||
else if (!filename.IsEmpty())
|
else if (!filename.IsEmpty())
|
||||||
{
|
{
|
||||||
wxString path, file, ext;
|
wxString path, file, ext;
|
||||||
wxSplitPath(filename, & path, & file, & ext);
|
wxFileName::SplitPath(filename, & path, & file, & ext);
|
||||||
return FindHandler(ext, imageType);
|
return FindHandler(ext, imageType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -7303,7 +7303,7 @@ bool wxRichTextFileHandler::SaveFile(wxRichTextBuffer *buffer, const wxString& f
|
|||||||
bool wxRichTextFileHandler::CanHandle(const wxString& filename) const
|
bool wxRichTextFileHandler::CanHandle(const wxString& filename) const
|
||||||
{
|
{
|
||||||
wxString path, file, ext;
|
wxString path, file, ext;
|
||||||
wxSplitPath(filename, & path, & file, & ext);
|
wxFileName::SplitPath(filename, & path, & file, & ext);
|
||||||
|
|
||||||
return (ext.Lower() == GetExtension());
|
return (ext.Lower() == GetExtension());
|
||||||
}
|
}
|
||||||
@@ -7424,12 +7424,10 @@ bool wxRichTextImageBlock::MakeImageBlock(const wxString& filename, wxBitmapType
|
|||||||
|
|
||||||
if ((imageType != wxBITMAP_TYPE_JPEG) && convertToJPEG)
|
if ((imageType != wxBITMAP_TYPE_JPEG) && convertToJPEG)
|
||||||
{
|
{
|
||||||
wxString tempFile;
|
wxString tempFile =
|
||||||
bool success = wxGetTempFileName(_("image"), tempFile) ;
|
wxFileName::CreateTempFileName(_("image"));
|
||||||
|
|
||||||
wxASSERT(success);
|
wxASSERT(!tempFile.IsEmpty());
|
||||||
|
|
||||||
wxUnusedVar(success);
|
|
||||||
|
|
||||||
image.SaveFile(tempFile, wxBITMAP_TYPE_JPEG);
|
image.SaveFile(tempFile, wxBITMAP_TYPE_JPEG);
|
||||||
filenameToRead = tempFile;
|
filenameToRead = tempFile;
|
||||||
@@ -7464,11 +7462,8 @@ bool wxRichTextImageBlock::MakeImageBlock(wxImage& image, wxBitmapType imageType
|
|||||||
if (imageType == wxBITMAP_TYPE_INVALID)
|
if (imageType == wxBITMAP_TYPE_INVALID)
|
||||||
return false; // Could not determine image type
|
return false; // Could not determine image type
|
||||||
|
|
||||||
wxString tempFile;
|
wxString tempFile = wxFileName::CreateTempFileName(_("image")) ;
|
||||||
bool success = wxGetTempFileName(_("image"), tempFile) ;
|
wxASSERT(!tempFile.IsEmpty());
|
||||||
|
|
||||||
wxASSERT(success);
|
|
||||||
wxUnusedVar(success);
|
|
||||||
|
|
||||||
if (!image.SaveFile(tempFile, m_imageType))
|
if (!image.SaveFile(tempFile, m_imageType))
|
||||||
{
|
{
|
||||||
@@ -7535,9 +7530,8 @@ bool wxRichTextImageBlock::Load(wxImage& image)
|
|||||||
wxMemoryInputStream mstream(m_data, m_dataSize);
|
wxMemoryInputStream mstream(m_data, m_dataSize);
|
||||||
bool success = image.LoadFile(mstream, GetImageType());
|
bool success = image.LoadFile(mstream, GetImageType());
|
||||||
#else
|
#else
|
||||||
wxString tempFile;
|
wxString tempFile = wxFileName::CreateTempFileName(_("image"));
|
||||||
bool success = wxGetTempFileName(_("image"), tempFile) ;
|
wxASSERT(!tempFile.IsEmpty());
|
||||||
wxASSERT(success);
|
|
||||||
|
|
||||||
if (!WriteBlock(tempFile, m_data, m_dataSize))
|
if (!WriteBlock(tempFile, m_data, m_dataSize))
|
||||||
{
|
{
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#endif // !PCH
|
#endif // !PCH
|
||||||
|
|
||||||
#include "wx/filefn.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/ffile.h"
|
#include "wx/ffile.h"
|
||||||
#include "wx/process.h"
|
#include "wx/process.h"
|
||||||
#include "wx/crt.h"
|
#include "wx/crt.h"
|
||||||
@@ -673,7 +673,7 @@ wxDialUpManagerImpl::CheckIfconfig()
|
|||||||
wxASSERT_MSG( m_IfconfigPath.length(),
|
wxASSERT_MSG( m_IfconfigPath.length(),
|
||||||
_T("can't use ifconfig if it wasn't found") );
|
_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 \'");
|
wxString cmd = wxT("/bin/sh -c \'");
|
||||||
cmd << m_IfconfigPath;
|
cmd << m_IfconfigPath;
|
||||||
#if defined(__AIX__) || \
|
#if defined(__AIX__) || \
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
#include "wx/net.h"
|
#include "wx/net.h"
|
||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/file.h"
|
#include "wx/file.h"
|
||||||
@@ -323,7 +323,7 @@ wxDialUpManagerImpl::CheckStatusInternal(void)
|
|||||||
{
|
{
|
||||||
wxASSERT(m_IfconfigPath.length());
|
wxASSERT(m_IfconfigPath.length());
|
||||||
|
|
||||||
wxString tmpfile = wxGetTempFileName("_wxdialuptest");
|
wxString tmpfile = wxFileName::CreateTempFileName("_wxdialuptest");
|
||||||
wxString cmd = "/bin/sh -c \'";
|
wxString cmd = "/bin/sh -c \'";
|
||||||
cmd << m_IfconfigPath << " >" << tmpfile << '\'';
|
cmd << m_IfconfigPath << " >" << tmpfile << '\'';
|
||||||
/* I tried to add an option to wxExecute() to not close stdout,
|
/* I tried to add an option to wxExecute() to not close stdout,
|
||||||
|
Reference in New Issue
Block a user