[Libreoffice-commits] core.git: 5 commits - svtools/source sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Sat Mar 8 01:13:58 PST 2014


 svtools/source/svhtml/parhtml.cxx |    7 ++++-
 sw/inc/index.hxx                  |   52 ++++++++++++++++++--------------------
 sw/source/core/bastyp/index.cxx   |   28 ++++++++++++--------
 3 files changed, 48 insertions(+), 39 deletions(-)

New commits:
commit d2622ba4f3eb53296df21ec14ec91fda42eebeeb
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Mar 4 08:58:06 2014 +0100

    'explicit' makes no sense for a default constructor
    
    Change-Id: Ib70c75e43ecf020fcb39696bddea414b0de9bbf7

diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 9fa4e63..9f9c600 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -111,7 +111,7 @@ protected:
     bool HasAnyIndex() const { return 0 != m_pFirst; }
 
 public:
-    explicit SwIndexReg();
+    SwIndexReg();
     virtual ~SwIndexReg();
 
     /// rtti, derived classes might do the same. If so, one can cast typesavely
commit 574086f4cfbd8f85b47f310e5637d224acc05056
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Mar 4 08:51:48 2014 +0100

    Remove '#define INLINE', inline in method definition is enough
    
    Change-Id: I9c7ae289492e3ec8ada111a8dddfb5426ef22d30

diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 568da1a..9fa4e63 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -26,12 +26,6 @@
 class SwIndexReg;
 struct SwPosition;
 
-#ifdef DBG_UTIL
-#define INLINE
-#else
-#define INLINE inline
-#endif
-
 /// Marks a character position inside a document model node.
 class SW_DLLPUBLIC SwIndex
 {
@@ -54,23 +48,23 @@ public:
     SwIndex( const SwIndex &, short nDiff );
     ~SwIndex() { Remove(); }
 
-    INLINE SwIndex& operator=( sal_Int32 const );
+    SwIndex& operator=( sal_Int32 const );
     SwIndex& operator=( const SwIndex & );
 
-    INLINE sal_Int32 operator++();
-    INLINE sal_Int32 operator--();
-    INLINE sal_Int32 operator++(int);
-    INLINE sal_Int32 operator--(int);
+    sal_Int32 operator++();
+    sal_Int32 operator--();
+    sal_Int32 operator++(int);
+    sal_Int32 operator--(int);
 
-    INLINE sal_Int32 operator+=( sal_Int32 const );
-    INLINE sal_Int32 operator-=( sal_Int32 const );
-    INLINE sal_Int32 operator+=( const SwIndex& );
-    INLINE sal_Int32 operator-=( const SwIndex& );
+    sal_Int32 operator+=( sal_Int32 const );
+    sal_Int32 operator-=( sal_Int32 const );
+    sal_Int32 operator+=( const SwIndex& );
+    sal_Int32 operator-=( const SwIndex& );
 
-    INLINE bool operator< ( const SwIndex& ) const;
-    INLINE bool operator<=( const SwIndex& ) const;
-    INLINE bool operator> ( const SwIndex& ) const;
-    INLINE bool operator>=( const SwIndex& ) const;
+    bool operator< ( const SwIndex& ) const;
+    bool operator<=( const SwIndex& ) const;
+    bool operator> ( const SwIndex& ) const;
+    bool operator>=( const SwIndex& ) const;
 
     bool operator< ( sal_Int32 const nVal ) const { return m_nIndex <  nVal; }
     bool operator<=( sal_Int32 const nVal ) const { return m_nIndex <= nVal; }
@@ -100,8 +94,6 @@ public:
     const SwIndexReg* GetIdxReg() const { return m_pIndexReg; }
 };
 
-#undef INLINE
-
 class SwIndexReg
 {
     friend class SwIndex;
commit b49e047472e37cda9e7f7c0ee6e4606862054f57
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Mar 4 00:23:14 2014 +0100

    Remove unused headers and forward declarations
    
    Change-Id: I8e8406dab1bca2a3349043eecaca168ff9ac00fb

diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 2d1394e..568da1a 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -19,14 +19,10 @@
 #ifndef INCLUDED_SW_INC_INDEX_HXX
 #define INCLUDED_SW_INC_INDEX_HXX
 
-#include <limits.h>
-
-#include "rtl/instance.hxx"
-#include <tools/solar.h>
+#include <sal/types.h>
 #include <tools/rtti.hxx>
 #include <swdllapi.h>
 
-class SwIndex;
 class SwIndexReg;
 struct SwPosition;
 
@@ -139,16 +135,19 @@ inline sal_Int32 SwIndex::operator++()
 {
     return ChgValue( *this, m_nIndex+1 ).m_nIndex;
 }
+
 inline sal_Int32 SwIndex::operator--()
 {
     return ChgValue( *this, m_nIndex-1 ).m_nIndex;
 }
+
 inline sal_Int32 SwIndex::operator++(int)
 {
     sal_Int32 const nOldIndex = m_nIndex;
     ChgValue( *this, m_nIndex+1 );
     return nOldIndex;
 }
+
 inline sal_Int32 SwIndex::operator--(int)
 {
     sal_Int32 const nOldIndex = m_nIndex;
@@ -160,14 +159,17 @@ inline sal_Int32 SwIndex::operator+=( sal_Int32 const nVal )
 {
     return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
 }
+
 inline sal_Int32 SwIndex::operator-=( sal_Int32 const nVal )
 {
     return ChgValue( *this, m_nIndex - nVal ).m_nIndex;
 }
+
 inline sal_Int32 SwIndex::operator+=( const SwIndex& rIndex )
 {
     return ChgValue( *this, m_nIndex + rIndex.m_nIndex ).m_nIndex;
 }
+
 inline sal_Int32 SwIndex::operator-=( const SwIndex& rIndex )
 {
     return ChgValue( *this, m_nIndex - rIndex.m_nIndex ).m_nIndex;
@@ -177,18 +179,22 @@ inline bool SwIndex::operator< ( const SwIndex& rIndex ) const
 {
     return m_nIndex <  rIndex.m_nIndex;
 }
+
 inline bool SwIndex::operator<=( const SwIndex& rIndex ) const
 {
     return m_nIndex <= rIndex.m_nIndex;
 }
+
 inline bool SwIndex::operator> ( const SwIndex& rIndex ) const
 {
     return m_nIndex >  rIndex.m_nIndex;
 }
+
 inline bool SwIndex::operator>=( const SwIndex& rIndex ) const
 {
     return m_nIndex >= rIndex.m_nIndex;
 }
+
 inline SwIndex& SwIndex::operator= ( sal_Int32 const nVal )
 {
     if (m_nIndex != nVal)
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 3fe567e..81da0bb 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -20,9 +20,6 @@
 #include "index.hxx"
 
 #include <assert.h>
-#include <stdlib.h>
-#include <rtl/ustring.hxx>
-#include <tools/solar.h>
 #include <sal/log.hxx>
 
 TYPEINIT0(SwIndexReg);
commit 63564f7a2554382386fe48c13eecf87f167e0a78
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Mar 4 00:14:37 2014 +0100

    OSL_ASSERT to SAL_WARN_IF
    
    Change-Id: Ib6102579f8b7c8899322992919cc922393fe70d8

diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 4f3f045..3fe567e 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <rtl/ustring.hxx>
 #include <tools/solar.h>
+#include <sal/log.hxx>
 
 TYPEINIT0(SwIndexReg);
 
@@ -290,7 +291,8 @@ void SwIndexReg::MoveTo( SwIndexReg& rArr )
 
 sal_Int32 SwIndex::operator++(int)
 {
-    OSL_ASSERT( m_nIndex < SAL_MAX_INT32 );
+    SAL_WARN_IF( !(m_nIndex < SAL_MAX_INT32), "sw.core",
+                 "SwIndex::operator++(int) wraps around" );
 
     const sal_Int32 nOldIndex = m_nIndex;
     ChgValue( *this, m_nIndex+1 );
@@ -299,7 +301,8 @@ sal_Int32 SwIndex::operator++(int)
 
 sal_Int32 SwIndex::operator++()
 {
-    OSL_ASSERT( m_nIndex < SAL_MAX_INT32 );
+    SAL_WARN_IF( !(m_nIndex < SAL_MAX_INT32), "sw.core",
+                 "SwIndex::operator++() wraps around" );
 
     ChgValue( *this, m_nIndex+1 );
     return m_nIndex;
@@ -307,7 +310,8 @@ sal_Int32 SwIndex::operator++()
 
 sal_Int32 SwIndex::operator--(int)
 {
-    OSL_ASSERT( m_nIndex>0 );
+    SAL_WARN_IF( !(m_nIndex > 0), "sw.core",
+                 "SwIndex::operator--(int) wraps around" );
 
     const sal_Int32 nOldIndex = m_nIndex;
     ChgValue( *this, m_nIndex-1 );
@@ -316,31 +320,36 @@ sal_Int32 SwIndex::operator--(int)
 
 sal_Int32 SwIndex::operator--()
 {
-    OSL_ASSERT( m_nIndex>0 );
+    SAL_WARN_IF( !( m_nIndex > 0), "sw.core",
+                 "SwIndex::operator--() wraps around" );
     return ChgValue( *this, m_nIndex-1 ).m_nIndex;
 }
 
 sal_Int32 SwIndex::operator+=( sal_Int32 const nVal )
 {
-    OSL_ASSERT( m_nIndex <= SAL_MAX_INT32 - nVal );
+    SAL_WARN_IF( !(m_nIndex <= SAL_MAX_INT32 - nVal), "sw.core",
+                 "SwIndex SwIndex::operator+=(sal_Int32) wraps around" );
     return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
 }
 
 sal_Int32 SwIndex::operator-=( sal_Int32 const nVal )
 {
-    OSL_ASSERT( m_nIndex >= nVal );
+    SAL_WARN_IF( !(m_nIndex >= nVal), "sw.core",
+                 "SwIndex::operator-=(sal_Int32) wraps around" );
     return ChgValue( *this, m_nIndex - nVal ).m_nIndex;
 }
 
 sal_Int32 SwIndex::operator+=( const SwIndex & rIndex )
 {
-    OSL_ASSERT( m_nIndex <= SAL_MAX_INT32 - rIndex.m_nIndex );
+    SAL_WARN_IF( !(m_nIndex <= SAL_MAX_INT32 - rIndex.m_nIndex), "sw.core",
+                 "SwIndex::operator+=(SwIndex) wraps around" );
     return ChgValue( *this, m_nIndex + rIndex.m_nIndex ).m_nIndex;
 }
 
 sal_Int32 SwIndex::operator-=( const SwIndex & rIndex )
 {
-    OSL_ASSERT( m_nIndex >= rIndex.m_nIndex );
+    SAL_WARN_IF( !(m_nIndex >= rIndex.m_nIndex), "sw.core",
+                 "SwIndex::operator-=(SwIndex) wraps around" );
     return ChgValue( *this, m_nIndex - rIndex.m_nIndex ).m_nIndex;
 }
 
commit dcc977b33960f2fbf8fec07f3f8a00a2cae4900e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Mon Mar 3 22:16:50 2014 +0100

    switch: ungroup two case which perform different operations
    
    Change-Id: I099501a596ebeb2820192d08de80eae342191bb7

diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index b33d320..f54c741 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -355,14 +355,19 @@ int HTMLParser::FilterToken( int nToken )
         bIsInBody = true;
         bIsInHeader = false;
         break;
+
     case HTML_HEAD_ON:
         bIsInHeader = true;
         break;
 
     case HTML_BODY_ON:
+        bIsInHeader = false;
+        bIsInBody = true;
+        break;
+
     case HTML_FRAMESET_ON:
         bIsInHeader = false;
-        bIsInBody = HTML_BODY_ON == nToken;
+        bIsInBody = false;
         break;
 
     case HTML_BODY_OFF:


More information about the Libreoffice-commits mailing list