From 5b5585e723bc2e22664e37b2ec8c224afde3ad14 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Fri, 15 Dec 2006 22:53:06 +0000 Subject: [PATCH] Account for a bigger width or precision when inserting a number into a wide stream on systems where sizeof(wchar_t) == 2. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16294 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/docstring.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/support/docstring.C b/src/support/docstring.C index 0c3739a014..0b7f796628 100644 --- a/src/support/docstring.C +++ b/src/support/docstring.C @@ -497,8 +497,11 @@ private: if (fill >= 0x80) throw num_put_failure(); - // 64 is large enough - std::string s(64, '\0'); + std::streamsize const sz = b.width() > b.precision() ? + b.width() : b.precision(); + // 64 is large enough, unless width or precision are bigger + std::streamsize const wd = (sz > 56 ? sz : 56) + 8; + std::string s(wd, '\0'); string_num_put_facet f; std::string::const_iterator cit = s.begin(); std::string::const_iterator end =