mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
CLogger: Use cppformat instead of sys_vswprintf.
sys_vswprintf relies on platform-specific printf implementations, which vary widely between platforms (in handling of truncation, return values, use of %s/%S/%hs/%ls for mixing char and wchar_t strings, etc) and are therefore a pain. Use cppformat's fmt::sprintf instead, which has very similar syntax to sprintf but is more C++ish and is portable. Also, wchar_t is stupid, so use char* strings (which are expected to be UTF-8) in CLogger. This creates a bit of a pain with changing all callers to convert to char* strings, but that's their fault for not using UTF-8 already. Refs #3011. This was SVN commit r16182.
This commit is contained in:
@@ -100,6 +100,11 @@ static MiscSetup miscSetup;
|
||||
|
||||
// Definition of functions from lib/self_test.h
|
||||
|
||||
bool ts_str_contains(const std::string& str1, const std::string& str2)
|
||||
{
|
||||
return str1.find(str2) != str1.npos;
|
||||
}
|
||||
|
||||
bool ts_str_contains(const std::wstring& str1, const std::wstring& str2)
|
||||
{
|
||||
return str1.find(str2) != str1.npos;
|
||||
|
||||
Reference in New Issue
Block a user