diff options
Diffstat (limited to 'sal/rtl/source/ustrbuf.c')
-rw-r--r-- | sal/rtl/source/ustrbuf.c | 32 |
1 files changed, 32 insertions, 0 deletions
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: */ |