This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/9874: filebuf::seekpos fails if codecvt::encoding() <= 0


>Number:         9874
>Category:       libstdc++
>Synopsis:       filebuf::seekpos fails if codecvt::encoding() <= 0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 27 10:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02 at ru dot is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
basic_filebuf<>::seekpos currently calls basic_filebuf<>::seekoff, which makes seekpos useless for variable-width encodings (where codecvt<>::encoding() <= 0).
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="seekposbug.cc"
Content-Disposition: inline; filename="seekposbug.cc"

#include <fstream>
#include <locale>

#undef NDEBUG
#include <cassert>

int main()
{
	using namespace std;

	wfilebuf fb;
	fb.pubimbue(locale("is_IS.UTF-8"));
	fb.open("setposbug.cc", ios_base::in);
	fb.sbumpc();
	streampos p1 = fb.pubseekoff(0, ios_base::cur);
	fb.sbumpc();
	streampos p2 = fb.pubseekpos(p1);
	assert(p2 != streampos(-1));
	fb.close();

	return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]