1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Replace utfcpp by UTF8.h in Localization.cpp

This commit is contained in:
Dav999-v 2023-02-23 04:14:38 +01:00 committed by Misa Elizabeth Kai
parent a545384677
commit 736ce3ecbf

View file

@ -2,10 +2,9 @@
#include "Localization.h" #include "Localization.h"
#include "LocalizationStorage.h" #include "LocalizationStorage.h"
#include <utf8/unchecked.h>
#include "Alloc.h" #include "Alloc.h"
#include "Game.h" #include "Game.h"
#include "UTF8.h"
#include "UtilityClass.h" #include "UtilityClass.h"
#include "VFormat.h" #include "VFormat.h"
@ -367,13 +366,14 @@ std::string toupper(const std::string& lower)
} }
std::string upper; std::string upper;
std::back_insert_iterator<std::string> inserter = std::back_inserter(upper); /* Capacity is not final, but some uppercase is more bytes than the
std::string::const_iterator iter = lower.begin(); * lowercase equivalent, so some extra breathing room couldn't hurt... */
upper.reserve(lower.length() + 6);
const char* lower_c = lower.c_str();
uint32_t ch;
bool ignorenext = false; bool ignorenext = false;
while (iter != lower.end()) while ((ch = UTF8_next(&lower_c)))
{ {
uint32_t ch = utf8::unchecked::next(iter);
if (get_langmeta()->toupper_lower_escape_char && ch == '~') if (get_langmeta()->toupper_lower_escape_char && ch == '~')
{ {
ignorenext = true; ignorenext = true;
@ -384,7 +384,7 @@ std::string toupper(const std::string& lower)
{ {
ch = toupper_ch(ch); ch = toupper_ch(ch);
} }
utf8::unchecked::append(ch, inserter); upper.append(UTF8_encode(ch).bytes);
ignorenext = false; ignorenext = false;
} }