Fix -Wunused-variable warnings

This commit is contained in:
Ilya Fedin 2021-07-13 21:36:37 +04:00 committed by John Preston
parent f0c474c6ae
commit b8485c0d8a
16 changed files with 11 additions and 40 deletions

View file

@ -416,7 +416,6 @@ void PanelAnimation::paintFrame(QPainter &p, int x, int y, int outerWidth, float
if (fadeTop != fadeBottom) {
auto painterFadeTop = fadeTop / pixelRatio;
auto painterFrameWidth = frameWidth / pixelRatio;
auto painterFrameHeight = frameHeight / pixelRatio;
p.drawPixmap(painterFrameLeft, painterFadeTop, painterFrameWidth, painterFadeBottom - painterFadeTop, _fadeMask, 0, fadeSkipLines, pixelRatio, fadeBottom - fadeTop);
}
if (fadeBottom != frameBottom) {
@ -424,8 +423,6 @@ void PanelAnimation::paintFrame(QPainter &p, int x, int y, int outerWidth, float
}
}
}
auto frameInts = _frameInts + frameLeft + frameTop * _frameIntsPerLine;
auto frameIntsPerLineAdd = (_finalWidth - frameWidth) + _frameIntsPerLineAdded;
// Draw corners
paintCorner(_topLeft, frameLeft, frameTop);

View file

@ -222,7 +222,6 @@ RadialState InfiniteRadialAnimation::computeState() {
kFullArcLength };
}
if (anim::Disabled()) {
const auto shown = 1.;
return { 1., 0, kFullArcLength };
}
const auto min = int(std::round(kFullArcLength * _st.arcMin));
@ -245,9 +244,6 @@ RadialState InfiniteRadialAnimation::computeState() {
const auto cycles = (now - _workStarted) / _st.sinePeriod;
const auto relative = (now - _workStarted) % _st.sinePeriod;
const auto smallDuration = _st.sineShift - _st.sineDuration;
const auto largeDuration = _st.sinePeriod
- _st.sineShift
- _st.sineDuration;
const auto basic = int((linear
+ min
+ (cycles * (kFullArcLength + min - max))) % kFullArcLength);

View file

@ -35,7 +35,9 @@ constexpr auto kSetVersion = uint32(2);
constexpr auto kCacheVersion = uint32(6);
constexpr auto kMaxId = uint32(1 << 8);
#if defined Q_OS_MAC && !defined OS_MAC_OLD
constexpr auto kScaleForTouchBar = 150;
#endif
enum class ConfigResult {
Invalid,

View file

@ -16,14 +16,16 @@
#include <QtGui/QOpenGLFunctions>
#include <QtWidgets/QOpenGLWidget>
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; }();
#define LOG_ONCE(x) [[maybe_unused]] static auto logged = [&] { LOG(x); return true; }();
namespace Ui::GL {
namespace {
bool ForceDisabled/* = false*/;
#ifdef Q_OS_WIN
ANGLE ResolvedANGLE = ANGLE::Auto;
#endif // Q_OS_WIN
void CrashCheckStart() {
auto f = QFile(Integration::Instance().openglCheckFilePath());
@ -102,7 +104,7 @@ Capabilities CheckCapabilities(QWidget *widget) {
LOG_ONCE(("OpenGL Profile: Compatibility."));
} break;
}
static const auto extensionsLogged = [&] {
[[maybe_unused]] static const auto extensionsLogged = [&] {
const auto renderer = reinterpret_cast<const char*>(
functions->glGetString(GL_RENDERER));
LOG(("OpenGL Renderer: %1").arg(renderer ? renderer : "[nullptr]"));

View file

@ -124,7 +124,7 @@ QImage prepareBlur(QImage img) {
uchar *pix = img.bits();
if (pix) {
int w = img.width(), h = img.height(), wold = w, hold = h;
int w = img.width(), h = img.height();
const int radius = 3;
const int r1 = radius + 1;
const int div = radius * 2 + 1;

View file

@ -175,7 +175,6 @@ void BoxContent::setInnerTopSkip(int innerTopSkip, bool scrollBottomFixed) {
void BoxContent::setInnerBottomSkip(int innerBottomSkip) {
if (_innerBottomSkip != innerBottomSkip) {
auto delta = innerBottomSkip - _innerBottomSkip;
_innerBottomSkip = innerBottomSkip;
if (_scroll && width() > 0) {
updateScrollAreaGeometry();

View file

@ -115,7 +115,6 @@ void BasicWindowHelper::setupBodyTitleAreaEvents() {
== Qt::LeftButton)) {
_mousePressed = true;
} else if (e->type() == QEvent::MouseMove) {
const auto mouseEvent = static_cast<QMouseEvent*>(e.get());
if (_mousePressed
#ifndef Q_OS_WIN // We handle fullscreen startSystemMove() only on Windows.
&& !_window->isFullScreen()

View file

@ -97,7 +97,6 @@ void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect
auto pattern = anim::shifted(c);
auto resultBytesPerPixel = (src.depth() >> 3);
constexpr auto resultIntsPerPixel = 1;
auto resultIntsPerLine = (outResult->bytesPerLine() >> 2);
auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;

View file

@ -79,7 +79,6 @@ TextWithEntities PrepareRichFromRich(
int32 i = 0, l = preparsed.size();
result.entities.clear();
result.entities.reserve(l);
const QChar s = result.text.size();
for (; i < l; ++i) {
auto type = preparsed.at(i).type();
if (((type == EntityType::Mention || type == EntityType::MentionName) && !parseMentions) ||

View file

@ -222,8 +222,6 @@ void BlockParser::parseWords(QFixed minResizeWidth, int blockFrom) {
int item = -1;
int newItem = eng->findItem(0);
style::align alignment = eng->option.alignment();
const QCharAttributes *attributes = eng->attributes();
if (!attributes)
return;

View file

@ -1315,7 +1315,7 @@ QString EscapeForRichParsing(const QString &text) {
QString SingleLine(const QString &text) {
auto result = text;
auto s = text.unicode(), ch = s, e = text.unicode() + text.size();
auto s = text.unicode(), e = text.unicode() + text.size();
// Trim.
while (s < e && IsTrimmed(*s)) {
@ -1405,7 +1405,6 @@ QStringList PrepareSearchWords(
? *SplitterOverride
: RegExpWordSplit(),
base::QStringSkipEmptyParts);
auto size = list.size();
result.reserve(list.size());
for (const auto &word : std::as_const(list)) {
auto trimmed = word.trimmed();
@ -2196,7 +2195,6 @@ EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags) {
}
return result;
};
auto till = offset;
for (const auto &tag : tags) {
if (tag.offset > offset) {
processState(State());

View file

@ -165,7 +165,6 @@ void Widget::mouseMoveEvent(QMouseEvent *e) {
}
const auto point = e->pos()
- QPoint(_st->padding.left(), _textTop);
const auto lines = _maxTextHeight / _st->style.font->height;
const auto state = _text.getStateElided(point, _textWidth + 1);
const auto was = ClickHandler::getActive();
if (was != state.link) {

View file

@ -564,7 +564,6 @@ void Checkbox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto check = checkRect();
auto ms = crl::now();
auto active = _check->currentAnimationValue();
if (isDisabled()) {
p.setOpacity(_st.disabledOpacity);

View file

@ -12,13 +12,6 @@
#include "ui/image/image_prepare.h"
#include "ui/ui_utility.h"
namespace {
constexpr float64 kFadeHeight = 1. / 3;
constexpr int kFadeAlphaMax = 160;
} // namespace
namespace Ui {
InnerDropdown::InnerDropdown(

View file

@ -108,7 +108,6 @@ bool IsNewline(QChar ch) {
auto resultLink = QString();
const auto checkingLink = (tag == kTagCheckLinkMeta);
const auto &text = textWithTags.text;
const auto &tags = textWithTags.tags;
auto from = 0;
auto till = int(text.size());
const auto adjust = [&] {
@ -1038,8 +1037,7 @@ void FlatInput::touchEvent(QTouchEvent *e) {
if (!_touchPress) return;
auto weak = MakeWeak(this);
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -1077,7 +1075,6 @@ void FlatInput::finishAnimations() {
void FlatInput::paintEvent(QPaintEvent *e) {
Painter p(this);
auto ms = crl::now();
auto placeholderFocused = _placeholderFocusedAnimation.value(_focused ? 1. : 0.);
auto pen = anim::pen(_st.borderColor, _st.borderActive, placeholderFocused);
pen.setWidth(_st.borderWidth);
@ -1650,8 +1647,7 @@ void InputField::handleTouchEvent(QTouchEvent *e) {
if (!_touchPress) return;
auto weak = MakeWeak(this);
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);
@ -2280,9 +2276,6 @@ void InputField::onDocumentContentsChange(
? _realCharsAdded
: charsAdded;
const auto removePosition = position;
const auto removeLength = charsRemoved;
_correcting = true;
QTextCursor(document->docHandle(), 0).joinPreviousEditBlock();
const auto guard = gsl::finally([&] {
@ -3855,8 +3848,7 @@ void MaskedInputField::touchEvent(QTouchEvent *e) {
if (!_touchPress) return;
auto weak = MakeWeak(this);
if (!_touchMove && window()) {
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
QPoint mapped(mapFromGlobal(_touchStart));
if (_touchRightButton) {
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart);

View file

@ -551,7 +551,6 @@ bool FlatLabel::eventHook(QEvent *e) {
}
void FlatLabel::touchEvent(QTouchEvent *e) {
const Qt::TouchPointStates &states(e->touchPointStates());
if (e->type() == QEvent::TouchCancel) { // cancel
if (!_touchInProgress) return;
_touchInProgress = false;