mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Fix issue #8471 - allow only pointers as readf parameters
This commit is contained in:
parent
db204e0f8a
commit
882a1fb8f6
2 changed files with 6 additions and 2 deletions
2
changelog/std-stdio-readf-only-pointers.dd
Normal file
2
changelog/std-stdio-readf-only-pointers.dd
Normal file
|
@ -0,0 +1,2 @@
|
|||
`std.stdio.readf` now only accepts pointers as input arguments.
|
||||
|
|
@ -16,13 +16,13 @@ module std.stdio;
|
|||
public import core.stdc.stdio;
|
||||
import core.stdc.stddef; // wchar_t
|
||||
import std.algorithm.mutation; // copy
|
||||
import std.meta; // allSatisfy
|
||||
import std.range.primitives; // ElementEncodingType, empty, front,
|
||||
// isBidirectionalRange, isInputRange, put
|
||||
import std.stdiobase;
|
||||
import std.traits; // isSomeChar, isSomeString, Unqual
|
||||
import std.traits; // isSomeChar, isSomeString, Unqual, isPointer
|
||||
import std.typecons; // Flag
|
||||
|
||||
|
||||
/++
|
||||
If flag $(D KeepTerminator) is set to $(D KeepTerminator.yes), then the delimiter
|
||||
is included in the strings returned.
|
||||
|
@ -1769,6 +1769,7 @@ is recommended if you want to process a complete file.
|
|||
* $(REF formattedRead, std,_format).
|
||||
*/
|
||||
uint readf(Data...)(in char[] format, Data data)
|
||||
if (allSatisfy!(isPointer, Data))
|
||||
{
|
||||
import std.format : formattedRead;
|
||||
|
||||
|
@ -3646,6 +3647,7 @@ void writefln(T...)(T args)
|
|||
* $(REF formattedRead, std,_format).
|
||||
*/
|
||||
uint readf(A...)(in char[] format, A args)
|
||||
if (allSatisfy!(isPointer, A))
|
||||
{
|
||||
return stdin.readf(format, args);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue