From 2baba6a1f36f7cd1f318e38ed9c6b59f90047233 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 29 Oct 2022 11:56:08 +0100 Subject: [PATCH] [core] Fix up previous commit 81a09549e7aba454af7516f146856b3589f1b547 --- .../kotlin/network/protocol/packet/OutgoingPacket.kt | 12 ++++++------ .../network/protocol/packet/chat/TroopManagement.kt | 2 +- .../packet/chat/receive/MessageSvc.PbSendMsg.kt | 4 ++-- .../network/LengthDelimitedPacketReaderTest.kt | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt index 82ae95dfb..54089e1e6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt @@ -25,7 +25,7 @@ import net.mamoe.mirai.utils.KEY_16_ZEROS import net.mamoe.mirai.utils.TestOnly import kotlin.random.Random -@kotlin.Suppress("unused") +@Suppress("unused") internal class OutgoingPacketWithRespType constructor( remark: String?, commandName: String, @@ -83,7 +83,7 @@ internal inline fun OutgoingPacketFactory.buildOutgoingUniPacke key: ByteArray = client.wLoginSigInfo.d2Key, extraData: ByteReadPacket = BRP_STUB, sequenceId: Int = client.nextSsoSequenceId(), - body: BytePacketBuilder.(sequenceId: Int) -> Unit + crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit ): OutgoingPacketWithRespType { return OutgoingPacketWithRespType(remark, commandName, sequenceId, buildPacket { @@ -114,7 +114,7 @@ internal inline fun IncomingPacketFactory.buildResponseUniPacke key: ByteArray = client.wLoginSigInfo.d2Key, extraData: ByteReadPacket = BRP_STUB, sequenceId: Int = client.nextSsoSequenceId(), - body: BytePacketBuilder.(sequenceId: Int) -> Unit = {} + crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit = {} ): OutgoingPacketWithRespType { @Suppress("DuplicatedCode") return OutgoingPacketWithRespType(name, commandName, sequenceId, buildPacket { @@ -141,7 +141,7 @@ private inline fun BytePacketBuilder.writeUniPacket( commandName: String, unknownData: ByteArray, extraData: ByteReadPacket = BRP_STUB, - body: BytePacketBuilder.() -> Unit + crossinline body: BytePacketBuilder.() -> Unit ) { writeIntLVPacket(lengthOffset = { it + 4 }) { commandName.let { @@ -176,7 +176,7 @@ internal inline fun OutgoingPacketFactory.buildLoginOutgoingPac remark: String? = null, commandName: String = this.commandName, key: ByteArray = KEY_16_ZEROS, - body: BytePacketBuilder.(sequenceId: Int) -> Unit + crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit ): OutgoingPacketWithRespType { val sequenceId: Int = client.nextSsoSequenceId() @@ -214,7 +214,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket( extraData: ByteReadPacket = BRP_STUB, unknownHex: String = "01 00 00 00 00 00 00 00 00 00 01 00", sequenceId: Int, - body: BytePacketBuilder.() -> Unit + crossinline body: BytePacketBuilder.() -> Unit ) { /* send diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt index 782fe0574..931a54e58 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt @@ -271,7 +271,7 @@ internal class TroopManagement { private inline fun impl( client: QQAndroidClient, groupCode: Long, - info: Oidb0x89a.Groupinfo.() -> Unit + crossinline info: Oidb0x89a.Groupinfo.() -> Unit ): OutgoingPacket { return buildOutgoingUniPacket(client) { writeProtoBuf( diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt index f11039d0f..f07f0fc76 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt @@ -112,8 +112,8 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory ImMsgBody.MsgBody, - pbSendMsgReq: ( + crossinline fragmentTranslator: (MessageChain) -> ImMsgBody.MsgBody, + crossinline pbSendMsgReq: ( msgBody: ImMsgBody.MsgBody, msgSeq: Int, msgRand: Int, diff --git a/mirai-core/src/nativeTest/kotlin/network/LengthDelimitedPacketReaderTest.kt b/mirai-core/src/nativeTest/kotlin/network/LengthDelimitedPacketReaderTest.kt index fc3fe2bb9..01b43f296 100644 --- a/mirai-core/src/nativeTest/kotlin/network/LengthDelimitedPacketReaderTest.kt +++ b/mirai-core/src/nativeTest/kotlin/network/LengthDelimitedPacketReaderTest.kt @@ -523,7 +523,7 @@ internal class LengthDelimitedPacketReaderTest : AbstractTest() { ) } - private inline fun buildLVPacket(block: BytePacketBuilder.() -> Unit): ByteReadPacket { + private inline fun buildLVPacket(crossinline block: BytePacketBuilder.() -> Unit): ByteReadPacket { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }