summaryrefslogtreecommitdiff
path: root/sal/rtl/source/strbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl/source/strbuf.c')
-rw-r--r--sal/rtl/source/strbuf.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c
index 47fd5c8b51ed..a620a3c0419d 100644
--- a/sal/rtl/source/strbuf.c
+++ b/sal/rtl/source/strbuf.c
@@ -146,4 +146,37 @@ void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
}
}
+/*************************************************************************
+ * rtl_stringbuffer_remove
+ */
+void SAL_CALL rtl_stringbuffer_remove( rtl_String ** This,
+ sal_Int32 start,
+ sal_Int32 end )
+{
+ sal_Int32 nTailLen;
+ sal_Char * pBuf;
+ sal_Int32 n;
+
+ if (end > (*This)->length)
+ end = (*This)->length;
+
+ n = end - start;
+
+ //remove nothing
+ if (!n)
+ return;
+
+ pBuf = (*This)->buffer;
+ nTailLen = (*This)->length - end;
+
+ if (nTailLen)
+ {
+ /* move the tail */
+ rtl_moveMemory(pBuf + start, pBuf + end, nTailLen * sizeof(sal_Char));
+ }
+
+ (*This)->length-=n;
+ pBuf[ (*This)->length ] = 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */