307 Commits

Author SHA1 Message Date
Andrew Kelley
3650cd3e8e std.fs.File: update for new writeFile API 2025-07-01 16:35:29 -07:00
Andrew Kelley
7b417c6caf std: improve the discarding writer
by making the vtable use File.Reader instead of File and Offset
2025-07-01 16:35:29 -07:00
Andrew Kelley
74c56376ee std: update http.WebSocket to new API 2025-07-01 16:35:29 -07:00
Andrew Kelley
da303bdaf1 std: fix a bunch of compilation errors 2025-07-01 16:35:29 -07:00
Andrew Kelley
06b44a0afa update git fetching logic to new reader/writer API
- flatten std.crypto.hash.Sha1 and give it a writable interface that
  optimizes splats
- flatten std.hash.crc and give it a writable interface that optimizes
  splats
- remove old writer impls from std.crypto
- add fs.File.Writer.moveToReader
- add fs.File.Writer.seekTo
- add std.io.Reader.Hashed and std.io.Writer.Hashed which are
  passthrough streams. Instead of passing through to null writer, use
  the writable interface implemented directly on hashers which doesn't
  have to account for passing through the data.
- add std.io.BufferedWriter.writeSplatAll
2025-07-01 16:35:29 -07:00
Jacob Young
01b580e75d fix compile errors building the compiler 2025-07-01 16:35:29 -07:00
Andrew Kelley
803215bb18 delete std.io.MultiWriter
instead this use case is better served with passthrough streams. For
instance, hashing writers should support being passed an underlying
writer, and the buffer can go in front of the hasher for optimal code.
2025-07-01 16:35:29 -07:00
Andrew Kelley
110af768bb remove std.io.BitWriter 2025-07-01 16:35:29 -07:00
Andrew Kelley
e76afef847 std.zip: operate on fs.File.Reader rather than anytype 2025-07-01 16:35:29 -07:00
Andrew Kelley
576702ca40 get autodocs wasm compiling again
it's triggering an error.EndOfStream error in the browser tho
2025-07-01 16:35:29 -07:00
Andrew Kelley
42cc1bd76e std.io.BufferedReader: implement readVecLimit 2025-07-01 16:35:28 -07:00
Andrew Kelley
2abbcb6d2a std.http: fix chunked transfer flushing and end-of-stream handling 2025-07-01 16:35:28 -07:00
Andrew Kelley
6fe9c8f036 std.io.BufferedReader: fix peekSentinel
it was tossing 2x
2025-07-01 16:35:28 -07:00
Andrew Kelley
5ac895c820 std.crypto.tls.Client: give all cleartext in read 2025-07-01 16:35:28 -07:00
Andrew Kelley
bb7af21d6f std.crypto.tls.Client: update to new reader/writer API 2025-07-01 16:35:28 -07:00
Andrew Kelley
b3da216f1b std.io.BufferedReader: add readRemaining 2025-07-01 16:35:28 -07:00
Andrew Kelley
cbe5920975 std.io.Reader: rename readAll to readRemaining 2025-07-01 16:35:28 -07:00
Andrew Kelley
990031444d std.io.Reader: add assertion to verify counts 2025-07-01 16:35:28 -07:00
Andrew Kelley
01973a8a16 std.io.BufferedReader: don't use @memmove yet
so I can use the x86 backend
2025-07-01 16:35:28 -07:00
Andrew Kelley
f32fc8a848 std.io.Reader.readRemainingArrayList: add minimum_buffer_size
since some reader implementations may require it
2025-07-01 16:35:28 -07:00
Andrew Kelley
2ff5ea2231 std.compress.zstd: fix raw/rle blocks not doing frame accounting 2025-07-01 16:35:28 -07:00
Andrew Kelley
e05af2da13 std.compress.zstd: it's compiling 2025-07-01 16:35:28 -07:00
Andrew Kelley
685d55c1a4 std.compress.zstd: rewrite
WIP - passing AstGen but not yet Sema
2025-07-01 16:35:28 -07:00
Andrew Kelley
25ac70f973 std: WIP update more to new reader/writer
delete some bad readers/writers

add limited reader

update TLS

about to do something drastic to compress
2025-07-01 16:35:28 -07:00
Andrew Kelley
aef0434c01 formatted printing: fix handling of nested format functions 2025-07-01 16:35:28 -07:00
Andrew Kelley
81b0d14e2b std.http: rewrite
WIP
2025-07-01 16:35:28 -07:00
Andrew Kelley
396464ee6b update std.net and nail down delimiter APIs
"exclusive" functions still need to report EndOfStream after the last
returned slice
2025-07-01 16:35:28 -07:00
Andrew Kelley
1bb75f9d62 stabilize readRemainingArrayList and readRemainingAlloc API 2025-07-01 16:35:28 -07:00
Andrew Kelley
045c1c1557 std.io.AllocatingWriter.writeSplat: better implementation 2025-07-01 16:35:28 -07:00
Andrew Kelley
d9b9e3c272 std: update some http to new reader/writer 2025-07-01 16:35:28 -07:00
Jacob Young
fceec91f77 cbe: port to new std.io.BufferedWriter API
when rebasing I gave up on the conflicts of src/link/C.zig and copied
the file from origin/master which was 710632b45cd7a7081af82af418eb3e405f7aa35e
2025-07-01 16:35:28 -07:00
Andrew Kelley
4dc3a9444c std: reader/writer fixes 2025-07-01 16:35:27 -07:00
Andrew Kelley
19b82ca7ab std.http.Server: implement chunked request parsing 2025-07-01 16:35:27 -07:00
Jacob Young
d62f22cc4d link: port to std.io.BufferedReader API changes 2025-07-01 16:35:27 -07:00
Jacob Young
6a0f2227e8 build_runner: port to std.io.BufferedReader API changes 2025-07-01 16:35:27 -07:00
Andrew Kelley
e9fd9798f4 std.tar.Writer: update reader/writer API usage 2025-07-01 16:35:27 -07:00
Andrew Kelley
24441b184f std.io.poll: update for BufferedReader
only posix is updated so far

also implement `BufferedReader.readVec`
2025-07-01 16:35:27 -07:00
Andrew Kelley
cdd05df532 std.io.BufferedReader: don't use a BufferedWriter field
this is way better with readVec and the ability to call
`std.io.Reader.buffered`.
2025-07-01 16:35:27 -07:00
Andrew Kelley
00afaa4b18 std.io.BufferedReader: get rid of the @constCast
but it's pushed out to various callsites
2025-07-01 16:35:27 -07:00
Andrew Kelley
f333267782 update std.http.Server to new API
and rename std.io.BufferedWriter.writableSlice to writableSliceGreedy

and make writableSlice and writableArray advance the buffer end position

introduce std.io.BufferedWriter.writeSplatLimit but it's unimplemented
2025-07-01 16:35:27 -07:00
Jacob Young
ffb0e283d7 build_runner: fix compile errors 2025-07-01 16:35:27 -07:00
Andrew Kelley
a4fdda6ae0 std.io: redo Reader and Writer yet again
explicit error sets ahoy matey

delete some sus APIs from File that need to be reworked
2025-07-01 16:35:27 -07:00
Andrew Kelley
20a784f713 std: start converting networking stuff to new reader/writer 2025-07-01 16:35:27 -07:00
Jacob Young
f3d0fc7a66 backends: port to new std.io.BufferedWriter API 2025-07-01 16:35:26 -07:00
Jacob Young
a21e7ab64f build_runner: port to new std.io.BufferedWriter API 2025-07-01 16:35:26 -07:00
Andrew Kelley
1164d5ece5 tweak std.io.Writer and followups
remove std.fs.Dir.readFileAllocOptions, replace with more flexible API
readFileIntoArrayList

remove std.fs.File.readToEndAllocOptions, replace with more flexible API
readIntoArrayList

update std.fs.File to new reader/writer API

add helper functions to std.io.Reader.Limit

replace std.io.Writer.FileLen with std.io.Reader.Limit

make offset a type rather than u64 so that it can distinguish between
streaming read and positional read

avoid an unnecessary allocation in std.zig.readSourceFileToEndAlloc when
there is a UTF-16 little endian BOM.
2025-07-01 16:35:26 -07:00
Andrew Kelley
383afd19d7 std.io.BufferedWriter: don't use ArrayList for this
it's the wrong abstraction and is only a footgun when used this way.
2025-07-01 16:35:26 -07:00
Andrew Kelley
4ee2534566 std.io.Reader: extract PositionalReader to separate interface 2025-07-01 16:35:26 -07:00
Andrew Kelley
60854795b8 array list tests passing again 2025-07-01 16:35:26 -07:00
Andrew Kelley
646454beb5 maybe it's better to track bytes written in BufferedWriter 2025-07-01 16:35:26 -07:00