Commit Graph

33890 Commits

Author SHA1 Message Date
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
Andrew Kelley 98f463ad59 revert introduction of @errorCast in this branch 2025-07-01 16:35:27 -07:00
Jacob Young b76b4c9c36 cbe: start porting to new std.io.BufferedWriter API
WIP

while rebasing this commit, I gave up on the conflicts and copied
src/link/C.zig from origin/master which was
710632b45c at the time.
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 3b390e4f13 revert most instances of anyerror to match origin/master 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
Andrew Kelley c872a9fd49 std.net.Stream: implement Reader 2025-07-01 16:35:26 -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
Andrew Kelley faab6d5cbf fix hello world 2025-07-01 16:35:26 -07:00
Jacob Young 1501734747 io: fix compile errors 2025-07-01 16:35:26 -07:00
Jacob Young 5d22c588e2 ubsan_rt: port to new std.io.BufferedWriter API 2025-07-01 16:35:26 -07:00
Jacob Young d76c8d0bd2 Dwarf: cleanup and port to new std.io.BufferedReader API 2025-07-01 16:35:26 -07:00
Andrew Kelley 9dc0b4a98f back to the anyerror!usize vtable 2025-07-01 16:35:26 -07:00
Andrew Kelley 6ac7931bec std: hacking around with buffered reader / writer semantics
I think I'm going to back out these vtable changes in the next commit
2025-07-01 16:35:26 -07:00
Andrew Kelley 890a02c345 std.io: move getStdIn, getStdOut, getStdErr functions to fs.File
preparing to rearrange std.io namespace into an interface
2025-07-01 16:35:26 -07:00
Andrew Kelley 6c48aad991 update some more std lib API to new Reader/Writer
std.compress needs an audit, I see some problems
2025-07-01 16:35:26 -07:00
Andrew Kelley 31e0b5c3c7 fix merge conflicts
partially reapply b636d56d6a
2025-07-01 16:35:26 -07:00
Andrew Kelley 57e1fc29d2 reader interface vecs and bufferedwriter arraylist 2025-07-01 16:35:26 -07:00
Andrew Kelley 5aa8573f2b redo reader 2025-07-01 16:35:26 -07:00
Andrew Kelley 2fb6ce2f92 update some more compiler code 2025-07-01 16:35:26 -07:00
Andrew Kelley 4aed226e07 zig fmt compiling 2025-07-01 16:35:26 -07:00
Andrew Kelley 5ada2e3937 std.http tests passing with updated writer API
fix splat implementation in std.fs.File

update http.Client, with caveats:
 * TODO: only 1 underlying write call
 * TODO: don't rely on max_buffers_len exceeding the caller
 * TODO: handle splat

update net.Stream API. also make it use WSASend on windows
2025-07-01 16:35:26 -07:00
Andrew Kelley 6c7b103122 std.crypto.tls.Client: upgrade to std.io.BufferedWriter
This is pretty clearly a better API.
2025-07-01 16:35:26 -07:00
Andrew Kelley d87b59f5a5 std.fmt.format: support base 64 encoding 2025-07-01 16:35:26 -07:00
Andrew Kelley 8464efa5dd std.posix.sendfile: don't write trailers on linux
After sending the file, better to return total bytes written. The caller
will decide if they want to do another syscall with the trailers. Maybe
the caller would rather buffer them.
2025-07-01 16:35:26 -07:00
Nameless a500651370 os: fix missing and incorrect msghdr definitions
Macos uses the BSD definition of msghdr

All linux architectures share a single msghdr definition. Many
architectures had manually inserted padding fields that were endian
specific and some had fields with different integers. This unifies all
architectures to use a single correct msghdr definition.
2025-07-01 16:35:26 -07:00
Andrew Kelley bf00eb3006 more of the compiler updated to new Writer API 2025-07-01 16:35:26 -07:00
Andrew Kelley 09af68de80 fix duration formatting 2025-07-01 16:35:26 -07:00
Andrew Kelley 051c7af49a get std lib json tests passing 2025-07-01 16:35:26 -07:00
Andrew Kelley e154b62d63 give std.json an API spanking
Avoid Redundant Names in Fully-Qualified Namespaces
2025-07-01 16:35:26 -07:00
Andrew Kelley 7569494b45 fix byte formatted printing 2025-07-01 16:35:26 -07:00
Andrew Kelley bb1dffcf32 much of the compiler upgraded to new API 2025-07-01 16:35:26 -07:00
Andrew Kelley f3be721785 build runner compiling 2025-07-01 16:35:26 -07:00
Andrew Kelley 716b4489be update more of the std lib to new API 2025-07-01 16:35:26 -07:00
Andrew Kelley e60adb97d0 AllocatingWriter passing unit test 2025-07-01 16:35:26 -07:00
Andrew Kelley fced9467e8 std ArrayList unit tests passing 2025-07-01 16:35:26 -07:00
Andrew Kelley 221b194f28 std.io.BufferedWriter: implement hex string printing 2025-07-01 16:35:26 -07:00
Andrew Kelley 824216b1d4 remove legacy writer from array list 2025-07-01 16:35:25 -07:00
Andrew Kelley ff3581ca2d update some of the build system to new API 2025-07-01 16:35:25 -07:00
Andrew Kelley 1d0495678d fixes
writeFile should be split into two
2025-07-01 16:35:25 -07:00
Andrew Kelley 35824e4822 writeSplat 2025-07-01 16:35:25 -07:00
Andrew Kelley b26aceba7d thinking about splat being the only function 2025-07-01 16:35:25 -07:00