From 1ead8885ba76def91ebbba5fe7288b5eb07dab3d Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Fri, 30 Dec 2022 23:09:36 +0100 Subject: [PATCH] Use loc::toupper_ch instead of SDL_toupper in VFormat This commit is part of rewritten history of the localization branch. The original (unsquashed) commit history can be found here: https://github.com/Dav999-v/VVVVVV/tree/localization-orig --- desktop_version/src/CWrappers.cpp | 13 ++++++++++++- desktop_version/src/CWrappers.h | 1 + desktop_version/src/VFormat.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/CWrappers.cpp b/desktop_version/src/CWrappers.cpp index 32ee9c6a..9f826196 100644 --- a/desktop_version/src/CWrappers.cpp +++ b/desktop_version/src/CWrappers.cpp @@ -1,8 +1,12 @@ #include +#include "Localization.h" #include "UtilityClass.h" -extern "C" char* HELP_number_words(int _t) +extern "C" +{ + +char* HELP_number_words(int _t) { /* C wrapper for UtilityClass::number_words. * Caller must VVV_free. */ @@ -15,3 +19,10 @@ extern "C" char* HELP_number_words(int _t) return buffer; } + +uint32_t LOC_toupper_ch(uint32_t ch) +{ + return loc::toupper_ch(ch); +} + +} /* extern "C" */ diff --git a/desktop_version/src/CWrappers.h b/desktop_version/src/CWrappers.h index eb03880f..f24e5e25 100644 --- a/desktop_version/src/CWrappers.h +++ b/desktop_version/src/CWrappers.h @@ -2,5 +2,6 @@ #define CWRAPPERS_H char* HELP_number_words(int _t); +uint32_t LOC_toupper_ch(uint32_t ch); #endif /* CWRAPPERS_H */ diff --git a/desktop_version/src/VFormat.c b/desktop_version/src/VFormat.c index ae8eff90..1e116d48 100644 --- a/desktop_version/src/VFormat.c +++ b/desktop_version/src/VFormat.c @@ -74,7 +74,7 @@ static inline void call_with_upper(format_callback callback, void* userdata, con utf8[bytes] = '\0'; PHYSFS_utf8ToUcs4(utf8, utf32, conv_bytes*4); - utf32[0] = SDL_toupper(utf32[0]); /* FIXME: use loc::toupper_ch in localization branch */ + utf32[0] = LOC_toupper_ch(utf32[0]); PHYSFS_utf8FromUcs4(utf32, utf8, conv_bytes); callback(userdata, utf8, SDL_strlen(utf8));