Commit graph

68 commits

Author SHA1 Message Date
Ali Cheraghi
dec1163fbb
all: replace all @Type usages
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-11-22 22:42:38 +00:00
Matthew Lugg
8a73fc8d8e
Merge pull request #25981 from mlugg/macos-fuzz-2
make the fuzzer vaguely work on macOS
2025-11-20 17:48:35 +00:00
Matthew Lugg
a87b533231
std.Io.Writer: fix some bugs 2025-11-20 10:42:21 +00:00
Jacob Young
8647e4d311 aarch64: cleanup register lock 2025-11-11 01:47:27 -05:00
snoire
ffb0050d81 std.Io.Writer.print: support .enum_literal in 't' format specifier 2025-11-06 13:45:21 +08:00
Andrew Kelley
7d478114ec fix compilation errors introduced by rebasing 2025-10-29 06:20:49 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley
e7729a7b89 std: start moving fs.File to Io 2025-10-29 06:20:48 -07:00
GasInfinity
55c0693c4a
fix: make compiler_rt and std.Io.Writer compile on 16-bit platforms. 2025-10-27 11:17:48 +01:00
Andrew Kelley
889942a8b7 std: fix sendFileReading not accounting for buffer
Related to 1d764c1fdf

Test case provided by:

Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-08 16:45:38 -07:00
Andrew Kelley
594cb38fcb
Merge pull request #25302 from ziglang/growCapacity
std: remove loop from growCapacity
2025-09-21 04:55:39 -07:00
Andrew Kelley
5ec0a7d8a5 coerce vectors to arrays rather than inline for 2025-09-20 18:33:00 -07:00
Andrew Kelley
0c1fbc4ea6 std: remove loop from growCapacity
I measured this against master branch and found no statistical
difference. Since this code is simpler and logically superior due to
always leaving sufficient unused capacity when growing, it is preferred
over status quo.
2025-09-20 14:34:18 -07:00
Andrew Kelley
eac2bbfec9 std.Io.Writer.writeSliceEndian: add compile error
check when an auto-layout struct is attempted to be memory reinterpreted
and written out. it would be writing undefined memory
2025-09-08 18:18:27 -07:00
Andrew Kelley
1d764c1fdf Revert "Merge pull request #24905 from gooncreeper/file-reader-buffered"
This reverts commit ac42eaaadd, reversing
changes made to 9fa2394f8c.

I would like a chance to review this, please. I already spotted some
issues.
2025-09-05 11:26:38 -07:00
Kendall Condon
d26b532647 sendFileAll: use stream instead of sendFileReading
This is a simpler implementation and allows file_reader to do more
optimal streaming.
2025-09-04 17:26:52 -04:00
Kendall Condon
58dda3b10b fix sendFile implementations bypassing interface buffer
Also removes `File.Reader.read` since it is otherwise unused and is a
footgun.
2025-09-04 17:26:49 -04:00
Travis Staloch
1ec8a7ab4c Io.Writer.Allocating: test new *Aligned methods
* added initAligned()
* added missing @alignCast in toArrayListAligned()
2025-08-31 19:29:02 -07:00
Andrew Kelley
fadd268a60 upgrade more old API uses 2025-08-30 00:48:50 -07:00
Andrew Kelley
9a0970a12b rework std.Io.Writer.Allocating to support runtime-known alignment
Also, breaking API changes to:
* std.fs.Dir.readFileAlloc
* std.fs.Dir.readFileAllocOptions
2025-08-30 00:48:50 -07:00
Andrew Kelley
cc931660eb link.MachO: update to not use GenericWriter 2025-08-28 18:30:57 -07:00
Andrew Kelley
2dc6ddd7e8 std.Io.Writer: add toArrayList/fromArrayList 2025-08-28 18:30:57 -07:00
TemariVirus
51a2c0feaf std.Io.Writer: fix upper case hex float formatting 2025-08-19 11:20:30 -07:00
Isaac Freund
551e009da7 Build.Step.Run: fix missing stdin buffer and flush
Writer.sendFileAll() asserts non-zero buffer capacity in the case that
the fallback is hit. It also requires the caller to flush. The buffer
may be bypassed as an optimization but this is not a guarantee.

Also improve the Writer documentation and add an earlier assert on
buffer capacity in sendFileAll().
2025-08-16 15:43:48 -07:00
Josh Wolfe
4fcdb08390 [std] fix compile error in std.Io.Writer.failing 2025-08-16 00:23:47 -07:00
Andrew Kelley
30b41dc510 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
2025-08-15 10:44:35 -07:00
Andrew Kelley
af7e142485 std.Io.Writer: introduce rebase to the vtable
fixes #24814
2025-08-14 12:56:37 -07:00
Kendall Condon
4f639ff880 http: fix handling of limit in chunkedSendFile
`limit` in chunkedSendFile applies only to the file, not the entire
chunk. `limit` in sendFileHeader does not include the header.

Additionally adds a comment to clarify what `limit` applies to in
sendFileHeader and fixed a small bug in it (`drain` is able to return
less then `header.len`).
2025-08-13 13:14:01 -07:00
Isaac Freund
b8124d9c0b std.io.Writer.Allocating: rename getWritten() to written()
This "get" is useless noise and was copied from FixedBufferWriter.
Since this API has not yet landed in a release, now is a good time
to make the breaking change to fix this.
2025-08-13 01:43:52 -07:00
Jacob Young
60f8584927 Dwarf: port to new Writer API 2025-08-11 12:00:50 -07:00
Ryan Liptak
3280fc98f3 Writer: Delete writePreserve/writeAllPreserve
This is one way of partially addressing https://github.com/ziglang/zig/issues/24767

- These functions are unused
- These functions are untested
- These functions are broken
  + The same dangling pointer bug from 6219c015d8 exists in `writePreserve`
  + The order of the bytes preserved in relation to the `bytes` being written can differ depending on unused buffer capacity at the time of the call and the drain implementation.

If there ends up being a need for these functions, they can be fixed and added back.
2025-08-10 19:49:02 -07:00
Andrew Kelley
df46ee61c4 std.Io.Writer.Allocating: configurable bump amount 2025-08-08 19:22:08 -07:00
Andrew Kelley
3d25a9c1e0 std.Io.Writer.Allocating.sendFile: use logicalPos
fixes #24754

tested with `zig build test-std -Dskip-release`
2025-08-08 14:21:57 -07:00
Igor Anić
6219c015d8 Io.Writer fix dangling pointer
While underlying writer is Allocating writer buffer can grow in
vtable.drain call. We should not hold pointer to the buffer before that
call and use it after.
This remembers positions instead of holding reference.
2025-08-08 12:56:26 -07:00
Andrew Kelley
9a538e0d54 link.Dwarf: minimal changes to remove CountingWriter 2025-08-07 22:26:42 -07:00
Andrew Kelley
e2d81bf6c0 http fixes 2025-08-07 10:04:29 -07:00
Andrew Kelley
eb17d4562a std.Io.Writer.Hashed: fix bad assert 2025-07-31 22:36:52 -07:00
Ian Johnson
d91744401f fetch: More Git fixes 2025-07-31 22:10:11 -07:00
Andrew Kelley
64814dc986 std.compress.flate.Decompress: respect stream limit 2025-07-31 22:10:11 -07:00
Andrew Kelley
6caa100f0d std.Io.Writer: fix wrong return value from fixedDrain 2025-07-31 22:10:11 -07:00
Andrew Kelley
c49c90a42a fetch: update API usage 2025-07-31 22:10:11 -07:00
Andrew Kelley
cf7a28febb std.Io.Reader: introduce readVec back into the VTable
simplifies and fixes things

addresses a subset of #24608
2025-07-30 09:26:34 -07:00
Andrew Kelley
66e49d93b7
Merge pull request #24559 from ziglang/zstd
std: rework zstd for new I/O API
2025-07-25 20:02:53 -07:00
Andrew Kelley
9e11727c7c
Merge pull request #23340 from castholm/pass-null-to-b-dependency
Add support for passing null, string literals, enum lists and more to `b.dependency()`
2025-07-25 18:00:46 -07:00
Andrew Kelley
7f1c04423e std.Io: add "preserve" variants to Reader/Writer 2025-07-25 14:15:33 -07:00
Jacob Young
5060ab99c9 aarch64: add new from scratch self-hosted backend 2025-07-22 19:43:47 -07:00
Andrew Kelley
9abc3232a8 std.fs.File.Reader: fix missed advance writer positions 2025-07-21 13:08:43 +02:00
Carl Åstholm
e7604bba3e Serialize float options using the hexadecimal format
This ensures no information is lost when the value is round-tripped.
2025-07-20 18:28:36 +02:00
Andrew Kelley
8373788c4c
Merge pull request #24488 from ziglang/more
std.zig: finish updating to new I/O API
2025-07-20 11:24:41 +02:00
Marc Tiehuis
4780cc50cf std.Io.Writer: support alignment for {t} specifier 2025-07-20 10:30:17 +02:00