fix: exit time dtor warnings (#2338)

This commit is contained in:
Charles Kerr 2021-12-24 20:07:33 -06:00 committed by GitHub
parent b058daff4b
commit b62b8f28bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 9 deletions

View File

@ -1020,8 +1020,7 @@ static void on_announce_done(tr_announce_response const* response, void* vdata)
} }
} }
auto const& warning = response->warning; if (auto const& warning = response->warning; !std::empty(warning))
if (!std::empty(warning))
{ {
tr_strlcpy(tier->lastAnnounceStr, warning.c_str(), sizeof(tier->lastAnnounceStr)); tr_strlcpy(tier->lastAnnounceStr, warning.c_str(), sizeof(tier->lastAnnounceStr));
dbgmsg(tier, "tracker gave \"%s\"", warning.c_str()); dbgmsg(tier, "tracker gave \"%s\"", warning.c_str());

View File

@ -96,7 +96,7 @@ public:
return std::rend(this->sv()); return std::rend(this->sv());
} }
[[nodiscard]] int compare(tr_interned_string const& that) const // <=> [[nodiscard]] auto compare(tr_interned_string const& that) const // <=>
{ {
return this->quark() - that.quark(); return this->quark() - that.quark();
} }

View File

@ -227,13 +227,13 @@ QIcon IconCache::getThemeIcon(
QString const& fallbackName, QString const& fallbackName,
std::optional<QStyle::StandardPixmap> const& fallbackPixmap) const std::optional<QStyle::StandardPixmap> const& fallbackPixmap) const
{ {
static auto const RtlSuffix = qApp->layoutDirection() == Qt::RightToLeft ? QStringLiteral("-rtl") : QString(); auto const rtl_suffix = qApp->layoutDirection() == Qt::RightToLeft ? QStringLiteral("-rtl") : QString();
auto icon = QIcon::fromTheme(name + RtlSuffix); auto icon = QIcon::fromTheme(name + rtl_suffix);
if (icon.isNull()) if (icon.isNull())
{ {
icon = QIcon::fromTheme(fallbackName + RtlSuffix); icon = QIcon::fromTheme(fallbackName + rtl_suffix);
} }
if (icon.isNull() && fallbackPixmap.has_value()) if (icon.isNull() && fallbackPixmap.has_value())

View File

@ -556,7 +556,7 @@ static int getOptMode(int val)
static bool debug = false; static bool debug = false;
static char* auth = nullptr; static char* auth = nullptr;
static char* netrc = nullptr; static char* netrc = nullptr;
static std::string session_id; static char* session_id = nullptr;
static bool UseSSL = false; static bool UseSSL = false;
static char* getEncodedMetainfo(char const* filename) static char* getEncodedMetainfo(char const* filename)
@ -810,7 +810,7 @@ static size_t parseResponseHeader(void* ptr, size_t size, size_t nmemb, void* /*
++end; ++end;
} }
session_id.assign(begin, end); session_id = tr_strvDup(std::string_view{ begin, size_t(end - begin) });
} }
return line_len; return line_len;
@ -2166,7 +2166,7 @@ static CURL* tr_curl_easy_init(struct evbuffer* writebuf)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); /* since most certs will be self-signed, do not verify against CA */ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); /* since most certs will be self-signed, do not verify against CA */
} }
if (!std::empty(session_id)) if (!tr_str_is_empty(session_id))
{ {
auto const h = tr_strvJoin(TR_RPC_SESSION_ID_HEADER, ": "sv, session_id); auto const h = tr_strvJoin(TR_RPC_SESSION_ID_HEADER, ": "sv, session_id);
auto* const custom_headers = curl_slist_append(nullptr, h.c_str()); auto* const custom_headers = curl_slist_append(nullptr, h.c_str());