[Libreoffice-commits] core.git: sc/inc sc/source unusedcode.easy

Noel Grandin noel at peralex.com
Sat Nov 15 08:04:31 PST 2014


 sc/inc/compiler.hxx           |   32 ++----------------
 sc/source/core/tool/token.cxx |   74 ------------------------------------------
 unusedcode.easy               |    2 -
 3 files changed, 4 insertions(+), 104 deletions(-)

New commits:
commit 1866d90d81d6ed3f4700e8b6a9021cd4afd84d9e
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Nov 14 09:53:59 2014 +0200

    remove unused code in ScRawToken
    
    Change-Id: I8f644ac7f7bbdd2c9cb6f5a41709e41efa737885
    Reviewed-on: https://gerrit.libreoffice.org/12423
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 85e9cc0..93246cd 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -35,9 +35,6 @@
 
 #include <formula/FormulaCompiler.hxx>
 
-#include <boost/intrusive_ptr.hpp>
-#include <boost/unordered_map.hpp>
-
 // constants and data types also for external modules (ScInterpreter et al)
 
 #define MAXSTRLEN    1024   /* maximum length of input string of one symbol */
@@ -89,8 +86,6 @@ class CompileFormulaContext;
 /*
     OpCode              eOp;        // OpCode
     formula::StackVar   eType;      // type of data
-    sal_uInt16          nRefCnt;    // reference count
-    bool                bRaw;       // not cloned yet and trimmed to real size
  */
 
 struct ScRawTokenBase
@@ -98,8 +93,6 @@ struct ScRawTokenBase
 protected:
     OpCode   eOp;
     formula::StackVar eType;
-    mutable sal_uInt16   nRefCnt;
-    bool     bRaw;
 };
 
 struct ScDoubleRawToken: private ScRawTokenBase
@@ -154,19 +147,15 @@ public:
         short        nJump[ FORMULA_MAXJUMPCOUNT + 1 ];     // If/Chose token
     };
 
-                //! other members not initialized
-                ScRawToken() { bRaw = true; }
+                //! members not initialized
+                ScRawToken() {}
 private:
                 ~ScRawToken() {}                //! only delete via Delete()
 public:
                 DECL_FIXEDMEMPOOL_NEWDEL( ScRawToken );
-    formula::StackVar    GetType()   const       { return (formula::StackVar) eType; }
-    OpCode      GetOpCode() const       { return (OpCode)   eOp;   }
+    formula::StackVar    GetType()   const       { return eType; }
+    OpCode      GetOpCode() const       { return eOp; }
     void        NewOpCode( OpCode e )   { eOp = e; }
-    void        IncRef()                { nRefCnt++;       }
-    void        DecRef()                { if( !--nRefCnt ) Delete(); }
-    sal_uInt16      GetRef() const          { return nRefCnt; }
-    SC_DLLPUBLIC void       Delete();
 
     // Use these methods only on tokens that are not part of a token array,
     // since the reference count is cleared!
@@ -192,7 +181,6 @@ public:
      */
     bool IsValidReference() const;
 
-    ScRawToken* Clone() const;      // real copy!
     formula::FormulaToken* CreateToken() const;   // create typified token
     void Load( SvStream&, sal_uInt16 nVer );
 
@@ -203,18 +191,6 @@ public:
         { return GetStrLenBytes( GetStrLen( pStr ) ); }
 };
 
-inline void intrusive_ptr_add_ref(ScRawToken* p)
-{
-    p->IncRef();
-}
-
-inline void intrusive_ptr_release(ScRawToken* p)
-{
-    p->DecRef();
-}
-
-typedef ::boost::intrusive_ptr<ScRawToken> ScRawTokenRef;
-
 class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler
 {
 public:
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 6bf5f4c..28bb7a1 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -174,14 +174,12 @@ void ScRawToken::SetOpCode( OpCode e )
             sbyte.cByte = 0;
             sbyte.bHasForceArray = ScParameterClassification::HasForceArray( eOp);
     }
-    nRefCnt = 0;
 }
 
 void ScRawToken::SetString( rtl_uString* pData, rtl_uString* pDataIgoreCase )
 {
     eOp   = ocPush;
     eType = svString;
-    nRefCnt = 0;
 
     sharedstring.mpData = pData;
     sharedstring.mpDataIgnoreCase = pDataIgoreCase;
@@ -193,7 +191,6 @@ void ScRawToken::SetSingleReference( const ScSingleRefData& rRef )
     eType     = svSingleRef;
     aRef.Ref1 =
     aRef.Ref2 = rRef;
-    nRefCnt   = 0;
 }
 
 void ScRawToken::SetDoubleReference( const ScComplexRefData& rRef )
@@ -201,7 +198,6 @@ void ScRawToken::SetDoubleReference( const ScComplexRefData& rRef )
     eOp   = ocPush;
     eType = svDoubleRef;
     aRef  = rRef;
-    nRefCnt = 0;
 }
 
 void ScRawToken::SetDouble(double rVal)
@@ -209,7 +205,6 @@ void ScRawToken::SetDouble(double rVal)
     eOp   = ocPush;
     eType = svDouble;
     nValue = rVal;
-    nRefCnt = 0;
 }
 
 void ScRawToken::SetErrorConstant( sal_uInt16 nErr )
@@ -217,14 +212,12 @@ void ScRawToken::SetErrorConstant( sal_uInt16 nErr )
     eOp   = ocPush;
     eType = svError;
     nError = nErr;
-    nRefCnt = 0;
 }
 
 void ScRawToken::SetName(bool bGlobal, sal_uInt16 nIndex)
 {
     eOp = ocName;
     eType = svIndex;
-    nRefCnt = 0;
 
     name.bGlobal = bGlobal;
     name.nIndex = nIndex;
@@ -234,7 +227,6 @@ void ScRawToken::SetExternalSingleRef( sal_uInt16 nFileId, const OUString& rTabN
 {
     eOp = ocPush;
     eType = svExternalSingleRef;
-    nRefCnt = 0;
 
     extref.nFileId = nFileId;
     extref.aRef.Ref1 =
@@ -249,7 +241,6 @@ void ScRawToken::SetExternalDoubleRef( sal_uInt16 nFileId, const OUString& rTabN
 {
     eOp = ocPush;
     eType = svExternalDoubleRef;
-    nRefCnt = 0;
 
     extref.nFileId = nFileId;
     extref.aRef = rRef;
@@ -263,7 +254,6 @@ void ScRawToken::SetExternalName( sal_uInt16 nFileId, const OUString& rName )
 {
     eOp = ocPush;
     eType = svExternalName;
-    nRefCnt = 0;
 
     extname.nFileId = nFileId;
 
@@ -282,7 +272,6 @@ void ScRawToken::SetExternal( const sal_Unicode* pStr )
     // Platz fuer Byte-Parameter lassen!
     memcpy( cStr+1, pStr, GetStrLenBytes( nLen ) );
     cStr[ nLen+1 ] = 0;
-    nRefCnt = 0;
 }
 
 bool ScRawToken::IsValidReference() const
@@ -311,52 +300,6 @@ sal_uInt16 ScRawToken::sbyteOffset()
     return static_cast<sal_uInt16>( reinterpret_cast<char*>(&aToken.sbyte) - reinterpret_cast<char*>(&aToken) );
 }
 
-ScRawToken* ScRawToken::Clone() const
-{
-    ScRawToken* p;
-    if ( eType == svDouble )
-    {
-        p = (ScRawToken*) new ScDoubleRawToken;
-        p->eOp = eOp;
-        p->eType = eType;
-        p->nValue = nValue;
-    }
-    else
-    {
-        static sal_uInt16 nOffset = sbyteOffset();     // offset of sbyte
-        sal_uInt16 n = nOffset;
-
-        switch( eType )
-        {
-            case svSep:         break;
-            case svByte:        n += sizeof(ScRawToken::sbyte); break;
-            case svDouble:      n += sizeof(double); break;
-            case svError:       n += sizeof(nError); break;
-            case svString:      n += sizeof(sharedstring); break;
-            case svSingleRef:
-            case svDoubleRef:   n += sizeof(aRef); break;
-            case svMatrix:      n += sizeof(ScMatrix*); break;
-            case svIndex:       n += sizeof(name); break;
-            case svJump:        n += nJump[ 0 ] * 2 + 2; break;
-            case svExternal:    n = sal::static_int_cast<sal_uInt16>( n + GetStrLenBytes( cStr+1 ) + GetStrLenBytes( 2 ) ); break;
-
-            // external references
-            case svExternalSingleRef:
-            case svExternalDoubleRef: n += sizeof(extref); break;
-            case svExternalName:      n += sizeof(extname); break;
-            default:
-            {
-                OSL_TRACE( "unknown ScRawToken::Clone() type %d", int(eType));
-            }
-        }
-        p = (ScRawToken*) new sal_uInt8[ n ];
-        memcpy( p, this, n * sizeof(sal_uInt8) );
-    }
-    p->nRefCnt = 0;
-    p->bRaw = false;
-    return p;
-}
-
 FormulaToken* ScRawToken::CreateToken() const
 {
 #if OSL_DEBUG_LEVEL > 1
@@ -433,23 +376,6 @@ FormulaToken* ScRawToken::CreateToken() const
 #undef IF_NOT_OPCODE_ERROR
 }
 
-void ScRawToken::Delete()
-{
-    if ( bRaw )
-        delete this;                            // FixedMemPool ScRawToken
-    else
-    {   // created per Clone
-        switch ( eType )
-        {
-            case svDouble :
-                delete (ScDoubleRawToken*) this;    // FixedMemPool ScDoubleRawToken
-            break;
-            default:
-                delete [] (sal_uInt8*) this;
-        }
-    }
-}
-
 namespace {
 
 //  TextEqual: if same formula entered (for optimization in sort)
diff --git a/unusedcode.easy b/unusedcode.easy
index 2dd6df1..7bd225a 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -26,8 +26,6 @@ SalGraphics::drawTransformedBitmap(basegfx::B2DPoint const&, basegfx::B2DPoint c
 ScBroadcastAreaSlotMachine::AreaBroadcastInRange(ScRange const&, ScHint const&) const
 ScDocument::CreateFormatTable() const
 ScFormulaCellGroup::scheduleCompilation()
-ScRawToken::Clone() const
-ScRawToken::Delete()
 ScVbaFormat<ooo::vba::excel::XStyle>::getAddIndent()
 ScVbaFormat<ooo::vba::excel::XStyle>::setAddIndent(com::sun::star::uno::Any const&)
 SfxAppMenuControl_Impl::RegisterControl(unsigned short, SfxModule*)


More information about the Libreoffice-commits mailing list