diff --git a/bitchat/Utils/CompressionUtil.swift b/bitchat/Utils/CompressionUtil.swift index 53a42d7d..883fdaa8 100644 --- a/bitchat/Utils/CompressionUtil.swift +++ b/bitchat/Utils/CompressionUtil.swift @@ -13,7 +13,7 @@ struct CompressionUtil { // Compression threshold - don't compress if data is smaller than this static let compressionThreshold = TransportConfig.compressionThresholdBytes // bytes - // Compress data using LZFSE for speed on Apple platforms + // Compress data using zlib algorithm (most compatible) static func compress(_ data: Data) -> Data? { // Skip compression for small data guard data.count >= compressionThreshold else { return nil } @@ -27,7 +27,7 @@ struct CompressionUtil { return compression_encode_buffer( destinationBuffer, data.count, sourcePtr, data.count, - nil, COMPRESSION_LZFSE + nil, COMPRESSION_ZLIB ) } @@ -36,7 +36,7 @@ struct CompressionUtil { return Data(bytes: destinationBuffer, count: compressedSize) } - // Decompress LZFSE compressed data + // Decompress zlib compressed data static func decompress(_ compressedData: Data, originalSize: Int) -> Data? { let destinationBuffer = UnsafeMutablePointer.allocate(capacity: originalSize) defer { destinationBuffer.deallocate() } @@ -46,7 +46,7 @@ struct CompressionUtil { return compression_decode_buffer( destinationBuffer, originalSize, sourcePtr, compressedData.count, - nil, COMPRESSION_LZFSE + nil, COMPRESSION_ZLIB ) }