Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115525
D5889.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D5889.diff
View Options
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -39,8 +39,6 @@
#include <shlwapi.h>
#endif
-#include <boost/scoped_array.hpp>
-
#include <QAbstractItemView>
#include <QApplication>
#include <QClipboard>
@@ -587,15 +585,15 @@
CoInitialize(nullptr);
// Get a pointer to the IShellLink interface.
- IShellLink *psl = nullptr;
+ IShellLinkW *psl = nullptr;
HRESULT hres =
CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
- IID_IShellLink, reinterpret_cast<void **>(&psl));
+ IID_IShellLinkW, reinterpret_cast<void **>(&psl));
if (SUCCEEDED(hres)) {
// Get the current executable path
- TCHAR pszExePath[MAX_PATH];
- GetModuleFileName(nullptr, pszExePath, sizeof(pszExePath));
+ WCHAR pszExePath[MAX_PATH];
+ GetModuleFileNameW(nullptr, pszExePath, ARRAYSIZE(pszExePath));
// Start client minimized
QString strArgs = "-min";
@@ -604,24 +602,12 @@
" -testnet=%d -regtest=%d", gArgs.GetBoolArg("-testnet", false),
gArgs.GetBoolArg("-regtest", false)));
-#ifdef UNICODE
- boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]);
- // Convert the QString to TCHAR*
- strArgs.toWCharArray(args.get());
- // Add missing '\0'-termination to string
- args[strArgs.length()] = '\0';
-#endif
-
// Set the path to the shortcut target
psl->SetPath(pszExePath);
- PathRemoveFileSpec(pszExePath);
+ PathRemoveFileSpecW(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
-#ifndef UNICODE
- psl->SetArguments(strArgs.toStdString().c_str());
-#else
- psl->SetArguments(args.get());
-#endif
+ psl->SetArguments(strArgs.toStdWString().c_str());
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
@@ -629,13 +615,8 @@
hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void **>(&ppf));
if (SUCCEEDED(hres)) {
- WCHAR pwsz[MAX_PATH];
- // Ensure that the string is ANSI.
- MultiByteToWideChar(CP_ACP, 0,
- StartupShortcutPath().string().c_str(), -1,
- pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
- hres = ppf->Save(pwsz, TRUE);
+ hres = ppf->Save(StartupShortcutPath().wstring().c_str(), TRUE);
ppf->Release();
psl->Release();
CoUninitialize();
diff --git a/src/util/system.cpp b/src/util/system.cpp
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1276,14 +1276,14 @@
#ifdef WIN32
fs::path GetSpecialFolderPath(int nFolder, bool fCreate) {
- char pszPath[MAX_PATH] = "";
+ WCHAR pszPath[MAX_PATH] = L"";
- if (SHGetSpecialFolderPathA(nullptr, pszPath, nFolder, fCreate)) {
+ if (SHGetSpecialFolderPathW(nullptr, pszPath, nFolder, fCreate)) {
return fs::path(pszPath);
}
LogPrintf(
- "SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
+ "SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
diff --git a/test/lint/lint-boost-dependencies.sh b/test/lint/lint-boost-dependencies.sh
--- a/test/lint/lint-boost-dependencies.sh
+++ b/test/lint/lint-boost-dependencies.sh
@@ -30,7 +30,6 @@
boost/preprocessor/stringize.hpp
boost/range/iterator.hpp
boost/range/adaptor/sliced.hpp
- boost/scoped_array.hpp
boost/signals2/connection.hpp
boost/signals2/last_value.hpp
boost/signals2/signal.hpp
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:18 (4 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187565
Default Alt Text
D5889.diff (3 KB)
Attached To
D5889: gui: Drop boost::scoped_array and use wchar_t API explicitly on Windows
Event Timeline
Log In to Comment