Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@nextcloud.com>2020-08-18 22:46:30 +0300
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>2020-09-01 09:37:03 +0300
commit80cc196f6fa9973b372164f0404463f10e498e07 (patch)
tree7acb071546dfd0385aba8f3f30ca018963918e3b /src/3rdparty
parent5cec1373ad6d28845a9588033171cd65dc29fc1e (diff)
Enable bugprone-narrowing-conversions clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/QProgressIndicator/QProgressIndicator.cpp12
-rw-r--r--src/3rdparty/kmessagewidget/kmessagewidget.cpp8
-rw-r--r--src/3rdparty/qtokenizer/qtokenizer.h7
3 files changed, 14 insertions, 13 deletions
diff --git a/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp b/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
index f32eb6e2f..cfdce199f 100644
--- a/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
+++ b/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
@@ -113,23 +113,23 @@ void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
- int outerRadius = (width-1)*0.5;
- int innerRadius = (width-1)*0.5*0.38;
+ int outerRadius = qRound((width - 1) * 0.5);
+ int innerRadius = qRound((width - 1) * 0.5 * 0.38);
int capsuleHeight = outerRadius - innerRadius;
- int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
+ int capsuleWidth = qRound((width > 32 ) ? capsuleHeight * 0.23 : capsuleHeight * 0.35);
int capsuleRadius = capsuleWidth/2;
for (int i=0; i<12; i++)
{
QColor color = m_color;
- color.setAlphaF(1.0f - (i/12.0f));
+ color.setAlphaF(1.0f - (static_cast<float>(i) / 12.0f));
p.setPen(Qt::NoPen);
p.setBrush(color);
p.save();
p.translate(rect().center());
- p.rotate(m_angle - i*30.0f);
- p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
+ p.rotate(m_angle - i * 30);
+ p.drawRoundedRect(qRound(-capsuleWidth * 0.5), -(innerRadius + capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
p.restore();
}
}
diff --git a/src/3rdparty/kmessagewidget/kmessagewidget.cpp b/src/3rdparty/kmessagewidget/kmessagewidget.cpp
index d2d0f12b7..595a5fa33 100644
--- a/src/3rdparty/kmessagewidget/kmessagewidget.cpp
+++ b/src/3rdparty/kmessagewidget/kmessagewidget.cpp
@@ -197,9 +197,9 @@ void KMessageWidgetPrivate::applyStyleSheet()
const QColor border = bgBaseColor;
// Generate a final background color from overlaying bgBaseColor over windowColor
- const int newRed = (bgBaseColor.red() * bgBaseColorAlpha) + (windowColor.red() * (1 - bgBaseColorAlpha));
- const int newGreen = (bgBaseColor.green() * bgBaseColorAlpha) + (windowColor.green() * (1 - bgBaseColorAlpha));
- const int newBlue = (bgBaseColor.blue() * bgBaseColorAlpha) + (windowColor.blue() * (1 - bgBaseColorAlpha));
+ const int newRed = qRound(bgBaseColor.red() * bgBaseColorAlpha) + qRound(windowColor.red() * (1 - bgBaseColorAlpha));
+ const int newGreen = qRound(bgBaseColor.green() * bgBaseColorAlpha) + qRound(windowColor.green() * (1 - bgBaseColorAlpha));
+ const int newBlue = qRound(bgBaseColor.blue() * bgBaseColorAlpha) + qRound(windowColor.blue() * (1 - bgBaseColorAlpha));
const QColor bgFinalColor = QColor(newRed, newGreen, newBlue);
@@ -241,7 +241,7 @@ void KMessageWidgetPrivate::updateSnapShot()
void KMessageWidgetPrivate::slotTimeLineChanged(qreal value)
{
- q->setFixedHeight(qMin(value * 2, qreal(1.0)) * content->height());
+ q->setFixedHeight(qMin(qRound(value * 2.0), 1) * content->height());
q->update();
}
diff --git a/src/3rdparty/qtokenizer/qtokenizer.h b/src/3rdparty/qtokenizer/qtokenizer.h
index d8ca3d53f..c317c42a9 100644
--- a/src/3rdparty/qtokenizer/qtokenizer.h
+++ b/src/3rdparty/qtokenizer/qtokenizer.h
@@ -220,7 +220,7 @@ public:
Use \c hasNext() to fetch the next token.
*/
T next() const {
- int len = d->tokenEnd-d->tokenBegin;
+ int len = std::distance(d->tokenBegin, d->tokenEnd);
const_iterator tmpStart = d->tokenBegin;
if (!d->returnQuotes && len > 1 && d->isQuote(*d->tokenBegin)) {
tmpStart++;
@@ -243,8 +243,9 @@ public:
* @return A reference to the token within the string
*/
QStringRef stringRef() {
- int begin = d->tokenBegin-d->begin;
- int end = d->tokenEnd-d->tokenBegin;
+ // If those differences overflow an int we'd have a veeeeeery long string in memory
+ int begin = std::distance(d->begin, d->tokenBegin);
+ int end = std::distance(d->tokenBegin, d->tokenEnd);
if (!d->returnQuotes && d->isQuote(*d->tokenBegin)) {
begin++;
end -= 2;