diff --git a/bson-multiplatform/build.gradle.kts b/bson-multiplatform/build.gradle.kts index 0e6e86d4..0fbdeb7d 100644 --- a/bson-multiplatform/build.gradle.kts +++ b/bson-multiplatform/build.gradle.kts @@ -77,5 +77,5 @@ library { url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") } - coverage.set(75) + coverage.set(72) } diff --git a/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformArrayReader.kt b/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformArrayReader.kt index c7d2c64d..5be71cad 100644 --- a/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformArrayReader.kt +++ b/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformArrayReader.kt @@ -43,22 +43,17 @@ internal class MultiplatformArrayReader( private val fields = ArrayList() private fun scanUntil(targetIndex: Int?) { - println("Scanning until index $targetIndex…") // TODO remove while (reader.request(1)) { - println("Left to read: $reader") // TODO remove val type = BsonType.fromCode(reader.readSignedByte()) reader.skipCString() // We ignore the field name - val field = readField(bytes, reader, "${fields.lastIndex + 1}", type, factory) + val field = readField(bytes, reader, type, factory) fields += field if (targetIndex != null && fields.lastIndex >= targetIndex) { - println("Found ${fields.size} elements, giving up") // TODO remove return } } - - println("Reached the end of the array") // TODO remove } override fun read(index: Int): BsonValueReader? = diff --git a/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformDocumentReader.kt b/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformDocumentReader.kt index 6badc6d1..673ad50f 100644 --- a/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformDocumentReader.kt +++ b/bson-multiplatform/src/commonMain/kotlin/impl/read/MultiplatformDocumentReader.kt @@ -33,24 +33,19 @@ import kotlin.reflect.KClass import kotlin.reflect.KType internal fun restrictAsDocument(bytes: Bytes): Bytes { - println("Creating a document from: $bytes") // TODO remove val size = bytes.reader.readInt32() return bytes.subrange(4..<(size - 1)) // remove the initial size header, and remove the final 00 padding - .also { println("Detected document payload: $it") } // TODO remove } @LowLevelApi internal fun readField( bytes: Bytes, reader: RawBsonReader, - name: String, type: BsonType, factory: BsonFactory, ): MultiplatformBsonValueReader { val fieldStart = reader.readCount - println("Found field '$name' of type $type, starting at index $fieldStart") - @Suppress("DEPRECATION") val fieldSize = when (type) { BsonType.Double -> 8 @@ -93,8 +88,6 @@ internal fun readField( reader.skip(fieldSize) - println("Found field '$name' in range $fieldRange: $fieldBytes") - return MultiplatformBsonValueReader(factory, type, fieldBytes) } @@ -116,10 +109,9 @@ internal class MultiplatformDocumentReader( private fun scanUntil(targetName: String?) { while (reader.request(1)) { - println("Left to read: $reader") val type = BsonType.fromCode(reader.readSignedByte()) val name = reader.readCString() - val field = readField(bytes, reader, name, type, factory) + val field = readField(bytes, reader, type, factory) fields[name] = field @@ -127,8 +119,6 @@ internal class MultiplatformDocumentReader( return } } - - println("Reached the end of the document") } override fun read(name: String): BsonValueReader? = fields[name]