diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-05-24 06:46:39 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-05-24 06:46:39 +0000 |
commit | 71191e311d949b1b7bdd74fc36a14306f492c181 (patch) | |
tree | a3a8515f71d17d9672863b5715ea6e3c5590b036 /src/myriadstream.cpp | |
parent | 8b5f78d058407cb874cbd4a2d917757dc959a482 (diff) | |
download | libbu++-71191e311d949b1b7bdd74fc36a14306f492c181.tar.gz libbu++-71191e311d949b1b7bdd74fc36a14306f492c181.tar.bz2 libbu++-71191e311d949b1b7bdd74fc36a14306f492c181.tar.xz libbu++-71191e311d949b1b7bdd74fc36a14306f492c181.zip |
Myriad unit test. Seems like it's workin' well.
Diffstat (limited to '')
-rw-r--r-- | src/myriadstream.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/myriadstream.cpp b/src/myriadstream.cpp index d714c23..2218ae4 100644 --- a/src/myriadstream.cpp +++ b/src/myriadstream.cpp | |||
@@ -23,7 +23,7 @@ Bu::MyriadStream::MyriadStream( Bu::Myriad &rMyriad, | |||
23 | iPos( 0 ) | 23 | iPos( 0 ) |
24 | { | 24 | { |
25 | #ifdef MYRIAD_STREAM_DEBUG | 25 | #ifdef MYRIAD_STREAM_DEBUG |
26 | sio << "MyriadStream: Created, iId=" << pStream->iId << ", iSize=" | 26 | sio << "MyriadStream: " << __LINE__ << ": Created, iId=" << pStream->iId << ", iSize=" |
27 | << pStream->iSize << sio.nl; | 27 | << pStream->iSize << sio.nl; |
28 | #endif | 28 | #endif |
29 | //pCurBlock = rMyriad.newBlock(); | 29 | //pCurBlock = rMyriad.newBlock(); |
@@ -46,7 +46,7 @@ void Bu::MyriadStream::close() | |||
46 | size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | 46 | size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) |
47 | { | 47 | { |
48 | #ifdef MYRIAD_STREAM_DEBUG | 48 | #ifdef MYRIAD_STREAM_DEBUG |
49 | sio << "MyriadStream: read: Started, asked to read " << nBytes << "b." | 49 | sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." |
50 | << sio.nl; | 50 | << sio.nl; |
51 | #endif | 51 | #endif |
52 | if( nBytes > pStream->iSize-iPos ) | 52 | if( nBytes > pStream->iSize-iPos ) |
@@ -55,13 +55,13 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | |||
55 | return 0; | 55 | return 0; |
56 | int iLeft = nBytes; | 56 | int iLeft = nBytes; |
57 | #ifdef MYRIAD_STREAM_DEBUG | 57 | #ifdef MYRIAD_STREAM_DEBUG |
58 | sio << "MyriadStream: read: Started, going to read " << nBytes << "b." | 58 | sio << "MyriadStream: read: " << __LINE__ << ": Started, going to read " << nBytes << "b." |
59 | << sio.nl; | 59 | << sio.nl; |
60 | #endif | 60 | #endif |
61 | if( pCurBlock == NULL ) | 61 | if( pCurBlock == NULL ) |
62 | { | 62 | { |
63 | #ifdef MYRIAD_STREAM_DEBUG | 63 | #ifdef MYRIAD_STREAM_DEBUG |
64 | sio << "MyriadStream: read: No block loaded, loading initial block." | 64 | sio << "MyriadStream: read: " << __LINE__ << ": No block loaded, loading initial block." |
65 | << sio.nl; | 65 | << sio.nl; |
66 | #endif | 66 | #endif |
67 | pCurBlock = rMyriad.getBlock( | 67 | pCurBlock = rMyriad.getBlock( |
@@ -74,7 +74,7 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | |||
74 | if( pCurBlock->iBlockIndex != iCurBlock ) | 74 | if( pCurBlock->iBlockIndex != iCurBlock ) |
75 | { | 75 | { |
76 | #ifdef MYRIAD_STREAM_DEBUG | 76 | #ifdef MYRIAD_STREAM_DEBUG |
77 | sio << "MyriadStream: read: Loading new block " << iCurBlock << "." | 77 | sio << "MyriadStream: read: " << __LINE__ << ": Loading new block " << iCurBlock << "." |
78 | << sio.nl; | 78 | << sio.nl; |
79 | #endif | 79 | #endif |
80 | rMyriad.releaseBlock( pCurBlock ); | 80 | rMyriad.releaseBlock( pCurBlock ); |
@@ -89,7 +89,7 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | |||
89 | pStream->iSize-iPos | 89 | pStream->iSize-iPos |
90 | ); | 90 | ); |
91 | #ifdef MYRIAD_STREAM_DEBUG | 91 | #ifdef MYRIAD_STREAM_DEBUG |
92 | sio << "MyriadStream: read: Copying out bytes: " | 92 | sio << "MyriadStream: read: " << __LINE__ << ": Copying out bytes: " |
93 | << iPos << "(" << (iPos%rMyriad.iBlockSize) << ")+" | 93 | << iPos << "(" << (iPos%rMyriad.iBlockSize) << ")+" |
94 | << iAmnt | 94 | << iAmnt |
95 | << ", " << iLeft << "b left." << sio.nl; | 95 | << ", " << iLeft << "b left." << sio.nl; |
@@ -112,7 +112,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
112 | return 0; | 112 | return 0; |
113 | 113 | ||
114 | #ifdef MYRIAD_STREAM_DEBUG | 114 | #ifdef MYRIAD_STREAM_DEBUG |
115 | sio << "MyriadStream: write: Started, asked to write " << nBytes << "b." | 115 | sio << "MyriadStream: write: " << __LINE__ << ": Started, asked to write " << nBytes << "b." |
116 | << sio.nl; | 116 | << sio.nl; |
117 | #endif | 117 | #endif |
118 | if( nBytes <= 0 ) | 118 | if( nBytes <= 0 ) |
@@ -143,7 +143,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
143 | pStream->aBlocks.append( iCurBlock ); | 143 | pStream->aBlocks.append( iCurBlock ); |
144 | rMyriad.bsBlockUsed.setBit( iCurBlock ); | 144 | rMyriad.bsBlockUsed.setBit( iCurBlock ); |
145 | #ifdef MYRIAD_STREAM_DEBUG | 145 | #ifdef MYRIAD_STREAM_DEBUG |
146 | sio << "MyriadStream: write: New block allocated and appended: " | 146 | sio << "MyriadStream: write: " << __LINE__ << ": New block allocated and appended: " |
147 | << iCurBlock << "." << sio.nl; | 147 | << iCurBlock << "." << sio.nl; |
148 | 148 | ||
149 | #endif | 149 | #endif |
@@ -151,7 +151,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
151 | if( !pCurBlock || pCurBlock->iBlockIndex != iCurBlock ) | 151 | if( !pCurBlock || pCurBlock->iBlockIndex != iCurBlock ) |
152 | { | 152 | { |
153 | #ifdef MYRIAD_STREAM_DEBUG | 153 | #ifdef MYRIAD_STREAM_DEBUG |
154 | sio << "MyriadStream: write: Loading new block " << iCurBlock << "." | 154 | sio << "MyriadStream: write: " << __LINE__ << ": Loading new block " << iCurBlock << "." |
155 | << sio.nl; | 155 | << sio.nl; |
156 | #endif | 156 | #endif |
157 | rMyriad.releaseBlock( pCurBlock ); | 157 | rMyriad.releaseBlock( pCurBlock ); |
@@ -172,7 +172,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
172 | pStream->iSize-iPos | 172 | pStream->iSize-iPos |
173 | ); | 173 | ); |
174 | #ifdef MYRIAD_STREAM_DEBUG | 174 | #ifdef MYRIAD_STREAM_DEBUG |
175 | sio << "MyriadStream: write (ovr): Copying in bytes: " | 175 | sio << "MyriadStream: write (ovr): " << __LINE__ << ": Copying in bytes: " |
176 | << (iPos%rMyriad.iBlockSize) << "+" | 176 | << (iPos%rMyriad.iBlockSize) << "+" |
177 | << iAmnt | 177 | << iAmnt |
178 | << ", " << iLeft << "b left." << sio.nl; | 178 | << ", " << iLeft << "b left." << sio.nl; |
@@ -193,7 +193,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
193 | iLeft | 193 | iLeft |
194 | ); | 194 | ); |
195 | #ifdef MYRIAD_STREAM_DEBUG | 195 | #ifdef MYRIAD_STREAM_DEBUG |
196 | sio << "MyriadStream: write (app): Copying in bytes: " | 196 | sio << "MyriadStream: write (app): " << __LINE__ << ": Copying in bytes: " |
197 | << (iPos%rMyriad.iBlockSize) << "+" | 197 | << (iPos%rMyriad.iBlockSize) << "+" |
198 | << iAmnt | 198 | << iAmnt |
199 | << ", " << iLeft << "b left." << sio.nl; | 199 | << ", " << iLeft << "b left." << sio.nl; |
@@ -230,7 +230,7 @@ void Bu::MyriadStream::setPos( long pos ) | |||
230 | 230 | ||
231 | void Bu::MyriadStream::setPosEnd( long pos ) | 231 | void Bu::MyriadStream::setPosEnd( long pos ) |
232 | { | 232 | { |
233 | iPos = pStream->iSize-pos-1; | 233 | iPos = pStream->iSize-pos; |
234 | } | 234 | } |
235 | 235 | ||
236 | bool Bu::MyriadStream::isEos() | 236 | bool Bu::MyriadStream::isEos() |