From e91839a42404645e3e0464df560d46ffa3954d86 Mon Sep 17 00:00:00 2001 From: paolo Date: Sat, 7 Aug 2004 15:31:50 +0000 Subject: [PATCH] 2004-08-07 Jonathan Wakely Paolo Carlini * src/debug.cc (_Error_formatter::_M_print_string): In order to print individual words from __string, _M_format_word can't be called since may be just sprintf, thus ignoring completely __n: instead, use memmove and append '\0' by hand. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85670 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/src/debug.cc | 15 ++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 597aa665d1a..bcca0d26c29 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2004-08-07 Jonathan Wakely + Paolo Carlini + + * src/debug.cc (_Error_formatter::_M_print_string): In order + to print individual words from __string, _M_format_word can't + be called since may be just sprintf, thus ignoring completely + __n: instead, use memmove and append '\0' by hand. + 2004-08-07 Paolo Carlini * config/locale/generic/c_locale.h (__convert_from_v): Don't diff --git a/libstdc++-v3/src/debug.cc b/libstdc++-v3/src/debug.cc index 05ebc2ffa7b..20295fb2898 100644 --- a/libstdc++-v3/src/debug.cc +++ b/libstdc++-v3/src/debug.cc @@ -569,12 +569,17 @@ namespace __gnu_debug { // [__start, __end) denotes the next word __end = __start; - while (isalnum(*__end)) ++__end; - if (__start == __end) ++__end; - if (isspace(*__end)) ++__end; + while (isalnum(*__end)) + ++__end; + if (__start == __end) + ++__end; + if (isspace(*__end)) + ++__end; - assert(__end - __start + 1< __bufsize); - _M_format_word(__buf, __end - __start + 1, "%s", __start); + const ptrdiff_t __len = __end - __start; + assert(__len < __bufsize); + memmove(__buf, __start, __len); + __buf[__len] = '\0'; _M_print_word(__buf); __start = __end; -- 2.11.0