Skip to content

Commit

Permalink
Fix Bugzilla 20870 - std.outbuffer.printf is trusted (dlang#9037)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel authored and RubyTheRoobster committed Aug 21, 2024
1 parent 250553b commit 4badf4b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions std/outbuffer.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import std.traits : isSomeString;
* OutBuffer's byte order is the format native to the computer.
* To control the byte order (endianness), use a class derived
* from OutBuffer.
*
* OutBuffer's internal buffer is allocated with the GC. Pointers
* stored into the buffer are scanned by the GC, but you have to
* ensure proper alignment, e.g. by using alignSize((void*).sizeof).
* ensure proper alignment, e.g. by using `alignSize((void*).sizeof)`.
*/

class OutBuffer
Expand Down Expand Up @@ -297,7 +298,7 @@ class OutBuffer
* Append output of C's vprintf() to internal buffer.
*/

void vprintf(scope string format, va_list args) @trusted nothrow
void vprintf(scope string format, va_list args) @system nothrow
{
import core.stdc.stdio : vsnprintf;
import core.stdc.stdlib : alloca;
Expand Down Expand Up @@ -342,7 +343,7 @@ class OutBuffer
* Append output of C's printf() to internal buffer.
*/

void printf(scope string format, ...) @trusted
void printf(scope string format, ...) @system
{
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -475,7 +476,7 @@ class OutBuffer
buf.write("hello");
buf.write(cast(byte) 0x20);
buf.write("world");
buf.printf(" %d", 62665);
buf.writef(" %d", 62665);
assert(cmp(buf.toString(), "hello world 62665") == 0);

buf.clear();
Expand Down

0 comments on commit 4badf4b

Please sign in to comment.