diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-07-04 11:29:08 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-07-04 11:30:37 +0200 |
commit | 3563ee58528846e694b495723a247ff128994c8c (patch) | |
tree | c35d1a742bb10801c5d8613a32c4e6ec50a41d71 /sal/rtl | |
parent | d8636d2f8e9c0398d3909f20f22d0e783d7061d5 (diff) |
change O[U]StringBuffer::remove() to take start+len
In order to be consistent with other usage in LO and C++ libs,
instead of being consistent with Java.
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/source/strbuf.c | 17 | ||||
-rw-r--r-- | sal/rtl/source/ustrbuf.c | 17 |
2 files changed, 14 insertions, 20 deletions
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c index a620a3c0419d..c9a4f3140643 100644 --- a/sal/rtl/source/strbuf.c +++ b/sal/rtl/source/strbuf.c @@ -151,31 +151,28 @@ void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This, */ void SAL_CALL rtl_stringbuffer_remove( rtl_String ** This, sal_Int32 start, - sal_Int32 end ) + sal_Int32 len ) { sal_Int32 nTailLen; sal_Char * pBuf; - sal_Int32 n; - - if (end > (*This)->length) - end = (*This)->length; - n = end - start; + if (len > (*This)->length - start) + len = (*This)->length - start; //remove nothing - if (!n) + if (!len) return; pBuf = (*This)->buffer; - nTailLen = (*This)->length - end; + nTailLen = (*This)->length - ( start + len ); if (nTailLen) { /* move the tail */ - rtl_moveMemory(pBuf + start, pBuf + end, nTailLen * sizeof(sal_Char)); + rtl_moveMemory(pBuf + start, pBuf + start + len, nTailLen * sizeof(sal_Char)); } - (*This)->length-=n; + (*This)->length-=len; pBuf[ (*This)->length ] = 0; } diff --git a/sal/rtl/source/ustrbuf.c b/sal/rtl/source/ustrbuf.c index f5dbefdb75b8..374913ae78b8 100644 --- a/sal/rtl/source/ustrbuf.c +++ b/sal/rtl/source/ustrbuf.c @@ -211,31 +211,28 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This, */ void SAL_CALL rtl_uStringbuffer_remove( rtl_uString ** This, sal_Int32 start, - sal_Int32 end ) + sal_Int32 len ) { sal_Int32 nTailLen; sal_Unicode * pBuf; - sal_Int32 n; - - if (end > (*This)->length) - end = (*This)->length; - n = end - start; + if (len > (*This)->length - start) + len = (*This)->length - start; //remove nothing - if (!n) + if (!len) return; pBuf = (*This)->buffer; - nTailLen = (*This)->length - end; + nTailLen = (*This)->length - ( start + len ); if (nTailLen) { /* move the tail */ - rtl_moveMemory(pBuf + start, pBuf + end, nTailLen * sizeof(sal_Unicode)); + rtl_moveMemory(pBuf + start, pBuf + start + len, nTailLen * sizeof(sal_Unicode)); } - (*This)->length-=n; + (*This)->length-=len; pBuf[ (*This)->length ] = 0; } |