Skip to content

Commit 1c5d225

Browse files
committed
Drop boost::scoped_array
1 parent ef4fac0 commit 1c5d225

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

src/qt/guiutil.cpp

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
#include <shlwapi.h>
3939
#endif
4040

41-
#include <boost/scoped_array.hpp>
42-
4341
#include <QAbstractItemView>
4442
#include <QApplication>
4543
#include <QClipboard>
@@ -547,52 +545,37 @@ bool SetStartOnSystemStartup(bool fAutoStart)
547545
CoInitialize(nullptr);
548546

549547
// Get a pointer to the IShellLink interface.
550-
IShellLink* psl = nullptr;
548+
IShellLinkW* psl = nullptr;
551549
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr,
552-
CLSCTX_INPROC_SERVER, IID_IShellLink,
550+
CLSCTX_INPROC_SERVER, IID_IShellLinkW,
553551
reinterpret_cast<void**>(&psl));
554552

555553
if (SUCCEEDED(hres))
556554
{
557555
// Get the current executable path
558-
TCHAR pszExePath[MAX_PATH];
559-
GetModuleFileName(nullptr, pszExePath, sizeof(pszExePath));
556+
WCHAR pszExePath[MAX_PATH];
557+
GetModuleFileNameW(nullptr, pszExePath, ARRAYSIZE(pszExePath));
560558

561559
// Start client minimized
562560
QString strArgs = "-min";
563561
// Set -testnet /-regtest options
564562
strArgs += QString::fromStdString(strprintf(" -testnet=%d -regtest=%d", gArgs.GetBoolArg("-testnet", false), gArgs.GetBoolArg("-regtest", false)));
565563

566-
#ifdef UNICODE
567-
boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]);
568-
// Convert the QString to TCHAR*
569-
strArgs.toWCharArray(args.get());
570-
// Add missing '\0'-termination to string
571-
args[strArgs.length()] = '\0';
572-
#endif
573-
574564
// Set the path to the shortcut target
575565
psl->SetPath(pszExePath);
576-
PathRemoveFileSpec(pszExePath);
566+
PathRemoveFileSpecW(pszExePath);
577567
psl->SetWorkingDirectory(pszExePath);
578568
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
579-
#ifndef UNICODE
580-
psl->SetArguments(strArgs.toStdString().c_str());
581-
#else
582-
psl->SetArguments(args.get());
583-
#endif
569+
psl->SetArguments(strArgs.toStdWString().c_str());
584570

585571
// Query IShellLink for the IPersistFile interface for
586572
// saving the shortcut in persistent storage.
587573
IPersistFile* ppf = nullptr;
588574
hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf));
589575
if (SUCCEEDED(hres))
590576
{
591-
WCHAR pwsz[MAX_PATH];
592-
// Ensure that the string is ANSI.
593-
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
594577
// Save the link by calling IPersistFile::Save.
595-
hres = ppf->Save(pwsz, TRUE);
578+
hres = ppf->Save(StartupShortcutPath().wstring().c_str(), TRUE);
596579
ppf->Release();
597580
psl->Release();
598581
CoUninitialize();

test/lint/lint-includes.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ EXPECTED_BOOST_INCLUDES=(
6565
boost/optional.hpp
6666
boost/preprocessor/cat.hpp
6767
boost/preprocessor/stringize.hpp
68-
boost/scoped_array.hpp
6968
boost/signals2/connection.hpp
7069
boost/signals2/last_value.hpp
7170
boost/signals2/signal.hpp

0 commit comments

Comments
 (0)