public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9320: Incorrect usage of traits_type::int_type in stdio_filebuf
@ 2003-02-13 12:20 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-13 12:20 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, peturr02

Synopsis: Incorrect usage of traits_type::int_type in stdio_filebuf

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Thu Feb 13 12:20:46 2003
State-Changed-Why:
    Fixed for 3.4 and 3.3 (make check-abi Ok).

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9320


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/9320: Incorrect usage of traits_type::int_type in stdio_filebuf
@ 2003-02-08 18:23 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-08 18:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, peturr02

Synopsis: Incorrect usage of traits_type::int_type in stdio_filebuf

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sat Feb  8 18:23:25 2003
Responsible-Changed-Why:
    Working on it.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sat Feb  8 18:23:25 2003
State-Changed-Why:
    Confirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9320


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/9320: Incorrect usage of traits_type::int_type in stdio_filebuf
@ 2003-01-15 10:26 peturr02
  0 siblings, 0 replies; 3+ messages in thread
From: peturr02 @ 2003-01-15 10:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9320
>Category:       libstdc++
>Synopsis:       Incorrect usage of traits_type::int_type in stdio_filebuf
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 15 02:26:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
The constructors for __gnu_cxx::stdio_filebuf<> take an int_type parameter that is used to specify a buffer size.

However, stdio_filebuf<> has the same template parameters as basic_filebuf<>, so I assume that the same constraits are set on int_type, i.e. int_type is not required to be an integer type (or convertible to one).

In any case this is a bad example for any users wishing to derive their own classes from basic_streambuf<> or basic_filebuf<>.
>How-To-Repeat:
See attachment (should compile, but doesn't).
>Fix:
Use streamsize instead of int_type for the constructors.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="inttypebug.cc"
Content-Disposition: inline; filename="inttypebug.cc"

#include <ext/stdio_filebuf.h>

struct MyChar
{
	int val;
};

struct MyInt
{
	long val;
};

class MyState
{
};

class MyTraits
{
public:
	typedef MyChar char_type;
	typedef MyInt int_type;
	typedef std::streampos pos_type;
	typedef std::streamoff off_type;
	typedef MyState state_type;

	static void
	assign(char_type& __c1, const char_type& __c2);

	static bool
	eq(const char_type& __c1, const char_type& __c2);

	static bool
	lt(const char_type& __c1, const char_type& __c2);

	static int
	compare(const char_type* __s1, const char_type* __s2, size_t __n);

	static size_t
	length(const char_type* __s);

	static const char_type*
	find(const char_type* __s, size_t __n, const char_type& __a);

	static char_type*
	move(char_type* __s1, const char_type* __s2, size_t __n);

	static char_type*
	copy(char_type* __s1, const char_type* __s2, size_t __n);

	static char_type*
	assign(char_type* __s, size_t __n, char_type __a);

	static char_type
	to_char_type(const int_type& __c);

	static int_type
	to_int_type(const char_type& __c);

	static bool
	eq_int_type(const int_type& __c1, const int_type& __c2);

	static int_type
	eof();

	static int_type
	not_eof(const int_type& __c);
};

template class std::basic_streambuf<MyChar, MyTraits>;
template class std::basic_filebuf<MyChar, MyTraits>;
template class __gnu_cxx::stdio_filebuf<MyChar, MyTraits>;

int main()
{
	typedef __gnu_cxx::stdio_filebuf<MyChar, MyTraits> buf_type;
	buf_type buf1 (static_cast<FILE*>(0), std::ios_base::in);
	buf_type buf2 (0, std::ios_base::in, false, MyInt());
	return 0;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-13 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-13 12:20 libstdc++/9320: Incorrect usage of traits_type::int_type in stdio_filebuf paolo
  -- strict thread matches above, loose matches on Subject: below --
2003-02-08 18:23 paolo
2003-01-15 10:26 peturr02

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).