Laytan Laats
fe2d256468
Properly close the temporary files in io tests
2024-08-28 19:53:20 +02:00
Laytan Laats
0f2ad95014
Fix EOF detection is os2 window read
2024-08-28 19:53:20 +02:00
Feoramund
7fa2e56cd9
Add io tests for bufio streams
2024-08-28 19:53:20 +02:00
Feoramund
24a53c246f
Make sure seek succeeds in io.Limited_Reader test setup
2024-08-28 19:53:20 +02:00
Feoramund
b11fa90ed2
Test empty slice usage in io procs
2024-08-28 19:53:20 +02:00
Feoramund
f453054aff
Return 0, nil in all io cases where an empty slice is provided
2024-08-28 19:53:20 +02:00
Feoramund
ef99373c31
Fix pread and pwrite on os2 Windows
...
The previous code was jumping ahead by the specified offset, instead of
getting the current offset.
2024-08-28 19:53:20 +02:00
Feoramund
1cd5cbb0e4
Test io unexpected pointer movement
2024-08-28 19:53:20 +02:00
Feoramund
56f232e5fc
Report invalid whence & offset on os2 Windows
2024-08-28 19:53:20 +02:00
Feoramund
de1432b315
Fix Windows infinite recursion with os2._flush
2024-08-28 19:53:20 +02:00
Feoramund
e7d6e2d163
Add documentation to os2.close
...
Make it explicit that using a stream after closing is like a
use-after-free bug.
2024-08-28 19:53:20 +02:00
Feoramund
8b40be50b9
Update core:io tests
...
- Relax return value requirements on errors. Only the error is checked,
as there are multiple conflicting return styles throughout the `os`
API.
Some return the error along with `0`, `-1`, or another value. This can
be smoothed out later.
- Test `os2` files now.
- No longer test streams after closing; this is considered similar to a
use-after-free in `os2`.
2024-08-28 19:53:20 +02:00
Feoramund
6798d15ecb
Check int(abs) instead to avoid overflows
2024-08-28 19:53:20 +02:00
Feoramund
6aedb2695a
Report Invalid_Whence on some os platforms
...
- Move `Seek`-related checks into OS-specific files for granularity.
Platforms:
- Darwin
- FreeBSD
- Haiku
- Linux
- NetBSD
- OpenBSD
2024-08-28 19:53:20 +02:00
Feoramund
0243647e15
Add missing flush functionality to os platforms
...
Platforms:
- FreeBSD
- Haiku
- Linux
- NetBSD
- OpenBSD
2024-08-28 19:53:20 +02:00
Feoramund
3ec4db212b
Report Invalid_Whence in os2 Linux seek
2024-08-28 19:53:20 +02:00
Feoramund
7683c1f4bb
Report Invalid_Whence in os2 POSIX seek
2024-08-28 19:53:20 +02:00
Feoramund
ef2cd9d97f
Copy missing errors in os2._get_platform_error from posix to linux
2024-08-28 19:53:20 +02:00
Feoramund
5b9e9fb822
Add test suite for core:io
2024-08-28 19:53:20 +02:00
Feoramund
741ccd7ff5
Zero n on error in _file_stream_proc
2024-08-28 19:53:20 +02:00
Feoramund
eb92a2df71
Fix indentation
2024-08-28 19:53:20 +02:00
Feoramund
d60f404bb4
Fix OpenBSD implementations of read_at and write_at
2024-08-28 19:53:20 +02:00
Feoramund
6c4806835c
Fix indentation
2024-08-28 19:53:20 +02:00
Feoramund
e1555e04ad
Fix Haiku implementations of read_at and write_at
2024-08-28 19:53:20 +02:00
Feoramund
7061032db6
Fix NetBSD implementations of read_at and write_at
...
These procedures must not modify the underlying file pointer.
2024-08-28 19:53:20 +02:00
Feoramund
861d892ffe
Make Windows pread and pwrite conform to POSIX
2024-08-28 19:53:20 +02:00
Feoramund
5c8c63ae04
Fix FreeBSD implementations of read_at and write_at
...
These procedures must not modify the underlying file pointer.
2024-08-28 19:53:20 +02:00
Feoramund
1ced76cdd1
Fix broken cases of Seek usage in _file_stream_proc
...
Handles `EINVAL`, among other fixes.
2024-08-28 19:53:20 +02:00
Feoramund
e83b982afe
Measure bytes.Buffer size by length instead of capacity
2024-08-28 19:53:20 +02:00
Feoramund
7c6cc81041
Add Seek behavior to bytes.Buffer
2024-08-28 19:53:20 +02:00
Feoramund
521e47ffee
Don't invalidate prev_rune if Reader seek failed
2024-08-28 19:53:20 +02:00
Feoramund
8251f4d7d0
Return .EOF in bytes.buffer_read_at instead
...
This is consistent with the other stream `read` procs
2024-08-28 19:53:20 +02:00
Feoramund
da49f7eb4e
Make bytes.reader_init return an io.Stream
...
Makes the API like the other stream `init` procs.
2024-08-28 19:53:20 +02:00
Feoramund
d66486c17e
Make io.Section_Reader set base too
...
This should fix seeking from `.Start`, getting the `size`, and
`read_at`.
Also make the API consistent with the other `*_init` procs in
`util.odin` by returning the `io.Reader`.
2024-08-28 19:53:20 +02:00
Feoramund
981a2e1a00
Add missing io.Stream_Mode responses
2024-08-28 19:53:19 +02:00
Laytan
eb6e5ee3a1
Merge pull request #4162 from laytan/os2-disable-custom-heap-allocator
...
os2: disable custom heap allocator
2024-08-28 19:51:22 +02:00
Laytan
5e850e24d6
os2: disable custom heap allocator
...
See #4161
2024-08-28 19:45:34 +02:00
Jeroen van Rijn
17d10b72d5
Merge pull request #4158 from sqrt-negativeone/master
...
Win32 clipboard procedures
2024-08-28 19:02:18 +02:00
Fakhri Mouad
b08c14b710
fix style, ensure we compile with flags -vet -strict-style -disallow-do
2024-08-28 17:52:58 +01:00
Jeroen van Rijn
d3fca60e4d
Merge pull request #4160 from Kelimion/vsdd
...
-vet -strict-style -disallow-do
2024-08-28 18:49:44 +02:00
Jeroen van Rijn
d602e2cc74
Remove duplicate vet flag.
2024-08-28 18:43:54 +02:00
Jeroen van Rijn
831e26cb6f
Remove unused import.
2024-08-28 18:42:54 +02:00
Jeroen van Rijn
7b276cbc7e
-vet -strict-style -disallow-do
2024-08-28 18:36:49 +02:00
Fakhri Mouad
7e4750c303
fix indentation in test file
2024-08-28 17:30:30 +01:00
Fakhri Mouad
967b6d46b2
avoid using do statement in odin codebase
2024-08-28 17:27:27 +01:00
Jeroen van Rijn
fcafd83506
Merge pull request #4159 from Kelimion/disallow-do
...
More -disallow-do in CI.
2024-08-28 18:20:39 +02:00
Jeroen van Rijn
21dab9673d
More -disallow-do in CI.
2024-08-28 18:13:53 +02:00
Fakhri Mouad
16503c3b91
Add Win32 procs needed to handle clipboard
2024-08-28 16:36:06 +01:00
Laytan Laats
1e6419b5b7
fix zombie thread leak in thread self cleanup
2024-08-28 16:22:38 +02:00
Laytan Laats
ef66f96cf2
fix windows bindings where BOOL is not actually a boolean
...
Fixes #4157
2024-08-28 15:45:41 +02:00