# std.compress.zstd.Decompress fixes · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/30b41dc51015c1ed8fa4a7c4f2c61e2a6206ff55)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 30b41dc51015c1ed8fa4a7c4f2c61e2a6206ff55

Requested commit: 30b41dc51015c1ed8fa4a7c4f2c61e2a6206ff55

Commit: 30b41dc51015c1ed8fa4a7c4f2c61e2a6206ff55

Tree: ab442ad8ac96dc82a6b03ff94e099f705689abc7

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.compress.zstd.Decompress fixes

* std.Io.Reader: appendRemaining no longer supports alignment and has
  different rules about how exceeding limit. Fixed bug where it would
  return success instead of error.StreamTooLong like it was supposed to.

* std.Io.Reader: simplify appendRemaining and appendRemainingUnlimited
  to be implemented based on std.Io.Writer.Allocating

* std.Io.Writer: introduce unreachableRebase

* std.Io.Writer: remove minimum_unused_capacity from Allocating. maybe
  that flexibility could have been handy, but let's see if anyone
  actually needs it. The field is redundant with the superlinear growth
  of ArrayList capacity.

* std.Io.Writer: growingRebase also ensures total capacity on the
  preserve parameter, making it no longer necessary to do
  ensureTotalCapacity at the usage site of decompression streams.

* std.compress.flate.Decompress: fix rebase not taking into account seek

* std.compress.zstd.Decompress: split into "direct" and "indirect" usage
  patterns depending on whether a buffer is provided to init, matching
  how flate works. Remove some overzealous asserts that prevented buffer
  expansion from within rebase implementation.

* std.zig: fix readSourceFileToAlloc returning an overaligned slice
  which was difficult to free correctly.

fixes #24608

```

## Parents

- [6d7c6a0f4e4f77e10462c3d8becf4e51fe172ccf](https://git.cafe/gitcafe/zig/commit/6d7c6a0f4e4f77e10462c3d8becf4e51fe172ccf?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/30b41dc51015c1ed8fa4a7c4f2c61e2a6206ff55?format=markdown)
