diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-11-23 23:54:25 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-11-23 23:54:25 +0000 |
commit | d09fbd451f492ab0df5c45f8205172b1035ce210 (patch) | |
tree | 76ba7e8f7f2aae5fe08af9711fe1f6f0151c0eaf | |
parent | c9574d3f77081fb4a654d42c298d6ebf34abca51 (diff) | |
download | libbu++-d09fbd451f492ab0df5c45f8205172b1035ce210.tar.gz libbu++-d09fbd451f492ab0df5c45f8205172b1035ce210.tar.bz2 libbu++-d09fbd451f492ab0df5c45f8205172b1035ce210.tar.xz libbu++-d09fbd451f492ab0df5c45f8205172b1035ce210.zip |
Ok, that was a strange bug...
-rw-r--r-- | src/fstring.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/fstring.h b/src/fstring.h index 8b512e2..c1b377c 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -253,6 +253,39 @@ namespace Bu | |||
253 | appendChunk( p3 ); | 253 | appendChunk( p3 ); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | /* | ||
257 | void insert( long nPos, const MyType &str ) | ||
258 | { | ||
259 | if( nLen <= 0 ) | ||
260 | return; | ||
261 | flatten(); | ||
262 | if( nPos <= 0 ) | ||
263 | { | ||
264 | prepend( pData, nLen ); | ||
265 | } | ||
266 | else if( nPos >= nLength ) | ||
267 | { | ||
268 | append( pData, nLen ); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | Chunk *p1 = newChunk( nPos ); | ||
273 | Chunk *p2 = newChunk( nLen ); | ||
274 | Chunk *p3 = newChunk( nLength-nPos ); | ||
275 | cpy( p1->pData, pFirst->pData, nPos ); | ||
276 | cpy( p2->pData, pData, nLen ); | ||
277 | cpy( p3->pData, pFirst->pData+nPos, nLength-nPos ); | ||
278 | clear(); | ||
279 | appendChunk( p1 ); | ||
280 | appendChunk( p2 ); | ||
281 | appendChunk( p3 ); | ||
282 | } | ||
283 | }*/ | ||
284 | |||
285 | void insert( long nPos, const chr *pData ) | ||
286 | { | ||
287 | insert( nPos, pData, strlen( pData ) ); | ||
288 | } | ||
256 | 289 | ||
257 | void remove( long nPos, long nLen ) | 290 | void remove( long nPos, long nLen ) |
258 | { | 291 | { |
@@ -261,7 +294,7 @@ namespace Bu | |||
261 | if( nLen >= nLength-nPos ) | 294 | if( nLen >= nLength-nPos ) |
262 | nLen = nLength-nPos-1; | 295 | nLen = nLength-nPos-1; |
263 | flatten(); | 296 | flatten(); |
264 | cpy( pFirst->pData+nPos, pFirst->pData+nPos+nLen, nLen+1 ); | 297 | cpy( pFirst->pData+nPos, pFirst->pData+nPos+nLen, nLength-nPos+1 ); |
265 | nLength -= nPos; | 298 | nLength -= nPos; |
266 | } | 299 | } |
267 | 300 | ||