Skip to content

Commit

Permalink
we should not emit checksums on *every* push
Browse files Browse the repository at this point in the history
  • Loading branch information
tayloraswift committed Apr 3, 2024
1 parent 7931e89 commit 739d899
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/LZ77/Deflator/LZ77.DeflatorBuffers.Stream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ extension LZ77.DeflatorBuffers.Stream
}

/// Emits a dynamic (type = 2) DEFLATE block.
mutating
private mutating
func writeBlock(final:Bool = false)
{
let tree:
Expand Down
9 changes: 8 additions & 1 deletion Sources/LZ77/Deflator/LZ77.DeflatorBuffers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ extension LZ77.DeflatorBuffers<LZ77.Format>

self.stream.compressBlocks(final: last)

guard case .zlib = self.format
guard last,
case .zlib = self.format
else
{
return
Expand Down Expand Up @@ -123,6 +124,12 @@ extension LZ77.DeflatorBuffers<Gzip.Format>

self.stream.compressBlocks(final: last)

guard last
else
{
return
}

let checksum:UInt32 = self.stream.input.checksum()
let bytes:UInt32 = self.stream.input.integral.bytes
self.stream.writeLittleEndianUInt32(checksum)
Expand Down

0 comments on commit 739d899

Please sign in to comment.