diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-03-29 04:01:45 +0000 | 
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-29 04:01:45 +0000 | 
| commit | c7636dc954eddfe58f7959392602fbc9072d77e7 (patch) | |
| tree | bef0b41561287ead10b5a17ccaa8a66c45efa6a1 /src/string.h | |
| parent | 86e3e2ed03a4889cf64a9149f1f0f5047a889c56 (diff) | |
| download | libbu++-c7636dc954eddfe58f7959392602fbc9072d77e7.tar.gz libbu++-c7636dc954eddfe58f7959392602fbc9072d77e7.tar.bz2 libbu++-c7636dc954eddfe58f7959392602fbc9072d77e7.tar.xz libbu++-c7636dc954eddfe58f7959392602fbc9072d77e7.zip  | |
String's replace function now doesn't get false positives on partial matches at
the end of strings.  Build should work much better now.
Diffstat (limited to 'src/string.h')
| -rw-r--r-- | src/string.h | 15 | 
1 files changed, 11 insertions, 4 deletions
diff --git a/src/string.h b/src/string.h index 9270c55..3ac161b 100644 --- a/src/string.h +++ b/src/string.h  | |||
| @@ -203,6 +203,7 @@ namespace Bu | |||
| 203 | if( *a != *b ) | 203 | if( *a != *b ) | 
| 204 | return false; | 204 | return false; | 
| 205 | } | 205 | } | 
| 206 | |||
| 206 | return true; | 207 | return true; | 
| 207 | } | 208 | } | 
| 208 | 209 | ||
| @@ -212,11 +213,14 @@ namespace Bu | |||
| 212 | const_iterator b = c; | 213 | const_iterator b = c; | 
| 213 | if( a == b ) | 214 | if( a == b ) | 
| 214 | return true; | 215 | return true; | 
| 215 | for(int j = 0; a && b && j < nLen; a++, b++, j++ ) | 216 | int j; | 
| 217 | for( j = 0; a && b && j < nLen; a++, b++, j++ ) | ||
| 216 | { | 218 | { | 
| 217 | if( *a != *b ) | 219 | if( *a != *b ) | 
| 218 | return false; | 220 | return false; | 
| 219 | } | 221 | } | 
| 222 | if( j < nLen ) | ||
| 223 | return false; | ||
| 220 | return true; | 224 | return true; | 
| 221 | } | 225 | } | 
| 222 | 226 | ||
| @@ -252,7 +256,7 @@ namespace Bu | |||
| 252 | bool compare( const String &s ) const | 256 | bool compare( const String &s ) const | 
| 253 | { | 257 | { | 
| 254 | if( !pChunk ) return false; | 258 | if( !pChunk ) return false; | 
| 255 | return compare( s.begin() ); | 259 | return compare( s.begin(), s.getSize() ); | 
| 256 | } | 260 | } | 
| 257 | 261 | ||
| 258 | bool compare( const String &s, int nLen ) const | 262 | bool compare( const String &s, int nLen ) const | 
| @@ -458,11 +462,14 @@ namespace Bu | |||
| 458 | iterator b = c; | 462 | iterator b = c; | 
| 459 | if( a == b ) | 463 | if( a == b ) | 
| 460 | return true; | 464 | return true; | 
| 461 | for(int j = 0; a && b && j < nLen; a++, b++, j++ ) | 465 | int j; | 
| 466 | for( j = 0; a && b && j < nLen; a++, b++, j++ ) | ||
| 462 | { | 467 | { | 
| 463 | if( *a != *b ) | 468 | if( *a != *b ) | 
| 464 | return false; | 469 | return false; | 
| 465 | } | 470 | } | 
| 471 | if( j < nLen ) | ||
| 472 | return false; | ||
| 466 | return true; | 473 | return true; | 
| 467 | } | 474 | } | 
| 468 | 475 | ||
| @@ -498,7 +505,7 @@ namespace Bu | |||
| 498 | bool compare( const String &s ) const | 505 | bool compare( const String &s ) const | 
| 499 | { | 506 | { | 
| 500 | if( !pChunk ) return false; | 507 | if( !pChunk ) return false; | 
| 501 | return compare( s.begin() ); | 508 | return compare( s.begin(), s.getSize() ); | 
| 502 | } | 509 | } | 
| 503 | 510 | ||
| 504 | bool compare( const String &s, int nLen ) const | 511 | bool compare( const String &s, int nLen ) const | 
