From c296a6e7905270c93e6a8262c7dd8ab9f6877a17 Mon Sep 17 00:00:00 2001 From: Ferdinand Majerech Date: Tue, 22 Jul 2014 02:15:33 +0200 Subject: [PATCH] MemoryStream now constructed in UTFDecoder. --- source/dyaml/reader.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/dyaml/reader.d b/source/dyaml/reader.d index 0499e65..46a3d51 100644 --- a/source/dyaml/reader.d +++ b/source/dyaml/reader.d @@ -102,7 +102,7 @@ final class Reader } version(unittest) { endian_ = result.endian; } - decoder_ = UTFFastDecoder(new MemoryStream(result.array), result.encoding); + decoder_ = UTFFastDecoder(result.array, result.encoding); } @trusted nothrow @nogc ~this() @@ -421,10 +421,10 @@ struct UTFBlockDecoder(size_t bufferSize_) if (bufferSize_ % 2 == 0) dchar[] buffer_; public: - /// Construct a UTFBlockDecoder decoding a stream. - this(MemoryStream stream, UTFEncoding encoding) @trusted + /// Construct a UTFBlockDecoder decoding data from a buffer. + this(ubyte[] buffer, UTFEncoding encoding) @trusted { - stream_ = stream; + stream_ = new MemoryStream(buffer); available_ = stream_.available; encoding_ = encoding; final switch(encoding_)