summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/source/strbuf.c33
-rw-r--r--sal/rtl/source/ustrbuf.c32
2 files changed, 65 insertions, 0 deletions
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c
index 446b1cee2..8d0f27625 100644
--- a/sal/rtl/source/strbuf.c
+++ b/sal/rtl/source/strbuf.c
@@ -144,6 +144,39 @@ 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 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: */
diff --git a/sal/rtl/source/ustrbuf.c b/sal/rtl/source/ustrbuf.c
index 33317b6f3..18ca27f22 100644
--- a/sal/rtl/source/ustrbuf.c
+++ b/sal/rtl/source/ustrbuf.c
@@ -206,5 +206,37 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This,
}
}
+/*************************************************************************
+ * rtl_uStringbuffer_remove
+ */
+void SAL_CALL rtl_uStringbuffer_remove( rtl_uString ** This,
+ sal_Int32 start,
+ sal_Int32 end )
+{
+ sal_Int32 nTailLen;
+ sal_Unicode * 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_Unicode));
+ }
+
+ (*This)->length-=n;
+ pBuf[ (*This)->length ] = 0;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */