summaryrefslogtreecommitdiff
path: root/src/fbasicstring.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbasicstring.h')
-rw-r--r--src/fbasicstring.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h
index bf43502..064ff16 100644
--- a/src/fbasicstring.h
+++ b/src/fbasicstring.h
@@ -1172,7 +1172,7 @@ namespace Bu
1172 */ 1172 */
1173 chr *getStr() 1173 chr *getStr()
1174 { 1174 {
1175 if( core->pFirst == NULL ) 1175 if( core->pFirst == NULL || core->nLength == 0 )
1176 return (chr *)""; 1176 return (chr *)"";
1177 1177
1178 flatten(); 1178 flatten();
@@ -1187,7 +1187,7 @@ namespace Bu
1187 */ 1187 */
1188 const chr *getStr() const 1188 const chr *getStr() const
1189 { 1189 {
1190 if( core->pFirst == NULL ) 1190 if( core->pFirst == NULL || core->nLength == 0 )
1191 return (chr *)""; 1191 return (chr *)"";
1192 1192
1193 flatten(); 1193 flatten();
@@ -1483,7 +1483,7 @@ namespace Bu
1483 */ 1483 */
1484 bool operator==( const chr *pData ) const 1484 bool operator==( const chr *pData ) const
1485 { 1485 {
1486 if( core->pFirst == NULL ) { 1486 if( core->pFirst == NULL || core->nLength == 0 ) {
1487 if( pData == NULL ) 1487 if( pData == NULL )
1488 return true; 1488 return true;
1489 if( pData[0] == (chr)0 ) 1489 if( pData[0] == (chr)0 )
@@ -1669,9 +1669,11 @@ namespace Bu
1669 1669
1670 bool compareSub( const chr *pData, long nIndex, long nLen ) const 1670 bool compareSub( const chr *pData, long nIndex, long nLen ) const
1671 { 1671 {
1672 if( core->pFirst == NULL ) { 1672 if( core->pFirst == NULL || core->nLength == 0 ) {
1673 if( pData == NULL ) 1673 if( pData == NULL )
1674 return true; 1674 return true;
1675 if( nLen == 0 )
1676 return true;
1675 if( pData[0] == (chr)0 ) 1677 if( pData[0] == (chr)0 )
1676 return true; 1678 return true;
1677 return false; 1679 return false;
@@ -1696,7 +1698,7 @@ namespace Bu
1696 1698
1697 bool compareSub( const MyType &rData, long nIndex, long nLen ) const 1699 bool compareSub( const MyType &rData, long nIndex, long nLen ) const
1698 { 1700 {
1699 if( core->pFirst == NULL || rData.core->pFirst == NULL ) 1701 if( core->pFirst == NULL || core->nLength == 0 || rData.core->pFirst == NULL || rData.core->nLength == 0 )
1700 return false; 1702 return false;
1701 if( nLen < 0 ) 1703 if( nLen < 0 )
1702 nLen = rData.core->nLength; 1704 nLen = rData.core->nLength;
@@ -1945,7 +1947,7 @@ namespace Bu
1945 1947
1946 void trimBack( chr c ) 1948 void trimBack( chr c )
1947 { 1949 {
1948 if( core->pFirst == NULL ) 1950 if( core->pFirst == NULL || core->nLength == 0 )
1949 return; 1951 return;
1950 flatten(); 1952 flatten();
1951 for( ; core->pFirst->nLength > 0 && core->pFirst->pData[core->pFirst->nLength-1] == c; core->pFirst->nLength--, core->nLength-- ) { } 1953 for( ; core->pFirst->nLength > 0 && core->pFirst->pData[core->pFirst->nLength-1] == c; core->pFirst->nLength--, core->nLength-- ) { }
@@ -2041,7 +2043,7 @@ namespace Bu
2041 if( isFlat() ) 2043 if( isFlat() )
2042 return; 2044 return;
2043 2045
2044 if( core->pFirst == NULL ) 2046 if( core->pFirst == NULL || core->nLength == 0 )
2045 return; 2047 return;
2046 2048
2047 Chunk *pNew = core->newChunk( core->nLength ); 2049 Chunk *pNew = core->newChunk( core->nLength );