From d7c2deaa9c3762a3735029d408ede82d5c046433 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Wed, 19 Jul 2017 16:48:16 +0100 Subject: Fixes bug in TreeStreamWriter::write reported by @gladtbx in #562. Also removes commented out code from that function. --- lib/Support/TreeStream.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/Support/TreeStream.cpp b/lib/Support/TreeStream.cpp index ef59b2a9..a0e1596f 100644 --- a/lib/Support/TreeStream.cpp +++ b/lib/Support/TreeStream.cpp @@ -63,7 +63,6 @@ TreeOStream TreeStreamWriter::open(const TreeOStream &os) { } void TreeStreamWriter::write(TreeOStream &os, const char *s, unsigned size) { -#if 1 if (bufferCount && (os.id!=lastID || size+bufferCount>bufferSize)) flushBuffer(); @@ -77,13 +76,8 @@ void TreeStreamWriter::write(TreeOStream &os, const char *s, unsigned size) { } else { output->write(reinterpret_cast(&os.id), 4); output->write(reinterpret_cast(&size), 4); - output->write(buffer, size); + output->write(s, size); } -#else - output->write(reinterpret_cast(&os.id), 4); - output->write(reinterpret_cast(&size), 4); - output->write(s, size); -#endif } void TreeStreamWriter::flushBuffer() { -- cgit 1.4.1