From e3f32ec6b417831d7331abb26ab3842c2b66e9ba Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 31 Oct 2020 18:22:05 +0300 Subject: [PATCH] mdbx++: refine `operator<<(ostream, pair)`. Change-Id: I0f42c17a241cf4e2ed6ae8f18e84a13ba5500a3b --- src/mdbx.c++ | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mdbx.c++ b/src/mdbx.c++ index ea2d026a..f21deaa0 100644 --- a/src/mdbx.c++ +++ b/src/mdbx.c++ @@ -1282,9 +1282,13 @@ __cold ::std::ostream &operator<<(::std::ostream &out, const slice &it) { out << "EMPTY->" << it.data(); else { const slice root(it.head(std::min(it.length(), size_t(64)))); - out << it.length() << "->" - << (root.is_printable() ? root.string() : root.base58_encode()) - << ((root == it) ? "" : "..."); + out << it.length() << "."; + if (root.is_printable()) + (out << "\"").write(root.char_ptr(), root.length()) << "\""; + else + out << root.base58_encode(); + if (root.length() < it.length()) + out << "..."; } return out << "}"; }