diff --git a/crypto/src/test/java/dev/openrs2/crypto/WhirlpoolTest.kt b/crypto/src/test/java/dev/openrs2/crypto/WhirlpoolTest.kt index a6bb4f38..2ea1f640 100644 --- a/crypto/src/test/java/dev/openrs2/crypto/WhirlpoolTest.kt +++ b/crypto/src/test/java/dev/openrs2/crypto/WhirlpoolTest.kt @@ -8,7 +8,7 @@ import kotlin.test.Test object WhirlpoolTest { private class IsoTestVector(input: String, expected: String) { val input = input.toByteArray(Charsets.US_ASCII) - val expected = ByteBufUtil.decodeHexDump(expected) + val expected: ByteArray = ByteBufUtil.decodeHexDump(expected) } private val ISO_TEST_VECTORS = listOf( diff --git a/util/src/main/java/dev/openrs2/util/charset/ModifiedUtf8Charset.kt b/util/src/main/java/dev/openrs2/util/charset/ModifiedUtf8Charset.kt index ce9b5461..fb5913b3 100644 --- a/util/src/main/java/dev/openrs2/util/charset/ModifiedUtf8Charset.kt +++ b/util/src/main/java/dev/openrs2/util/charset/ModifiedUtf8Charset.kt @@ -31,15 +31,17 @@ public object ModifiedUtf8Charset : Charset("ModifiedUtf8", null) { return CoderResult.OVERFLOW } - if (len == 1) { - output.put(char.toByte()) - } else if (len == 2) { - output.put((0xC0 or ((char.toInt() shr 6) and 0x1F)).toByte()) - output.put((0x80 or (char.toInt() and 0x3F)).toByte()) - } else { - output.put((0xE0 or ((char.toInt() shr 12) and 0x1F)).toByte()) - output.put((0x80 or ((char.toInt() shr 6) and 0x1F)).toByte()) - output.put((0x80 or (char.toInt() and 0x3F)).toByte()) + when (len) { + 1 -> output.put(char.toByte()) + 2 -> { + output.put((0xC0 or ((char.toInt() shr 6) and 0x1F)).toByte()) + output.put((0x80 or (char.toInt() and 0x3F)).toByte()) + } + else -> { + output.put((0xE0 or ((char.toInt() shr 12) and 0x1F)).toByte()) + output.put((0x80 or ((char.toInt() shr 6) and 0x1F)).toByte()) + output.put((0x80 or (char.toInt() and 0x3F)).toByte()) + } } } diff --git a/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt b/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt index 2fd50901..3856e605 100644 --- a/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt +++ b/util/src/main/java/dev/openrs2/util/io/InputStreamExtensions.kt @@ -25,6 +25,7 @@ public fun InputStream.contentEquals(other: InputStream): Boolean { remaining -= n2 } + @Suppress("ReplaceJavaStaticMethodWithKotlinAnalog") if (!Arrays.equals(buf1, 0, n1, buf2, 0, n1)) { return false } diff --git a/util/src/test/java/dev/openrs2/util/collect/ForestDisjointSetTest.kt b/util/src/test/java/dev/openrs2/util/collect/ForestDisjointSetTest.kt index 29c8897c..a9da5b6d 100644 --- a/util/src/test/java/dev/openrs2/util/collect/ForestDisjointSetTest.kt +++ b/util/src/test/java/dev/openrs2/util/collect/ForestDisjointSetTest.kt @@ -112,7 +112,7 @@ object ForestDisjointSetTest { set.union(set1, set.add(2)) set.union(set1, set.add(3)) - assertEquals(setOf(1, 2, 3), set1.asSequence().toSet()) + assertEquals(setOf(1, 2, 3), set1.toSet()) } @Test