replace localtime with _s/_r variant

cppcheck warns on localtime which is not necessarily threadsafe.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-02-11 14:05:01 -08:00
parent 625a2b8167
commit 75dae3fb96

View File

@ -741,7 +741,12 @@ void CrwMap::decode0x180e(const CiffComponent& ciffComponent, const CrwMapping*
ULongValue v;
v.read(ciffComponent.pData(), 8, byteOrder);
time_t t = v.value_.at(0);
auto tm = std::localtime(&t);
struct tm r;
#ifdef _WIN32
auto tm = localtime_s(&r, &t) ? nullptr : &r;
#else
auto tm = localtime_r(&t, &r);
#endif
if (tm) {
const size_t m = 20;
char s[m];