aboutsummaryrefslogtreecommitdiff
path: root/src/newline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newline.cpp')
-rw-r--r--src/newline.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/newline.cpp b/src/newline.cpp
index 0dbbae5..00c73f9 100644
--- a/src/newline.cpp
+++ b/src/newline.cpp
@@ -19,24 +19,27 @@ size_t Bu::NewLine::stop()
19 return 0; 19 return 0;
20} 20}
21 21
22size_t Bu::NewLine::read( void *pBuf, size_t iAmnt ) 22size_t Bu::NewLine::read( void *pBufV, size_t iAmnt )
23{ 23{
24 size_t iRead = rNext.read( pBuf, iAmnt ); 24 size_t iTotal = 0;
25 size_t iOffset = 0; 25 size_t iOffset = 0;
26 size_t iRead = rNext.read( pBufV, iAmnt );
27 char *pBuf = (char *)pBufV;
26 28
27 for( size_t i = 0; i < iRead; i++ ) 29 for( size_t i = 0; i < iRead; i++ )
28 { 30 {
29 if( pBuf[i] == '\r' ) 31 if( pBuf[i] == '\r' )
30 { 32 {
31 pBuf[i+iOffset] = '\n'; 33 pBuf[i+iOffset] = '\n';
32 if( pBuf[j+1] == '\n' ) 34 if( pBuf[i+1] == '\n' )
33 { 35 {
34 iOffset--; 36 iOffset--;
35 } 37 }
36 } 38 }
37 else if( pBuf[i] == '\n' ) 39 else if( pBuf[i] == '\n' )
38 { 40 {
39 if( pBuf[j+1] == '\r' ) 41 pBuf[i+iOffset] = '\n';
42 if( pBuf[i+1] == '\r' )
40 { 43 {
41 iOffset--; 44 iOffset--;
42 } 45 }
@@ -47,7 +50,8 @@ size_t Bu::NewLine::read( void *pBuf, size_t iAmnt )
47 } 50 }
48 } 51 }
49 52
50 iRead += iOffset; 53 iTotal += iRead + iOffset;
54 return iTotal;
51} 55}
52 56
53size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt ) 57size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt )