[Libreoffice-commits] core.git: basctl/source basic/inc basic/source include/basic

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 15 07:48:36 UTC 2017


 basctl/source/basicide/baside2b.cxx |    4 ++--
 basic/inc/sbxbase.hxx               |    2 +-
 basic/source/classes/sb.cxx         |    6 +++---
 basic/source/comp/parser.cxx        |    4 ++--
 basic/source/runtime/methods.cxx    |    2 +-
 basic/source/runtime/runtime.cxx    |    2 +-
 basic/source/sbx/sbxarray.cxx       |    2 +-
 basic/source/sbx/sbxbase.cxx        |   16 ++++++++--------
 basic/source/sbx/sbxconv.hxx        |    2 +-
 basic/source/sbx/sbxscan.cxx        |    8 ++++----
 basic/source/sbx/sbxvalue.cxx       |    8 ++++----
 include/basic/sberrors.hxx          |    2 +-
 include/basic/sbxcore.hxx           |    4 ++--
 include/basic/sbxdef.hxx            |    3 ---
 include/basic/sbxvar.hxx            |    2 +-
 15 files changed, 32 insertions(+), 35 deletions(-)

New commits:
commit 7aee0ea7c5a780bca5193382b6f73599c2f025eb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 15 08:40:10 2017 +0200

    replace SbxError typedef with ErrCode
    
    part of a larger patch to convert ErrCode to strong_int
    
    Change-Id: Ia56e5d6d8c4217d6f258e2113d20ce737977892f
    Reviewed-on: https://gerrit.libreoffice.org/38813
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 369f7790bb5f..825d5ffc70f3 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1889,7 +1889,7 @@ void StackWindow::UpdateCalls()
 
     if (StarBASIC::IsRunning())
     {
-        SbxError eOld = SbxBase::GetError();
+        ErrCode eOld = SbxBase::GetError();
         aTreeListBox->SetSelectionMode( SelectionMode::Single );
 
         sal_Int32 nScope = 0;
@@ -2382,7 +2382,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
 {
     SbMethod* pCurMethod = StarBASIC::GetActiveMethod();
 
-    SbxError eOld = SbxBase::GetError();
+    ErrCode eOld = SbxBase::GetError();
     setBasicWatchMode( true );
 
     SvTreeListEntry* pEntry = First();
diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx
index 12ea1267d05c..561bc77121c9 100644
--- a/basic/inc/sbxbase.hxx
+++ b/basic/inc/sbxbase.hxx
@@ -34,7 +34,7 @@ class SbxBasicFormater;
 // AppData structure for SBX:
 struct SbxAppData
 {
-    SbxError            eSbxError;  // Error code
+    ErrCode             eErrCode;  // Error code
     std::vector<std::unique_ptr<SbxFactory>>
                         m_Factories;
 
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 2474beb9bd48..23f6244ec28d 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -984,7 +984,7 @@ StarBASIC::~StarBASIC()
     }
     else if( bDocBasic )
     {
-        SbxError eOld = SbxBase::GetError();
+        ErrCode eOld = SbxBase::GetError();
 
         lclRemoveDocBasicItem( *this );
 
@@ -1358,11 +1358,11 @@ bool StarBASIC::Call( const OUString& rName, SbxArray* pParam )
     bool bRes = SbxObject::Call( rName, pParam );
     if( !bRes )
     {
-        SbxError eErr = SbxBase::GetError();
+        ErrCode eErr = SbxBase::GetError();
         SbxBase::ResetError();
         if( eErr != ERRCODE_SBX_OK )
         {
-            RTError( (ErrCode)eErr, OUString(), 0, 0, 0 );
+            RTError( eErr, OUString(), 0, 0, 0 );
         }
     }
     return bRes;
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 21131edbf6f8..45e1b49c9537 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -434,11 +434,11 @@ bool SbiParser::Parse()
                         eCurTok == SUB || eCurTok == FUNCTION )
                     aGen.Statement();
                 (this->*( p->Func ) )();
-                SbxError nSbxErr = SbxBase::GetError();
+                ErrCode nSbxErr = SbxBase::GetError();
                 if( nSbxErr )
                 {
                     SbxBase::ResetError();
-                    Error( (ErrCode)nSbxErr );
+                    Error( nSbxErr );
                 }
             }
         }
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 59b02467ab37..15f357c9950f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2635,7 +2635,7 @@ RTLFUNC(IsDate)
         }
         else if( eType == SbxSTRING )
         {
-            SbxError nPrevError = SbxBase::GetError();
+            ErrCode nPrevError = SbxBase::GetError();
             SbxBase::ResetError();
 
             // force conversion of the parameter to SbxDATE
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 13244e39de7d..f43e882d87a4 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1606,7 +1606,7 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
     if (  aAny.getValueType().getTypeClass() == TypeClass_STRUCT )
     {
         refVar->SetType( SbxOBJECT );
-        SbxError eOldErr = SbxBase::GetError();
+        ErrCode eOldErr = SbxBase::GetError();
         // There are some circumstances when calling GetObject
         // will trigger an error, we need to squash those here.
         // Alternatively it is possible that the same scenario
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index db4655dace63..43b970ce1ee2 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -551,7 +551,7 @@ void SbxDimArray::Clear()
 
 void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, bool bAllowSize0 )
 {
-    SbxError eRes = ERRCODE_SBX_OK;
+    ErrCode eRes = ERRCODE_SBX_OK;
     if( ub < lb && !bAllowSize0 )
     {
         eRes = ERRCODE_SBX_BOUNDS;
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 6c8148e00022..2b591093d67e 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -34,7 +34,7 @@
 
 
 SbxAppData::SbxAppData()
-    : eSbxError(ERRCODE_SBX_OK)
+    : eErrCode(ERRCODE_SBX_OK)
     , pBasicFormater(nullptr)
     , eBasicFormaterLangType(LANGUAGE_DONTKNOW)
 {
@@ -94,26 +94,26 @@ void SbxBase::SetModified( bool b )
         ResetFlag( SbxFlagBits::Modified );
 }
 
-SbxError SbxBase::GetError()
+ErrCode SbxBase::GetError()
 {
-    return GetSbxData_Impl().eSbxError;
+    return GetSbxData_Impl().eErrCode;
 }
 
-void SbxBase::SetError( SbxError e )
+void SbxBase::SetError( ErrCode e )
 {
     SbxAppData& r = GetSbxData_Impl();
-    if( e && r.eSbxError == ERRCODE_SBX_OK )
-        r.eSbxError = e;
+    if( e && r.eErrCode == ERRCODE_SBX_OK )
+        r.eErrCode = e;
 }
 
 bool SbxBase::IsError()
 {
-    return GetSbxData_Impl().eSbxError != ERRCODE_SBX_OK;
+    return GetSbxData_Impl().eErrCode != ERRCODE_SBX_OK;
 }
 
 void SbxBase::ResetError()
 {
-    GetSbxData_Impl().eSbxError = ERRCODE_SBX_OK;
+    GetSbxData_Impl().eErrCode = ERRCODE_SBX_OK;
 }
 
 void SbxBase::AddFactory( SbxFactory* pFac )
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 08fa296f2c8f..25edf9bc2163 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -26,7 +26,7 @@ class SbxArray;
 
 // SBXSCAN.CXX
 extern void ImpCvtNum( double nNum, short nPrec, OUString& rRes, bool bCoreString=false );
-extern SbxError ImpScan
+extern ErrCode ImpScan
     ( const OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
       bool bAllowIntntl=false, bool bOnlyIntntl=false );
 
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 8a5d59573d2d..b39dba8a0e3e 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -82,7 +82,7 @@ bool ImpStrChr( const sal_Unicode* p, sal_Unicode c )
 // but exponent may also be a D, so data type is SbxDOUBLE
 // conversion error if data type is fixed and it doesn't fit
 
-SbxError ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType,
+ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType,
                   sal_uInt16* pLen, bool bAllowIntntl, bool bOnlyIntntl )
 {
     sal_Unicode cIntntlDecSep, cIntntlGrpSep;
@@ -272,11 +272,11 @@ SbxError ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType,
 }
 
 // port for CDbl in the Basic
-SbxError SbxValue::ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle )
+ErrCode SbxValue::ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle )
 {
     SbxDataType t;
     sal_uInt16 nLen = 0;
-    SbxError nRetError = ImpScan( rSrc, nVal, t, &nLen,
+    ErrCode nRetError = ImpScan( rSrc, nVal, t, &nLen,
         /*bAllowIntntl*/false, /*bOnlyIntntl*/true );
     // read completely?
     if( nRetError == ERRCODE_SBX_OK && nLen != rSrc.getLength() )
@@ -550,7 +550,7 @@ static sal_uInt16 printfmtstr( const OUString& rStr, OUString& rRes, const OUStr
 
 bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
 {
-    SbxError eRes = ERRCODE_SBX_OK;
+    ErrCode eRes = ERRCODE_SBX_OK;
     if( !CanWrite() )
     {
         eRes = ERRCODE_SBX_PROP_READONLY;
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 7ff177d8a736..10c3e0620016 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -268,7 +268,7 @@ SbxValue* SbxValue::TheRealValue( bool bObjInObjError ) const
 bool SbxValue::Get( SbxValues& rRes ) const
 {
     bool bRes = false;
-    SbxError eOld = GetError();
+    ErrCode eOld = GetError();
     if( eOld != ERRCODE_SBX_OK )
         ResetError();
     if( !CanRead() )
@@ -422,7 +422,7 @@ GET( GetDecimal,  SbxDECIMAL,    SbxDecimal*,   pDecimal )
 bool SbxValue::Put( const SbxValues& rVal )
 {
     bool bRes = false;
-    SbxError eOld = GetError();
+    ErrCode eOld = GetError();
     if( eOld != ERRCODE_SBX_OK )
         ResetError();
     if( !CanWrite() )
@@ -834,7 +834,7 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
 #endif
     SbxDataType eThisType = GetType();
     SbxDataType eOpType = rOp.GetType();
-    SbxError eOld = GetError();
+    ErrCode eOld = GetError();
     if( eOld != ERRCODE_SBX_OK )
         ResetError();
     if( !CanWrite() )
@@ -1212,7 +1212,7 @@ bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
 #endif
 
     bool bRes = false;
-    SbxError eOld = GetError();
+    ErrCode eOld = GetError();
     if( eOld != ERRCODE_SBX_OK )
         ResetError();
     if( !CanRead() || !rOp.CanRead() )
diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx
index 52dc1256835a..95ccfa1c6cc3 100644
--- a/include/basic/sberrors.hxx
+++ b/include/basic/sberrors.hxx
@@ -22,7 +22,7 @@
 
 #include <basic/sbxdef.hxx>
 
-// Mapping to SbxError
+// Mapping to ErrCode
 #define ERRCODE_BASIC_SYNTAX                ERRCODE_SBX_SYNTAX                  // unspecified syntax error
 #define ERRCODE_BASIC_BAD_ARGUMENT          ERRCODE_SBX_NOTIMP                  // Invalid procedure call
 #define ERRCODE_BASIC_MATH_OVERFLOW         ERRCODE_SBX_OVERFLOW                // Overflow
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
index afa7e393f56c..3c1c48fdd9c5 100644
--- a/include/basic/sbxcore.hxx
+++ b/include/basic/sbxcore.hxx
@@ -80,8 +80,8 @@ public:
     bool            Store( SvStream& );
     virtual bool    LoadCompleted();
 
-    static SbxError GetError();
-    static void SetError( SbxError );
+    static ErrCode GetError();
+    static void SetError( ErrCode );
     static bool IsError();
     static void ResetError();
 
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
index 9008702ac5a2..973a472640fa 100644
--- a/include/basic/sbxdef.hxx
+++ b/include/basic/sbxdef.hxx
@@ -124,9 +124,6 @@ enum class SbxNameType {          // Type of the questioned name of a variable
     ShortTypes,     // Name%(A%,B$)
 };
 
-// from 1996/3/20: New error messages
-typedef sal_uIntPtr SbxError;           // Preserve old type
-
 #endif
 
 
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 5645a6cb409f..516d0d936516 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -166,7 +166,7 @@ public:
     void fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const;
     bool PutCurrency( sal_Int64 );
             // Interface for CDbl in Basic
-    static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
+    static ErrCode ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
 
     bool PutObject( SbxBase* );
 


More information about the Libreoffice-commits mailing list