summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-09-14 07:10:06 +0000
committerMike Buland <eichlan@xagasoft.com>2010-09-14 07:10:06 +0000
commitd210c301bc3e8867cad883e80663208474cc1ea5 (patch)
treecf79adc2952c20dfc5c8c051b3a0d907c4f7d9c7
parent29ab73673e547abd20fc1a98e6ae642b11952808 (diff)
downloadlibbu++-d210c301bc3e8867cad883e80663208474cc1ea5.tar.gz
libbu++-d210c301bc3e8867cad883e80663208474cc1ea5.tar.bz2
libbu++-d210c301bc3e8867cad883e80663208474cc1ea5.tar.xz
libbu++-d210c301bc3e8867cad883e80663208474cc1ea5.zip
Quite exciting, really. That lurking myriad bug has been found, it was not
forcing a header update when a stream changed size, but did not require additional blocks to be linked in. Kind of strange, but it's fixed now. A little more testing and I think it'll be ready.
-rw-r--r--src/archive.cpp9
-rw-r--r--src/myriad.cpp5
-rw-r--r--src/myriad.h2
-rw-r--r--src/myriadstream.cpp12
4 files changed, 23 insertions, 5 deletions
diff --git a/src/archive.cpp b/src/archive.cpp
index f29895c..69d4a0c 100644
--- a/src/archive.cpp
+++ b/src/archive.cpp
@@ -9,6 +9,8 @@
9#include "bu/stream.h" 9#include "bu/stream.h"
10#include "bu/archival.h" 10#include "bu/archival.h"
11 11
12#include "bu/sio.h"
13
12Bu::Archive::Archive( Stream &rStream, bool bLoading ) : 14Bu::Archive::Archive( Stream &rStream, bool bLoading ) :
13 bLoading( bLoading ), 15 bLoading( bLoading ),
14 rStream( rStream ), 16 rStream( rStream ),
@@ -24,8 +26,13 @@ void Bu::Archive::write( const void *pData, int32_t nSize )
24{ 26{
25 if( nSize == 0 || pData == NULL ) 27 if( nSize == 0 || pData == NULL )
26 return; 28 return;
27 29
30// Bu::sio << "Writing starting at pos: " << rStream.tell() << " - "
31// << Bu::sio.flush;
32
28 rStream.write( (const char *)pData, nSize ); 33 rStream.write( (const char *)pData, nSize );
34//
35// Bu::sio << rStream.tell() << " (" << nSize << "b)" << Bu::sio.nl;
29} 36}
30 37
31void Bu::Archive::read( void *pData, int32_t nSize ) 38void Bu::Archive::read( void *pData, int32_t nSize )
diff --git a/src/myriad.cpp b/src/myriad.cpp
index bfb2ccc..8650a1c 100644
--- a/src/myriad.cpp
+++ b/src/myriad.cpp
@@ -593,6 +593,11 @@ void Bu::Myriad::setStreamSize( Stream *pStream, long iSize )
593 } 593 }
594} 594}
595 595
596void Bu::Myriad::headerChanged()
597{
598 bHeaderChanged = true;
599}
600
596bool Bu::Myriad::isMyriad( Bu::Stream &sStore ) 601bool Bu::Myriad::isMyriad( Bu::Stream &sStore )
597{ 602{
598 sStore.setPos( 0 ); 603 sStore.setPos( 0 );
diff --git a/src/myriad.h b/src/myriad.h
index 53a42b8..84f273e 100644
--- a/src/myriad.h
+++ b/src/myriad.h
@@ -198,6 +198,8 @@ namespace Bu
198 int streamAddBlock( Stream *pStream ); 198 int streamAddBlock( Stream *pStream );
199 void setStreamSize( Stream *pStream, long iSize ); 199 void setStreamSize( Stream *pStream, long iSize );
200 200
201 void headerChanged();
202
201 private: 203 private:
202 Bu::Stream &sStore; 204 Bu::Stream &sStore;
203 int iBlockSize; 205 int iBlockSize;
diff --git a/src/myriadstream.cpp b/src/myriadstream.cpp
index 6623b2b..74dca04 100644
--- a/src/myriadstream.cpp
+++ b/src/myriadstream.cpp
@@ -6,15 +6,18 @@
6 */ 6 */
7 7
8#include "bu/myriadstream.h" 8#include "bu/myriadstream.h"
9#include "bu/sio.h"
10
11using Bu::sio;
12using Bu::Fmt;
13 9
14#include <string.h> 10#include <string.h>
15 11
16// #define MYRIAD_STREAM_DEBUG 1 12// #define MYRIAD_STREAM_DEBUG 1
17 13
14#ifdef MYRIAD_STREAM_DEBUG
15#include "bu/sio.h"
16
17using Bu::sio;
18using Bu::Fmt;
19#endif
20
18Bu::MyriadStream::MyriadStream( Bu::Myriad &rMyriad, 21Bu::MyriadStream::MyriadStream( Bu::Myriad &rMyriad,
19 Bu::Myriad::Stream *pStream ) : 22 Bu::Myriad::Stream *pStream ) :
20 rMyriad( rMyriad ), 23 rMyriad( rMyriad ),
@@ -203,6 +206,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes )
203 ); 206 );
204 iPos += iAmnt; 207 iPos += iAmnt;
205 pStream->iSize += iAmnt; 208 pStream->iSize += iAmnt;
209 rMyriad.headerChanged();
206 pBuf = &((char *)pBuf)[iAmnt]; 210 pBuf = &((char *)pBuf)[iAmnt];
207 iLeft -= iAmnt; 211 iLeft -= iAmnt;
208 } 212 }