diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:59:03 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:59:03 +0200 |
commit | 5b5501f54ec560bf7a5e3ac1b1257b6072a69057 (patch) | |
tree | 2735f8af1183f82309d6d21262e613f164be7bf7 /sal/rtl/source | |
parent | c5235330a83081e6b744d93996f37b3abd6ac30a (diff) | |
parent | a6ba297abbe0a78954de2b2cbd911df899dc985c (diff) |
resyncing to master
Diffstat (limited to 'sal/rtl/source')
-rw-r--r-- | sal/rtl/source/strbuf.c | 30 | ||||
-rw-r--r-- | sal/rtl/source/ustrbuf.c | 29 |
2 files changed, 59 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: */ diff --git a/sal/rtl/source/ustrbuf.c b/sal/rtl/source/ustrbuf.c index 33317b6f3..638b27eeb 100644 --- a/sal/rtl/source/ustrbuf.c +++ b/sal/rtl/source/ustrbuf.c @@ -206,5 +206,34 @@ 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 len ) +{ + sal_Int32 nTailLen; + sal_Unicode * 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_Unicode)); + } + + (*This)->length-=len; + pBuf[ (*This)->length ] = 0; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |