aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-01 02:47:08 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-01 02:47:08 +0000
commitaeb8bee786a9495c78ed94e2a8485ed790714635 (patch)
tree8ffe8bb122daedabb92c18495d9cb95e601f71ea
parentdaa25c26e99eb62a4ce499f8079b15734987ac0d (diff)
downloadlibbu++-aeb8bee786a9495c78ed94e2a8485ed790714635.tar.gz
libbu++-aeb8bee786a9495c78ed94e2a8485ed790714635.tar.bz2
libbu++-aeb8bee786a9495c78ed94e2a8485ed790714635.tar.xz
libbu++-aeb8bee786a9495c78ed94e2a8485ed790714635.zip
The cache...
Diffstat (limited to '')
-rw-r--r--src/buffer.cpp9
-rw-r--r--src/buffer.h2
-rw-r--r--src/cache.h27
3 files changed, 24 insertions, 14 deletions
diff --git a/src/buffer.cpp b/src/buffer.cpp
index 57f965c..cbebfc2 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -41,12 +41,12 @@ void Bu::Buffer::fillReadBuf()
41{ 41{
42 if( iReadBufFill+iReadPos < iBufSize ) 42 if( iReadBufFill+iReadPos < iBufSize )
43 { 43 {
44 //printf("Buffer: Attempting to read %db.\n", iBufSize-iReadBufFill-iReadPos ); 44 printf("Buffer: Attempting to read %db.\n", iBufSize-iReadBufFill-iReadPos );
45 iReadBufFill += rNext.read( 45 iReadBufFill += rNext.read(
46 sReadBuf+iReadPos+iReadBufFill, 46 sReadBuf+iReadPos+iReadBufFill,
47 iBufSize-iReadBufFill-iReadPos 47 iBufSize-iReadBufFill-iReadPos
48 ); 48 );
49 //printf("Buffer: Read from stream, %db now in buffer.\n", iReadBufFill ); 49 printf("Buffer: Read from stream, %db now in buffer.\n", iReadBufFill );
50 } 50 }
51} 51}
52 52
@@ -152,3 +152,8 @@ void Bu::Buffer::flush()
152 } 152 }
153} 153}
154 154
155bool Bu::Buffer::isEos()
156{
157 return iReadPos == (iReadBufFill-1) && rNext.isEos();
158}
159
diff --git a/src/buffer.h b/src/buffer.h
index b931937..97d4127 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -30,6 +30,8 @@ namespace Bu
30 30
31 virtual void flush(); 31 virtual void flush();
32 32
33 virtual bool isEos();
34
33 private: 35 private:
34 void fillReadBuf(); 36 void fillReadBuf();
35 37
diff --git a/src/cache.h b/src/cache.h
index 06b798c..1753407 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -317,20 +317,23 @@ namespace Bu
317 void erase( const keytype &cId ) 317 void erase( const keytype &cId )
318 { 318 {
319 TRACE( cId ); 319 TRACE( cId );
320 try { 320 if( hEnt.has( cId ) )
321 if( hEnt.get( cId ).iRefs > 0 ) 321 {
322 { 322 try {
323 printf("Shouldn't delete, references still exist!\n"); 323 if( hEnt.get( cId ).iRefs > 0 )
324 return; 324 {
325 printf("Shouldn't delete, references still exist!\n");
326 return;
327 }
325 } 328 }
329 catch( Bu::HashException &e ) {
330 get( cId );
331 }
332
333 pCalc->onUnload( hEnt.get( cId ).pData, cId );
334 pStore->destroy( hEnt.get( cId ).pData, cId );
326 } 335 }
327 catch( Bu::HashException &e ) { 336
328 get( cId );
329 }
330
331 pCalc->onUnload( hEnt.get( cId ).pData, cId );
332
333 pStore->destroy( hEnt.get( cId ).pData, cId );
334 hEnt.erase( cId ); 337 hEnt.erase( cId );
335 } 338 }
336 339