mirror of https://github.com/procxx/kepka.git
				
				
				
			Add explicit typecasting for some constants
This commit is contained in:
		
							parent
							
								
									3c350fc719
								
							
						
					
					
						commit
						c4fe2f86ea
					
				| 
						 | 
				
			
			@ -485,7 +485,11 @@ bool StickersBox::installFail(quint64 setId, const RPCError &error) {
 | 
			
		|||
void StickersBox::preloadArchivedSets() {
 | 
			
		||||
	if (!_tabs) return;
 | 
			
		||||
	if (!_archivedRequestId) {
 | 
			
		||||
		_archivedRequestId = MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(0), MTP_long(0), MTP_int(kArchivedLimitFirstRequest)), rpcDone(&StickersBox::getArchivedDone, 0ULL));
 | 
			
		||||
		_archivedRequestId =
 | 
			
		||||
				MTP::send(MTPmessages_GetArchivedStickers(MTP_flags(0),
 | 
			
		||||
														  MTP_long(0),
 | 
			
		||||
														  MTP_int(kArchivedLimitFirstRequest)),
 | 
			
		||||
						  rpcDone(&StickersBox::getArchivedDone, Q_UINT64_C(0)));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -242,13 +242,13 @@ enum Flags {
 | 
			
		|||
namespace Stickers {
 | 
			
		||||
 | 
			
		||||
constexpr auto DefaultSetId = 0; // for backward compatibility
 | 
			
		||||
constexpr auto CustomSetId = 0xFFFFFFFFFFFFFFFFULL;
 | 
			
		||||
constexpr auto RecentSetId = 0xFFFFFFFFFFFFFFFEULL; // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto NoneSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto CloudRecentSetId = 0xFFFFFFFFFFFFFFFCULL; // for cloud-stored recent stickers
 | 
			
		||||
constexpr auto FeaturedSetId = 0xFFFFFFFFFFFFFFFBULL; // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto FavedSetId = 0xFFFFFFFFFFFFFFFAULL; // for cloud-stored faved stickers
 | 
			
		||||
constexpr auto MegagroupSetId = 0xFFFFFFFFFFFFFFEFULL; // for setting up megagroup sticker set
 | 
			
		||||
constexpr auto CustomSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFF);
 | 
			
		||||
constexpr auto RecentSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFE); // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto NoneSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFD); // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto CloudRecentSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFC); // for cloud-stored recent stickers
 | 
			
		||||
constexpr auto FeaturedSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFB); // for emoji/stickers panel, should not appear in Sets
 | 
			
		||||
constexpr auto FavedSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFFA); // for cloud-stored faved stickers
 | 
			
		||||
constexpr auto MegagroupSetId = Q_UINT64_C(0xFFFFFFFFFFFFFFEF); // for setting up megagroup sticker set
 | 
			
		||||
struct Set {
 | 
			
		||||
	Set(quint64 id, quint64 access, const QString &title, const QString &shortName, qint32 count, qint32 hash, MTPDstickerSet::Flags flags)
 | 
			
		||||
		: id(id)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -317,7 +317,7 @@ void Mixer::Track::reattach(AudioMsgId::Type type) {
 | 
			
		|||
		alSourceQueueBuffers(stream.source, 1, stream.buffers + i);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	alSourcei(stream.source, AL_SAMPLE_OFFSET, qMax(state.position - bufferedPosition, 0LL));
 | 
			
		||||
	alSourcei(stream.source, AL_SAMPLE_OFFSET, qMax(state.position - bufferedPosition, Q_INT64_C(0)));
 | 
			
		||||
	if (!IsStopped(state.state) && state.state != State::PausedAtEnd) {
 | 
			
		||||
		alSourcef(stream.source, AL_GAIN, ComputeVolume(type));
 | 
			
		||||
		alSourcePlay(stream.source);
 | 
			
		||||
| 
						 | 
				
			
			@ -830,7 +830,7 @@ void Mixer::resume(const AudioMsgId &audio, bool fast) {
 | 
			
		|||
				Audio::AttachToDevice();
 | 
			
		||||
				if (track->state.state == State::PausedAtEnd) {
 | 
			
		||||
					if (track->isStreamCreated()) {
 | 
			
		||||
						alSourcei(track->stream.source, AL_SAMPLE_OFFSET, qMax(track->state.position - track->bufferedPosition, 0LL));
 | 
			
		||||
						alSourcei(track->stream.source, AL_SAMPLE_OFFSET, qMax(track->state.position - track->bufferedPosition, Q_INT64_C(0)));
 | 
			
		||||
						if (!checkCurrentALError(type)) return;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ TimeMs FFMpegReaderImplementation::frameRealTime() const {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
TimeMs FFMpegReaderImplementation::framePresentationTime() const {
 | 
			
		||||
	return qMax(_frameTime + _frameTimeCorrection, 0LL);
 | 
			
		||||
	return qMax(_frameTime + _frameTimeCorrection, Q_INT64_C(0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TimeMs FFMpegReaderImplementation::durationMs() const {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ TimeMs QtGifReaderImplementation::frameRealTime() const {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
TimeMs QtGifReaderImplementation::framePresentationTime() const {
 | 
			
		||||
	return qMax(_frameTime, 0LL);
 | 
			
		||||
	return qMax(_frameTime, Q_INT64_C(0));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ReaderImplementation::ReadResult QtGifReaderImplementation::readNextFrame() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -775,7 +775,7 @@ void Manager::process() {
 | 
			
		|||
	_processingInThread = thread();
 | 
			
		||||
 | 
			
		||||
	bool checkAllReaders = false;
 | 
			
		||||
	auto ms = getms(), minms = ms + 86400 * 1000LL;
 | 
			
		||||
	auto ms = getms(), minms = ms + 86400 * Q_INT64_C(1000);
 | 
			
		||||
	{
 | 
			
		||||
		QMutexLocker lock(&_readerPointersMutex);
 | 
			
		||||
		for (auto it = _readerPointers.begin(), e = _readerPointers.end(); it != e; ++it) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -154,7 +154,7 @@ void CoverWidget::setCloseCallback(ButtonCallback &&callback) {
 | 
			
		|||
void CoverWidget::handleSeekProgress(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	if (_seekPositionMs != positionMs) {
 | 
			
		||||
		_seekPositionMs = positionMs;
 | 
			
		||||
		updateTimeLabel();
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ void CoverWidget::handleSeekProgress(double progress) {
 | 
			
		|||
void CoverWidget::handleSeekFinished(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	_seekPositionMs = -1;
 | 
			
		||||
 | 
			
		||||
	auto type = AudioMsgId::Type::Song;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ Widget::~Widget() = default;
 | 
			
		|||
void Widget::handleSeekProgress(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	if (_seekPositionMs != positionMs) {
 | 
			
		||||
		_seekPositionMs = positionMs;
 | 
			
		||||
		updateTimeLabel();
 | 
			
		||||
| 
						 | 
				
			
			@ -248,7 +248,7 @@ void Widget::handleSeekProgress(double progress) {
 | 
			
		|||
void Widget::handleSeekFinished(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	_seekPositionMs = -1;
 | 
			
		||||
 | 
			
		||||
	auto state = mixer()->currentState(_type);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ Controller::Controller(QWidget *parent) : TWidget(parent)
 | 
			
		|||
void Controller::handleSeekProgress(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	if (_seekPositionMs != positionMs) {
 | 
			
		||||
		_seekPositionMs = positionMs;
 | 
			
		||||
		refreshTimeTexts();
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ void Controller::handleSeekProgress(double progress) {
 | 
			
		|||
void Controller::handleSeekFinished(double progress) {
 | 
			
		||||
	if (!_lastDurationMs) return;
 | 
			
		||||
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), 0LL, _lastDurationMs);
 | 
			
		||||
	auto positionMs = snap(static_cast<TimeMs>(progress * _lastDurationMs), Q_INT64_C(0), _lastDurationMs);
 | 
			
		||||
	_seekPositionMs = -1;
 | 
			
		||||
	emit seekFinished(positionMs);
 | 
			
		||||
	refreshTimeTexts();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1001,7 +1001,7 @@ public:
 | 
			
		|||
		if (!redirect.isEmpty()) _url = redirect;
 | 
			
		||||
 | 
			
		||||
		QNetworkRequest req(_url);
 | 
			
		||||
		QByteArray rangeHeaderValue = "bytes=" + QByteArray::number(_already) + "-";
 | 
			
		||||
		QByteArray rangeHeaderValue = "bytes=" + QByteArray::number(static_cast<qlonglong>(_already)) + "-";
 | 
			
		||||
		req.setRawHeader("Range", rangeHeaderValue);
 | 
			
		||||
		_reply = manager.get(req);
 | 
			
		||||
		return _reply;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 | 
			
		|||
#include "core/basic_types.h"
 | 
			
		||||
#include <QtCore/QTimer>
 | 
			
		||||
#include <QtGui/QColor>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
namespace Media {
 | 
			
		||||
namespace Clip {
 | 
			
		||||
| 
						 | 
				
			
			@ -280,21 +281,21 @@ FORCE_INLINE Shifted operator*(ShiftedMultiplier multiplier, Shifted shifted) {
 | 
			
		|||
 | 
			
		||||
FORCE_INLINE Shifted shifted(quint32 components) {
 | 
			
		||||
	auto wide = static_cast<quint64>(components);
 | 
			
		||||
	return (wide & 0x00000000000000FFULL)
 | 
			
		||||
		| ((wide & 0x000000000000FF00ULL) << 8)
 | 
			
		||||
		| ((wide & 0x0000000000FF0000ULL) << 16)
 | 
			
		||||
		| ((wide & 0x00000000FF000000ULL) << 24);
 | 
			
		||||
	return (wide & Q_UINT64_C(0x00000000000000FF))
 | 
			
		||||
		| ((wide & Q_UINT64_C(0x000000000000FF00)) << 8)
 | 
			
		||||
		| ((wide & Q_UINT64_C(0x0000000000FF0000)) << 16)
 | 
			
		||||
		| ((wide & Q_UINT64_C(0x00000000FF000000)) << 24);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FORCE_INLINE quint32 unshifted(Shifted components) {
 | 
			
		||||
	return static_cast<quint32>((components.value & 0x000000000000FF00ULL) >> 8)
 | 
			
		||||
		| static_cast<quint32>((components.value & 0x00000000FF000000ULL) >> 16)
 | 
			
		||||
		| static_cast<quint32>((components.value & 0x0000FF0000000000ULL) >> 24)
 | 
			
		||||
		| static_cast<quint32>((components.value & 0xFF00000000000000ULL) >> 32);
 | 
			
		||||
	return static_cast<quint32>((components.value & Q_UINT64_C(0x000000000000FF00)) >> 8)
 | 
			
		||||
		 | static_cast<quint32>((components.value & Q_UINT64_C(0x00000000FF000000)) >> 16)
 | 
			
		||||
		 | static_cast<quint32>((components.value & Q_UINT64_C(0x0000FF0000000000)) >> 24)
 | 
			
		||||
		 | static_cast<quint32>((components.value & Q_UINT64_C(0xFF00000000000000)) >> 32);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FORCE_INLINE Shifted reshifted(Shifted components) {
 | 
			
		||||
	return (components.value >> 8) & 0x00FF00FF00FF00FFULL;
 | 
			
		||||
	return (components.value >> 8) & Q_UINT64_C(0x00FF00FF00FF00FF);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FORCE_INLINE Shifted shifted(QColor color) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ public:
 | 
			
		|||
 | 
			
		||||
		virtual int width() const = 0;
 | 
			
		||||
		void paint(Painter &p, style::color color, int x, int y, int outerWidth, TimeMs ms) {
 | 
			
		||||
			paintFrame(p, color, x, y, outerWidth, qMax(ms - _started, 0LL) % _period);
 | 
			
		||||
			paintFrame(p, color, x, y, outerWidth, qMax(ms - _started, Q_INT64_C(0)) % _period);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual ~Impl() = default;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue