1
0
forked from 0ad/0ad

Change %c to %lc for wchar arguments.

swprintf_s expected an argument of type char (due to %c). Given an
argument of type wchar.
This fixes N7 and N8 from #5288

Refs #5288

Patch By: @animus
Accepted By: @phosit, @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D4993
This was SVN commit r27751.
This commit is contained in:
phosit 2023-07-05 07:37:28 +00:00
parent e60bed753f
commit 47a7f78c9d
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2023 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -93,7 +93,7 @@ std::wstring TraceEntry::EncodeAsText() const
const wchar_t action = (wchar_t)m_action;
wchar_t buf[1000];
swprintf_s(buf, ARRAY_SIZE(buf), L"%#010f: %c \"%ls\" %lu\n", m_timestamp, action, m_pathname.string().c_str(), (unsigned long)m_size);
swprintf_s(buf, ARRAY_SIZE(buf), L"%#010f: %lc \"%ls\" %lu\n", m_timestamp, action, m_pathname.string().c_str(), (unsigned long)m_size);
setlocale(LC_ALL, oldLocale);
return buf;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2023 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -209,7 +209,7 @@ std::wstring FileDescription(const VfsFile& file)
wcsftime(timestamp, ARRAY_SIZE(timestamp), L"%a %b %d %H:%M:%S %Y", localtime(&mtime));
wchar_t buf[200];
swprintf_s(buf, ARRAY_SIZE(buf), L"(%c; %6lu; %ls) %ls", file.Loader()->LocationCode(), (unsigned long)file.Size(), timestamp, file.Name().string().c_str());
swprintf_s(buf, ARRAY_SIZE(buf), L"(%lc; %6lu; %ls) %ls", file.Loader()->LocationCode(), (unsigned long)file.Size(), timestamp, file.Name().string().c_str());
return buf;
}