shouldn't XFoo implementations use sal_Bool, and not bool?

Lionel Elie Mamane lionel at mamane.lu
Sat May 30 13:30:50 PDT 2015


On Sat, May 30, 2015 at 08:04:54PM +0000, stephan.bergmann.tinderbox at googlemail.com wrote:

> One of you broke the build of LibreOffice with your commit :-(
> Please commit and push a fix ASAP!
> /home/tinderbox/master/dbaccess/source/core/api/RowSetBase.cxx:1242:14: error: implicit conversion (IntegralCast) from 'bool' to 'int' [loplugin:implicitboolconversion]
>             (m_pCache->isAfterLast() != isAfterLast()) || ( m_pCache->isBeforeFirst() != isBeforeFirst() ) ||
>              ^~~~~~~~~~~~~~~~~~~~~~~
> /home/tinderbox/master/dbaccess/source/core/api/RowSetBase.cxx:1242:61: error: implicit conversion (IntegralCast) from 'bool' to 'int' [loplugin:implicitboolconversion]
>             (m_pCache->isAfterLast() != isAfterLast()) || ( m_pCache->isBeforeFirst() != isBeforeFirst() ) ||
>                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~

Err... m_pCache->isBeforeFirst() and isBeforeFirst() having different
return types is ... weird. It seems to come from

commit fee4efcb54c8162955f6fe626d9b68c3b74b3068
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Apr 17 11:16:55 2014 +0200

    dbaccess: sal_Bool->bool
    
    Change-Id: Ieb52470f9638b74898954db3890aaf2cf202290a

diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index a06af91..a42c3ee 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -100,30 +100,30 @@ namespace dbaccess
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::su
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::
         // ::com::sun::star::sdbc::XResultSet
-        virtual sal_Bool SAL_CALL next(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-        virtual sal_Bool SAL_CALL isBeforeFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-        virtual sal_Bool SAL_CALL isAfterLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-        virtual sal_Bool SAL_CALL isFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-        virtual sal_Bool SAL_CALL isLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual bool SAL_CALL next(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual bool SAL_CALL isBeforeFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual bool SAL_CALL isAfterLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual bool SAL_CALL isFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual bool SAL_CALL isLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);


Which changed dbaccess/source/core/api/CacheSet.hxx to bool return
types. But these are (copies of) the com::sun::star::sdbc::XResultSet
interface, so shouldn't those have stayed sal_Bool?


-- 
Lionel


More information about the LibreOffice mailing list