This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: patch for fstream.cc
- To: Vadim Egorov <egorovv@my-deja.com>
- Subject: Re: patch for fstream.cc
- From: Vadim Egorov <egorovv@1c.ru>
- Date: Tue, 08 Jun 1999 19:14:55 +0400
- CC: libstdc++@sourceware.cygnus.com
- References: <IJGOONMLCBMGAAAA@my-deja.com>
Vadim Egorov wrote:
>
> Hello,
> When I tryed to use std::wcout in simple test like this:
>
> std::wcout << L"hellow world" << endl ;
> std::wcout << L"hellow world" << endl ;
>
> I got a lot of garbage in output.
>
> I think I managed to locate the source of error.
>
> Here is a small patch to fix the problem.
Actually I found that there are two identical places where basic_filebuf
converts char_type string into
char string but allocates conversion buffer for char_type.
Now with Phil Edwards' fstream patch it works ok.
Here is updated patch
1999-06-08 Vadim Egorov <egorovv@1c.ru>
* bits/fstream.tcc (_M_really_overflow): Fixed size of
conversion buffer
Index: fstream.tcc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/fstream.tcc,v
retrieving revision 1.21
diff -c -r1.21 fstream.tcc
*** fstream.tcc 1999/06/03 00:47:35 1.21
--- fstream.tcc 1999/06/08 12:07:35
***************
*** 377,383 ****
traits_type::copy(__pbuf, this->pbase(), __plen);
char_type* __pend;
! int __conv_len = __plen * sizeof(char_type);
char __conv_buf[__conv_len];
char* __conv_end;
--- 377,383 ----
traits_type::copy(__pbuf, this->pbase(), __plen);
char_type* __pend;
! int __conv_len = __plen * sizeof(char);
char __conv_buf[__conv_len];
char* __conv_end;
***************
*** 519,525 ****
traits_type::copy(__rbuf, this->pbase(), __plen);
traits_type::copy(__rbuf + __plen, __unsft_buf,
__unsft_len);
! int __conv_len = __rlen * sizeof(char_type);
char __conv_buf[__conv_len];
char* __conv_end;
--- 520,526 ----
traits_type::copy(__rbuf, this->pbase(), __plen);
traits_type::copy(__rbuf + __plen, __unsft_buf,
__unsft_len);
! int __conv_len = __rlen * sizeof(char);
char __conv_buf[__conv_len];
char* __conv_end;
--
*********************************************
Vadim Egorov, 1C * Вадим Егоров,1C
egorovv@1c.ru * egorovv@1c.ru
*********************************************