removed unsecure wxTmpnam() function (patch by Francesco Montorsi)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47238 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// Name: wx/wxcrt.h
|
// Name: wx/wxcrt.h
|
||||||
// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
|
// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
|
||||||
// CRT functions
|
// CRT functions
|
||||||
// Author: Joel Farley, Ove K<>ven
|
// Author: Joel Farley, Ove K<>ven
|
||||||
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik
|
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee, Vaclav Slavik
|
||||||
// Created: 1998/06/12
|
// Created: 1998/06/12
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@@ -703,13 +703,6 @@ inline int wxRemove(const wxString& path)
|
|||||||
inline int wxRename(const wxString& oldpath, const wxString& newpath)
|
inline int wxRename(const wxString& oldpath, const wxString& newpath)
|
||||||
{ return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); }
|
{ return wxCRT_Rename(oldpath.fn_str(), newpath.fn_str()); }
|
||||||
|
|
||||||
// NB: we don't provide wxString/wxCStrData versions of wxTmpnam, because 's'
|
|
||||||
// is writable
|
|
||||||
inline char *wxTmpnam(char *s)
|
|
||||||
{ return wxCRT_TmpnamA(s); }
|
|
||||||
inline wchar_t *wxTmpnam(wchar_t *s)
|
|
||||||
{ return wxCRT_TmpnamW(s); }
|
|
||||||
|
|
||||||
extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s);
|
extern WXDLLIMPEXP_BASE int wxPuts(const wxString& s);
|
||||||
extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream);
|
extern WXDLLIMPEXP_BASE int wxFputs(const wxString& s, FILE *stream);
|
||||||
extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s);
|
extern WXDLLIMPEXP_BASE void wxPerror(const wxString& s);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* Name: wx/wxcrtbase.h
|
* Name: wx/wxcrtbase.h
|
||||||
* Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
|
* Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
|
||||||
* CRT functions
|
* CRT functions
|
||||||
* Author: Joel Farley, Ove K<>ven
|
* Author: Joel Farley, Ove K<>ven
|
||||||
* Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
|
* Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
|
||||||
* Created: 1998/06/12
|
* Created: 1998/06/12
|
||||||
* RCS-ID: $Id$
|
* RCS-ID: $Id$
|
||||||
@@ -476,14 +476,12 @@ WXDLLIMPEXP_BASE int wxCRT_FputsW(const wchar_t *ch, FILE *stream);
|
|||||||
WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream);
|
WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define wxCRT_TmpnamA tmpnam
|
/*
|
||||||
#ifdef _ttmpnam
|
NB: tmpnam() is unsafe and thus is not wrapped!
|
||||||
#define wxCRT_TmpnamW _wtmpnam
|
Use other wxWidgets facilities instead:
|
||||||
#endif
|
wxFileName::CreateTempFileName, wxTempFile, or wxTempFileOutputStream
|
||||||
|
*/
|
||||||
#ifndef wxCRT_TmpnamW
|
#define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead
|
||||||
WXDLLIMPEXP_BASE wchar_t *wxCRT_TmpnamW(wchar_t *s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define wxCRT_PerrorA perror
|
#define wxCRT_PerrorA perror
|
||||||
#ifdef wxHAVE_TCHAR_SUPPORT
|
#ifdef wxHAVE_TCHAR_SUPPORT
|
||||||
|
@@ -1106,22 +1106,6 @@ int wxCRT_RemoveW(const wchar_t *path)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef wxCRT_TmpnamW
|
|
||||||
wchar_t *wxCRT_TmpnamW(wchar_t *s)
|
|
||||||
{
|
|
||||||
// tmpnam_r() returns NULL if s=NULL, do the same
|
|
||||||
wxCHECK_MSG( s, NULL, "wxTmpnam must be called with a buffer" );
|
|
||||||
|
|
||||||
#ifndef L_tmpnam
|
|
||||||
#define L_tmpnam 1024
|
|
||||||
#endif
|
|
||||||
wxCharBuffer buf(L_tmpnam);
|
|
||||||
tmpnam(buf.data());
|
|
||||||
|
|
||||||
wxConvLibc.ToWChar(s, L_tmpnam+1, buf.data());
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#endif // !wxCRT_TmpnamW
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
Reference in New Issue
Block a user