mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
some warnings fixed, TDESKTOP_DISABLE_NETWORK_PROXY macro added
This commit is contained in:
parent
2cbda4e1e5
commit
0b2bcbc3e9
25 changed files with 143 additions and 105 deletions
|
@ -189,7 +189,7 @@ void readKeyValue(const char *&from, const char *end) {
|
|||
|
||||
if (*from == ':') {
|
||||
start = ++from;
|
||||
|
||||
|
||||
QVector<QString> &counted(keysCounted[varName][tagName]);
|
||||
QByteArray subvarValue;
|
||||
bool foundtag = false;
|
||||
|
@ -606,13 +606,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
++depth;
|
||||
current += ich;
|
||||
|
||||
if (tag == current) {
|
||||
bool exact = (tag == current);
|
||||
if (exact) {
|
||||
tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " == e) {\n";
|
||||
tcpp << tab.repeated(depth + 1) << "\treturn lt_" << tag << ";\n";
|
||||
tcpp << tab.repeated(depth + 1) << "}\n";
|
||||
}
|
||||
|
||||
tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n";
|
||||
QByteArray nexttag = j.key();
|
||||
if (exact && depth > 0 && nexttag.mid(0, depth) != current) {
|
||||
current.chop(1);
|
||||
--depth;
|
||||
tcpp << tab.repeated(depth + 1) << "break;\n";
|
||||
break;
|
||||
} else {
|
||||
tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n";
|
||||
}
|
||||
} while (true);
|
||||
++j;
|
||||
}
|
||||
|
@ -637,7 +646,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
tcpp << "\tswitch (*(ch + " << depth << ")) {\n";
|
||||
for (LangKeys::const_iterator i = keys.cbegin(), j = i + 1, e = keys.cend(); i != e; ++i) {
|
||||
QByteArray key = i.key();
|
||||
while (key.mid(0, depth) != current) {
|
||||
while (depth > 0 && key.mid(0, depth) != current) {
|
||||
tcpp << tab.repeated(depth - 3) << "}\n";
|
||||
current.chop(1);
|
||||
--depth;
|
||||
|
@ -645,7 +654,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
}
|
||||
do {
|
||||
if (key == current) break;
|
||||
|
||||
|
||||
char ich = i.key().at(current.size());
|
||||
tcpp << tab.repeated(current.size() - 3) << "case '" << ich << "':\n";
|
||||
if (j == e || ich != ((j.key().size() > depth) ? j.key().at(depth) : 0)) {
|
||||
|
@ -661,13 +670,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
++depth;
|
||||
current += ich;
|
||||
|
||||
if (key == current) {
|
||||
bool exact = (key == current);
|
||||
if (exact) {
|
||||
tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " == e) {\n";
|
||||
tcpp << tab.repeated(depth - 3) << "\treturn " << key << (keysTags[key].isEmpty() ? "" : "__tagged") << ";\n";
|
||||
tcpp << tab.repeated(depth - 3) << "}\n";
|
||||
}
|
||||
|
||||
tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n";
|
||||
QByteArray nextkey = j.key();
|
||||
if (exact && depth > 0 && nextkey.mid(0, depth) != current) {
|
||||
current.chop(1);
|
||||
--depth;
|
||||
tcpp << tab.repeated(depth - 3) << "break;\n";
|
||||
break;
|
||||
} else {
|
||||
tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n";
|
||||
}
|
||||
} while (true);
|
||||
++j;
|
||||
}
|
||||
|
@ -707,16 +725,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
tcpp << "\tif (index >= lngtags_max_counted_values) return lngkeys_cnt;\n\n";
|
||||
if (!tags.isEmpty()) {
|
||||
tcpp << "\tswitch (key) {\n";
|
||||
for (int i = 0, l = keysOrder.size(); i < l; ++i) {
|
||||
QVector<QByteArray> &tagsList(keysTags[keysOrder[i]]);
|
||||
for (auto key : keysOrder) {
|
||||
QVector<QByteArray> &tagsList(keysTags[key]);
|
||||
if (tagsList.isEmpty()) continue;
|
||||
|
||||
QMap<QByteArray, QVector<QString> > &countedTags(keysCounted[keysOrder[i]]);
|
||||
tcpp << "\tcase " << keysOrder[i] << "__tagged: {\n";
|
||||
QMap<QByteArray, QVector<QString> > &countedTags(keysCounted[key]);
|
||||
bool hasCounted = false;
|
||||
for (auto tag : tagsList) {
|
||||
if (!countedTags[tag].isEmpty()) {
|
||||
hasCounted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasCounted) continue;
|
||||
|
||||
tcpp << "\tcase " << key << "__tagged: {\n";
|
||||
tcpp << "\t\tswitch (tag) {\n";
|
||||
for (int j = 0, s = tagsList.size(); j < s; ++j) {
|
||||
if (!countedTags[tagsList[j]].isEmpty()) {
|
||||
tcpp << "\t\tcase lt_" << tagsList[j] << ": return LangKey(" << keysOrder[i] << "__" << tagsList[j] << "0 + index);\n";
|
||||
for (auto tag : tagsList) {
|
||||
if (!countedTags[tag].isEmpty()) {
|
||||
tcpp << "\t\tcase lt_" << tag << ": return LangKey(" << key << "__" << tag << "0 + index);\n";
|
||||
}
|
||||
}
|
||||
tcpp << "\t\t}\n";
|
||||
|
@ -724,7 +751,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
|
|||
}
|
||||
tcpp << "\t}\n\n";
|
||||
}
|
||||
tcpp << "\treturn lngkeys_cnt;";
|
||||
tcpp << "\treturn lngkeys_cnt;\n";
|
||||
tcpp << "}\n\n";
|
||||
|
||||
tcpp << "bool LangLoader::feedKeyValue(LangKey key, const QString &value) {\n";
|
||||
|
|
|
@ -2474,9 +2474,12 @@ namespace App {
|
|||
}
|
||||
|
||||
void setProxySettings(QNetworkAccessManager &manager) {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
manager.setProxy(getHttpProxySettings());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxy getHttpProxySettings() {
|
||||
const ConnectionProxy *proxy = 0;
|
||||
if (Global::started()) {
|
||||
|
@ -2489,14 +2492,17 @@ namespace App {
|
|||
}
|
||||
return QNetworkProxy(QNetworkProxy::DefaultProxy);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setProxySettings(QTcpSocket &socket) {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
if (cConnectionType() == dbictTcpProxy) {
|
||||
const ConnectionProxy &p(cConnectionProxy());
|
||||
socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, p.host, p.port, p.user, p.password));
|
||||
} else {
|
||||
socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QImage **cornersMask() {
|
||||
|
|
|
@ -250,7 +250,9 @@ namespace App {
|
|||
const ReplyMarkup &replyMarkup(ChannelId channelId, MsgId msgId);
|
||||
|
||||
void setProxySettings(QNetworkAccessManager &manager);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxy getHttpProxySettings();
|
||||
#endif
|
||||
void setProxySettings(QTcpSocket &socket);
|
||||
|
||||
QImage **cornersMask();
|
||||
|
|
|
@ -761,7 +761,9 @@ AppClass::AppClass() : QObject()
|
|||
_window->showSettings();
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
#endif
|
||||
|
||||
if (state != Local::ReadMapPassNeeded) {
|
||||
checkMapVersion();
|
||||
|
|
|
@ -226,10 +226,10 @@ void audioPlayNotify() {
|
|||
|
||||
void audioFinish() {
|
||||
if (player) {
|
||||
delete player;
|
||||
deleteAndMark(player);
|
||||
}
|
||||
if (capture) {
|
||||
delete capture;
|
||||
deleteAndMark(capture);
|
||||
}
|
||||
|
||||
alSourceStop(notifySource);
|
||||
|
@ -243,14 +243,14 @@ void audioFinish() {
|
|||
}
|
||||
|
||||
if (audioContext) {
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcMakeContextCurrent(nullptr);
|
||||
alcDestroyContext(audioContext);
|
||||
audioContext = 0;
|
||||
audioContext = nullptr;
|
||||
}
|
||||
|
||||
if (audioDevice) {
|
||||
alcCloseDevice(audioDevice);
|
||||
audioDevice = 0;
|
||||
audioDevice = nullptr;
|
||||
}
|
||||
|
||||
cSetHasAudioCapture(false);
|
||||
|
@ -1685,7 +1685,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const
|
|||
err = SetupErrorAtStart;
|
||||
QMutexLocker lock(&playerMutex);
|
||||
AudioPlayer *voice = audioPlayer();
|
||||
if (!voice) return 0;
|
||||
if (!voice) return nullptr;
|
||||
|
||||
bool isGoodId = false;
|
||||
AudioPlayer::Msg *m = 0;
|
||||
|
@ -1717,7 +1717,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const
|
|||
if (!l || !m) {
|
||||
LOG(("Audio Error: trying to load part of audio, that is not current at the moment"));
|
||||
err = SetupErrorNotPlaying;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (*l && (!isGoodId || !(*l)->check(m->file, m->data))) {
|
||||
|
@ -1741,27 +1741,26 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const
|
|||
// if (!f.open(QIODevice::ReadOnly)) {
|
||||
// LOG(("Audio Error: could not open file '%1'").arg(m->fname));
|
||||
// m->state = AudioPlayerStoppedAtStart;
|
||||
// return 0;
|
||||
// return nullptr;
|
||||
// }
|
||||
// header = f.read(8);
|
||||
// }
|
||||
// if (header.size() < 8) {
|
||||
// LOG(("Audio Error: could not read header from file '%1', data size %2").arg(m->fname).arg(m->data.isEmpty() ? QFileInfo(m->fname).size() : m->data.size()));
|
||||
// m->state = AudioPlayerStoppedAtStart;
|
||||
// return 0;
|
||||
// return nullptr;
|
||||
// }
|
||||
|
||||
*l = new FFMpegLoader(m->file, m->data);
|
||||
|
||||
int ret;
|
||||
if (!(*l)->open(position)) {
|
||||
m->state = AudioPlayerStoppedAtStart;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
int64 duration = (*l)->duration();
|
||||
if (duration <= 0) {
|
||||
m->state = AudioPlayerStoppedAtStart;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
m->duration = duration;
|
||||
m->frequency = (*l)->frequency();
|
||||
|
@ -1771,7 +1770,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const
|
|||
if (!m->skipEnd) {
|
||||
err = SetupErrorLoadedFull;
|
||||
LOG(("Audio Error: trying to load part of audio, that is already loaded to the end"));
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return *l;
|
||||
|
@ -2029,7 +2028,7 @@ void AudioCaptureInner::onStart() {
|
|||
}
|
||||
|
||||
// Open audio stream
|
||||
if ((res = avcodec_open2(d->codecContext, d->codec, NULL)) < 0) {
|
||||
if ((res = avcodec_open2(d->codecContext, d->codec, nullptr)) < 0) {
|
||||
LOG(("Audio Error: Unable to avcodec_open2 for capture, error %1, %2").arg(res).arg(av_make_error_string(err, sizeof(err), res)));
|
||||
onStop(false);
|
||||
emit error();
|
||||
|
|
|
@ -839,7 +839,7 @@ void SetupChannelBox::onChange() {
|
|||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
int32 i, len = name.size();
|
||||
int32 len = name.size();
|
||||
for (int32 i = 0; i < len; ++i) {
|
||||
QChar ch = name.at(i);
|
||||
if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_') {
|
||||
|
|
|
@ -201,8 +201,10 @@ void ConnectionBox::onSave() {
|
|||
} else {
|
||||
cSetConnectionType(dbictAuto);
|
||||
cSetConnectionProxy(ConnectionProxy());
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
#endif
|
||||
}
|
||||
if (cPlatform() == dbipWindows && cTryIPv6() != _tryIPv6.checked()) {
|
||||
cSetTryIPv6(_tryIPv6.checked());
|
||||
|
|
|
@ -160,7 +160,7 @@ void UsernameBox::onChanged() {
|
|||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
int32 i, len = name.size();
|
||||
int32 len = name.size();
|
||||
for (int32 i = 0; i < len; ++i) {
|
||||
QChar ch = name.at(i);
|
||||
if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_' && (ch != '@' || i > 0)) {
|
||||
|
|
|
@ -2646,7 +2646,6 @@ void HistoryBlock::removeItem(HistoryItem *item) {
|
|||
}
|
||||
// myIndex can be invalid now, because of destroying previous blocks
|
||||
|
||||
dh = item->height();
|
||||
items.remove(index);
|
||||
if ((!item->out() || item->isPost()) && item->unread() && history->unreadCount) {
|
||||
history->setUnreadCount(history->unreadCount - 1);
|
||||
|
@ -4725,7 +4724,7 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r,
|
|||
_data->checkSticker();
|
||||
bool loaded = _data->loaded();
|
||||
|
||||
bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost, hovered, pressed;
|
||||
bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost;
|
||||
|
||||
int32 usew = _maxw, usex = 0;
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
|
|
|
@ -3663,7 +3663,7 @@ namespace Local {
|
|||
|
||||
QString name, invitationUrl;
|
||||
quint64 access;
|
||||
qint32 date, version, adminned, forbidden, flags;
|
||||
qint32 date, version, forbidden, flags;
|
||||
from.stream >> name >> access >> date >> version >> forbidden >> flags >> invitationUrl;
|
||||
|
||||
if (!wasLoaded) {
|
||||
|
|
|
@ -642,14 +642,26 @@ namespace SignalHandlers {
|
|||
return stream;
|
||||
}
|
||||
|
||||
template <bool Unsigned, typename Type>
|
||||
struct _writeNumberSignAndRemoveIt {
|
||||
static void call(Type &number) {
|
||||
if (number < 0) {
|
||||
_writeChar('-');
|
||||
number = -number;
|
||||
}
|
||||
}
|
||||
};
|
||||
template <typename Type>
|
||||
struct _writeNumberSignAndRemoveIt<true, Type> {
|
||||
static void call(Type &number) {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
const dump &_writeNumber(const dump &stream, Type number) {
|
||||
if (!CrashDumpFile) return stream;
|
||||
|
||||
if (number < 0) {
|
||||
_writeChar('-');
|
||||
number = -number;
|
||||
}
|
||||
_writeNumberSignAndRemoveIt<(Type(-1) > Type(0)), Type>::call(number);
|
||||
Type upper = 1, prev = number / 10;
|
||||
while (prev >= upper) {
|
||||
upper *= 10;
|
||||
|
@ -937,7 +949,10 @@ namespace SignalHandlers {
|
|||
Status start() {
|
||||
CrashDumpPath = cWorkingDir() + qsl("tdata/working");
|
||||
#ifdef Q_OS_WIN
|
||||
if (FILE *f = _wfopen(CrashDumpPath.toStdWString().c_str(), L"rb")) {
|
||||
FILE *f = nullptr;
|
||||
if (_wfopen_s(&f, CrashDumpPath.toStdWString().c_str(), L"rb") != 0) {
|
||||
f = nullptr;
|
||||
} else {
|
||||
#else
|
||||
if (FILE *f = fopen(QFile::encodeName(CrashDumpPath).constData(), "rb")) {
|
||||
#endif
|
||||
|
@ -964,12 +979,18 @@ namespace SignalHandlers {
|
|||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
CrashDumpFile = _wfopen(CrashDumpPath.toStdWString().c_str(), L"wb");
|
||||
if (_wfopen_s(&CrashDumpFile, CrashDumpPath.toStdWString().c_str(), L"wb") != 0) {
|
||||
CrashDumpFile = nullptr;
|
||||
}
|
||||
#else
|
||||
CrashDumpFile = fopen(QFile::encodeName(CrashDumpPath).constData(), "wb");
|
||||
#endif
|
||||
if (CrashDumpFile) {
|
||||
#ifdef Q_OS_WIN
|
||||
CrashDumpFileNo = _fileno(CrashDumpFile);
|
||||
#else
|
||||
CrashDumpFileNo = fileno(CrashDumpFile);
|
||||
#endif
|
||||
if (SetSignalHandlers) {
|
||||
#ifndef Q_OS_WIN
|
||||
struct sigaction sigact;
|
||||
|
|
|
@ -4027,7 +4027,7 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
|||
feedUpdates(updates);
|
||||
}
|
||||
App::emitPeerUpdated();
|
||||
} catch (mtpErrorUnexpected &e) { // just some other type
|
||||
} catch (mtpErrorUnexpected &) { // just some other type
|
||||
}
|
||||
}
|
||||
update();
|
||||
|
|
|
@ -722,7 +722,7 @@ for restype in typesList:
|
|||
|
||||
typesText += '\tvoid write(mtpBuffer &to) const;\n'; # write method
|
||||
inlineMethods += 'inline void MTP' + restype + '::write(mtpBuffer &to) const {\n';
|
||||
if (withType):
|
||||
if (withType and writer != ''):
|
||||
inlineMethods += '\tswitch (_type) {\n';
|
||||
inlineMethods += writer;
|
||||
inlineMethods += '\t}\n';
|
||||
|
|
|
@ -641,7 +641,9 @@ MTPautoConnection::MTPautoConnection(QThread *thread) : MTPabstractTcpConnection
|
|||
moveToThread(thread);
|
||||
|
||||
manager.moveToThread(thread);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
manager.setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
#endif
|
||||
|
||||
httpStartTimer.moveToThread(thread);
|
||||
httpStartTimer.setSingleShot(true);
|
||||
|
@ -652,7 +654,9 @@ MTPautoConnection::MTPautoConnection(QThread *thread) : MTPabstractTcpConnection
|
|||
connect(&tcpTimeoutTimer, SIGNAL(timeout()), this, SLOT(onTcpTimeoutTimer()));
|
||||
|
||||
sock.moveToThread(thread);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
sock.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
#endif
|
||||
connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected()));
|
||||
connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected()));
|
||||
|
@ -2722,7 +2726,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt
|
|||
MTPMsgResendReq request(rFrom, rEnd);
|
||||
handleMsgsStates(request.c_msg_resend_req().vmsg_ids.c_vector().v, states, toAck);
|
||||
}
|
||||
} catch(Exception &e) {
|
||||
} catch(Exception &) {
|
||||
LOG(("Message Error: could not parse sent msgs_state_req"));
|
||||
throw;
|
||||
}
|
||||
|
@ -2942,7 +2946,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt
|
|||
|
||||
}
|
||||
|
||||
} catch (Exception &e) {
|
||||
} catch (Exception &) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3548,7 +3552,7 @@ void MTProtoConnectionPrivate::dhClientParamsSend() {
|
|||
client_dh_inner_data.vg_b._string().v.resize(256);
|
||||
|
||||
// gen rand 'b'
|
||||
uint32 b[64], *g_b((uint32*)&client_dh_inner_data.vg_b._string().v[0]), g_b_len;
|
||||
uint32 b[64], *g_b((uint32*)&client_dh_inner_data.vg_b._string().v[0]);
|
||||
memset_rand(b, sizeof(b));
|
||||
|
||||
// count g_b and auth_key using openssl BIGNUM methods
|
||||
|
@ -3807,7 +3811,7 @@ void MTProtoConnectionPrivate::sendRequestNotSecure(const TRequest &request) {
|
|||
|
||||
onSentSome(buffer.size() * sizeof(mtpPrime));
|
||||
|
||||
} catch (Exception &e) {
|
||||
} catch (Exception &) {
|
||||
return restart();
|
||||
}
|
||||
}
|
||||
|
@ -3844,7 +3848,7 @@ bool MTProtoConnectionPrivate::readResponseNotSecure(TResponse &response) {
|
|||
}
|
||||
const mtpPrime *from(answer + 5), *end(from + len - 5);
|
||||
response.read(from, end);
|
||||
} catch (Exception &e) {
|
||||
} catch (Exception &) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -440,7 +440,7 @@ private:
|
|||
MTPabstractConnection *_conn, *_conn4, *_conn6;
|
||||
|
||||
SingleTimer retryTimer; // exp retry timer
|
||||
uint32 retryTimeout;
|
||||
int retryTimeout;
|
||||
quint64 retryWillFinish;
|
||||
|
||||
SingleTimer oldConnectionTimer;
|
||||
|
|
|
@ -831,19 +831,6 @@ public:
|
|||
VType v;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
class MTPvector;
|
||||
template <typename T>
|
||||
MTPvector<T> MTP_vector(uint32 count);
|
||||
|
||||
template <typename T>
|
||||
MTPvector<T> MTP_vector(uint32 count, const T &value);
|
||||
|
||||
template <typename T>
|
||||
MTPvector<T> MTP_vector(const QVector<T> &v);
|
||||
|
||||
template <typename T>
|
||||
class MTPvector : private mtpDataOwner {
|
||||
public:
|
||||
|
@ -897,9 +884,12 @@ private:
|
|||
explicit MTPvector(MTPDvector<T> *_data) : mtpDataOwner(_data) {
|
||||
}
|
||||
|
||||
friend MTPvector<T> MTP_vector<T>(uint32 count);
|
||||
friend MTPvector<T> MTP_vector<T>(uint32 count, const T &value);
|
||||
friend MTPvector<T> MTP_vector<T>(const QVector<T> &v);
|
||||
template <typename U>
|
||||
friend MTPvector<U> MTP_vector(uint32 count);
|
||||
template <typename U>
|
||||
friend MTPvector<U> MTP_vector(uint32 count, const U &value);
|
||||
template <typename U>
|
||||
friend MTPvector<U> MTP_vector(const QVector<U> &v);
|
||||
typedef typename MTPDvector<T>::VType VType;
|
||||
};
|
||||
template <typename T>
|
||||
|
|
|
@ -771,9 +771,11 @@ private:
|
|||
};
|
||||
|
||||
void reinitWebLoadManager() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
if (webLoadManager()) {
|
||||
webLoadManager()->setProxySettings(App::getHttpProxySettings());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void stopWebLoadManager() {
|
||||
|
@ -790,11 +792,13 @@ void stopWebLoadManager() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void WebLoadManager::setProxySettings(const QNetworkProxy &proxy) {
|
||||
QMutexLocker lock(&_loaderPointersMutex);
|
||||
_proxySettings = proxy;
|
||||
emit proxyApplyDelayed();
|
||||
}
|
||||
#endif
|
||||
|
||||
WebLoadManager::WebLoadManager(QThread *thread) {
|
||||
moveToThread(thread);
|
||||
|
@ -1021,8 +1025,10 @@ void WebLoadManager::sendRequest(webFileLoaderPrivate *loader, const QString &re
|
|||
}
|
||||
|
||||
void WebLoadManager::proxyApply() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QMutexLocker lock(&_loaderPointersMutex);
|
||||
_manager.setProxy(_proxySettings);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebLoadManager::finish() {
|
||||
|
|
|
@ -321,7 +321,9 @@ public:
|
|||
|
||||
WebLoadManager(QThread *thread);
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void setProxySettings(const QNetworkProxy &proxy);
|
||||
#endif
|
||||
|
||||
void append(webFileLoader *loader, const QString &url);
|
||||
void stop(webFileLoader *reader);
|
||||
|
@ -352,7 +354,9 @@ private:
|
|||
void sendRequest(webFileLoaderPrivate *loader, const QString &redirect = QString());
|
||||
bool handleReplyResult(webFileLoaderPrivate *loader, WebReplyProcessResult result);
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxy _proxySettings;
|
||||
#endif
|
||||
QNetworkAccessManager _manager;
|
||||
typedef QMap<webFileLoader*, webFileLoaderPrivate*> LoaderPointers;
|
||||
LoaderPointers _loaderPointers;
|
||||
|
|
|
@ -23307,8 +23307,6 @@ inline void MTPbool::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId
|
|||
}
|
||||
}
|
||||
inline void MTPbool::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPbool::MTPbool(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -24329,8 +24327,6 @@ inline void MTPstorage_fileType::read(const mtpPrime *&from, const mtpPrime *end
|
|||
}
|
||||
}
|
||||
inline void MTPstorage_fileType::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPstorage_fileType::MTPstorage_fileType(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -26148,8 +26144,6 @@ inline void MTPinputPeerNotifyEvents::read(const mtpPrime *&from, const mtpPrime
|
|||
}
|
||||
}
|
||||
inline void MTPinputPeerNotifyEvents::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPinputPeerNotifyEvents::MTPinputPeerNotifyEvents(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -26212,8 +26206,6 @@ inline void MTPpeerNotifyEvents::read(const mtpPrime *&from, const mtpPrime *end
|
|||
}
|
||||
}
|
||||
inline void MTPpeerNotifyEvents::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPpeerNotifyEvents::MTPpeerNotifyEvents(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -27077,8 +27069,6 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end,
|
|||
}
|
||||
}
|
||||
inline void MTPmessagesFilter::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -29763,8 +29753,6 @@ inline void MTPinputPrivacyKey::read(const mtpPrime *&from, const mtpPrime *end,
|
|||
}
|
||||
}
|
||||
inline void MTPinputPrivacyKey::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPinputPrivacyKey::MTPinputPrivacyKey(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -29795,8 +29783,6 @@ inline void MTPprivacyKey::read(const mtpPrime *&from, const mtpPrime *end, mtpT
|
|||
}
|
||||
}
|
||||
inline void MTPprivacyKey::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPprivacyKey::MTPprivacyKey(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -30382,8 +30368,6 @@ inline void MTPcontactLink::read(const mtpPrime *&from, const mtpPrime *end, mtp
|
|||
}
|
||||
}
|
||||
inline void MTPcontactLink::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPcontactLink::MTPcontactLink(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -32054,8 +32038,6 @@ inline void MTPchannelParticipantsFilter::read(const mtpPrime *&from, const mtpP
|
|||
}
|
||||
}
|
||||
inline void MTPchannelParticipantsFilter::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPchannelParticipantsFilter::MTPchannelParticipantsFilter(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -32095,8 +32077,6 @@ inline void MTPchannelParticipantRole::read(const mtpPrime *&from, const mtpPrim
|
|||
}
|
||||
}
|
||||
inline void MTPchannelParticipantRole::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPchannelParticipantRole::MTPchannelParticipantRole(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
@ -32808,8 +32788,6 @@ inline void MTPauth_codeType::read(const mtpPrime *&from, const mtpPrime *end, m
|
|||
}
|
||||
}
|
||||
inline void MTPauth_codeType::write(mtpBuffer &to) const {
|
||||
switch (_type) {
|
||||
}
|
||||
}
|
||||
inline MTPauth_codeType::MTPauth_codeType(mtpTypeId type) : _type(type) {
|
||||
switch (type) {
|
||||
|
|
|
@ -613,8 +613,6 @@ void OverviewInner::onDragExec() {
|
|||
|
||||
bool uponSelected = false;
|
||||
if (_dragItem) {
|
||||
bool afterDragSymbol;
|
||||
uint16 symbol;
|
||||
if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) {
|
||||
uponSelected = _selected.contains(_dragItem);
|
||||
} else {
|
||||
|
|
|
@ -2185,7 +2185,6 @@ namespace PlatformSpecific {
|
|||
|
||||
namespace {
|
||||
void _psLogError(const char *str, LSTATUS code) {
|
||||
WCHAR errMsg[2048];
|
||||
LPTSTR errorText = NULL, errorTextDefault = L"(Unknown error)";
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errorText, 0, 0);
|
||||
if (!errorText) {
|
||||
|
@ -2523,11 +2522,11 @@ bool LoadDbgHelp(bool extended = false) {
|
|||
|
||||
WCHAR szTemp[4096];
|
||||
if (GetModuleFileName(NULL, szTemp, 4096) > 0) {
|
||||
wcscat(szTemp, L".local");
|
||||
wcscat_s(szTemp, L".local");
|
||||
if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES) {
|
||||
// ".local" file does not exist, so we can try to load the dbghelp.dll from the "Debugging Tools for Windows"
|
||||
if (GetEnvironmentVariable(L"ProgramFiles", szTemp, 4096) > 0) {
|
||||
wcscat(szTemp, L"\\Debugging Tools for Windows\\dbghelp.dll");
|
||||
wcscat_s(szTemp, L"\\Debugging Tools for Windows\\dbghelp.dll");
|
||||
// now check if the file exists:
|
||||
if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) {
|
||||
hDll = LoadLibrary(szTemp);
|
||||
|
@ -2535,7 +2534,7 @@ bool LoadDbgHelp(bool extended = false) {
|
|||
}
|
||||
// Still not found? Then try to load the 64-Bit version:
|
||||
if (!hDll && (GetEnvironmentVariable(L"ProgramFiles", szTemp, 4096) > 0)) {
|
||||
wcscat(szTemp, L"\\Debugging Tools for Windows 64-Bit\\dbghelp.dll");
|
||||
wcscat_s(szTemp, L"\\Debugging Tools for Windows 64-Bit\\dbghelp.dll");
|
||||
if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) {
|
||||
hDll = LoadLibrary(szTemp);
|
||||
}
|
||||
|
@ -2729,12 +2728,6 @@ BOOL _getModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULEW64 *pModu
|
|||
}
|
||||
|
||||
void psWriteDump() {
|
||||
OSVERSIONINFOEXA version;
|
||||
ZeroMemory(&version, sizeof(OSVERSIONINFOEXA));
|
||||
version.dwOSVersionInfoSize = sizeof(version);
|
||||
if (GetVersionExA((OSVERSIONINFOA*)&version) != FALSE) {
|
||||
SignalHandlers::dump() << "OS-Version: " << version.dwMajorVersion << "." << version.dwMinorVersion << "." << version.dwBuildNumber << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
char ImageHlpSymbol64[sizeof(IMAGEHLP_SYMBOL64) + StackEntryMaxNameLength];
|
||||
|
@ -3291,7 +3284,7 @@ bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title
|
|||
hr = nodeList->get_Length(&nodeListLength);
|
||||
if (!SUCCEEDED(hr)) return false;
|
||||
|
||||
if (nodeListLength < (withSubtitle ? 3 : 2)) return false;
|
||||
if (nodeListLength < (withSubtitle ? 3U : 2U)) return false;
|
||||
|
||||
{
|
||||
ComPtr<IXmlNode> textNode;
|
||||
|
|
|
@ -319,7 +319,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
|||
connect(&_autoLock, SIGNAL(clicked()), this, SLOT(onAutoLock()));
|
||||
connect(&_passwordEdit, SIGNAL(clicked()), this, SLOT(onPassword()));
|
||||
connect(&_passwordTurnOff, SIGNAL(clicked()), this, SLOT(onPasswordOff()));
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
connect(&_connectionType, SIGNAL(clicked()), this, SLOT(onConnectionType()));
|
||||
#endif
|
||||
connect(&_showSessions, SIGNAL(clicked()), this, SLOT(onShowSessions()));
|
||||
connect(&_askQuestion, SIGNAL(clicked()), this, SLOT(onAskQuestion()));
|
||||
connect(&_telegramFAQ, SIGNAL(clicked()), this, SLOT(onTelegramFAQ()));
|
||||
|
@ -1377,11 +1379,13 @@ void SettingsInner::onAutoLock() {
|
|||
Ui::showLayer(box);
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void SettingsInner::onConnectionType() {
|
||||
ConnectionBox *box = new ConnectionBox();
|
||||
connect(box, SIGNAL(closed()), this, SLOT(updateConnectionType()), Qt::QueuedConnection);
|
||||
Ui::showLayer(box);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SettingsInner::onUsername() {
|
||||
UsernameBox *box = new UsernameBox();
|
||||
|
|
|
@ -101,10 +101,10 @@ public slots:
|
|||
void onUpdatePhoto();
|
||||
void onUpdatePhotoCancel();
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
void onAutoUpdate();
|
||||
void onCheckNow();
|
||||
#endif
|
||||
#endif
|
||||
void onRestartNow();
|
||||
|
||||
void onFullPeerUpdated(PeerData *peer);
|
||||
|
@ -116,7 +116,9 @@ public slots:
|
|||
void onPasswordOff();
|
||||
void onReloadPassword(Qt::ApplicationState state = Qt::ApplicationActive);
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void onConnectionType();
|
||||
#endif
|
||||
|
||||
void onUsername();
|
||||
|
||||
|
@ -162,13 +164,13 @@ public slots:
|
|||
|
||||
void onLocalStorageClear();
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
void onUpdateChecking();
|
||||
void onUpdateLatest();
|
||||
void onUpdateDownloading(qint64 ready, qint64 total);
|
||||
void onUpdateReady();
|
||||
void onUpdateFailed();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void onShowSessions();
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ public:
|
|||
return _index.loadAcquire() - 1;
|
||||
}
|
||||
static uint64 Bit() {
|
||||
return (1 << Index());
|
||||
return (1ULL << Index());
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalOptions>/Zm152 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -1665,7 +1666,7 @@
|
|||
<CustomBuild Include="SourceFiles\intro\introwidget.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing introwidget.h...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/intro/introwidget.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/introwidget.h"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing introwidget.h...</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing introwidget.h...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
|
|
Loading…
Add table
Reference in a new issue