summaryrefslogtreecommitdiff
path: root/src/unstable/newline.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/unstable/newline.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/unstable/newline.cpp')
-rw-r--r--src/unstable/newline.cpp66
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
10Bu::NewLine::NewLine( Bu::Stream &rNext ) : 10Bu::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
24Bu::size Bu::NewLine::stop() 24Bu::size Bu::NewLine::stop()
25{ 25{
26 return 0; 26 return 0;
27} 27}
28 28
29Bu::size Bu::NewLine::read( void *pBufV, Bu::size iAmnt ) 29Bu::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
64Bu::size Bu::NewLine::write( const void *, Bu::size ) 64Bu::size Bu::NewLine::write( const void *, Bu::size )
65{ 65{
66 return 0; 66 return 0;
67} 67}
68 68