From 58a0ba451a28497e5b4572a89db4f8f98ee441ee Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 24 Mar 2011 23:59:39 +0000 Subject: This may really screw things up, but the trimBack function made no sense, so I changed it. We'll have to add back in the other one if anyone needs it. This will most likely require things to be rebuilt, but they'll complain instead of mislinking this time :-P --- src/string.cpp | 19 ++++++++++++++++++- src/string.h | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/string.cpp b/src/string.cpp index ce86c0d..9cf3ffc 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -1103,7 +1103,7 @@ void Bu::String::trimFront( long nAmnt ) core->clear(); core->appendChunk( pNew ); } - +/* void Bu::String::trimBack( char c ) { if( core->pFirst == NULL || core->nLength == 0 ) @@ -1113,6 +1113,23 @@ void Bu::String::trimBack( char c ) core->pFirst->pData[core->pFirst->nLength-1] == c; core->pFirst->nLength--, core->nLength-- ) { } } +*/ +void Bu::String::trimBack( long iAmnt ) +{ + if( iAmnt < 0 ) + return; + if( core->nLength - iAmnt < 0 ) + { + clear(); + return; + } + if( core->pFirst == NULL || core->nLength == 0 ) + return; + + flatten(); + core->pFirst->nLength -= iAmnt; + core->nLength -= iAmnt; +} Bu::String::iterator Bu::String::begin() { diff --git a/src/string.h b/src/string.h index 59a2cd1..71798db 100644 --- a/src/string.h +++ b/src/string.h @@ -923,7 +923,8 @@ namespace Bu */ void trimFront( long nAmnt ); - void trimBack( char c ); + // void trimBack( char c ); + void trimBack( long iAmnt ); iterator begin(); -- cgit v1.2.3