diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 16:54:55 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-01-27 16:54:55 +0000 |
commit | 00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6 (patch) | |
tree | f5e127d2e169a0eb93c66d5c76852303d4a10f0c /src/nids.cpp | |
parent | 9098237f5bb16b204a5ea999b702e5eb170f68ac (diff) | |
download | libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.gz libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.bz2 libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.tar.xz libbu++-00bb8c39b97638c872ebccc6aee7f3c5fb57d7d6.zip |
Corrected the Bu::File::canRead() and Bu::File::canWrite() functions, they work
now. It helps to read the system docs. Anyway, nids is all fixed up, it seems
to work great now, and I guess I got all the corner cases we'll hit for a while,
fishtrax really did a number on them :)
I also cleaned up all the debugging output, now you can see your program run
instead of libbu++ internals.
There could still be a good amount of improvement made in nids, it really
shouldn't re-write whole blocks every time you write to a stream, but that will
be an easy change down the line that won't effect any of the existing code.
Diffstat (limited to 'src/nids.cpp')
-rw-r--r-- | src/nids.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nids.cpp b/src/nids.cpp index 00d5f2b..23c11b0 100644 --- a/src/nids.cpp +++ b/src/nids.cpp | |||
@@ -114,8 +114,8 @@ void Bu::Nids::initialize( int iBlockSize, int iPreAllocate ) | |||
114 | 114 | ||
115 | void Bu::Nids::updateHeader() | 115 | void Bu::Nids::updateHeader() |
116 | { | 116 | { |
117 | // if( !sStore.canWrite() ) | 117 | if( !sStore.canWrite() ) |
118 | // return; | 118 | return; |
119 | sStore.setPos( 10 ); // Skip the magic number, version, bpi, block size | 119 | sStore.setPos( 10 ); // Skip the magic number, version, bpi, block size |
120 | sStore.write( &iBlocks, 4 ); | 120 | sStore.write( &iBlocks, 4 ); |
121 | sStore.write( &iUsed, 4 ); | 121 | sStore.write( &iUsed, 4 ); |
@@ -222,8 +222,8 @@ void Bu::Nids::setBlock( uint32_t uIndex, Bu::Nids::Block *pBlock ) | |||
222 | 222 | ||
223 | void Bu::Nids::updateStreamSize( uint32_t uIndex, uint32_t uSize ) | 223 | void Bu::Nids::updateStreamSize( uint32_t uIndex, uint32_t uSize ) |
224 | { | 224 | { |
225 | // if( !sStore.canWrite() ) | 225 | if( !sStore.canWrite() ) |
226 | // return; | 226 | return; |
227 | sStore.setPos( iBlockStart + (iBlockSize*uIndex)+4*3 ); | 227 | sStore.setPos( iBlockStart + (iBlockSize*uIndex)+4*3 ); |
228 | sStore.write( &uSize, 4 ); | 228 | sStore.write( &uSize, 4 ); |
229 | } | 229 | } |
@@ -240,8 +240,8 @@ uint32_t Bu::Nids::getNextBlock( uint32_t uIndex, | |||
240 | sStore.setPos( iBlockStart + (iBlockSize*uIndex)+1*4 ); | 240 | sStore.setPos( iBlockStart + (iBlockSize*uIndex)+1*4 ); |
241 | sStore.write( &uNew, 4 ); | 241 | sStore.write( &uNew, 4 ); |
242 | getBlock( uNew, pBlock ); | 242 | getBlock( uNew, pBlock ); |
243 | printf("Allocated new block (%u) for stream %u.\n", | 243 | //printf("Allocated new block (%u) for stream %u.\n", |
244 | uNew, pBlock->uFirstBlock ); | 244 | // uNew, pBlock->uFirstBlock ); |
245 | } | 245 | } |
246 | else | 246 | else |
247 | { | 247 | { |