From d210c301bc3e8867cad883e80663208474cc1ea5 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 14 Sep 2010 07:10:06 +0000 Subject: 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. --- src/archive.cpp | 9 ++++++++- src/myriad.cpp | 5 +++++ src/myriad.h | 2 ++ src/myriadstream.cpp | 12 ++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') 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 @@ #include "bu/stream.h" #include "bu/archival.h" +#include "bu/sio.h" + Bu::Archive::Archive( Stream &rStream, bool bLoading ) : bLoading( bLoading ), rStream( rStream ), @@ -24,8 +26,13 @@ void Bu::Archive::write( const void *pData, int32_t nSize ) { if( nSize == 0 || pData == NULL ) return; - + +// Bu::sio << "Writing starting at pos: " << rStream.tell() << " - " +// << Bu::sio.flush; + rStream.write( (const char *)pData, nSize ); +// +// Bu::sio << rStream.tell() << " (" << nSize << "b)" << Bu::sio.nl; } void 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 ) } } +void Bu::Myriad::headerChanged() +{ + bHeaderChanged = true; +} + bool Bu::Myriad::isMyriad( Bu::Stream &sStore ) { 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 int streamAddBlock( Stream *pStream ); void setStreamSize( Stream *pStream, long iSize ); + void headerChanged(); + private: Bu::Stream &sStore; 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 @@ */ #include "bu/myriadstream.h" -#include "bu/sio.h" - -using Bu::sio; -using Bu::Fmt; #include // #define MYRIAD_STREAM_DEBUG 1 +#ifdef MYRIAD_STREAM_DEBUG +#include "bu/sio.h" + +using Bu::sio; +using Bu::Fmt; +#endif + Bu::MyriadStream::MyriadStream( Bu::Myriad &rMyriad, Bu::Myriad::Stream *pStream ) : rMyriad( rMyriad ), @@ -203,6 +206,7 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) ); iPos += iAmnt; pStream->iSize += iAmnt; + rMyriad.headerChanged(); pBuf = &((char *)pBuf)[iAmnt]; iLeft -= iAmnt; } -- cgit v1.2.3