Commit graph

695 commits

Author SHA1 Message Date
Paul Backus
4a91ed7033 stdio: add readfln and File.readfln
Compared to readf, these functions provide a less error-prone way to
read a single line of formatted input.

Fixes #10370
2025-03-03 03:47:52 +01:00
Elias Batek
1b242048c9 Fix #10605 - Make File.byLine usable in @safe contexts 2025-01-17 18:51:08 +01:00
Elias Batek
35c492c4ba
Make File.byLineCopy usable in @safe contexts (#10606) 2025-01-02 11:59:10 +08:00
Steven Schveighoffer
ad8ee55872
Fix #10607 - Structs lines and ByLineCopy cannot be usefully constructed in @safe code (#9035)
Originally known as "Properly mark lines constructor".

Co-authored-by: Elias Batek <15967408+0xEAB@users.noreply.github.com>
2025-01-02 07:16:00 +08:00
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
Feldwor
30a054b31d
Add .byLine Windows Example: Update stdio.d (#8860) 2024-10-21 12:31:11 +08:00
Nick Treleaven
4d54884a49
Fix Bugzilla 24685 - std.stdio.File.rawRead allows reading raw pointers from files in @safe code (#9030) 2024-07-27 07:23:54 +08:00
Denis Feklushkin
8a7aee06a3
DEPRECATED_2.107 code removed (#9028) 2024-07-23 18:20:36 +08:00
Jeremy Baxter
7c68568353 std.stdio: fdopen is a POSIX library function
It's implemented in Windows but it's not part of standard C.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fdopen
2024-07-14 15:37:44 +12:00
Jeremy Baxter
f31a7bc41d replace dead links
for link in $(grep -Eor 'https?://[^\\)", ]+' | grep -v dlang.org \
| grep -Eo 'https?://.+'); do (printf "%s: " "$link"; curl -Is "$link" \
| head -n1) | grep -E '4..$'; done

for link in $(grep -Eor '\\$\\(HTTP .+, ' | grep -v dlang.org \
| cut -d' ' -f2- | sed 's/, .*$//'); do out="$(curl -Is "$link")"; \
(! [ $? = 0 ] || printf '%s' "$out" | head -n1 | grep -Eq '4..') \
&& printf '%s\\n' "$link"; done
2024-07-14 15:16:11 +12:00
Martin Kinkelin
acd2013413 Get rid of obsolete CRuntime_DigitalMars support 2024-05-25 21:45:49 +02:00
Walter Bright
9cb5f6d7db
Merge pull request #8802 from WalterBright/CRuntimeStdio
std.stdio: remove redundant version declarations
2023-08-24 09:07:52 -07:00
Walter Bright
6fd66c5455 std.stdio: untangle fdopen references 2023-08-24 09:00:24 +02:00
Walter Bright
258c98ac36 std.stdio: remove redundant version declarations 2023-08-23 21:50:17 -07:00
Iain Buclaw
105bc4508c Remove declarations with expired deprecations 2023-07-04 21:37:48 +02:00
Walter Bright
33f63dbd5d
std.stdio: add glossary, fileno_t (#8772) 2023-06-22 17:41:08 +03:00
Walter Bright
b3e664e174
Merge pull request #8770 from WalterBright/setmode
fix Issue 23312 - Crash when calling writeln in WinMain
2023-06-21 11:24:52 -07:00
Dennis
e411f326c1
Merge pull request #8771 from WalterBright/stdio-version
std.stdio: add default case
2023-06-21 11:37:31 +02:00
Walter Bright
e690d40e0b std.stdio: add default case 2023-06-21 01:46:06 -07:00
Walter Bright
cdf9ce5e51 fix Issue 23312 - Crash when calling writeln in WinMain 2023-06-21 01:33:33 -07:00
Dennis
5cd77a6e32
User hyperlinks to refer to bugzilla issues (#8766) 2023-06-16 14:45:44 +03:00
Nick Treleaven
a3a4bdbb27
Fix cstdio links (#8740)
* Fix cstdio links

Fixes Issue 23834 - std.file : File links to c functions are invalid and
need updating

* Fix whitespace

* No need for prefix underscore
2023-04-24 12:55:48 +03:00
Jeremy
3c74c2b88a
Add an introduction to the std.json documentation, fix some mistakes in std.curl and replace broken links in std.stdio (#8724)
* Fix some mistakes in curl.d

* Add an introduction for std.json

* Fix more documentation in curl.d

* Fix broken links in std.stdio documentation
2023-03-21 11:01:15 +02:00
Rosca Rares
71c78b4dee Fix Issue 19567 2023-02-01 00:18:28 +01:00
Dennis
09275da681
Merge pull request #8623 from ntrel/safe-readln
Make std.stdio.File.readln @safe
2022-12-05 12:15:37 +01:00
Walter Bright
7bcb8a013d remove unused reference to isPointer from std.stdio 2022-12-01 00:32:20 -08:00
Nick Treleaven
6c9a746295 Fix getdelim trusted encapsulation 2022-11-25 11:21:06 +00:00
Nick Treleaven
f06030819b Remove double @trusted 2022-11-25 10:50:20 +00:00
Nick Treleaven
7b8fbf0350 Remove unsafe opDispatch
Use @trusted lambda for DIGITAL_MARS_STDIO impl
2022-11-25 10:50:20 +00:00
Nick Treleaven
4796637441 Add LockedFile.opDispatch 2022-11-19 20:26:01 +00:00
Nick Treleaven
89ce0c94de Remove LockedFile.fp method
We can use `fps` for `ferror` calls instead.
2022-11-19 17:08:00 +00:00
Nick Treleaven
59749cbc64 Remove 2 unnecessary vars 2022-11-19 14:42:03 +00:00
Nick Treleaven
96ac2e88c8 Tweak LockedFile unittest 2022-11-19 14:39:34 +00:00
Nick Treleaven
b5df5011a7 Move trusted_FGETC to LockedFile method 2022-11-19 14:39:07 +00:00
Nick Treleaven
b036f74ef2 Use LockedFile struct to enforce safe interface
Instead of wrong trusted_FUNLOCK.
Note: trusted_FGETC does have a @safe interface.
2022-11-17 11:51:10 +00:00
Nick Treleaven
9f05dd4d4a Remove unnecessary trusted lambda 2022-11-16 09:46:05 +00:00
Nick Treleaven
80be7fdba2 Revert "Use slice instead of pointer to avoid lambdas"
This reverts commit a5912ca262.
2022-11-16 09:45:36 +00:00
Nick Treleaven
01c80ba94b fp._ptr arithmetic 2022-11-15 18:05:45 +00:00
Nick Treleaven
2da49ee4c8 Make ReadlnAppender.putonly take const array 2022-11-15 17:57:31 +00:00
Nick Treleaven
597e73fd93 3 more @trusted calls 2022-11-15 17:52:11 +00:00
Nick Treleaven
cf131b797d Make StdioException.opCall @safe 2022-11-15 17:40:33 +00:00
Nick Treleaven
a5912ca262 Use slice instead of pointer to avoid lambdas 2022-11-15 17:39:34 +00:00
Nick Treleaven
40df30bc6e Make readlnImpl @safe and use @trusted lambdas 2022-11-15 17:32:04 +00:00
Nick Treleaven
5267ccf0b8 Make std.stdio.File.readln @safe 2022-11-14 15:38:54 +00:00
Geod24
9f008f2485 Remove usages of 'in' on Windows C bindings 2022-10-14 13:32:48 +02:00
Atila Neves
03ac553e03 Fix issue 21000 - allow use of std{in,out,err} with -preview=nosharedaccess 2022-10-04 18:50:10 +02:00
Luís Ferreira
7bf882bfe6 chore(stdio): annotate postblit of File struct
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-09-20 00:50:38 +02:00
Iain Buclaw
bee0ae0a79 partial fix for Issue 23344 - std.stdio: error: undefined identifier fputc_unlocked
While the proper fix would be to define the missing getc/putc macros,
for now to keep the build happy, just treat uClibc as a GENERIC_IO
platform.
2022-09-19 00:01:53 +02:00
vali0901
1d16213980 Fix Issue 13893 - rawRead must take a non-empty buffer 2022-07-23 18:09:32 +03:00
vali0901
85b47bc401 Fix Issue 13893 - rawRead must take a non-empty buffer 2022-07-23 16:50:33 +03:00