diff options
Diffstat (limited to '')
-rw-r--r-- | src/unstable/newline.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/unstable/newline.cpp b/src/unstable/newline.cpp index c7eb94c..50a4d4e 100644 --- a/src/unstable/newline.cpp +++ b/src/unstable/newline.cpp | |||
@@ -8,8 +8,8 @@ | |||
8 | #include "bu/newline.h" | 8 | #include "bu/newline.h" |
9 | 9 | ||
10 | Bu::NewLine::NewLine( Bu::Stream &rNext ) : | 10 | Bu::NewLine::NewLine( Bu::Stream &rNext ) : |
11 | Bu::Filter( rNext ), | 11 | Bu::Filter( rNext ), |
12 | bExChar( false ) | 12 | bExChar( false ) |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
@@ -23,46 +23,46 @@ void Bu::NewLine::start() | |||
23 | 23 | ||
24 | Bu::size Bu::NewLine::stop() | 24 | Bu::size Bu::NewLine::stop() |
25 | { | 25 | { |
26 | return 0; | 26 | return 0; |
27 | } | 27 | } |
28 | 28 | ||
29 | Bu::size Bu::NewLine::read( void *pBufV, Bu::size iAmnt ) | 29 | Bu::size Bu::NewLine::read( void *pBufV, Bu::size iAmnt ) |
30 | { | 30 | { |
31 | Bu::size iTotal = 0; | 31 | Bu::size iTotal = 0; |
32 | Bu::size iOffset = 0; | 32 | Bu::size iOffset = 0; |
33 | Bu::size iRead = rNext.read( pBufV, iAmnt ); | 33 | Bu::size iRead = rNext.read( pBufV, iAmnt ); |
34 | char *pBuf = (char *)pBufV; | 34 | char *pBuf = (char *)pBufV; |
35 | 35 | ||
36 | for( Bu::size i = 0; i < iRead; i++ ) | 36 | for( Bu::size i = 0; i < iRead; i++ ) |
37 | { | 37 | { |
38 | if( pBuf[i] == '\r' ) | 38 | if( pBuf[i] == '\r' ) |
39 | { | 39 | { |
40 | pBuf[i+iOffset] = '\n'; | 40 | pBuf[i+iOffset] = '\n'; |
41 | if( pBuf[i+1] == '\n' ) | 41 | if( pBuf[i+1] == '\n' ) |
42 | { | 42 | { |
43 | iOffset--; | 43 | iOffset--; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | else if( pBuf[i] == '\n' ) | 46 | else if( pBuf[i] == '\n' ) |
47 | { | 47 | { |
48 | pBuf[i+iOffset] = '\n'; | 48 | pBuf[i+iOffset] = '\n'; |
49 | if( pBuf[i+1] == '\r' ) | 49 | if( pBuf[i+1] == '\r' ) |
50 | { | 50 | { |
51 | iOffset--; | 51 | iOffset--; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | else if( iOffset ) | 54 | else if( iOffset ) |
55 | { | 55 | { |
56 | pBuf[i+iOffset] = pBuf[i]; | 56 | pBuf[i+iOffset] = pBuf[i]; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | iTotal += iRead + iOffset; | 60 | iTotal += iRead + iOffset; |
61 | return iTotal; | 61 | return iTotal; |
62 | } | 62 | } |
63 | 63 | ||
64 | Bu::size Bu::NewLine::write( const void *, Bu::size ) | 64 | Bu::size Bu::NewLine::write( const void *, Bu::size ) |
65 | { | 65 | { |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||