summaryrefslogtreecommitdiff
path: root/sal/rtl/source/ustrbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl/source/ustrbuf.c')
-rw-r--r--sal/rtl/source/ustrbuf.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sal/rtl/source/ustrbuf.c b/sal/rtl/source/ustrbuf.c
index 18ca27f22..638b27eeb 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;
}