             if stream.src_size == 0 {
                 do {
                     sourceData = try provider(position, Swift.min((size - position), bufferSize))
-                    if let sourceData = sourceData {
-                        position += sourceData.count
-                        stream.src_size = sourceData.count
-                    }
+                    position += stream.prepare(for: sourceData)
                 } catch { throw error }
             }
             if let sourceData = sourceData {

            }
        } while status == COMPRESSION_STATUS_OK
        return crc32
    }
}


import Compression

extension Data {

    static func process(operation: compression_stream_operation, size: Int, bufferSize: Int, skipCRC32: Bool = false,
                        provider: Provider, consumer: Consumer) throws -> CRC32 {
        var crc32 = CRC32(0)
