Skip to content

Commit 1f42ce2

Browse files
authored
Fix OutputStream
1 parent 5fcf977 commit 1f42ce2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/yup_core/streams/yup_OutputStream.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,14 @@ bool OutputStream::writeText (const String& text, bool asUTF16, bool writeUTF16B
267267
continue;
268268
}
269269

270-
if (! writeShort ((short) c))
271-
return false;
270+
CharPointer_UTF16::CharType buffer[2]{};
271+
CharPointer_UTF16 begin { buffer };
272+
auto end = begin;
273+
end.write (c);
274+
275+
for (const auto unit : makeRange (begin.getAddress(), end.getAddress()))
276+
if (! writeShort ((short) unit))
277+
return false;
272278
}
273279
}
274280
else
@@ -429,3 +435,4 @@ YUP_API OutputStream& YUP_CALLTYPE operator<< (OutputStream& stream, const NewLi
429435
}
430436

431437
} // namespace yup
438+

0 commit comments

Comments
 (0)