Skip to content

Commit c110f97

Browse files
committed
refactor(string): Rename Wchar/Utf8 conversion functions to use Unicode prefix
1 parent 2535562 commit c110f97

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

Core/GameEngine/Source/Common/System/AsciiString.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void AsciiString::translate(const UnicodeString& stringSrc)
280280
return;
281281
size_t size = Get_Utf8_Size(src);
282282
char* buf = getBufferForRead((Int)(size - 1));
283-
Wchar_To_Utf8(buf, src, size);
283+
Unicode_To_Utf8(buf, src, size);
284284
validate();
285285
}
286286

Core/GameEngine/Source/Common/System/UnicodeString.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ void UnicodeString::translate(const AsciiString& stringSrc)
227227
const char* src = stringSrc.str();
228228
if (!src[0])
229229
return;
230-
size_t size = Get_Wchar_Size(src);
230+
size_t size = Get_Unicode_Size(src);
231231
WideChar* buf = getBufferForRead((Int)(size - 1));
232-
Utf8_To_Wchar(buf, src, size);
232+
Utf8_To_Unicode(buf, src, size);
233233
validate();
234234
}
235235

Core/GameEngine/Source/GameNetwork/GameSpy/Thread/ThreadUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
// TheSuperHackers @refactor bobtista 02/04/2026 Use WWLib UTF-8 functions instead of raw Win32 API calls
3636
std::wstring MultiByteToWideCharSingleLine( const char *orig )
3737
{
38-
size_t size = Get_Wchar_Size(orig);
38+
size_t size = Get_Unicode_Size(orig);
3939
std::wstring ret(size - 1, L'\0');
40-
Utf8_To_Wchar(&ret[0], orig, size);
40+
Utf8_To_Unicode(&ret[0], orig, size);
4141
WideChar *c = nullptr;
4242
do
4343
{
@@ -65,7 +65,7 @@ std::string WideCharStringToMultiByte( const WideChar *orig )
6565
{
6666
size_t size = Get_Utf8_Size(orig);
6767
std::string ret(size - 1, '\0');
68-
Wchar_To_Utf8(&ret[0], orig, size);
68+
Unicode_To_Utf8(&ret[0], orig, size);
6969
return ret;
7070
}
7171

Core/Libraries/Source/WWVegas/WWLib/utf8.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ size_t Get_Utf8_Size(const wchar_t* src)
9090
return (bytes > 0) ? (size_t)bytes : 1;
9191
}
9292

93-
size_t Get_Wchar_Size(const char* src)
93+
size_t Get_Unicode_Size(const char* src)
9494
{
9595
int wchars = MultiByteToWideChar(CP_UTF8, 0, src, -1, nullptr, 0);
9696
return (wchars > 0) ? (size_t)wchars : 1;
9797
}
9898

99-
void Wchar_To_Utf8(char* dest, const wchar_t* src, size_t dest_size)
99+
void Unicode_To_Utf8(char* dest, const wchar_t* src, size_t dest_size)
100100
{
101101
if (dest_size == 0)
102102
return;
@@ -105,7 +105,7 @@ void Wchar_To_Utf8(char* dest, const wchar_t* src, size_t dest_size)
105105
dest[0] = '\0';
106106
}
107107

108-
void Utf8_To_Wchar(wchar_t* dest, const char* src, size_t dest_size)
108+
void Utf8_To_Unicode(wchar_t* dest, const char* src, size_t dest_size)
109109
{
110110
if (dest_size == 0)
111111
return;

Core/Libraries/Source/WWVegas/WWLib/utf8.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ size_t Get_Utf8_Size(const wchar_t* src);
3939

4040
// Returns the number of wchar_t elements required to store the wide character
4141
// representation of the UTF-8 string src, including the null terminator.
42-
size_t Get_Wchar_Size(const char* src);
42+
size_t Get_Unicode_Size(const char* src);
4343

4444
// Converts a wide character string to UTF-8. dest_size is in bytes.
45-
void Wchar_To_Utf8(char* dest, const wchar_t* src, size_t dest_size);
45+
void Unicode_To_Utf8(char* dest, const wchar_t* src, size_t dest_size);
4646

4747
// Converts a UTF-8 string to wide characters. dest_size is in wchar_t elements.
48-
void Utf8_To_Wchar(wchar_t* dest, const char* src, size_t dest_size);
48+
void Utf8_To_Unicode(wchar_t* dest, const char* src, size_t dest_size);

0 commit comments

Comments
 (0)