[Libreoffice-commits] core.git: 5 commits - avmedia/source basic/source chart2/source connectivity/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 14 09:11:37 PST 2014


 avmedia/source/vlc/wrapper/Player.cxx                       |    5 +--
 basic/source/runtime/methods.cxx                            |    6 +--
 basic/source/runtime/runtime.cxx                            |    4 +-
 basic/source/sbx/sbxscan.cxx                                |    2 -
 chart2/source/controller/main/ControllerCommandDispatch.cxx |    8 ++--
 chart2/source/view/inc/VSeriesPlotter.hxx                   |    2 -
 connectivity/source/commontools/FValue.cxx                  |   20 ++++++------
 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx    |   10 +-----
 8 files changed, 26 insertions(+), 31 deletions(-)

New commits:
commit cc7ffa07f1afe05251428aace2b4ef818a693c0d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 14 18:09:09 2014 +0100

    Be explicit when using bool as integral value
    
    Change-Id: I782942e25107ce996f3f31c3f53123c118d81838

diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 4d176be..4180bc2 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -1021,7 +1021,7 @@ OUString ORowSetValue::getString( ) const
                 }
                 break;
             case DataType::BIT:
-                aRet = OUString::number(static_cast<bool>(*this));
+                aRet = OUString::number(int(static_cast<bool>(*this)));
                 break;
             case DataType::BOOLEAN:
                 aRet = OUString::boolean(static_cast<bool>(*this));
@@ -1175,7 +1175,7 @@ sal_Int8 ORowSetValue::getInt8()    const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_Int8(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1321,7 +1321,7 @@ sal_Int16 ORowSetValue::getInt16()  const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_Int16(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1392,7 +1392,7 @@ sal_uInt16 ORowSetValue::getUInt16()  const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_uInt16(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1466,7 +1466,7 @@ sal_Int32 ORowSetValue::getInt32()  const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_Int32(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1539,7 +1539,7 @@ sal_uInt32 ORowSetValue::getUInt32()  const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_uInt32(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1613,7 +1613,7 @@ sal_Int64 ORowSetValue::getLong()   const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_Int64(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1686,7 +1686,7 @@ sal_uInt64 ORowSetValue::getULong()   const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = sal_uInt64(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1764,7 +1764,7 @@ float ORowSetValue::getFloat()  const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = float(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
@@ -1843,7 +1843,7 @@ double ORowSetValue::getDouble()    const
                 break;
             case DataType::BIT:
             case DataType::BOOLEAN:
-                nRet = m_aValue.m_bBool;
+                nRet = double(m_aValue.m_bBool);
                 break;
             case DataType::TINYINT:
                 if ( m_bSigned )
commit ab6e083f7d58b541a78b1a78ba127941808b2ed4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 14 18:07:51 2014 +0100

    bool improvements
    
    Change-Id: Ibe8e80169b222e425df7016a0012591793546adf

diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index adb1783..2ae114f 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -41,13 +41,9 @@ using namespace com::sun::star::sdbcx;
 
 namespace
 {
-    int libo_strcmp0 (const char *str1, const char *str2)
+    bool equal(const char *str1, const char *str2)
     {
-         if (!str1)
-             return -(str1 != str2);
-         if (!str2)
-             return str1 != str2;
-         return strcmp (str1, str2);
+        return str1 == 0 || str2 == 0 ? str1 == str2 : strcmp(str1, str2) == 0;
     }
 }
 
@@ -1093,7 +1089,7 @@ bool isSourceBackend(ESource *pSource, const char *backendname)
         return false;
 
     gpointer extension = e_source_get_extension (pSource, E_SOURCE_EXTENSION_ADDRESS_BOOK);
-    return extension && libo_strcmp0 (e_source_backend_get_backend_name (extension), backendname) == 0;
+    return extension && equal(e_source_backend_get_backend_name (extension), backendname);
 }
 
 Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
commit 3bf277a044ded4e117020b42677bf45a307ffb76
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 14 18:06:51 2014 +0100

    bool improvements
    
    Change-Id: Ia30628e093a885165b2d8a7b1a999c0dc7ee65cd

diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index 85df663..d88a263 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -78,10 +78,10 @@ namespace impl
 {
 
 /// Constants for moving the series.
-enum EnumForward{
-    MOVE_SERIES_FORWARD = true,
-    MOVE_SERIES_BACKWARD = false
-};
+namespace {
+    static bool const MOVE_SERIES_FORWARD = true;
+    static bool const MOVE_SERIES_BACKWARD = false;
+}
 
 /** Represents the current state of the controller (needed for issue 63017).
 
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index 6a087de..a4b0fb6 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -51,7 +51,7 @@ public:
     {
         m_aNumberFormatMap[tFullAxisIndex(nDimIndex,nAxisIndex)] = nFormatKey;
     }
-    sal_Int32 hasFormat( sal_Int32 nDimIndex, sal_Int32 nAxisIndex ) const
+    bool hasFormat( sal_Int32 nDimIndex, sal_Int32 nAxisIndex ) const
     {
         return (m_aNumberFormatMap.find(tFullAxisIndex(nDimIndex,nAxisIndex)) !=m_aNumberFormatMap.end());
     }
commit 0d29aab156fb2eaf780fd152f0923b4850684846
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 14 18:06:04 2014 +0100

    bool improvements
    
    Change-Id: Ic9ea40c430e0b0ab0d46bac3ba150ddac96c6acc

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 86ae936..5951494 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1643,16 +1643,16 @@ RTLFUNC(StrComp)
     const OUString& rStr2 = rPar.Get(2)->GetOUString();
 
     SbiInstance* pInst = GetSbData()->pInst;
-    sal_Int16 nTextCompare;
+    bool nTextCompare;
     bool bCompatibility = ( pInst && pInst->IsCompatibility() );
     if( bCompatibility )
     {
         SbiRuntime* pRT = pInst->pRun;
-        nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
+        nTextCompare = pRT && pRT->GetImageFlag( SBIMG_COMPARETEXT );
     }
     else
     {
-        nTextCompare = sal_True;
+        nTextCompare = true;
     }
     if ( rPar.Count() == 4 )
         nTextCompare = rPar.Get(3)->GetInteger();
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index ad31f78..21ae531 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1585,8 +1585,8 @@ void SbiRuntime::StepLIKE()
     SbxVariable* pRes = new SbxVariable;
     utl::TextSearch aSearch(aSearchOpt);
     sal_Int32 nStart=0, nEnd=value.getLength();
-    int bRes = aSearch.SearchForward(value, &nStart, &nEnd);
-    pRes->PutBool( bRes != 0 );
+    bool bRes = aSearch.SearchForward(value, &nStart, &nEnd);
+    pRes->PutBool( bRes );
 
     PushVar( pRes );
 }
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 15c5074..6d39ba7 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -76,7 +76,7 @@ bool ImpStrChr( const sal_Unicode* p, sal_Unicode c )
 
 bool ImpIsAlNum( sal_Unicode c )
 {
-    return (c < 128) ? isalnum( static_cast<char>(c) ) : false;
+    return c < 128 && isalnum( static_cast<char>(c) );
 }
 
 // scanning a string according to BASIC-conventions
commit 1110840db78c2960b6848a9f336fe96b3a53b39b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 14 18:02:23 2014 +0100

    These should be extern "C" function types
    
    Change-Id: I3dcbc1b643a29ee080e5b034dccd4882a43590a4

diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx
index 2d38e3a..dd0fd4c 100644
--- a/avmedia/source/vlc/wrapper/Player.cxx
+++ b/avmedia/source/vlc/wrapper/Player.cxx
@@ -16,8 +16,7 @@
 
 struct libvlc_media_t;
 
-namespace
-{
+namespace { extern "C" {
     void ( *libvlc_media_player_retain ) ( libvlc_media_player_t *p_mi );
     libvlc_media_player_t * ( *libvlc_media_player_new_from_media ) ( libvlc_media_t *p_md );
     void ( *libvlc_media_player_release ) ( libvlc_media_player_t *p_mi );
@@ -58,7 +57,7 @@ namespace
     int ( *libvlc_audio_get_track ) ( libvlc_media_player_t *p_mi );
     libvlc_track_description_t * ( *libvlc_audio_get_track_description ) (libvlc_media_player_t *p_mi );
     int ( *libvlc_audio_set_track ) (libvlc_media_player_t *p_mi, int i_track);
-}
+} }
 
 namespace avmedia
 {


More information about the Libreoffice-commits mailing list