From 5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 22 Feb 2017 16:39:20 +0200 Subject: make UNO enums scoped for internal LO code this modifies codemaker so that, for an UNO enum, we generate code that effectively looks like: #ifdef LIBO_INTERNAL_ONLY && HAVE_CX11_CONSTEXPR enum class XXX { ONE = 1 }; constexpr auto ONE = XXX_ONE; #else ...the old normal way.. #endif which means that for LO internal code, the enums are scoped. The "constexpr auto" trick acts like an alias so we don't have to use scoped naming everywhere. Change-Id: I3054ecb230e8666ce98b4a9cb87b384df5f64fb4 Reviewed-on: https://gerrit.libreoffice.org/34546 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/drivers/mozab/bootstrap/MNSFolders.cxx | 2 +- .../drivers/mozab/bootstrap/MNSProfileDiscover.cxx | 12 ++++----- .../source/drivers/postgresql/pq_tools.cxx | 30 +++++++++++----------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx index a363aa2d40c9..a82aa90e545f 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx @@ -92,7 +92,7 @@ namespace OUString const & lcl_guessProfileRoot( MozillaProductType _product ) { - size_t productIndex = _product - 1; + size_t productIndex = (int)_product - 1; static OUString s_productDirectories[NB_PRODUCTS]; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index 3e0432adda7d..05d47378764d 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -70,7 +70,7 @@ namespace connectivity //Thunderbird and firefox profiles are saved in profiles.ini void ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; OUString regDir = getRegistryDir(product); @@ -145,7 +145,7 @@ namespace connectivity OUString ProfileAccess::getProfilePath( css::mozilla::MozillaProductType product, const OUString& profileName ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end()) { @@ -158,13 +158,13 @@ namespace connectivity ::sal_Int32 ProfileAccess::getProfileCount( css::mozilla::MozillaProductType product) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; return static_cast< ::sal_Int32 >(rProduct.mProfileList.size()); } ::sal_Int32 ProfileAccess::getProfileList( css::mozilla::MozillaProductType product, css::uno::Sequence< OUString >& list ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; list.realloc(static_cast(rProduct.mProfileList.size())); sal_Int32 i=0; @@ -182,7 +182,7 @@ namespace connectivity OUString ProfileAccess::getDefaultProfile( css::mozilla::MozillaProductType product ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (!rProduct.mCurrentProfileName.isEmpty()) { @@ -206,7 +206,7 @@ namespace connectivity bool ProfileAccess::getProfileExists( css::mozilla::MozillaProductType product, const OUString& profileName ) { - sal_Int32 index=product; + sal_Int32 index=(sal_Int32)product; ProductStruct &rProduct = m_ProductProfileList[index]; if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end()) { diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 3ab8d1d621d5..b6e021116326 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -1151,52 +1151,52 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, bool bSuccessfullyReRouted = true; switch (_rValue.getValueTypeClass()) { - case typelib_TypeClass_HYPER: + case css::uno::TypeClass_HYPER: { sal_Int64 nValue = 0; _rxParameters->setLong( _nColumnIndex, nValue ); } break; - case typelib_TypeClass_VOID: + case css::uno::TypeClass_VOID: _rxParameters->setNull(_nColumnIndex,css::sdbc::DataType::VARCHAR); break; - case typelib_TypeClass_STRING: + case css::uno::TypeClass_STRING: _rxParameters->setString(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_BOOLEAN: + case css::uno::TypeClass_BOOLEAN: _rxParameters->setBoolean(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_BYTE: + case css::uno::TypeClass_BYTE: _rxParameters->setByte(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_UNSIGNED_SHORT: - case typelib_TypeClass_SHORT: + case css::uno::TypeClass_UNSIGNED_SHORT: + case css::uno::TypeClass_SHORT: _rxParameters->setShort(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_CHAR: + case css::uno::TypeClass_CHAR: _rxParameters->setString(_nColumnIndex, OUString(*o3tl::forceAccess(_rValue))); break; - case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_LONG: + case css::uno::TypeClass_UNSIGNED_LONG: + case css::uno::TypeClass_LONG: _rxParameters->setInt(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_FLOAT: + case css::uno::TypeClass_FLOAT: _rxParameters->setFloat(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_DOUBLE: + case css::uno::TypeClass_DOUBLE: _rxParameters->setDouble(_nColumnIndex, *o3tl::forceAccess(_rValue)); break; - case typelib_TypeClass_SEQUENCE: + case css::uno::TypeClass_SEQUENCE: if (auto s = o3tl::tryAccess>(_rValue)) { _rxParameters->setBytes(_nColumnIndex, *s); @@ -1204,7 +1204,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, else bSuccessfullyReRouted = false; break; - case typelib_TypeClass_STRUCT: + case css::uno::TypeClass_STRUCT: if (auto s1 = o3tl::tryAccess(_rValue)) _rxParameters->setTimestamp(_nColumnIndex, *s1); else if (auto s2 = o3tl::tryAccess(_rValue)) @@ -1215,7 +1215,7 @@ bool implSetObject( const Reference< XParameters >& _rxParameters, bSuccessfullyReRouted = false; break; - case typelib_TypeClass_INTERFACE: + case css::uno::TypeClass_INTERFACE: { Reference< css::io::XInputStream > xStream; if (_rValue >>= xStream) -- cgit