Updated Xcode build for using standard library.

Also trying to use g++-6 for travis build.
This commit is contained in:
John Preston 2017-02-21 17:37:53 +03:00
parent ffc557a0f9
commit 755325fef3
24 changed files with 57 additions and 35 deletions

View File

@ -35,8 +35,8 @@ addons:
- dpatch
- equivs
- fakeroot
- g++-4.9
- gcc-4.9
- g++-6
- gcc-6
- git
- gnome-common
- gobject-introspection
@ -62,8 +62,8 @@ addons:
before_install:
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- .travis/check.sh
- export CXX="g++-4.9" CC="gcc-4.9"
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
- export CXX="g++-6" CC="gcc-6"
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
- sudo update-alternatives --config gcc
- g++ --version

View File

@ -155,7 +155,7 @@ QPixmap BoxContent::grabInnerCache() {
auto result = myGrab(this, _scroll->geometry());
if (isTopShadowVisible) _topShadow->show();
if (isBottomShadowVisible) _bottomShadow->show();
return std::move(result);
return result;
}
void BoxContent::resizeEvent(QResizeEvent *e) {

View File

@ -425,7 +425,7 @@ QPixmap StickersBox::grabContentCache() {
_tabs->hide();
auto result = grabInnerCache();
_tabs->show();
return std::move(result);
return result;
}
void StickersBox::installSet(uint64 setId) {

View File

@ -26,6 +26,21 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <ctime>
#include "core/build_config.h"
#if defined COMPILER_CLANG || defined COMPILER_GCC
namespace std {
template <typename T>
constexpr std::add_const_t<T>& as_const(T& t) noexcept {
return t;
}
template <typename T>
void as_const(const T&&) = delete;
} // namespace std
#endif // COMPILER_CLANG || COMPILER_GCC
#include "core/ordered_set.h"
//using uchar = unsigned char; // Qt has uchar

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once
#include <vector>
#include <deque>
#include "core/type_traits.h"
namespace base {
@ -285,7 +286,7 @@ private:
UnregisterActiveObservable(&this->_callHandlers);
}
std::vector<EventType> _events;
std::deque<EventType> _events;
bool _handling = false;
};
@ -425,9 +426,10 @@ protected:
void unsubscribe(int index) {
if (!index) return;
t_assert(index > 0 && index <= _subscriptions.size());
auto count = static_cast<int>(_subscriptions.size());
t_assert(index > 0 && index <= count);
_subscriptions[index - 1].destroy();
if (index == _subscriptions.size()) {
if (index == count) {
while (index > 0 && !_subscriptions[--index]) {
_subscriptions.pop_back();
}

View File

@ -215,8 +215,8 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
}
} else if (_state == FilteredState || _state == SearchedState) {
if (!_hashtagResults.empty()) {
int32 from = floorclamp(r.y(), st::mentionHeight, 0, _hashtagResults.size());
int32 to = ceilclamp(r.y() + r.height(), st::mentionHeight, 0, _hashtagResults.size());
auto from = floorclamp(r.y(), st::mentionHeight, 0, _hashtagResults.size());
auto to = ceilclamp(r.y() + r.height(), st::mentionHeight, 0, _hashtagResults.size());
p.translate(0, from * st::mentionHeight);
if (from < _hashtagResults.size()) {
auto htagwidth = fullWidth - st::dialogsPadding.x() * 2;

View File

@ -150,7 +150,7 @@ QPixmap ItemBase::getResultContactAvatar(int width, int height) const {
if (result.height() != height * cIntRetinaFactor()) {
result = result.scaled(QSize(width, height) * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
return std::move(result);
return result;
}
return QPixmap();
}

View File

@ -694,7 +694,7 @@ Widget::Step::CoverAnimation Widget::Step::prepareCoverAnimation(Step *after) {
result.description = Ui::FlatLabel::CrossFade(after->_description->entity(), _description->entity(), st::introBg, after->_description->pos(), _description->pos());
result.contentSnapshotWas = after->prepareContentSnapshot();
result.contentSnapshotNow = prepareContentSnapshot();
return std::move(result);
return result;
}
QPixmap Widget::Step::prepareContentSnapshot() {

View File

@ -2217,10 +2217,10 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
}
_stack.clear();
} else {
for (int i = 0, s = _stack.size(); i < s; ++i) {
for (auto i = 0, s = int(_stack.size()); i < s; ++i) {
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) {
foundInStack = true;
while (_stack.size() > i + 1) {
while (int(_stack.size()) > i + 1) {
clearBotStartToken(_stack.back()->peer);
_stack.pop_back();
}

View File

@ -115,7 +115,7 @@ QImage PreviewWindowSystemButton(QColor inner, QColor border) {
p.drawEllipse(QRectF(0.5, 0.5, fullSize - 1., fullSize - 1.));
}
result.setDevicePixelRatio(cRetinaFactor());
return std::move(result);
return result;
}
void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int titleHeight, int outerWidth) {

View File

@ -3317,7 +3317,7 @@ QImage EmojiPan::grabForPanelAnimation() {
_inPanelGrab = true;
render(&result);
_inPanelGrab = false;
return std::move(result);
return result;
}
void EmojiPan::hideAnimated() {

View File

@ -99,7 +99,7 @@ QImage RoundShadowAnimation::cloneImage(const style::icon &source) {
Painter p(&result);
source.paint(p, 0, 0, source.width());
}
return std::move(result);
return result;
}
void RoundShadowAnimation::paintCorner(Corner &corner, int left, int top) {

View File

@ -207,7 +207,7 @@ QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda<void(
p.setBrush(QColor(255, 255, 255));
drawer(p);
}
return std::move(result);
return result;
}
QImage RippleAnimation::rectMask(QSize size) {

View File

@ -266,7 +266,7 @@ QImage prepareColored(style::color add, QImage image) {
pix[i + 3] = uchar(a + ((aca * (0xFF - a)) >> 16));
}
}
return std::move(image);
return image;
}
QImage prepareOpaque(QImage image) {
@ -285,7 +285,7 @@ QImage prepareOpaque(QImage image) {
ints += addPerLine;
}
}
return std::move(image);
return image;
}
QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, int outerh) {
@ -337,7 +337,7 @@ QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, in
t_assert(!img.isNull());
}
img.setDevicePixelRatio(cRetinaFactor());
return std::move(img);
return img;
}
} // namespace Images

View File

@ -71,7 +71,7 @@ inline QImage colorizeImage(const QImage &src, QColor c, QRect srcRect = QRect()
if (srcRect.isNull()) srcRect = src.rect();
auto result = QImage(srcRect.size(), QImage::Format_ARGB32_Premultiplied);
colorizeImage(src, c, &result, srcRect);
return std::move(result);
return result;
}
inline QImage colorizeImage(const QImage &src, const color &c, QRect srcRect = QRect()) {

View File

@ -223,20 +223,20 @@ QImage MonoIcon::instance(QColor colorOverride, DBIScale scale) const {
} else {
colorizeImage(_maskImage, colorOverride, &result);
}
return std::move(result);
return result;
}
auto size = readGeneratedSize(_mask, scale);
if (!size.isEmpty()) {
auto result = QImage(size * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor());
result.fill(colorOverride);
return std::move(result);
return result;
}
auto mask = createIconMask(_mask, scale);
auto result = QImage(mask.size(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor());
colorizeImage(mask, colorOverride, &result);
return std::move(result);
return result;
}
void MonoIcon::ensureLoaded() const {

View File

@ -77,7 +77,7 @@ QPixmap myGrab(TWidget *target, QRect rect, QColor bg) {
target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish();
return std::move(result);
return result;
}
QImage myGrabImage(TWidget *target, QRect rect, QColor bg) {
@ -94,7 +94,7 @@ QImage myGrabImage(TWidget *target, QRect rect, QColor bg) {
target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish();
return std::move(result);
return result;
}
void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) {

View File

@ -274,7 +274,7 @@ QImage InnerDropdown::grabForPanelAnimation() {
}
}
}
return std::move(result);
return result;
}
void InnerDropdown::opacityAnimationCallback() {

View File

@ -609,7 +609,7 @@ std::unique_ptr<CrossFadeAnimation> FlatLabel::CrossFade(FlatLabel *from, FlatLa
result.lineAddTop = addedHeight / 2;
result.lineHeight += addedHeight;
}
return std::move(result);
return result;
};
auto was = prepareData(from);
auto now = prepareData(to);
@ -643,13 +643,13 @@ std::unique_ptr<CrossFadeAnimation> FlatLabel::CrossFade(FlatLabel *from, FlatLa
}
auto positionBase = position + label->pos();
result.position = positionBase + QPoint(label->_st.margin.left() + left, label->_st.margin.top() + top);
return std::move(result);
return result;
};
for (int i = 0; i != maxLines; ++i) {
result->addLine(preparePart(from, fromPosition, was, i, now), preparePart(to, toPosition, now, i, was));
}
return std::move(result);
return result;
}
Text::StateResult FlatLabel::dragActionUpdate() {

View File

@ -408,7 +408,7 @@ QImage PopupMenu::grabForPanelAnimation() {
}
}
}
return std::move(result);
return result;
}
void PopupMenu::deleteOnHide(bool del) {

View File

@ -98,7 +98,7 @@ QPixmap Shadow::grab(TWidget *target, const style::Shadow &shadow, Sides sides)
target->render(&p, QPoint(extend.left(), extend.top()), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish();
}
return std::move(result);
return result;
}
} // namespace Ui

View File

@ -895,7 +895,7 @@ std::unique_ptr<Preview> GeneratePreview(const QString &filepath, const CurrentD
return std::unique_ptr<Preview>();
}
result->preview = Generator(result->instance, data).generate();
return std::move(result);
return result;
}
int DefaultPreviewTitleHeight() {

View File

@ -54,6 +54,7 @@
'-Wno-switch',
'-Wno-comment',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
],
},
'xcode_settings': {

View File

@ -1,3 +1,7 @@
1.0.14 (20.02.17)
- Bug fixes and other minor improvements.
1.0.13 (20.02.17)
- Bug fixes and other minor improvements.