From ab98206d18ce8d148dedb58ff49aa38a2e11403b Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 10 Jan 2020 23:19:05 +0800 Subject: [PATCH] Simplify --- .../qqandroid/network/protocol/packet/PacketFactory.kt | 6 +----- .../qqandroid/network/protocol/packet/login/LoginPacket.kt | 2 +- .../kotlin/net.mamoe.mirai/utils/io/InputUtils.kt | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt index 1d89123dc..1c4c3b4b6 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt @@ -42,11 +42,7 @@ internal abstract class PacketFactory PacketFactory.decode(bot: QQAndroidBot, packet: ByteReadPacket): P { - return this.run { - packet.decode(bot) - } -} +private suspend inline fun

PacketFactory.decode(bot: QQAndroidBot, packet: ByteReadPacket): P = packet.decode(bot) private val DECRYPTER_16_ZERO = ByteArray(16) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt index 964fb1be6..3a998d48c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt @@ -189,7 +189,7 @@ internal object LoginPacket : PacketFactory = this.readTLVMap() diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/InputUtils.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/InputUtils.kt index 6d12a8100..7a42bec10 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/InputUtils.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/InputUtils.kt @@ -103,7 +103,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = true, tagSize: Int): MutableMap