Skip to content

Commit d46aecc

Browse files
Rename code page conversion methods
1 parent 11e0bad commit d46aecc

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ namespace config {
984984

985985
for (auto &[name, val] : vars) {
986986
#ifdef _WIN32
987-
std::cout << "["sv << name << "] -- ["sv << convertUtf8ToCurrentCodepage(val) << ']' << std::endl;
987+
std::cout << "["sv << name << "] -- ["sv << utf8ToAcp(val) << ']' << std::endl;
988988
#else
989989
std::cout << "["sv << name << "] -- ["sv << val << ']' << std::endl;
990990
#endif

src/platform/windows/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ std::wstring acpToUtf16(const std::string& origStr) {
1919
return utf16Str;
2020
}
2121

22-
std::string utf16toAcp(const std::wstring& utf16Str) {
22+
std::string utf16ToAcp(const std::wstring& utf16Str) {
2323
auto acp = GetACP();
2424

2525
int codepageLen = WideCharToMultiByte(acp, 0, utf16Str.c_str(), utf16Str.size(), NULL, 0, NULL, NULL);
@@ -33,7 +33,7 @@ std::string utf16toAcp(const std::wstring& utf16Str) {
3333
return codepageStr;
3434
}
3535

36-
std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str) {
36+
std::string utf8ToAcp(const std::string& utf8Str) {
3737
if (GetACP() == CP_UTF8) {
3838
return std::string(utf8Str);
3939
}
@@ -46,10 +46,10 @@ std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str) {
4646
std::wstring utf16Str(utf16Len, L'\0');
4747
MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), utf8Str.size(), &utf16Str[0], utf16Len);
4848

49-
return utf16toAcp(utf16Str);
49+
return utf16ToAcp(utf16Str);
5050
}
5151

52-
std::string convertCurrentCodepageToUtf8(const std::string& origStr) {
52+
std::string acpToUtf8(const std::string& origStr) {
5353
if (GetACP() == CP_UTF8) {
5454
return std::string(origStr);
5555
}

src/platform/windows/utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <wtsapi32.h>
88

99
std::wstring acpToUtf16(const std::string& origStr);
10-
std::string utf16toAcp(const std::wstring& utf16Str);
11-
std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str);
12-
std::string convertCurrentCodepageToUtf8(const std::string& currentStr);
10+
std::string utf16ToAcp(const std::wstring& utf16Str);
11+
std::string utf8ToAcp(const std::string& utf8Str);
12+
std::string acpToUtf8(const std::string& currentStr);
1313

1414
std::string get_error_string(LONG error_code);
1515

src/system_tray.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ namespace system_tray {
226226

227227
#ifdef _WIN32
228228
std::string tmp_str = "Open Apollo (" + config::nvhttp.sunshine_name + ":" + std::to_string(net::map_port(confighttp::PORT_HTTPS)) + ")";
229-
static const std::string title_str = convertUtf8ToCurrentCodepage(tmp_str);
229+
static const std::string title_str = utf8ToAcp(tmp_str);
230230
#else
231231
static const std::string title_str = "Open Apollo (" + config::nvhttp.sunshine_name + ":" + std::to_string(net::map_port(confighttp::PORT_HTTPS)) + ")";
232232
#endif
@@ -268,8 +268,8 @@ namespace system_tray {
268268
snprintf(msg, std::size(msg), "%s launched.", app_name.c_str());
269269
snprintf(force_close_msg, std::size(force_close_msg), "Force close [%s]", app_name.c_str());
270270
#ifdef _WIN32
271-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
272-
strncpy(force_close_msg, convertUtf8ToCurrentCodepage(force_close_msg).c_str(), std::size(force_close_msg) - 1);
271+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
272+
strncpy(force_close_msg, utf8ToAcp(force_close_msg).c_str(), std::size(force_close_msg) - 1);
273273
#endif
274274
tray.notification_text = msg;
275275
tray.notification_icon = TRAY_ICON_PLAYING;
@@ -293,7 +293,7 @@ namespace system_tray {
293293
char msg[256];
294294
snprintf(msg, std::size(msg), "Streaming paused for %s", app_name.c_str());
295295
#ifdef _WIN32
296-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
296+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
297297
#endif
298298
tray.icon = TRAY_ICON_PAUSING;
299299
tray.notification_title = "Stream Paused";
@@ -318,7 +318,7 @@ namespace system_tray {
318318
char msg[256];
319319
snprintf(msg, std::size(msg), "Streaming stopped for %s", app_name.c_str());
320320
#ifdef _WIN32
321-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
321+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
322322
#endif
323323
tray.icon = TRAY_ICON;
324324
tray.notification_icon = TRAY_ICON;
@@ -344,7 +344,7 @@ namespace system_tray {
344344
char msg[256];
345345
snprintf(msg, std::size(msg), "Application %s exited too fast with code %d. Click here to terminate the stream.", app_name.c_str(), exit_code);
346346
#ifdef _WIN32
347-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
347+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
348348
#endif
349349
tray.icon = TRAY_ICON;
350350
tray.notification_icon = TRAY_ICON;
@@ -395,7 +395,7 @@ namespace system_tray {
395395
char msg[256];
396396
snprintf(msg, std::size(msg), "Device %s paired Succesfully. Please make sure you have access to the device.", device_name.c_str());
397397
#ifdef _WIN32
398-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
398+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
399399
#endif
400400
tray.notification_title = "Device Paired Succesfully";
401401
tray.notification_text = msg;
@@ -419,7 +419,7 @@ namespace system_tray {
419419
char msg[256];
420420
snprintf(msg, std::size(msg), "%s has connected to the session.", client_name.c_str());
421421
#ifdef _WIN32
422-
strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1);
422+
strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1);
423423
#endif
424424
tray.notification_title = "Client Connected";
425425
tray.notification_text = msg;

0 commit comments

Comments
 (0)