mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-30 12:18:05 -06:00
Use helper functions to construct smart pointers
This commit is contained in:
@@ -60,7 +60,7 @@ std::shared_ptr<lt::torrent_plugin> NativeSessionExtension::new_torrent(const lt
|
||||
#else
|
||||
boost::shared_ptr<lt::torrent_plugin> NativeSessionExtension::new_torrent(const lt::torrent_handle &torrentHandle, void *)
|
||||
{
|
||||
return boost::shared_ptr<lt::torrent_plugin> {new NativeTorrentExtension {torrentHandle}};
|
||||
return boost::make_shared<NativeTorrentExtension>(torrentHandle);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -457,7 +457,7 @@ void SearchPluginManager::update()
|
||||
if (!engineElem.isNull()) {
|
||||
const QString pluginName = engineElem.tagName();
|
||||
|
||||
std::unique_ptr<PluginInfo> plugin {new PluginInfo {}};
|
||||
auto plugin = std::make_unique<PluginInfo>();
|
||||
plugin->name = pluginName;
|
||||
plugin->version = getPluginVersion(pluginPath(pluginName));
|
||||
plugin->fullName = engineElem.elementsByTagName("name").at(0).toElement().text();
|
||||
|
||||
@@ -327,7 +327,7 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
const std::wstring pathW {path.toStdWString()};
|
||||
std::unique_ptr<wchar_t[]> volumePath {new wchar_t[path.length() + 1] {}};
|
||||
auto volumePath = std::make_unique<wchar_t[]>(path.length() + 1);
|
||||
if (!::GetVolumePathNameW(pathW.c_str(), volumePath.get(), (path.length() + 1)))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
|
||||
}
|
||||
else {
|
||||
const QString msg = QCoreApplication::translate("misc", "qBittorrent will shutdown the computer now because all downloads are complete.");
|
||||
std::unique_ptr<wchar_t[]> msgWchar(new wchar_t[msg.length() + 1] {});
|
||||
auto msgWchar = std::make_unique<wchar_t[]>(msg.length() + 1);
|
||||
msg.toWCharArray(msgWchar.get());
|
||||
::InitiateSystemShutdownW(nullptr, msgWchar.get(), 10, true, false);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Utils
|
||||
|
||||
path += source;
|
||||
|
||||
std::unique_ptr<wchar_t[]> pathWchar(new wchar_t[path.length() + 1] {});
|
||||
auto pathWchar = std::make_unique<wchar_t[]>(path.length() + 1);
|
||||
path.toWCharArray(pathWchar.get());
|
||||
|
||||
return reinterpret_cast<T>(
|
||||
|
||||
Reference in New Issue
Block a user