forked from 0ad/0ad
non-VC compile fix: map scanf_s to scanf etc.
This was SVN commit r7240.
This commit is contained in:
parent
03726c0b54
commit
936be062ac
@ -95,13 +95,22 @@ typedef int errno_t;
|
|||||||
extern errno_t fopen_s(FILE** pfile, const char* filename, const char* mode);
|
extern errno_t fopen_s(FILE** pfile, const char* filename, const char* mode);
|
||||||
extern errno_t _wfopen_s(FILE** pfile, const wchar_t* filename, const wchar_t* mode);
|
extern errno_t _wfopen_s(FILE** pfile, const wchar_t* filename, const wchar_t* mode);
|
||||||
|
|
||||||
// *scanf_s functions have a different API to *scanf - in particular, any
|
// we'd like to avoid deprecation warnings caused by scanf. selective
|
||||||
// %s or %c or %[ parameter must be followed by a size parameter.
|
// 'undeprecation' isn't possible, replacing all stdio declarations with
|
||||||
// Therefore we can't just fall back on the *scanf functions.
|
// our own deprecation scheme is a lot of work, suppressing all deprecation
|
||||||
// Emulating the behaviour would require a lot of effort, so don't bother and
|
// warnings would cause important other warnings to be missed, and avoiding
|
||||||
// just require callers to deal with the problem.
|
// scanf outright isn't convenient.
|
||||||
//#define fscanf_s fscanf
|
// the remaining alternative is using scanf_s where available and otherwise
|
||||||
//#define sscanf_s sscanf
|
// defining it to scanf. note that scanf_s has a different API:
|
||||||
|
// any %s or %c or %[ format specifier's buffer must be followed by a
|
||||||
|
// size parameter. callers must either avoid these, or provide two codepaths
|
||||||
|
// (use scanf #if EMULATE_SECURE_CRT, otherwise scanf_s).
|
||||||
|
#define scanf_s scanf
|
||||||
|
#define wscanf_s wscanf
|
||||||
|
#define fscanf_s fscanf
|
||||||
|
#define fwscanf_s fwscanf
|
||||||
|
#define sscanf_s sscanf
|
||||||
|
#define swscanf_s swscanf
|
||||||
|
|
||||||
#endif // #if EMULATE_SECURE_CRT
|
#endif // #if EMULATE_SECURE_CRT
|
||||||
#endif // #ifndef INCLUDED_SECURE_CRT
|
#endif // #ifndef INCLUDED_SECURE_CRT
|
||||||
|
Loading…
Reference in New Issue
Block a user