File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/compression Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ import aws.sdk.kotlin.crt.Closeable
88import kotlinx.cinterop.*
99import platform.zlib.*
1010
11+ private const val DEFAULT_WINDOW_BITS = 15 // Default window bits
12+ private const val WINDOW_BITS_GZIP_OFFSET = 16 // Gzip offset for window bits
13+ private const val MEM_LEVEL = 8 // Default memory level
14+
1115/* *
1216 * Streaming-style gzip compressor, implemented using zlib bindings
1317 */
@@ -30,8 +34,8 @@ internal class GzipCompressor : Closeable {
3034 stream.ptr,
3135 Z_BEST_COMPRESSION ,
3236 Z_DEFLATED ,
33- 15 + 16 , // Default windows bits (15) plus 16 for gzip encoding
34- 8 , // Default memory level
37+ DEFAULT_WINDOW_BITS + WINDOW_BITS_GZIP_OFFSET , // Default windows bits (15) plus 16 for gzip encoding
38+ MEM_LEVEL ,
3539 Z_DEFAULT_STRATEGY ,
3640 ZLIB_VERSION ,
3741 sizeOf< z_stream> ().toInt(),
@@ -112,7 +116,9 @@ internal class GzipCompressor : Closeable {
112116 }
113117
114118 override fun close () {
115- if (isClosed) { return }
119+ if (isClosed) {
120+ return
121+ }
116122
117123 deflateEnd(stream.ptr)
118124 nativeHeap.free(stream.ptr)
You can’t perform that action at this time.
0 commit comments