forked from 0ad/0ad
Windows test fix
This was SVN commit r7050.
This commit is contained in:
parent
ed5fde8641
commit
7d21402d0f
@ -44,10 +44,15 @@ TraceEntry::TraceEntry(EAction action, const char* pathname, size_t size)
|
||||
|
||||
TraceEntry::TraceEntry(const char* text)
|
||||
{
|
||||
#define TRACE_FORMAT "%f: %c \"%" STRINGIZE(PATH_MAX) "[^\"]\" %d\n" /* use a macro to allow compile-time type-checking */
|
||||
char pathname[PATH_MAX];
|
||||
char pathname[PATH_MAX] = "";
|
||||
char action;
|
||||
const int fieldsRead = sscanf_s(text, TRACE_FORMAT, &m_timestamp, &action, pathname, &m_size);
|
||||
#if EMULATE_SECURE_CRT
|
||||
#define TRACE_FORMAT "%f: %c \"%" STRINGIZE(PATH_MAX) "[^\"]\" %d\n" /* use a macro to allow compile-time type-checking */
|
||||
const int fieldsRead = sscanf(text, TRACE_FORMAT, &m_timestamp, &action, pathname, &m_size);
|
||||
#else
|
||||
#define TRACE_FORMAT "%f: %c \"%[^\"]\" %d\n"
|
||||
const int fieldsRead = sscanf_s(text, TRACE_FORMAT, &m_timestamp, &action, 1, pathname, PATH_MAX, &m_size);
|
||||
#endif
|
||||
debug_assert(fieldsRead == 4);
|
||||
debug_assert(action == 'L' || action == 'S');
|
||||
m_action = (EAction)action;
|
||||
|
@ -91,8 +91,13 @@ typedef int errno_t;
|
||||
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);
|
||||
|
||||
#define fscanf_s fscanf
|
||||
#define sscanf_s sscanf
|
||||
// *scanf_s functions have a different API to *scanf - in particular, any
|
||||
// %s or %c or %[ parameter must be followed by a size parameter.
|
||||
// Therefore we can't just fall back on the *scanf functions.
|
||||
// Emulating the behaviour would require a lot of effort, so don't bother and
|
||||
// just require callers to deal with the problem.
|
||||
//#define fscanf_s fscanf
|
||||
//#define sscanf_s sscanf
|
||||
|
||||
#endif // #if EMULATE_SECURE_CRT
|
||||
#endif // #ifndef INCLUDED_SECURE_CRT
|
||||
|
Loading…
Reference in New Issue
Block a user