mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Allow to build with -Werror and clang
Fixes -Wdeprecated-enum-enum-conversion, -Wdeprecated-declarations, -Wrange-loop-construct, -Winconsistent-missing-override
This commit is contained in:
parent
89765340c3
commit
b6881022ce
9 changed files with 21 additions and 13 deletions
|
@ -292,7 +292,7 @@ ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions) {
|
||||||
|
|
||||||
// Apply the strictest.
|
// Apply the strictest.
|
||||||
const auto fixOne = [&] {
|
const auto fixOne = [&] {
|
||||||
for (const auto [first, second] : dependencies) {
|
for (const auto &[first, second] : dependencies) {
|
||||||
if ((restrictions & second) && !(restrictions & first)) {
|
if ((restrictions & second) && !(restrictions & first)) {
|
||||||
restrictions |= first;
|
restrictions |= first;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -126,7 +126,7 @@ PreLaunchLog::PreLaunchLog(QWidget *parent) : QTextEdit(parent) {
|
||||||
setPalette(p);
|
setPalette(p);
|
||||||
|
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
setFrameStyle(int(QFrame::NoFrame) | QFrame::Plain);
|
||||||
viewport()->setAutoFillBackground(false);
|
viewport()->setAutoFillBackground(false);
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
document()->setDocumentMargin(0);
|
document()->setDocumentMargin(0);
|
||||||
|
|
|
@ -127,11 +127,11 @@ ButtonBar::ButtonBar(
|
||||||
if (children.empty()) {
|
if (children.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto widgets = ranges::view::all(
|
const auto widgets = ranges::views::all(
|
||||||
children
|
children
|
||||||
) | ranges::view::filter([](not_null<const QObject*> object) {
|
) | ranges::views::filter([](not_null<const QObject*> object) {
|
||||||
return object->isWidgetType();
|
return object->isWidgetType();
|
||||||
}) | ranges::view::transform([](not_null<QObject*> object) {
|
}) | ranges::views::transform([](not_null<QObject*> object) {
|
||||||
return static_cast<Ui::RpWidget*>(object.get());
|
return static_cast<Ui::RpWidget*>(object.get());
|
||||||
}) | ranges::to_vector;
|
}) | ranges::to_vector;
|
||||||
|
|
||||||
|
|
|
@ -2678,7 +2678,7 @@ MessageIdsList HistoryInner::getSelectedItems() const {
|
||||||
return selected.first->fullId();
|
return selected.first->fullId();
|
||||||
}) | to_vector;
|
}) | to_vector;
|
||||||
|
|
||||||
result |= actions::sort(ordered_less{}, [](const FullMsgId &msgId) {
|
result |= actions::sort(less{}, [](const FullMsgId &msgId) {
|
||||||
return msgId.channel ? msgId.msg : (msgId.msg - ServerMaxMsgId);
|
return msgId.channel ? msgId.msg : (msgId.msg - ServerMaxMsgId);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -136,7 +136,7 @@ int paintBubbleSide(
|
||||||
CornerVerticalSide side,
|
CornerVerticalSide side,
|
||||||
const style::color &bg) {
|
const style::color &bg) {
|
||||||
if (style == SideStyle::Rounded) {
|
if (style == SideStyle::Rounded) {
|
||||||
const auto corner = (NormalMask * MaskMultiplier) | side;
|
const auto corner = (int(NormalMask) * MaskMultiplier) | side;
|
||||||
auto left = circleCorner(corner | CornerLeft, bg);
|
auto left = circleCorner(corner | CornerLeft, bg);
|
||||||
int leftWidth = left.width() / cIntRetinaFactor();
|
int leftWidth = left.width() / cIntRetinaFactor();
|
||||||
p.drawPixmap(x, y, left);
|
p.drawPixmap(x, y, left);
|
||||||
|
@ -155,7 +155,7 @@ int paintBubbleSide(
|
||||||
return cornerHeight;
|
return cornerHeight;
|
||||||
} else if (style == SideStyle::Inverted) {
|
} else if (style == SideStyle::Inverted) {
|
||||||
// CornerLeft and CornerRight are inverted for SideStyle::Inverted sprites.
|
// CornerLeft and CornerRight are inverted for SideStyle::Inverted sprites.
|
||||||
const auto corner = (InvertedMask * MaskMultiplier) | side;
|
const auto corner = (int(InvertedMask) * MaskMultiplier) | side;
|
||||||
auto left = circleCorner(corner | CornerRight, bg);
|
auto left = circleCorner(corner | CornerRight, bg);
|
||||||
int leftWidth = left.width() / cIntRetinaFactor();
|
int leftWidth = left.width() / cIntRetinaFactor();
|
||||||
p.drawPixmap(x - leftWidth, y, left);
|
p.drawPixmap(x - leftWidth, y, left);
|
||||||
|
|
|
@ -512,7 +512,7 @@ void OverlayWidget::RendererGL::validateControls() {
|
||||||
};
|
};
|
||||||
auto maxWidth = 0;
|
auto maxWidth = 0;
|
||||||
auto fullHeight = 0;
|
auto fullHeight = 0;
|
||||||
for (const auto meta : metas) {
|
for (const auto &meta : metas) {
|
||||||
maxWidth = std::max(meta.icon->width(), maxWidth);
|
maxWidth = std::max(meta.icon->width(), maxWidth);
|
||||||
fullHeight += meta.icon->height();
|
fullHeight += meta.icon->height();
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ void OverlayWidget::RendererGL::validateControls() {
|
||||||
auto p = QPainter(&image);
|
auto p = QPainter(&image);
|
||||||
auto index = 0;
|
auto index = 0;
|
||||||
auto height = 0;
|
auto height = 0;
|
||||||
for (const auto meta : metas) {
|
for (const auto &meta : metas) {
|
||||||
meta.icon->paint(p, 0, height, maxWidth);
|
meta.icon->paint(p, 0, height, maxWidth);
|
||||||
_controlsTextures[index++] = QRect(
|
_controlsTextures[index++] = QRect(
|
||||||
QPoint(0, height) * _factor,
|
QPoint(0, height) * _factor,
|
||||||
|
|
|
@ -636,7 +636,7 @@ void Pip::RendererGL::validateControls() {
|
||||||
};
|
};
|
||||||
auto maxWidth = 0;
|
auto maxWidth = 0;
|
||||||
auto fullHeight = 0;
|
auto fullHeight = 0;
|
||||||
for (const auto meta : metas) {
|
for (const auto &meta : metas) {
|
||||||
Assert(meta.icon->size() == meta.iconOver->size());
|
Assert(meta.icon->size() == meta.iconOver->size());
|
||||||
maxWidth = std::max(meta.icon->width(), maxWidth);
|
maxWidth = std::max(meta.icon->width(), maxWidth);
|
||||||
fullHeight += 2 * meta.icon->height();
|
fullHeight += 2 * meta.icon->height();
|
||||||
|
@ -657,7 +657,7 @@ void Pip::RendererGL::validateControls() {
|
||||||
icon->size() * _factor);
|
icon->size() * _factor);
|
||||||
height += icon->height();
|
height += icon->height();
|
||||||
};
|
};
|
||||||
for (const auto meta : metas) {
|
for (const auto &meta : metas) {
|
||||||
paint(meta.icon);
|
paint(meta.icon);
|
||||||
paint(meta.iconOver);
|
paint(meta.iconOver);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Launcher : public Core::Launcher {
|
||||||
public:
|
public:
|
||||||
Launcher(int argc, char *argv[]);
|
Launcher(int argc, char *argv[]);
|
||||||
|
|
||||||
int exec();
|
int exec() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initHook() override;
|
void initHook() override;
|
||||||
|
|
|
@ -211,6 +211,14 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
target_compile_options(lib_tgcalls
|
||||||
|
PRIVATE
|
||||||
|
-Wno-deprecated-volatile
|
||||||
|
-Wno-ambiguous-reversed-operator
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
||||||
platform/android/AndroidContext.cpp
|
platform/android/AndroidContext.cpp
|
||||||
platform/android/AndroidContext.h
|
platform/android/AndroidContext.h
|
||||||
|
|
Loading…
Add table
Reference in a new issue