Remove no longer necessary WinCmdLineArgs class

This change removes one use case of `std::wstring_convert`, which is
deprecated in C++17 and removed in C++26. Other uses remain for now.
This commit is contained in:
Hennadii Stepanov 2025-04-29 16:02:21 +01:00
parent ce7f41c01b
commit 78a0c238ec
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
6 changed files with 0 additions and 44 deletions

View file

@ -1313,8 +1313,6 @@ static int CommandLineRPC(int argc, char *argv[])
MAIN_FUNCTION
{
#ifdef WIN32
common::WinCmdLineArgs winArgs;
std::tie(argc, argv) = winArgs.get();
common::WindowsScopedCodePage windows_terminal_output_code_page{CP_UTF8};
#endif
SetupEnvironment();

View file

@ -98,8 +98,6 @@ MAIN_FUNCTION
{
ArgsManager& args = gArgs;
#ifdef WIN32
common::WinCmdLineArgs winArgs;
std::tie(argc, argv) = winArgs.get();
common::WindowsScopedCodePage windows_terminal_output_code_page{CP_UTF8};
#endif

View file

@ -255,8 +255,6 @@ static bool AppInit(NodeContext& node)
MAIN_FUNCTION
{
#ifdef WIN32
common::WinCmdLineArgs winArgs;
std::tie(argc, argv) = winArgs.get();
common::WindowsScopedCodePage windows_terminal_output_code_page{CP_UTF8};
#endif

View file

@ -867,29 +867,6 @@ void ArgsManager::LogArgs() const
namespace common {
#ifdef WIN32
WinCmdLineArgs::WinCmdLineArgs()
{
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> utf8_cvt;
argv = new char*[argc];
args.resize(argc);
for (int i = 0; i < argc; i++) {
args[i] = utf8_cvt.to_bytes(wargv[i]);
argv[i] = &*args[i].begin();
}
LocalFree(wargv);
}
WinCmdLineArgs::~WinCmdLineArgs()
{
delete[] argv;
}
std::pair<int, char**> WinCmdLineArgs::get()
{
return std::make_pair(argc, argv);
}
WindowsScopedCodePage::WindowsScopedCodePage(UINT new_console_outp_code_page)
: m_original_code_page{GetConsoleOutputCP()}
{

View file

@ -480,19 +480,6 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message
namespace common {
#ifdef WIN32
class WinCmdLineArgs
{
public:
WinCmdLineArgs();
~WinCmdLineArgs();
std::pair<int, char**> get();
private:
int argc;
char** argv;
std::vector<std::string> args;
};
/**
* A RAII-style class for temporarily changing the terminal output code page during runtime.
*/

View file

@ -479,8 +479,6 @@ static void SetupUIArgs(ArgsManager& argsman)
int GuiMain(int argc, char* argv[])
{
#ifdef WIN32
common::WinCmdLineArgs winArgs;
std::tie(argc, argv) = winArgs.get();
common::WindowsScopedCodePage windows_terminal_output_code_page{CP_UTF8};
#endif