[Libreoffice-commits] core.git: 2 commits - filter/source include/filter include/svx sc/source svx/source

Noel Grandin noel at peralex.com
Mon Jun 2 23:22:23 PDT 2014


 filter/source/msfilter/dffpropset.cxx  |   10 +++++-----
 include/filter/msfilter/dffpropset.hxx |    8 ++++----
 include/svx/rulritem.hxx               |    4 ++--
 sc/source/filter/excel/impop.cxx       |    2 +-
 sc/source/filter/excel/xipivot.cxx     |    2 +-
 sc/source/filter/excel/xltools.cxx     |    2 +-
 sc/source/filter/inc/imp_op.hxx        |    2 +-
 sc/source/filter/inc/xltools.hxx       |    2 +-
 svx/source/dialog/rulritem.cxx         |    8 ++++----
 svx/source/fmcomp/gridcell.cxx         |    4 +++-
 10 files changed, 23 insertions(+), 21 deletions(-)

New commits:
commit b447687292334687a371b66d7ad56ba9662b898e
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jun 2 10:44:30 2014 +0200

    cid#1194914 Overflowed return value
    
    Change-Id: I0f06d0c631632e2dcbba706a17830033aae6f365

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index fa7dcc3..4168322 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -4237,7 +4237,9 @@ sal_Int16 SAL_CALL FmXListBoxCell::getSelectedItemPos() throw( RuntimeException,
     if (m_pBox)
     {
         UpdateFromColumn();
-        return m_pBox->GetSelectEntryPos();
+        sal_Int32 nPos = m_pBox->GetSelectEntryPos();
+        assert(nPos < SHRT_MAX);
+        return nPos;
     }
     return 0;
 }
commit 2537d2dd496c0d05042ca33b99760de79df67682
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jun 2 10:41:35 2014 +0200

    convert some sal_uInt8 fields to bool
    
    Change-Id: Icd5845367157cc0b0c9342c6037b199c49432a76

diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx
index 189ff08..99b33d5 100644
--- a/filter/source/msfilter/dffpropset.cxx
+++ b/filter/source/msfilter/dffpropset.cxx
@@ -1146,11 +1146,11 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly )
         {
             bool bSetProperty = !bSetUninitializedOnly || ( !IsProperty( nRecType ) || !IsHardAttribute( nRecType ) );
 
-            DffPropFlags aPropFlag = { 1, 0, 0, 0 };
+            DffPropFlags aPropFlag = { true, false, false, false };
             if ( nTmp & 0x4000 )
-                aPropFlag.bBlip = sal_True;
+                aPropFlag.bBlip = true;
             if ( nTmp & 0x8000 )
-                aPropFlag.bComplex = sal_True;
+                aPropFlag.bComplex = true;
             if ( aPropFlag.bComplex && nContent && ( nComplexDataFilePos < aHd.GetRecEndFilePos() ) )
             {
                 // normally nContent is the complete size of the complex property,
@@ -1201,7 +1201,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly )
                     nComplexDataFilePos += nContent;                    // store filepos, that is used for the next complex property
                 }
                 else                                                    // a complex property needs content
-                    aPropFlag.bSet = sal_False;                         // otherwise something is wrong
+                    aPropFlag.bSet = false;                             // otherwise something is wrong
             }
             if ( bSetProperty )
             {
@@ -1272,7 +1272,7 @@ bool DffPropSet::IsHardAttribute( sal_uInt32 nId ) const
         bRetValue = (mpPropSetEntries[nId | 0x3f].nComplexIndexOrFlagsHAttr
                         & (1 << (0xf - (nId & 0xf)))) != 0;
     else
-        bRetValue = ( mpPropSetEntries[ nId ].aFlags.bSoftAttr == 0 );
+        bRetValue = ( mpPropSetEntries[ nId ].aFlags.bSoftAttr == false );
     return bRetValue;
 };
 
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
index 6489cc4..19f7749 100644
--- a/include/filter/msfilter/dffpropset.hxx
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -26,10 +26,10 @@
 
 struct DffPropFlags
 {
-    sal_uInt8   bSet        : 1;
-    sal_uInt8   bComplex    : 1;
-    sal_uInt8   bBlip       : 1;
-    sal_uInt8   bSoftAttr   : 1;
+    bool   bSet        : 1;
+    bool   bComplex    : 1;
+    bool   bBlip       : 1;
+    bool   bSoftAttr   : 1;
 };
 
 struct DffPropSetEntry
diff --git a/include/svx/rulritem.hxx b/include/svx/rulritem.hxx
index f1b7268..56074ee 100644
--- a/include/svx/rulritem.hxx
+++ b/include/svx/rulritem.hxx
@@ -155,8 +155,8 @@ class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
     long nRight;            // Right edge for the table; for columns always
                             // equal to the surrounding frame
     sal_uInt16 nActColumn;  // the current column
-    sal_uInt8  bTable;      // table?
-    sal_uInt8  bOrtho;      // evenly spread columns
+    bool       bTable;      // table?
+    bool       bOrtho;      // evenly spread columns
 
 protected:
     virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index ba281b8..4ee35b2 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -1239,7 +1239,7 @@ void ImportExcel::NewTable( void )
 }
 
 
-const ScTokenArray* ImportExcel::ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError, double& rVal )
+const ScTokenArray* ImportExcel::ErrorToFormula( bool bErrOrVal, sal_uInt8 nError, double& rVal )
 {
     return pFormConv->GetBoolErr( XclTools::ErrorToEnum( rVal, bErrOrVal, nError ) );
 }
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index ad2ae65..966abdf 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -120,7 +120,7 @@ void XclImpPCItem::WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) c
         double fValue;
         sal_uInt8 nErrCode = static_cast< sal_uInt8 >( *pnError );
         const ScTokenArray* pScTokArr = rRoot.GetOldFmlaConverter().GetBoolErr(
-            XclTools::ErrorToEnum( fValue, EXC_BOOLERR_ERROR, nErrCode ) );
+            XclTools::ErrorToEnum( fValue, true, nErrCode ) );
         ScFormulaCell* pCell = pScTokArr ? new ScFormulaCell(&rDoc.getDoc(), rScPos, *pScTokArr) : new ScFormulaCell(&rDoc.getDoc(), rScPos);
         pCell->SetHybridDouble( fValue );
         rDoc.setFormulaCell(rScPos, pCell);
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index dc81c94..01c3b48 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -258,7 +258,7 @@ double XclTools::ErrorToDouble( sal_uInt8 nXclError )
     return fVal;
 }
 
-XclBoolError XclTools::ErrorToEnum( double& rfDblValue, sal_uInt8 bErrOrBool, sal_uInt8 nValue )
+XclBoolError XclTools::ErrorToEnum( double& rfDblValue, bool bErrOrBool, sal_uInt8 nValue )
 {
     XclBoolError eType;
     if( bErrOrBool )
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 39063ff..0587fd0 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -197,7 +197,7 @@ protected:
 
     virtual void            EndSheet( void );
     void                    NewTable( void );
-    const ScTokenArray*     ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError,
+    const ScTokenArray*     ErrorToFormula( bool bErrOrVal, sal_uInt8 nError,
                                 double& rVal );
 
     virtual void            AdjustRowHeight();
diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx
index df39c39..0493ca2 100644
--- a/sc/source/filter/inc/xltools.hxx
+++ b/sc/source/filter/inc/xltools.hxx
@@ -119,7 +119,7 @@ public:
         @param rfDblValue  Returns 0.0 for error codes or the value of a Boolean (0.0 or 1.0).
         @param bErrorOrBool  false = nError is a Boolean value; true = is an error value.
         @param nValue  The error code or Boolean value. */
-    static XclBoolError ErrorToEnum( double& rfDblValue, sal_uInt8 bErrOrBool, sal_uInt8 nValue );
+    static XclBoolError ErrorToEnum( double& rfDblValue, bool bErrOrBool, sal_uInt8 nValue );
 
     /** Returns the length in twips calculated from a length in inches. */
     static sal_uInt16   GetTwipsFromInch( double fInches );
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
index a6bb6e8..6c91427 100644
--- a/svx/source/dialog/rulritem.cxx
+++ b/svx/source/dialog/rulritem.cxx
@@ -457,8 +457,8 @@ SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) :
     nLeft       (0),
     nRight      (0),
     nActColumn  (nAct),
-    bTable      (sal_False),
-    bOrtho      (sal_True)
+    bTable      (false),
+    bOrtho      (true)
 
 {}
 
@@ -467,8 +467,8 @@ SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 ri
     nLeft       (left),
     nRight      (right),
     nActColumn  (nActCol),
-    bTable      (sal_True),
-    bOrtho      (sal_True)
+    bTable      (true),
+    bOrtho      (true)
 {}
 
 SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :


More information about the Libreoffice-commits mailing list