Fix a potential crash in localtime_r win32.

Using localtime_s anyway.  Both ways it was actually threadsafe.
This commit is contained in:
Unknown W. Brackets 2013-07-28 00:36:34 -07:00
parent fa7182ec34
commit d644dacced

View File

@ -29,21 +29,20 @@
// User directory indices for GetUserPath
enum {
D_USER_IDX,
D_USER_IDX,
D_SCREENSHOTS_IDX,
D_LOGS_IDX,
D_LOGS_IDX,
D_CONFIG_IDX,
F_CONFIG_IDX,
F_CONFIG_IDX,
F_MAINLOG_IDX,
NUM_PATH_INDICES
};
// No thread safe
#ifdef _WIN32
inline struct tm* localtime_r (const time_t *clock, struct tm *result) {
if (!clock || !result) return NULL;
memcpy(result,localtime(clock),sizeof(*result));
return result;
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0)
return result;
return NULL;
}
#endif