Skip to content

Commit

Permalink
Mark std.file.readText as trusted
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Jul 30, 2014
1 parent 8e0b336 commit 7aecde3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions std/file.d
Expand Up @@ -346,9 +346,10 @@ enforce(chomp(readText("deleteme")) == "abc");
----
*/

S readText(S = string)(in char[] name)
S readText(S = string)(in char[] name) @safe if (isSomeString!S)
{
auto result = cast(S) read(name);
static auto trustedCast(void[] buf) @trusted { return cast(S)buf; }
auto result = trustedCast(read(name));
std.utf.validate(result);
return result;
}
Expand Down

0 comments on commit 7aecde3

Please sign in to comment.