mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Use proper return type
`count()`, `length()`, `size()`, `indexOf()` and `lastIndexOf()` were returning `int` in Qt5. In Qt6 they return `qsizetype`. PR #23317.
This commit is contained in:
@@ -101,7 +101,7 @@ QList<QVariantHash> RSS::Private::FeedSerializer::loadArticles(const QByteArray
|
||||
QList<QVariantHash> result;
|
||||
const QJsonArray jsonArr = jsonDoc.array();
|
||||
result.reserve(jsonArr.size());
|
||||
for (int i = 0; i < jsonArr.size(); ++i)
|
||||
for (qsizetype i = 0; i < jsonArr.size(); ++i)
|
||||
{
|
||||
const QJsonValue jsonVal = jsonArr[i];
|
||||
if (!jsonVal.isObject())
|
||||
|
||||
@@ -406,7 +406,7 @@ void AutoDownloader::handleFeedURLChanged(Feed *feed, const QString &oldURL)
|
||||
{
|
||||
for (AutoDownloadRule &rule : m_rules)
|
||||
{
|
||||
if (const auto i = rule.feedURLs().indexOf(oldURL); i >= 0)
|
||||
if (const qsizetype i = rule.feedURLs().indexOf(oldURL); i >= 0)
|
||||
{
|
||||
auto feedURLs = rule.feedURLs();
|
||||
feedURLs.replace(i, feed->url());
|
||||
|
||||
@@ -60,7 +60,7 @@ QList<Article *> Folder::articles() const
|
||||
|
||||
for (Item *item : asConst(items()))
|
||||
{
|
||||
int n = news.size();
|
||||
qsizetype n = news.size();
|
||||
news << item->articles();
|
||||
std::inplace_merge(news.begin(), news.begin() + n, news.end()
|
||||
, [](Article *a1, Article *a2)
|
||||
|
||||
@@ -94,7 +94,7 @@ QStringList Item::expandPath(const QString &path)
|
||||
// if (!isValidRSSFolderName(folder))
|
||||
// return result;
|
||||
|
||||
int index = 0;
|
||||
qsizetype index = 0;
|
||||
while ((index = path.indexOf(Item::PathSeparator, index)) >= 0)
|
||||
{
|
||||
result << path.first(index);
|
||||
@@ -107,12 +107,12 @@ QStringList Item::expandPath(const QString &path)
|
||||
|
||||
QString Item::parentPath(const QString &path)
|
||||
{
|
||||
const int pos = path.lastIndexOf(Item::PathSeparator);
|
||||
const qsizetype pos = path.lastIndexOf(Item::PathSeparator);
|
||||
return (pos >= 0) ? path.first(pos) : QString();
|
||||
}
|
||||
|
||||
QString Item::relativeName(const QString &path)
|
||||
{
|
||||
const int pos = path.lastIndexOf(Item::PathSeparator);
|
||||
const qsizetype pos = path.lastIndexOf(Item::PathSeparator);
|
||||
return (pos >= 0) ? path.sliced(pos + 1) : path;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace
|
||||
// if (month >= 12 || dayOfWeek >= 7
|
||||
// || (dayOfWeek < 0 && format == RFCDateDay))
|
||||
// return QDateTime;
|
||||
const int i = parts[nyear].size();
|
||||
const qsizetype i = parts[nyear].size();
|
||||
if (i < 4)
|
||||
{
|
||||
// It's an obsolete year specification with less than 4 digits
|
||||
@@ -503,7 +503,7 @@ namespace
|
||||
{
|
||||
// Check for any other alphabetic time zone
|
||||
bool nonalpha = false;
|
||||
for (int i = 0, end = zone.size(); (i < end) && !nonalpha; ++i)
|
||||
for (qsizetype i = 0, end = zone.size(); (i < end) && !nonalpha; ++i)
|
||||
nonalpha = !isalpha(zone[i]);
|
||||
if (nonalpha)
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user