[Libreoffice-commits] .: 4 commits - editeng/source sal/inc sal/rtl svl/inc svl/source

Lubos Lunak llunak at kemper.freedesktop.org
Fri Mar 30 08:47:13 PDT 2012


 editeng/source/editeng/editdoc.cxx |   12 ++++++------
 sal/inc/rtl/string.hxx             |    2 +-
 sal/inc/rtl/ustring.hxx            |   29 +++--------------------------
 sal/rtl/source/strtmpl.cxx         |    2 +-
 svl/inc/svl/itempool.hxx           |    2 +-
 svl/source/inc/poolio.hxx          |    4 ++--
 svl/source/items/poolio.cxx        |    2 +-
 7 files changed, 15 insertions(+), 38 deletions(-)

New commits:
commit fb5ede9e31dd2fee767d7e5438c8e3376e926daa
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 30 17:27:59 2012 +0200

    add const

diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx
index 15e88e9..12f7067 100644
--- a/svl/inc/svl/itempool.hxx
+++ b/svl/inc/svl/itempool.hxx
@@ -225,7 +225,7 @@ public:
 
     void                            SetVersionMap( sal_uInt16 nVer,
                                                    sal_uInt16 nOldStart, sal_uInt16 nOldEnd,
-                                                   sal_uInt16 *pWhichIdTab );
+                                                   const sal_uInt16 *pWhichIdTab );
     sal_uInt16                      GetNewWhich( sal_uInt16 nOldWhich ) const;
     sal_uInt16                      GetVersion() const;
     void                            SetFileFormatVersion( sal_uInt16 nFileFormatVersion );
diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index d59792e..b334e05 100644
--- a/svl/source/inc/poolio.hxx
+++ b/svl/source/inc/poolio.hxx
@@ -39,10 +39,10 @@ struct SfxPoolVersion_Impl
 {
     sal_uInt16          _nVer;
     sal_uInt16          _nStart, _nEnd;
-    sal_uInt16*         _pMap;
+    const sal_uInt16*         _pMap;
 
                     SfxPoolVersion_Impl( sal_uInt16 nVer, sal_uInt16 nStart, sal_uInt16 nEnd,
-                                         sal_uInt16 *pMap )
+                                         const sal_uInt16 *pMap )
                     :   _nVer( nVer ),
                         _nStart( nStart ),
                         _nEnd( nEnd ),
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 92e1d7e..416a595 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -1267,7 +1267,7 @@ void SfxItemPool::SetVersionMap
     sal_uInt16  nVer,               /*  neue Versionsnummer */
     sal_uInt16  nOldStart,          /*  alte erste Which-Id */
     sal_uInt16  nOldEnd,            /*  alte letzte Which-Id */
-    sal_uInt16* pOldWhichIdTab      /*  Array mit genau dem Aufbau der Which-Ids
+    const sal_uInt16* pOldWhichIdTab /*  Array mit genau dem Aufbau der Which-Ids
                                     der vorhergehenden Version, in denen
                                     die jeweils neue Which-Id steht. */
 )
commit 05322eb0ad1b1ff676e7f2e583d747079803e12a
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 30 17:03:14 2012 +0200

    const data
    
    Especially given it's not namespaced (const is automatically static).

diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 86a709b..51f0112 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -167,7 +167,7 @@ DBG_NAME( EE_EditLine );
 DBG_NAME( EE_ContentNode );
 DBG_NAME( EE_CharAttribList );
 
-SfxItemInfo aItemInfos[EDITITEMCOUNT] = {
+const SfxItemInfo aItemInfos[EDITITEMCOUNT] = {
         { SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE },         // EE_PARA_WRITINGDIR
         { 0, SFX_ITEM_POOLABLE },                               // EE_PARA_XMLATTRIBS
         { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },   // EE_PARA_HANGINGPUNCTUATION
@@ -222,23 +222,23 @@ SfxItemInfo aItemInfos[EDITITEMCOUNT] = {
         { SID_FIELD, SFX_ITEM_POOLABLE }
 };
 
-sal_uInt16 aV1Map[] = {
+const sal_uInt16 aV1Map[] = {
     3999, 4001, 4002, 4003, 4004, 4005, 4006,
     4007, 4008, 4009, 4010, 4011, 4012, 4013, 4017, 4018, 4019 // MI: 4019?
 };
 
-sal_uInt16 aV2Map[] = {
+const sal_uInt16 aV2Map[] = {
     3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009,
     4010, 4011, 4012, 4013, 4014, 4015, 4016, 4018, 4019, 4020
 };
 
-sal_uInt16 aV3Map[] = {
+const sal_uInt16 aV3Map[] = {
     3997, 3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007,
     4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019,
     4020, 4021
 };
 
-sal_uInt16 aV4Map[] = {
+const sal_uInt16 aV4Map[] = {
     3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003,
     4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013,
     4014, 4015, 4016, 4017, 4018,
@@ -246,7 +246,7 @@ sal_uInt16 aV4Map[] = {
     4034, 4035, 4036, 4037
 };
 
-sal_uInt16 aV5Map[] = {
+const sal_uInt16 aV5Map[] = {
     3994, 3995, 3996, 3997, 3998, 3999, 4000, 4001, 4002, 4003,
     4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013,
     4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023,
commit 1b9772c6edb124bbd28004e312957d7ac854dcbe
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 30 16:58:44 2012 +0200

    do not just warn on allocation failure, simply abort

diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 72af04e..8dbb413 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -249,7 +249,7 @@ public:
         rtl_uString2String( &pData, value, length, encoding, convertFlags );
         if (pData == 0) {
 #if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
+            abort();
 #else
             throw std::bad_alloc();
 #endif
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index a552889..8035bdc 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -284,7 +284,7 @@ public:
         rtl_string2UString( &pData, value, length, encoding, convertFlags );
         if (pData == 0) {
 #if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
+            abort();
 #else
             throw std::bad_alloc();
 #endif
@@ -1734,7 +1734,7 @@ public:
         rtl_uString_intern( &pNew, pData );
         if (pNew == 0) {
 #if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
+            abort();
 #else
             throw std::bad_alloc();
 #endif
@@ -1777,7 +1777,7 @@ public:
                                    convertFlags, pInfo );
         if (pNew == 0) {
 #if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
+            abort();
 #else
             throw std::bad_alloc();
 #endif
commit d537da41d7b51783f98e0629917dc3831b053795
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 30 16:53:45 2012 +0200

    no bad_alloc throwing in string literal O(U)String functions
    
    String literals should be reasonably short, and if memory is so low
    that they trigger allocation failure, something else would would
    trip over very soon anyway.

diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index ad6fad2..a552889 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -192,7 +192,6 @@ public:
 
       @param    literal         the 8-bit ASCII string literal
 
-      @exception std::bad_alloc is thrown if an out-of-memory condition occurs
       @since LibreOffice 3.6
     */
 #ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
@@ -203,13 +202,6 @@ public:
     {
         pData = 0;
         rtl_uString_newFromLiteral( &pData, literal, N - 1 );
-        if (pData == 0) {
-#if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
-#else
-            throw std::bad_alloc();
-#endif
-        }
 #ifdef RTL_STRING_UNITTEST
         rtl_string_unittest_const_literal = true;
 #endif
@@ -237,13 +229,6 @@ public:
     {
         pData = 0;
         rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
-        if (pData == 0) {
-#if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
-#else
-            throw std::bad_alloc();
-#endif
-        }
 #ifdef RTL_STRING_UNITTEST
         rtl_string_unittest_const_literal = true;
 #endif
@@ -379,20 +364,12 @@ public:
 
       @param    literal         the 8-bit ASCII string literal
 
-      @exception std::bad_alloc is thrown if an out-of-memory condition occurs
       @since LibreOffice 3.6
     */
     template< typename T >
     typename internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
     {
         rtl_uString_newFromLiteral( &pData, literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
-        if (pData == 0) {
-#if defined EXCEPTIONS_OFF
-            SAL_WARN("sal", "std::bad_alloc but EXCEPTIONS_OFF");
-#else
-            throw std::bad_alloc();
-#endif
-        }
         return *this;
     }
 
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index 026d647..8e1de8b 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -1218,7 +1218,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromLiteral)( IMPL_RTL_STRINGDATA** ppThis
         IMPL_RTL_STRINGNAME( release )( *ppThis );
 
     *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-    OSL_ASSERT(*ppThis != NULL);
+    assert( *ppThis != NULL );
     if ( (*ppThis) )
     {
         IMPL_RTL_STRCODE* pBuffer = (*ppThis)->buffer;


More information about the Libreoffice-commits mailing list