blob: 0dbbae5e94eca3ece1e56847fdf672c23d7ee832 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include "bu/newline.h"
Bu::NewLine::NewLine( Bu::Stream &rNext ) :
Bu::Filter( rNext ),
bExChar( false )
{
}
Bu::NewLine::~NewLine()
{
}
void Bu::NewLine::start()
{
}
size_t Bu::NewLine::stop()
{
return 0;
}
size_t Bu::NewLine::read( void *pBuf, size_t iAmnt )
{
size_t iRead = rNext.read( pBuf, iAmnt );
size_t iOffset = 0;
for( size_t i = 0; i < iRead; i++ )
{
if( pBuf[i] == '\r' )
{
pBuf[i+iOffset] = '\n';
if( pBuf[j+1] == '\n' )
{
iOffset--;
}
}
else if( pBuf[i] == '\n' )
{
if( pBuf[j+1] == '\r' )
{
iOffset--;
}
}
else if( iOffset )
{
pBuf[i+iOffset] = pBuf[i];
}
}
iRead += iOffset;
}
size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt )
{
}
|