From 0f86f306236e3c9a2a75a92d1aed3b5a834d013d Mon Sep 17 00:00:00 2001 From: dsavvinov Date: Wed, 10 Aug 2016 20:42:28 +0300 Subject: [PATCH] Protobuf: added missing NoTag-versions of some serialization functions in runtime --- proto/runtime/src/main/kotlin/CodedInputStream.kt | 5 ++++- proto/runtime/src/main/kotlin/CodedOutputStream.kt | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/proto/runtime/src/main/kotlin/CodedInputStream.kt b/proto/runtime/src/main/kotlin/CodedInputStream.kt index be1dde7f777..5474b90fcc4 100644 --- a/proto/runtime/src/main/kotlin/CodedInputStream.kt +++ b/proto/runtime/src/main/kotlin/CodedInputStream.kt @@ -86,9 +86,12 @@ class CodedInputStream(val buffer: ByteArray) { fun readSInt64(expectedFieldNumber: Int): Long { val tag = readTag(expectedFieldNumber, WireType.VARINT) - return readZigZag64NoTag() + return readSInt64NoTag() } + fun readSInt64NoTag(): Long { + return readZigZag64NoTag() + } fun readBytes(expectedFieldNumber: Int): ByteArray { val tag = readTag(expectedFieldNumber, WireType.LENGTH_DELIMITED) return readBytesNoTag() diff --git a/proto/runtime/src/main/kotlin/CodedOutputStream.kt b/proto/runtime/src/main/kotlin/CodedOutputStream.kt index 767f648d8fc..a55d5a9f2c7 100644 --- a/proto/runtime/src/main/kotlin/CodedOutputStream.kt +++ b/proto/runtime/src/main/kotlin/CodedOutputStream.kt @@ -26,6 +26,10 @@ class CodedOutputStream(val buffer: ByteArray) { writeInt32(fieldNumber, value) } + fun writeUInt32NoTag(value: Int) { + writeInt32NoTag(value) + } + fun writeInt64(fieldNumber: Int, value: Long) { writeTag(fieldNumber, WireType.VARINT) writeInt64NoTag(value) @@ -36,6 +40,10 @@ class CodedOutputStream(val buffer: ByteArray) { writeInt64(fieldNumber, value) } + fun writeUInt64NoTag(value: Long) { + writeInt64NoTag(value) + } + fun writeBool(fieldNumber: Int, value: Boolean) { writeTag(fieldNumber, WireType.VARINT) writeBoolNoTag(value)