diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 00:32:36 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 00:32:36 +0000 |
commit | 22e51abaebd4f0c194e505d879f9b6a2fc31890d (patch) | |
tree | 25b57bfbc04af4a772516983d926f3858fe0cd61 /src/fstring.h | |
parent | 2de3693dd24463c5a02b9308ddfd674f58bac7c1 (diff) | |
download | libbu++-22e51abaebd4f0c194e505d879f9b6a2fc31890d.tar.gz libbu++-22e51abaebd4f0c194e505d879f9b6a2fc31890d.tar.bz2 libbu++-22e51abaebd4f0c194e505d879f9b6a2fc31890d.tar.xz libbu++-22e51abaebd4f0c194e505d879f9b6a2fc31890d.zip |
Fixed a bunch of stuff, I don't even know what...
Diffstat (limited to 'src/fstring.h')
-rw-r--r-- | src/fstring.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/fstring.h b/src/fstring.h index 00bb12c..73b04ab 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -222,10 +222,13 @@ namespace Bu | |||
222 | 222 | ||
223 | Chunk *pNew = newChunk( nNewSize ); | 223 | Chunk *pNew = newChunk( nNewSize ); |
224 | long nNewLen = (nNewSize<nLength)?(nNewSize):(nLength); | 224 | long nNewLen = (nNewSize<nLength)?(nNewSize):(nLength); |
225 | cpy( pNew->pData, pFirst->pData, nNewLen ); | 225 | if( nLength > 0 ) |
226 | { | ||
227 | cpy( pNew->pData, pFirst->pData, nNewLen ); | ||
228 | aChr.deallocate( pFirst->pData, pFirst->nLength+1 ); | ||
229 | aChunk.deallocate( pFirst, 1 ); | ||
230 | } | ||
226 | pNew->pData[nNewLen] = (chr)0; | 231 | pNew->pData[nNewLen] = (chr)0; |
227 | aChr.deallocate( pFirst->pData, pFirst->nLength+1 ); | ||
228 | aChunk.deallocate( pFirst, 1 ); | ||
229 | pFirst = pLast = pNew; | 232 | pFirst = pLast = pNew; |
230 | nLength = nNewSize; | 233 | nLength = nNewSize; |
231 | } | 234 | } |
@@ -396,7 +399,7 @@ namespace Bu | |||
396 | flatten(); | 399 | flatten(); |
397 | const chr *a = pData; | 400 | const chr *a = pData; |
398 | chr *b = pFirst->pData; | 401 | chr *b = pFirst->pData; |
399 | for( ; *a!=(chr)0; a++, b++ ) | 402 | for( ; *a!=(chr)0 || *b!=(chr)0; a++, b++ ) |
400 | { | 403 | { |
401 | if( *a != *b ) | 404 | if( *a != *b ) |
402 | return false; | 405 | return false; |
@@ -420,7 +423,7 @@ namespace Bu | |||
420 | pData.flatten(); | 423 | pData.flatten(); |
421 | const chr *a = pData.pFirst->pData; | 424 | const chr *a = pData.pFirst->pData; |
422 | chr *b = pFirst->pData; | 425 | chr *b = pFirst->pData; |
423 | for( ; *a!=(chr)0; a++, b++ ) | 426 | for( ; *a!=(chr)0 || *b!=(chr)0; a++, b++ ) |
424 | { | 427 | { |
425 | if( *a != *b ) | 428 | if( *a != *b ) |
426 | return false; | 429 | return false; |
@@ -587,7 +590,7 @@ namespace Bu | |||
587 | long nNewLen = nLength - nAmnt; | 590 | long nNewLen = nLength - nAmnt; |
588 | flatten(); | 591 | flatten(); |
589 | Chunk *pNew = newChunk( nNewLen ); | 592 | Chunk *pNew = newChunk( nNewLen ); |
590 | cpy( pNew->pData, pFirst->pData, nNewLen ); | 593 | cpy( pNew->pData, pFirst->pData+nAmnt, nNewLen ); |
591 | clear(); | 594 | clear(); |
592 | appendChunk( pNew ); | 595 | appendChunk( pNew ); |
593 | } | 596 | } |