From f004c6299042ad03b990671213d86198079371cb Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 3 Mar 2023 21:26:44 +0700 Subject: [PATCH] Increase (de)compress buffer sizes --- .../kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt index 34056cfe8..b6a9c2a0b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/matter/MatterManager.kt @@ -1417,7 +1417,7 @@ object MatterManager { inflater.setInput(bbytes) while (!inflater.finished()) { - val chunk = ByteArray(4096) + val chunk = ByteArray(2 shl 16) val inflated = inflater.inflate(chunk) if (inflated == 0) { @@ -1429,7 +1429,7 @@ object MatterManager { throw IndexOutOfBoundsException("Pipe Bomb") } - if (inflated == 4096) { + if (inflated == 2 shl 16) { chunks.add(chunk) } else { chunks.add(chunk.copyOfRange(0, inflated)) @@ -1517,7 +1517,7 @@ object MatterManager { deflater.setInput(stream.array, 0, stream.length) deflater.finish() - val bytes = ByteArray(4096) + val bytes = ByteArray(2 shl 16) while (true) { val written = deflater.deflate(bytes)