summaryrefslogtreecommitdiff
path: root/sal/rtl/source
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl/source')
-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 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: */
diff --git a/sal/rtl/source/ustrbuf.c b/sal/rtl/source/ustrbuf.c
index 3b05eb258c90..f5dbefdb75b8 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: */