diff options
Diffstat (limited to '')
-rw-r--r-- | src/fstring.h | 19 |
1 files changed, 14 insertions, 5 deletions
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 | |||
138 | append( &cData, 1 ); | 138 | append( &cData, 1 ); |
139 | } | 139 | } |
140 | 140 | ||
141 | void prepend( const MyType & sData ) | ||
142 | { | ||
143 | prepend( sData.getStr(), sData.getSize() ); | ||
144 | } | ||
145 | |||
141 | void prepend( const chr *pData ) | 146 | void prepend( const chr *pData ) |
142 | { | 147 | { |
143 | long nLen; | 148 | long nLen; |
@@ -413,17 +418,21 @@ namespace Bu | |||
413 | clear(); | 418 | clear(); |
414 | long nLen; | 419 | long nLen; |
415 | ar >> nLen; | 420 | ar >> nLen; |
416 | 421 | ||
417 | Chunk *pNew = newChunk( nLen ); | 422 | if( nLen > 0 ) |
418 | ar.read( pNew->pData, nLen*sizeof(chr) ); | 423 | { |
419 | appendChunk( pNew ); | 424 | Chunk *pNew = newChunk( nLen ); |
425 | ar.read( pNew->pData, nLen*sizeof(chr) ); | ||
426 | appendChunk( pNew ); | ||
427 | } | ||
420 | } | 428 | } |
421 | else | 429 | else |
422 | { | 430 | { |
423 | flatten(); | 431 | flatten(); |
424 | 432 | ||
425 | ar << nLength; | 433 | ar << nLength; |
426 | ar.write( pFirst->pData, nLength*sizeof(chr) ); | 434 | if( nLength ) |
435 | ar.write( pFirst->pData, nLength*sizeof(chr) ); | ||
427 | } | 436 | } |
428 | } | 437 | } |
429 | 438 | ||