Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions std/stdio.d
Original file line number Diff line number Diff line change
Expand Up @@ -2690,7 +2690,7 @@ $(D Range) that locks the file and allows fast writing to it.
}
else static if (c.sizeof == 2)
{
import std.utf : toUTF8;
import std.utf : encode, UseReplacementDchar;

if (orientation_ <= 0)
{
Expand All @@ -2701,9 +2701,9 @@ $(D Range) that locks the file and allows fast writing to it.
else
{
char[4] buf;
auto b = toUTF8(buf, c);
foreach (i ; 0 .. b.length)
trustedFPUTC(b[i], handle_);
immutable size = encode!(UseReplacementDchar.yes)(buf, c);
foreach (i ; 0 .. size)
trustedFPUTC(buf[i], handle_);
}
}
else
Expand Down Expand Up @@ -4462,12 +4462,12 @@ private struct ReadlnAppender
}
void putdchar(dchar dc) @trusted
{
import std.utf : toUTF8;
import std.utf : encode, UseReplacementDchar;

char[4] ubuf;
char[] u = toUTF8(ubuf, dc);
reserve(u.length);
foreach (c; u)
immutable size = encode!(UseReplacementDchar.yes)(ubuf, dc);
reserve(size);
foreach (c; ubuf)
buf.ptr[pos++] = c;
}
Copy link
Contributor

@wilzbach wilzbach Feb 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to CodeCov this isn't used/covered :/

void putonly(char[] b) @trusted
Expand Down
8 changes: 4 additions & 4 deletions std/utf.d
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,8 @@ void validate(S)(in S str) @safe pure
}());
}

/* =================== Conversion to UTF8 ======================= */
//@@@DEPRECATED_2017-10@@@
deprecated("To be removed November 2017. Please use std.utf.encode instead.")
char[] toUTF8(return out char[4] buf, dchar c) nothrow @nogc @safe pure
{
if (c <= 0x7F)
Expand Down Expand Up @@ -2735,9 +2736,8 @@ string toUTF8(S)(S s) if (isInputRange!S && isSomeChar!(ElementEncodingType!S))
assert(r2.toUTF8.equal([0xF0, 0x90, 0x90, 0xB7]));
}


/* =================== Conversion to UTF16 ======================= */

//@@@DEPRECATED_2017-10@@@
deprecated("To be removed November 2017. Please use std.utf.encode instead.")
wchar[] toUTF16(return ref wchar[2] buf, dchar c) nothrow @nogc @safe pure
in
{
Expand Down