mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-28 02:03:35 +00:00
Fix MTP logging.
This commit is contained in:
parent
09d85e25c1
commit
548a0c8517
@ -1048,7 +1048,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
types.reserve(20); vtypes.reserve(20); stages.reserve(20); flags.reserve(20);\n\
|
||||
types.push_back(mtpTypeId(cons)); vtypes.push_back(mtpTypeId(vcons)); stages.push_back(0); flags.push_back(0);\n\
|
||||
\n\
|
||||
const mtpPrime *start = from;\n\
|
||||
mtpTypeId type = cons, vtype = vcons;\n\
|
||||
int32 stage = 0, flag = 0;\n\
|
||||
\n\
|
||||
@ -1064,13 +1063,13 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
throw Exception("unknown type on stage > 0");\n\
|
||||
}\n\
|
||||
types.back() = type = *from;\n\
|
||||
start = ++from;\n\
|
||||
++from;\n\
|
||||
}\n\
|
||||
\n\
|
||||
int32 lev = level + types.size() - 1;\n\
|
||||
auto it = serializers.constFind(type);\n\
|
||||
if (it != serializers.cend()) {\n\
|
||||
(*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag);\n\
|
||||
(*it.value())(to, stage, lev, types, vtypes, stages, flags, from, end, flag);\n\
|
||||
} else {\n\
|
||||
mtpTextSerializeCore(to, from, end, type, lev, vtype);\n\
|
||||
types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();\n\
|
||||
|
@ -1612,7 +1612,7 @@ ConnectionPrivate::HandleResult ConnectionPrivate::handleOneReceived(const mtpPr
|
||||
case mtpc_gzip_packed: {
|
||||
DEBUG_LOG(("Message Info: gzip container"));
|
||||
mtpBuffer response = ungzip(++from, end);
|
||||
if (!response.size()) {
|
||||
if (response.empty()) {
|
||||
return HandleResult::RestartConnection;
|
||||
}
|
||||
return handleOneReceived(response.data(), response.data() + response.size(), msgId, serverTime, serverSalt, badTime);
|
||||
|
@ -302,11 +302,11 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
result.resize(0);
|
||||
|
||||
z_stream stream;
|
||||
stream.zalloc = 0;
|
||||
stream.zfree = 0;
|
||||
stream.opaque = 0;
|
||||
stream.zalloc = nullptr;
|
||||
stream.zfree = nullptr;
|
||||
stream.opaque = nullptr;
|
||||
stream.avail_in = 0;
|
||||
stream.next_in = 0;
|
||||
stream.next_in = nullptr;
|
||||
int res = inflateInit2(&stream, 16 + MAX_WBITS);
|
||||
if (res != Z_OK) {
|
||||
throw Exception(QString("ungzip init, code: %1").arg(res));
|
||||
@ -331,7 +331,7 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
result.resize(result.size() - (stream.avail_out >> 2));
|
||||
inflateEnd(&stream);
|
||||
|
||||
if (!result.size()) {
|
||||
if (result.empty()) {
|
||||
throw Exception("ungzip void data");
|
||||
}
|
||||
const mtpPrime *newFrom = result.constData(), *newEnd = result.constData() + result.size();
|
||||
|
Loading…
Reference in New Issue
Block a user