From: Jonathan Wakely Date: Sat, 7 Aug 2004 15:31:50 +0000 (+0100) Subject: debug.cc (_Error_formatter::_M_print_string): In order to print individual words... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8844a2f541582d58075af46362d57a1f75fc6eff;p=gcc.git debug.cc (_Error_formatter::_M_print_string): In order to print individual words from __string... 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. Co-Authored-By: Paolo Carlini From-SVN: r85670 --- 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;