diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-08-03 21:33:33 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-08-03 21:33:33 +0000 |
commit | 6e6402825bcd6021d62fd2eb8a0669641fe9c266 (patch) | |
tree | 6942e99b440849046482e99eef7590014c06120d /src/buffer.cpp | |
parent | fbb30d35cfa10bf36d4ecb2d0eb5971c24aab26a (diff) | |
download | libbu++-6e6402825bcd6021d62fd2eb8a0669641fe9c266.tar.gz libbu++-6e6402825bcd6021d62fd2eb8a0669641fe9c266.tar.bz2 libbu++-6e6402825bcd6021d62fd2eb8a0669641fe9c266.tar.xz libbu++-6e6402825bcd6021d62fd2eb8a0669641fe9c266.zip |
Hey, buffer has some good tweaks, added some stuff and fixed stuff in formatter
and base64 no longer accidentally complains about properly formatted streams,
as much...
Diffstat (limited to 'src/buffer.cpp')
-rw-r--r-- | src/buffer.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/buffer.cpp b/src/buffer.cpp index 5e7fb9a..d4eb8a6 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp | |||
@@ -40,12 +40,12 @@ void Bu::Buffer::fillReadBuf() | |||
40 | { | 40 | { |
41 | if( iReadBufFill+iReadPos < iBufSize ) | 41 | if( iReadBufFill+iReadPos < iBufSize ) |
42 | { | 42 | { |
43 | printf("Buffer: Attempting to read %db.\n", iBufSize-iReadBufFill-iReadPos ); | 43 | //printf("Buffer: Attempting to read %db.\n", iBufSize-iReadBufFill-iReadPos ); |
44 | iReadBufFill += rNext.read( | 44 | iReadBufFill += rNext.read( |
45 | sReadBuf+iReadPos+iReadBufFill, | 45 | sReadBuf+iReadPos+iReadBufFill, |
46 | iBufSize-iReadBufFill-iReadPos | 46 | iBufSize-iReadBufFill-iReadPos |
47 | ); | 47 | ); |
48 | printf("Buffer: Read from stream, %db now in buffer.\n", iReadBufFill ); | 48 | //printf("Buffer: Read from stream, %db now in buffer.\n", iReadBufFill ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
@@ -82,7 +82,7 @@ size_t Bu::Buffer::read( void *pBuf, size_t nBytes ) | |||
82 | } | 82 | } |
83 | while( nTotRead < nBytes && iReadBufFill > 0 ); | 83 | while( nTotRead < nBytes && iReadBufFill > 0 ); |
84 | 84 | ||
85 | printf("Buffer: %db returned, %db remain in buffer.\n", nTotRead, iReadBufFill ); | 85 | //printf("Buffer: %db returned, %db remain in buffer.\n", nTotRead, iReadBufFill ); |
86 | 86 | ||
87 | return nTotRead; | 87 | return nTotRead; |
88 | } | 88 | } |
@@ -107,14 +107,14 @@ size_t Bu::Buffer::write( const void *pBuf, size_t nBytes ) | |||
107 | ); | 107 | ); |
108 | nTotWrote += iAmnt; | 108 | nTotWrote += iAmnt; |
109 | iWriteBufFill += iAmnt; | 109 | iWriteBufFill += iAmnt; |
110 | printf("Buffer: Moved %db to write buffer, %db filled now.\n", | 110 | //printf("Buffer: Moved %db to write buffer, %db filled now.\n", |
111 | iAmnt, iWriteBufFill ); | 111 | //iAmnt, iWriteBufFill ); |
112 | } | 112 | } |
113 | while( iWritePos+iWriteBufFill == iBufSize ) | 113 | while( iWritePos+iWriteBufFill == iBufSize ) |
114 | { | 114 | { |
115 | printf("iWritePos = %d\n", iWritePos ); | 115 | //printf("iWritePos = %d\n", iWritePos ); |
116 | int iWr = rNext.write( sWriteBuf+iWritePos, iWriteBufFill ); | 116 | int iWr = rNext.write( sWriteBuf+iWritePos, iWriteBufFill ); |
117 | printf("Buffer: Wrote %db from buffer to stream, %db filled now.\n", iWr, iWriteBufFill-iWr ); | 117 | //printf("Buffer: Wrote %db from buffer to stream, %db filled now.\n", iWr, iWriteBufFill-iWr ); |
118 | if( iWr == 0 ) | 118 | if( iWr == 0 ) |
119 | { | 119 | { |
120 | return nTotWrote; | 120 | return nTotWrote; |
@@ -139,12 +139,12 @@ void Bu::Buffer::flush() | |||
139 | { | 139 | { |
140 | if( iWriteBufFill > 0 ) | 140 | if( iWriteBufFill > 0 ) |
141 | { | 141 | { |
142 | printf("Buffer: Flushing remaining data, %db.\n", iWriteBufFill ); | 142 | //printf("Buffer: Flushing remaining data, %db.\n", iWriteBufFill ); |
143 | int iWr = 0; | 143 | int iWr = 0; |
144 | do | 144 | do |
145 | { | 145 | { |
146 | iWr = rNext.write( sWriteBuf+iWritePos, iWriteBufFill ); | 146 | iWr = rNext.write( sWriteBuf+iWritePos, iWriteBufFill ); |
147 | printf("Buffer: %db written to stream.\n", iWr ); | 147 | //printf("Buffer: %db written to stream.\n", iWr ); |
148 | iWritePos += iWr; | 148 | iWritePos += iWr; |
149 | iWriteBufFill -= iWr; | 149 | iWriteBufFill -= iWr; |
150 | } while( iWriteBufFill > 0 && iWr > 0 ); | 150 | } while( iWriteBufFill > 0 && iWr > 0 ); |