diff --git a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py index 12eb36008b..cbab7e0a1c 100644 --- a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py +++ b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py @@ -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\ diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp index 55d76433d4..2c90a99402 100644 --- a/Telegram/SourceFiles/mtproto/connection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -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); diff --git a/Telegram/SourceFiles/mtproto/core_types.cpp b/Telegram/SourceFiles/mtproto/core_types.cpp index 8a27619508..84a57235da 100644 --- a/Telegram/SourceFiles/mtproto/core_types.cpp +++ b/Telegram/SourceFiles/mtproto/core_types.cpp @@ -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();