From 7ba47b5b688afd7e04b38a3e0e4aa018c10a9a59 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 11 Jun 2007 16:03:46 +0000 Subject: Corrected another issue with the prefix * iterator operator in Bu::Hash, it was still trying to use a pair internally. Also added more helpers to FString. --- src/fstring.h | 19 ++++++++++++++----- src/hash.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/fstring.h b/src/fstring.h index d0307b5..7dda87c 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -138,6 +138,11 @@ namespace Bu append( &cData, 1 ); } + void prepend( const MyType & sData ) + { + prepend( sData.getStr(), sData.getSize() ); + } + void prepend( const chr *pData ) { long nLen; @@ -413,17 +418,21 @@ namespace Bu clear(); long nLen; ar >> nLen; - - Chunk *pNew = newChunk( nLen ); - ar.read( pNew->pData, nLen*sizeof(chr) ); - appendChunk( pNew ); + + if( nLen > 0 ) + { + Chunk *pNew = newChunk( nLen ); + ar.read( pNew->pData, nLen*sizeof(chr) ); + appendChunk( pNew ); + } } else { flatten(); ar << nLength; - ar.write( pFirst->pData, nLength*sizeof(chr) ); + if( nLength ) + ar.write( pFirst->pData, nLength*sizeof(chr) ); } } diff --git a/src/hash.h b/src/hash.h index f6c207f..1bb25c9 100644 --- a/src/hash.h +++ b/src/hash.h @@ -458,7 +458,7 @@ namespace Bu value &operator *() { - return hsh.getAtPos( nPos ); + return hsh.getValueAtPos( nPos ); } key &getKey() -- cgit v1.2.3