Skip to content

Commit c264a0d

Browse files
Restored original names for typedefs. Fixed gcc build.
1 parent 5e104ad commit c264a0d

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

‎Foundation/include/Poco/MemoryStream.h‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
namespace Poco {
3333

3434

35-
template <typename charT, typename traits>
36-
class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
35+
template <typename ch, typename tr>
36+
class BasicMemoryStreamBuf: public std::basic_streambuf<ch, tr>
3737
/// BasicMemoryStreamBuf is a simple implementation of a
3838
/// stream buffer for reading and writing from a memory area.
3939
///
@@ -43,11 +43,13 @@ class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
4343
/// ostream, but not for an iostream.
4444
{
4545
protected:
46-
typedef charT char_type;
47-
typedef typename traits::int_type int_type;
48-
typedef typename traits::pos_type pos_type;
49-
typedef typename traits::off_type off_type;
50-
typedef traits traits_type;
46+
typedef std::basic_streambuf<ch, tr> Base;
47+
typedef std::basic_ios<ch, tr> IOS;
48+
typedef ch char_type;
49+
typedef tr char_traits;
50+
typedef typename Base::int_type int_type;
51+
typedef typename Base::pos_type pos_type;
52+
typedef typename Base::off_type off_type;
5153

5254
public:
5355
BasicMemoryStreamBuf(char_type* pBuffer, std::streamsize bufferSize):
@@ -64,12 +66,12 @@ class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
6466

6567
virtual int_type overflow(int_type /*c*/)
6668
{
67-
return traits_type::eof();
69+
return char_traits::eof();
6870
}
6971

7072
virtual int_type underflow()
7173
{
72-
return traits_type::eof();
74+
return char_traits::eof();
7375
}
7476

7577
virtual pos_type seekoff(off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
@@ -81,7 +83,7 @@ class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
8183
{
8284
// Position the input sequence
8385

84-
if (gptr() == 0)
86+
if (this->gptr() == 0)
8587
return fail;
8688

8789
switch (way)
@@ -93,21 +95,21 @@ class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
9395
// cur is not valid if both in and out are specified (Condition 3)
9496
if ((which & std::ios_base::out) != 0)
9597
return fail;
96-
newoff = gptr() - eback();
98+
newoff = this->gptr() - this->eback();
9799
break;
98100
case std::ios_base::end:
99-
newoff = egptr() - eback();
101+
newoff = this->egptr() - this->eback();
100102
break;
101103
}
102104

103-
if ((newoff + off) < 0 || (egptr() - eback()) < (newoff + off))
105+
if ((newoff + off) < 0 || (this->egptr() - this->eback()) < (newoff + off))
104106
return fail;
105-
this->setg(eback(), eback() + newoff + off, egptr());
107+
this->setg(this->eback(), this->eback() + newoff + off, this->egptr());
106108
}
107109

108110
if ((which & std::ios_base::out) != 0)
109111
{
110-
if (pptr() == 0)
112+
if (this->pptr() == 0)
111113
return fail;
112114

113115
switch (way)
@@ -119,16 +121,16 @@ class BasicMemoryStreamBuf: public std::basic_streambuf<charT, traits>
119121
// cur is not valid if both in and out are specified (Condition 3)
120122
if ((which & std::ios_base::in) != 0)
121123
return fail;
122-
newoff = pptr() - pbase();
124+
newoff = this->pptr() - this->pbase();
123125
break;
124126
case std::ios_base::end:
125-
newoff = epptr() - pbase();
127+
newoff = this->epptr() - this->pbase();
126128
break;
127129
}
128130

129-
if (newoff + off < 0 || (epptr() - pbase()) < newoff + off)
131+
if (newoff + off < 0 || (this->epptr() - this->pbase()) < newoff + off)
130132
return fail;
131-
this->pbump((int)(newoff + off - (pptr() - pbase())));
133+
this->pbump((int)(newoff + off - (this->pptr() - this->pbase())));
132134
}
133135

134136
return newoff;

0 commit comments

Comments
 (0)