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:
6 files changed
-64
No files matched your search
@@ -1328,10 +1328,6 @@ static int CommandLineRPC(int argc, char *argv[])
|
|||||||
|
|
||||||
MAIN_FUNCTION
|
MAIN_FUNCTION
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
common::WinCmdLineArgs winArgs;
|
|
||||||
std::tie(argc, argv) = winArgs.get();
|
|
||||||
#endif
|
|
||||||
SetupEnvironment();
|
SetupEnvironment();
|
||||||
if (!SetupNetworking()) {
|
if (!SetupNetworking()) {
|
||||||
tfm::format(std::cerr, "Error: Initializing networking failed\n");
|
tfm::format(std::cerr, "Error: Initializing networking failed\n");
|
||||||
|
|||||||
@@ -94,10 +94,6 @@ static std::optional<int> WalletAppInit(ArgsManager& args, int argc, char* argv[
|
|||||||
MAIN_FUNCTION
|
MAIN_FUNCTION
|
||||||
{
|
{
|
||||||
ArgsManager& args = gArgs;
|
ArgsManager& args = gArgs;
|
||||||
#ifdef WIN32
|
|
||||||
common::WinCmdLineArgs winArgs;
|
|
||||||
std::tie(argc, argv) = winArgs.get();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int exit_status;
|
int exit_status;
|
||||||
std::unique_ptr<interfaces::Init> init = interfaces::MakeWalletInit(argc, argv, exit_status);
|
std::unique_ptr<interfaces::Init> init = interfaces::MakeWalletInit(argc, argv, exit_status);
|
||||||
|
|||||||
@@ -259,11 +259,6 @@ static bool AppInit(NodeContext& node)
|
|||||||
|
|
||||||
MAIN_FUNCTION
|
MAIN_FUNCTION
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
common::WinCmdLineArgs winArgs;
|
|
||||||
std::tie(argc, argv) = winArgs.get();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NodeContext node;
|
NodeContext node;
|
||||||
int exit_status;
|
int exit_status;
|
||||||
std::unique_ptr<interfaces::Init> init = interfaces::MakeNodeInit(node, argc, argv, exit_status);
|
std::unique_ptr<interfaces::Init> init = interfaces::MakeNodeInit(node, argc, argv, exit_status);
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <codecvt>
|
|
||||||
#include <shellapi.h>
|
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -879,30 +877,3 @@ void ArgsManager::LogArgs() const
|
|||||||
}
|
}
|
||||||
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options);
|
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} // namespace common
|
|
||||||
@@ -480,21 +480,4 @@ std::string HelpMessageGroup(const std::string& message);
|
|||||||
*/
|
*/
|
||||||
std::string HelpMessageOpt(const std::string& option, const std::string& message);
|
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;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
} // namespace common
|
|
||||||
|
|
||||||
#endif // BITCOIN_COMMON_ARGS_H
|
#endif // BITCOIN_COMMON_ARGS_H
|
||||||
@@ -478,11 +478,6 @@ static void SetupUIArgs(ArgsManager& argsman)
|
|||||||
|
|
||||||
int GuiMain(int argc, char* argv[])
|
int GuiMain(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
common::WinCmdLineArgs winArgs;
|
|
||||||
std::tie(argc, argv) = winArgs.get();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unique_ptr<interfaces::Init> init = interfaces::MakeGuiInit(argc, argv);
|
std::unique_ptr<interfaces::Init> init = interfaces::MakeGuiInit(argc, argv);
|
||||||
|
|
||||||
SetupEnvironment();
|
SetupEnvironment();
|
||||||
|
|||||||
Reference in new issue
Block a user