[Libreoffice-commits] .: 4 commits - codemaker/source sal/inc sal/qa sal/rtl sal/util

Caolán McNamara caolan at kemper.freedesktop.org
Thu Jun 30 03:37:05 PDT 2011


 codemaker/source/javamaker/classfile.cxx   |    5 
 sal/inc/rtl/strbuf.h                       |   19 ++
 sal/inc/rtl/strbuf.hxx                     |   29 +++
 sal/inc/rtl/ustrbuf.h                      |   18 ++
 sal/inc/rtl/ustrbuf.hxx                    |   31 +++
 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx |   48 +++++
 sal/qa/OStringBuffer/rtl_String_Utils.cxx  |  249 ----------------------------
 sal/qa/OStringBuffer/rtl_String_Utils.hxx  |   34 ---
 sal/qa/rtl_strings/rtl_String_Utils.cxx    |  251 -----------------------------
 sal/qa/rtl_strings/rtl_String_Utils.hxx    |   40 ----
 sal/rtl/source/strbuf.c                    |   33 +++
 sal/rtl/source/ustrbuf.c                   |   32 +++
 sal/util/sal.map                           |    9 -
 13 files changed, 212 insertions(+), 586 deletions(-)

New commits:
commit add6f2d9f4257a39f64c15439385bda867ebf30d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 30 11:01:14 2011 +0100

    callcatcher: various unused foo

diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.cxx b/sal/qa/OStringBuffer/rtl_String_Utils.cxx
index b722a82..e88d6db 100644
--- a/sal/qa/OStringBuffer/rtl_String_Utils.cxx
+++ b/sal/qa/OStringBuffer/rtl_String_Utils.cxx
@@ -208,63 +208,8 @@ void makeComment( char *com, const char *str1, const char *str2,
     com[str1Length + signLength + AStringLen(str2)] = 0;
 }
 
-
 //------------------------------------------------------------------------
 
-sal_Bool AStringToFloatCompare ( const sal_Char  *pStr,
-                                 const float      nX,
-                                 const float      nEPS
-                                )
-{
-    sal_Bool cmp = sal_False;
-
-    if ( pStr != NULL )
-    {
-        ::rtl::OString aStr(pStr);
-
-        float actNum = 0;
-        float expNum = nX;
-        float eps    = nEPS;
-
-        actNum = aStr.toFloat();
-
-        if ( abs( (int)(actNum - expNum) ) <= eps )
-        {
-            cmp = sal_True;
-        } // if
-    } // if
-
-    return cmp;
-} // AStringToFloatCompare
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
-                                  const double     nX,
-                                  const double     nEPS
-                                )
-{
-    sal_Bool cmp = sal_False;
-
-    if ( pStr != NULL )
-    {
-        ::rtl::OString aStr(pStr);
-
-        double actNum = 0;
-        double expNum = nX;
-        double eps    = nEPS;
-
-        actNum = aStr.toDouble();
-
-        if ( abs( (int)(actNum - expNum) ) <= eps )
-        {
-            cmp = sal_True;
-        } // if
-    } // if
-
-    return cmp;
-} // AStringToDoubleCompare
-
 sal_uInt32 UStringLen( const sal_Unicode *pUStr )
 {
     sal_uInt32 nUStrLen = 0;
@@ -400,160 +345,4 @@ sal_Int32 AStringToUStringNCompare( const sal_Unicode  *pUStr,
     return nCmp;
 } // AStringToUStringNCompare
 
-//------------------------------------------------------------------------
-
-sal_Int32 AStringToRTLUStringCompare( const rtl_uString  *pRTLUStr,
-                                      const sal_Char     *pAStr
-                                    )
-{
-    sal_Int32 nCmp = kErrCompareAStringToRTLUString;
-
-    if ( ( pRTLUStr != NULL ) && ( pAStr != NULL ) )
-    {
-        rtl_uString *pRTLUStrCopy = NULL;
-
-        rtl_uString_newFromString( &pRTLUStrCopy, pRTLUStr );
-
-        if ( pRTLUStrCopy != NULL )
-        {
-            const sal_Unicode *pUStr = rtl_uString_getStr( pRTLUStrCopy );
-
-            if ( pUStr != NULL )
-            {
-                nCmp = AStringToUStringCompare( pUStr, pAStr );
-            } // if
-
-            rtl_uString_release( pRTLUStrCopy );
-
-            pRTLUStrCopy = NULL;
-        } // if
-    } // if
-
-    return nCmp;
-} // AStringToRTLUStringCompare
-
-//------------------------------------------------------------------------
-
-sal_Int32 AStringToRTLUStringNCompare( const rtl_uString  *pRTLUStr,
-                                       const sal_Char     *pAStr,
-                                       const sal_uInt32    nAStrCount
-                                     )
-{
-    sal_Int32 nCmp = kErrCompareNAStringToRTLUString;
-
-    if ( ( pRTLUStr != NULL ) && ( pAStr != NULL ) )
-    {
-        rtl_uString *pRTLUStrCopy = NULL;
-
-        rtl_uString_newFromString( &pRTLUStrCopy, pRTLUStr );
-
-        if ( pRTLUStrCopy != NULL )
-        {
-            const sal_Unicode  *pUStr = rtl_uString_getStr( pRTLUStrCopy );
-
-            if ( pUStr != NULL )
-            {
-                nCmp = AStringToUStringNCompare( pUStr, pAStr, nAStrCount );
-            } // if
-
-            rtl_uString_release( pRTLUStrCopy );
-
-            pRTLUStrCopy = NULL;
-        } // if
-    } // if
-
-    return nCmp;
-} // AStringToRTLUStringNCompare
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringCopy( sal_Unicode     *pDest,
-                               const sal_Char  *pSrc
-                             )
-{
-    sal_Bool    bCopied = sal_False;
-    sal_uInt32  nCount  = AStringLen( pSrc );
-    sal_uInt32  nLen    = nCount;
-
-    if (    ( pDest != NULL )
-         && ( pSrc  != NULL )
-         && ( AStringNIsValid( pSrc, nLen ) )
-       )
-    {
-        for (;;)
-        {
-            *pDest = (unsigned char)*pSrc;
-
-            pDest++;
-            pSrc++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nCount > 0 )
-            {
-                nCount--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-
-        if ( nCount == 0 )
-        {
-            bCopied = sal_True;
-        } // if
-    } // if
-
-    return  bCopied;
-} // AStringToUStringCopy
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringNCopy( sal_Unicode       *pDest,
-                                const sal_Char    *pSrc,
-                                const sal_uInt32   nSrcLen
-                              )
-{
-    sal_Bool    bCopied = sal_False;
-    sal_uInt32  nCount  = nSrcLen;
-    sal_uInt32  nLen    = nSrcLen;
-
-    if (    ( pDest != NULL )
-         && ( pSrc  != NULL )
-         && ( AStringNIsValid( pSrc, nLen ) )
-       )
-    {
-        for (;;)
-        {
-            *pDest = (unsigned char)*pSrc;
-
-            pDest++;
-            pSrc++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nCount > 0 )
-            {
-                nCount--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-
-        if ( nCount == 0 )
-        {
-            bCopied = sal_True;
-        } // if
-    } // if
-
-    return  bCopied;
-} // AStringToUStringNCopy
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.hxx b/sal/qa/OStringBuffer/rtl_String_Utils.hxx
index 558c963..8547371 100644
--- a/sal/qa/OStringBuffer/rtl_String_Utils.hxx
+++ b/sal/qa/OStringBuffer/rtl_String_Utils.hxx
@@ -64,18 +64,6 @@ sal_uInt32 UStringLen( const sal_Unicode *pUStr );
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringToFloatCompare ( const sal_Char  *pStr,
-                                 const float      nX,
-                                 const float      nEPS
-                                );
-
-sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
-                                  const double     nX,
-                                  const double     nEPS
-                                );
-
-//------------------------------------------------------------------------
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         );
@@ -91,26 +79,6 @@ sal_Int32 AStringToUStringNCompare( const sal_Unicode  *pUStr,
                                     const sal_uInt32    nAStrCount
                                    );
 
-sal_Int32 AStringToRTLUStringCompare( const rtl_uString  *pRTLUStr,
-                                      const sal_Char     *pAStr
-                                    );
-
-sal_Int32 AStringToRTLUStringNCompare( const rtl_uString  *pRTLUStr,
-                                       const sal_Char     *pAStr,
-                                       const sal_uInt32    nAStrCount
-                                     );
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringCopy( sal_Unicode     *pDest,
-                               const sal_Char  *pSrc
-                             );
-
-sal_Bool AStringToUStringNCopy( sal_Unicode       *pDest,
-                                const sal_Char    *pSrc,
-                                const sal_uInt32   nSrcLen
-                              );
-
 #endif /* __cplusplus */
 
 #endif /* _RTL_STRING_UTILS_HXX */
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.cxx b/sal/qa/rtl_strings/rtl_String_Utils.cxx
index acc2dbf..29cede8 100644
--- a/sal/qa/rtl_strings/rtl_String_Utils.cxx
+++ b/sal/qa/rtl_strings/rtl_String_Utils.cxx
@@ -185,63 +185,6 @@ void makeComment( char *com, const char *str1, const char *str2,
     com[str1Length + signLength + AStringLen(str2)] = 0;
 }
 
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToFloatCompare ( const sal_Char  *pStr,
-                                 const float      nX,
-                                 const float      nEPS
-                                )
-{
-    sal_Bool cmp = sal_False;
-
-    if ( pStr != NULL )
-    {
-        ::rtl::OString aStr(pStr);
-
-        float actNum = 0;
-        float expNum = nX;
-        float eps    = nEPS;
-
-        actNum = aStr.toFloat();
-
-        if ( abs( (int)(actNum - expNum) ) <= eps )
-        {
-            cmp = sal_True;
-        } // if
-    } // if
-
-    return cmp;
-} // AStringToFloatCompare
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
-                                  const double     nX,
-                                  const double     nEPS
-                                )
-{
-    sal_Bool cmp = sal_False;
-
-    if ( pStr != NULL )
-    {
-        ::rtl::OString aStr(pStr);
-
-        double actNum = 0;
-        double expNum = nX;
-        double eps    = nEPS;
-
-        actNum = aStr.toDouble();
-
-        if ( abs( (int)(actNum - expNum) ) <= eps )
-        {
-            cmp = sal_True;
-        } // if
-    } // if
-
-    return cmp;
-} // AStringToDoubleCompare
-
 sal_uInt32 UStringLen( const sal_Unicode *pUStr )
 {
     sal_uInt32 nUStrLen = 0;
@@ -377,160 +320,4 @@ sal_Int32 AStringToUStringNCompare( const sal_Unicode  *pUStr,
     return nCmp;
 } // AStringToUStringNCompare
 
-//------------------------------------------------------------------------
-
-sal_Int32 AStringToRTLUStringCompare( const rtl_uString  *pRTLUStr,
-                                      const sal_Char     *pAStr
-                                    )
-{
-    sal_Int32 nCmp = kErrCompareAStringToRTLUString;
-
-    if ( ( pRTLUStr != NULL ) && ( pAStr != NULL ) )
-    {
-        rtl_uString *pRTLUStrCopy = NULL;
-
-        rtl_uString_newFromString( &pRTLUStrCopy, pRTLUStr );
-
-        if ( pRTLUStrCopy != NULL )
-        {
-            const sal_Unicode *pUStr = rtl_uString_getStr( pRTLUStrCopy );
-
-            if ( pUStr != NULL )
-            {
-                nCmp = AStringToUStringCompare( pUStr, pAStr );
-            } // if
-
-            rtl_uString_release( pRTLUStrCopy );
-
-            pRTLUStrCopy = NULL;
-        } // if
-    } // if
-
-    return nCmp;
-} // AStringToRTLUStringCompare
-
-//------------------------------------------------------------------------
-
-sal_Int32 AStringToRTLUStringNCompare( const rtl_uString  *pRTLUStr,
-                                       const sal_Char     *pAStr,
-                                       const sal_uInt32    nAStrCount
-                                     )
-{
-    sal_Int32 nCmp = kErrCompareNAStringToRTLUString;
-
-    if ( ( pRTLUStr != NULL ) && ( pAStr != NULL ) )
-    {
-        rtl_uString *pRTLUStrCopy = NULL;
-
-        rtl_uString_newFromString( &pRTLUStrCopy, pRTLUStr );
-
-        if ( pRTLUStrCopy != NULL )
-        {
-            const sal_Unicode  *pUStr = rtl_uString_getStr( pRTLUStrCopy );
-
-            if ( pUStr != NULL )
-            {
-                nCmp = AStringToUStringNCompare( pUStr, pAStr, nAStrCount );
-            } // if
-
-            rtl_uString_release( pRTLUStrCopy );
-
-            pRTLUStrCopy = NULL;
-        } // if
-    } // if
-
-    return nCmp;
-} // AStringToRTLUStringNCompare
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringCopy( sal_Unicode     *pDest,
-                               const sal_Char  *pSrc
-                             )
-{
-    sal_Bool    bCopied = sal_False;
-    sal_uInt32  nCount  = AStringLen( pSrc );
-    sal_uInt32  nLen    = nCount;
-
-    if (    ( pDest != NULL )
-         && ( pSrc  != NULL )
-         && ( AStringNIsValid( pSrc, nLen ) )
-       )
-    {
-        while ( nCount >= 0 )
-        {
-            *pDest = (unsigned char)*pSrc;
-
-            pDest++;
-            pSrc++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nCount > 0 )
-            {
-                nCount--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-
-        if ( nCount == 0 )
-        {
-            bCopied = sal_True;
-        } // if
-    } // if
-
-    return  bCopied;
-} // AStringToUStringCopy
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringNCopy( sal_Unicode       *pDest,
-                                const sal_Char    *pSrc,
-                                const sal_uInt32   nSrcLen
-                              )
-{
-    sal_Bool    bCopied = sal_False;
-    sal_uInt32  nCount  = nSrcLen;
-    sal_uInt32  nLen    = nSrcLen;
-
-    if (    ( pDest != NULL )
-         && ( pSrc  != NULL )
-         && ( AStringNIsValid( pSrc, nLen ) )
-       )
-    {
-        while ( nCount >= 0 )
-        {
-            *pDest = (unsigned char)*pSrc;
-
-            pDest++;
-            pSrc++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nCount > 0 )
-            {
-                nCount--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-
-        if ( nCount == 0 )
-        {
-            bCopied = sal_True;
-        } // if
-    } // if
-
-    return  bCopied;
-} // AStringToUStringNCopy
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.hxx b/sal/qa/rtl_strings/rtl_String_Utils.hxx
index 7c7f025..7ebce2e 100644
--- a/sal/qa/rtl_strings/rtl_String_Utils.hxx
+++ b/sal/qa/rtl_strings/rtl_String_Utils.hxx
@@ -63,18 +63,6 @@ sal_uInt32 UStringLen( const sal_Unicode *pUStr );
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringToFloatCompare ( const sal_Char  *pStr,
-                                 const float      nX,
-                                 const float      nEPS
-                                );
-
-sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
-                                  const double     nX,
-                                  const double     nEPS
-                                );
-
-//------------------------------------------------------------------------
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         );
@@ -90,34 +78,8 @@ sal_Int32 AStringToUStringNCompare( const sal_Unicode  *pUStr,
                                     const sal_uInt32    nAStrCount
                                    );
 
-sal_Int32 AStringToRTLUStringCompare( const rtl_uString  *pRTLUStr,
-                                      const sal_Char     *pAStr
-                                    );
-
-sal_Int32 AStringToRTLUStringNCompare( const rtl_uString  *pRTLUStr,
-                                       const sal_Char     *pAStr,
-                                       const sal_uInt32    nAStrCount
-                                     );
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringToUStringCopy( sal_Unicode     *pDest,
-                               const sal_Char  *pSrc
-                             );
-
-sal_Bool AStringToUStringNCopy( sal_Unicode       *pDest,
-                                const sal_Char    *pSrc,
-                                const sal_uInt32   nSrcLen
-                              );
-
 #endif /* __cplusplus */
 
 #endif /* _RTL_STRING_UTILS_HXX */
 
-
-
-
-
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3e70dad692cd6ed6a8ed0a87da883429222dabbd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 30 10:42:53 2011 +0100

    callcatcher: unused writeU1

diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index 4f6f675..bd9d9b7 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -90,11 +90,6 @@ void write(FileStream & file, void const * buffer, sal_uInt64 size) {
     }
 }
 
-void writeU1(FileStream & file, sal_uInt8 data) {
-    unsigned char buf[] = { static_cast< unsigned char >(data) };
-    write(file, &buf, sizeof buf);
-}
-
 void writeU2(FileStream & file, sal_uInt16 data) {
     unsigned char buf[] = {
         static_cast< unsigned char >(data >> 8),
commit 593daad2162b994e6b6f2c3c135391ca3f04d0af
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 30 10:38:01 2011 +0100

    callcatcher: unused code

diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.cxx b/sal/qa/OStringBuffer/rtl_String_Utils.cxx
index f4445fa..b722a82 100644
--- a/sal/qa/OStringBuffer/rtl_String_Utils.cxx
+++ b/sal/qa/OStringBuffer/rtl_String_Utils.cxx
@@ -286,44 +286,6 @@ sal_uInt32 UStringLen( const sal_Unicode *pUStr )
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringIsValid( const sal_Char  *pAStr )
-{
-    if ( pAStr != NULL )
-    {
-        sal_uInt32 nLen  = AStringLen( pAStr );
-        sal_uChar  uChar = 0;
-
-        while ( *pAStr )
-        {
-            uChar = (unsigned char)*pAStr;
-
-            if ( uChar > 127 )
-            {
-                return sal_False;
-            } // if
-
-            pAStr++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nLen > 0 )
-            {
-                nLen--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-    } // if
-
-    return sal_True;
-} // AStringIsValid
-
-//------------------------------------------------------------------------
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         )
diff --git a/sal/qa/OStringBuffer/rtl_String_Utils.hxx b/sal/qa/OStringBuffer/rtl_String_Utils.hxx
index d9770d3..558c963 100644
--- a/sal/qa/OStringBuffer/rtl_String_Utils.hxx
+++ b/sal/qa/OStringBuffer/rtl_String_Utils.hxx
@@ -76,8 +76,6 @@ sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringIsValid( const sal_Char  *pAStr );
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         );
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.cxx b/sal/qa/rtl_strings/rtl_String_Utils.cxx
index 2250d98..acc2dbf 100644
--- a/sal/qa/rtl_strings/rtl_String_Utils.cxx
+++ b/sal/qa/rtl_strings/rtl_String_Utils.cxx
@@ -263,44 +263,6 @@ sal_uInt32 UStringLen( const sal_Unicode *pUStr )
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringIsValid( const sal_Char  *pAStr )
-{
-    if ( pAStr != NULL )
-    {
-        sal_uInt32 nLen  = AStringLen( pAStr );
-        sal_uChar  uChar = 0;
-
-        while ( ( nLen >= 0 ) && ( *pAStr ) )
-        {
-            uChar = (unsigned char)*pAStr;
-
-            if ( uChar > 127 )
-            {
-                return sal_False;
-            } // if
-
-            pAStr++;
-
-            // Since we are dealing with unsigned integers
-            // we want to make sure that the last number is
-            // indeed zero.
-
-            if ( nLen > 0 )
-            {
-                nLen--;
-            } // if
-            else
-            {
-                break;
-            } // else
-        } // while
-    } // if
-
-    return sal_True;
-} // AStringIsValid
-
-//------------------------------------------------------------------------
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         )
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.hxx b/sal/qa/rtl_strings/rtl_String_Utils.hxx
index be4083b..7c7f025 100644
--- a/sal/qa/rtl_strings/rtl_String_Utils.hxx
+++ b/sal/qa/rtl_strings/rtl_String_Utils.hxx
@@ -75,8 +75,6 @@ sal_Bool AStringToDoubleCompare ( const sal_Char  *pStr,
 
 //------------------------------------------------------------------------
 
-sal_Bool AStringIsValid( const sal_Char  *pAStr );
-
 sal_Bool AStringNIsValid( const sal_Char   *pAStr,
                           const sal_uInt32  nStrLen
                         );
commit 3533a051a623d3587db715d057fb9a3746c0bc19
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 30 09:12:40 2011 +0100

    add StringBuffers ::remove

diff --git a/sal/inc/rtl/strbuf.h b/sal/inc/rtl/strbuf.h
index 0156e6e..1c076cf 100644
--- a/sal/inc/rtl/strbuf.h
+++ b/sal/inc/rtl/strbuf.h
@@ -105,7 +105,6 @@ void SAL_CALL rtl_stringbuffer_ensureCapacity(	/*inout*/rtl_String ** This,
     @param 	offset  	the offset.
     @param 	ch      	a character array.
     @param	len    		the number of characters to append.
-    @return	this string buffer.
  */
 void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This, 
                                        /*inout*/sal_Int32 * capacity,
@@ -113,6 +112,24 @@ void SAL_CALL rtl_stringbuffer_insert( /*inout*/rtl_String ** This,
                                        const sal_Char * str, 
                                        sal_Int32 len);
 
+/**
+    Removes the characters in a substring of this sequence.
+
+    The substring begins at the specified <code>start</code> and
+    extends to the character at index <code>end - 1</code> or to
+    the end of the sequence if no such character exists. If
+    <code>start</code> is equal to <code>end</code>, no changes
+    are made.
+
+    start must be >= 0 && <= This->length && <= end
+
+    @param 	start      	The beginning index, inclusive
+    @param	end    		The ending index, exclusive
+ */
+void SAL_CALL rtl_stringbuffer_remove( /*inout*/rtl_String ** This,
+                                       sal_Int32 start,
+                                       sal_Int32 end );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 47f2c0b..7e52b21 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -54,7 +54,7 @@ namespace rtl
     is compiled to the equivalent of:
     <p><blockquote><pre>
         x = new OStringBuffer().append("a").append(4).append("c")
-                              .toString()
+                              .makeStringAndClear()
     </pre></blockquote><p>
     The principal operations on a <code>OStringBuffer</code> are the
     <code>append</code> and <code>insert</code> methods, which are
@@ -670,6 +670,33 @@ public:
         sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
         return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
     }
+
+    /**
+        Removes the characters in a substring of this sequence.
+
+        The substring begins at the specified <code>start</code> and
+        extends to the character at index <code>end - 1</code> or to
+        the end of the sequence if no such character exists. If
+        <code>start</code> is equal to <code>end</code>, no changes
+        are made.
+
+        start must be >= 0 && <= getLength() && <= end
+
+        As is usual for the rtl string classes, this is based
+        on an analogous Java StringBuffer member. In this
+        case <code>delete</code>, but because that's a reserved
+        keyword in C++, this is named <code>remove</code>.
+
+        @param  start      	The beginning index, inclusive
+        @param  end    		The ending index, exclusive
+        @return this string buffer.
+     */
+    OStringBuffer & remove( sal_Int32 start, sal_Int32 end )
+    {
+        rtl_stringbuffer_remove( &pData, start, end );
+        return *this;
+    }
+
 private:
     /**
         A pointer to the data structur which contains the data.
diff --git a/sal/inc/rtl/ustrbuf.h b/sal/inc/rtl/ustrbuf.h
index dfd8019..d2d2ed4 100644
--- a/sal/inc/rtl/ustrbuf.h
+++ b/sal/inc/rtl/ustrbuf.h
@@ -159,6 +159,24 @@ void SAL_CALL rtl_uStringbuffer_insert_ascii(   /*inout*/rtl_uString ** This,
                                                 const sal_Char * str,
                                                 sal_Int32 len);
 
+/**
+    Removes the characters in a substring of this sequence.
+
+    The substring begins at the specified <code>start</code> and
+    extends to the character at index <code>end - 1</code> or to
+    the end of the sequence if no such character exists. If
+    <code>start</code> is equal to <code>end</code>, no changes
+    are made.
+
+    start must be >= 0 && <= This->length && <= end
+
+    @param 	start      	The beginning index, inclusive
+    @param	end    		The ending index, exclusive
+ */
+void SAL_CALL rtl_uStringbuffer_remove( /*inout*/rtl_uString ** This,
+                                       sal_Int32 start,
+                                       sal_Int32 end );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index b6160cc..d48c5c7 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -53,7 +53,7 @@ namespace rtl
     is compiled to the equivalent of:
     <p><blockquote><pre>
         x = new OUStringBuffer().append("a").append(4).append("c")
-                              .toString()
+                              .makeStringAndClear()
     </pre></blockquote><p>
     The principal operations on a <code>OUStringBuffer</code> are the
     <code>append</code> and <code>insert</code> methods, which are
@@ -95,7 +95,7 @@ public:
         Allocates a new string buffer that contains the same sequence of
         characters as the string buffer argument.
 
-        @param   value   a <code>OStringBuffer</code>.
+        @param   value   a <code>OUStringBuffer</code>.
      */
     OUStringBuffer( const OUStringBuffer & value )
         : pData(NULL)
@@ -280,7 +280,6 @@ public:
      */
     const OUString toString() const { return OUString(pData->buffer); }
 
-
     /**
         The character at the specified index of this string buffer is set
         to <code>ch</code>.
@@ -739,6 +738,32 @@ public:
         return *this;
     }
 
+    /**
+        Removes the characters in a substring of this sequence.
+
+        The substring begins at the specified <code>start</code> and
+        extends to the character at index <code>end - 1</code> or to
+        the end of the sequence if no such character exists. If
+        <code>start</code> is equal to <code>end</code>, no changes
+        are made.
+
+        start must be >= 0 && <= getLength() && <= end
+
+        As is usual for the rtl string classes, this is based
+        on an analogous Java StringBuffer member. In this
+        case <code>delete</code>, but because that's a reserved
+        keyword in C++, this is named <code>remove</code>.
+
+        @param  start      	The beginning index, inclusive
+        @param  end    		The ending index, exclusive
+        @return this string buffer.
+     */
+    OUStringBuffer & remove( sal_Int32 start, sal_Int32 end )
+    {
+        rtl_uStringbuffer_remove( &pData, start, end );
+        return *this;
+    }
+
     /** Allows access to the internal data of this OUStringBuffer, for effective
         manipulation.
 
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index 206287b..2307dab 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -319,6 +319,53 @@ namespace rtl_OStringBuffer
         CPPUNIT_TEST_SUITE_END();
     };
 
+
+    class  remove : public CppUnit::TestFixture
+    {
+    public:
+        void setUp()
+        {
+        }
+
+        void tearDown()
+        {
+        }
+
+        void remove_001()
+        {
+            ::rtl::OStringBuffer sb(
+                RTL_CONSTASCII_STRINGPARAM("Red Hat, Inc."));
+
+            sb.remove(0, 4);
+            CPPUNIT_ASSERT(sb.toString().equalsL(
+                RTL_CONSTASCII_STRINGPARAM("Hat, Inc.")));
+
+            sb.remove(3, 9);
+            CPPUNIT_ASSERT(sb.toString().equalsL(
+                RTL_CONSTASCII_STRINGPARAM("Hat")));
+
+            sb.remove(0, 100);
+
+            CPPUNIT_ASSERT(sb.toString().isEmpty());
+
+            sb.append(RTL_CONSTASCII_STRINGPARAM("Red Hat, Inc."));
+
+            sb.remove(3, 100);
+
+            CPPUNIT_ASSERT(sb.toString().equalsL(
+                RTL_CONSTASCII_STRINGPARAM("Red")));
+
+            sb.remove(0, sb.getLength());
+
+            CPPUNIT_ASSERT(sb.toString().isEmpty());
+        }
+
+        CPPUNIT_TEST_SUITE(remove);
+        CPPUNIT_TEST(remove_001);
+        CPPUNIT_TEST_SUITE_END();
+    };
+
+
 // -----------------------------------------------------------------------------
 
     class  getLength : public CppUnit::TestFixture
@@ -16555,6 +16602,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_008_float);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_008_Float_Negative);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_009_double);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_009_Double_Negative);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::remove);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c
index 446b1ce..8d0f276 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 33317b6..18ca27f 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: */
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 020e11f..152b023 100755
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -598,14 +598,19 @@ UDK_3.10 { # OOo 3.2
         rtl_math_acosh;
 } UDK_3.9;
 
-
-UDK_3.11 { # OOo 3.4
+UDK_3.11 { # symbols available in >= OOo/LibO 3.4
     global:
         osl_setEnvironment;
         osl_clearEnvironment;
         osl_setThreadName;
 } UDK_3.10;
 
+LIBO_UDK_3.5 { # symbols available in >= LibO 3.5
+    global:
+        rtl_stringbuffer_remove;
+        rtl_uStringbuffer_remove;
+} UDK_3.10;
+
 PRIVATE_1.0 {
     global:
         osl_detail_ObjectRegistry_storeAddresses;


More information about the Libreoffice-commits mailing list