1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-23 11:30:24 +00:00

Eliminate use of deprecated codecvt.

This commit is contained in:
Thomas Harte 2023-04-30 16:55:55 -04:00
parent 6552d962ab
commit 8f0dc9d9a2

View File

@ -33,7 +33,6 @@
#include <cassert>
#include <atomic>
#include <bitset>
#include <codecvt>
#include <locale>
namespace {
@ -145,9 +144,13 @@ struct ActivityObserver: public Activity::Observer {
ROM::Request missing_roms;
_machine.reset(Machine::MachineForTargets(_analyser.targets, CSROMFetcher(&missing_roms), error));
if(!_machine) {
std::wstring_convert<std::codecvt_utf8<wchar_t>> wstring_converter;
const std::wstring description = missing_roms.description(0, L'•');
[missingROMs appendString:[NSString stringWithUTF8String:wstring_converter.to_bytes(description).c_str()]];
static_assert(sizeof(wchar_t) == 4, "This code assumes wchar_t is UTF32");
NSString *nativeString = [[NSString alloc]
initWithBytes:description.data()
length:description.size()*sizeof(wchar_t)
encoding:NSUTF32LittleEndianStringEncoding];
[missingROMs appendString:nativeString];
return nil;
}
updater.performer.machine = _machine.get();