debug.cc (_Error_formatter::_M_print_string): In order to print individual words...
authorJonathan Wakely <redi@gcc.gnu.org>
Sat, 7 Aug 2004 15:31:50 +0000 (16:31 +0100)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 7 Aug 2004 15:31:50 +0000 (15:31 +0000)
2004-08-07  Jonathan Wakely  <redi@gcc.gnu.org>
    Paolo Carlini  <pcarlini@suse.de>

* 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 <pcarlini@suse.de>
From-SVN: r85670

libstdc++-v3/ChangeLog
libstdc++-v3/src/debug.cc

index 597aa665d1ae557a2b2726047b38882714228eb7..bcca0d26c2990b198307187621c99ca6b3872089 100644 (file)
@@ -1,3 +1,11 @@
+2004-08-07  Jonathan Wakely  <redi@gcc.gnu.org>
+           Paolo Carlini  <pcarlini@suse.de>
+       
+       * 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  <pcarlini@suse.de>
 
        * config/locale/generic/c_locale.h (__convert_from_v): Don't
index 05ebc2ffa7b914dad4a6e10e8872c6bb766cb518..20295fb28989ac3774fef63ee20b327a9f793b6b 100644 (file)
@@ -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;