summaryrefslogtreecommitdiff
path: root/sal/rtl/source/strbuf.c
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-21 18:59:03 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-07-21 18:59:03 +0200
commit5b5501f54ec560bf7a5e3ac1b1257b6072a69057 (patch)
tree2735f8af1183f82309d6d21262e613f164be7bf7 /sal/rtl/source/strbuf.c
parentc5235330a83081e6b744d93996f37b3abd6ac30a (diff)
parenta6ba297abbe0a78954de2b2cbd911df899dc985c (diff)
resyncing to master
Diffstat (limited to 'sal/rtl/source/strbuf.c')
-rw-r--r--sal/rtl/source/strbuf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c
index 446b1cee2..c0e9694dc 100644
--- a/sal/rtl/source/strbuf.c
+++ b/sal/rtl/source/strbuf.c
@@ -144,6 +144,36 @@ void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
(*This)->length = nOldLen + len;
pBuf[ nOldLen + len ] = 0;
}
+}
+
+/*************************************************************************
+ * rtl_stringbuffer_remove
+ */
+void SAL_CALL rtl_stringbuffer_remove( rtl_String ** This,
+ sal_Int32 start,
+ sal_Int32 len )
+{
+ sal_Int32 nTailLen;
+ sal_Char * pBuf;
+
+ if (len > (*This)->length - start)
+ len = (*This)->length - start;
+
+ //remove nothing
+ if (!len)
+ return;
+
+ pBuf = (*This)->buffer;
+ nTailLen = (*This)->length - ( start + len );
+
+ if (nTailLen)
+ {
+ /* move the tail */
+ rtl_moveMemory(pBuf + start, pBuf + start + len, nTailLen * sizeof(sal_Char));
+ }
+
+ (*This)->length-=len;
+ pBuf[ (*This)->length ] = 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */