[Libreoffice-commits] core.git: 2 commits - connectivity/source cppuhelper/source dbaccess/source extensions/source external/lcms2 formula/source i18npool/source include/comphelper reportdesign/source stoc/source unotools/source xmloff/source

Stephan Bergmann sbergman at redhat.com
Wed Jan 28 08:57:37 PST 2015


 connectivity/source/commontools/parameters.cxx               |    6 ++----
 connectivity/source/drivers/calc/CTable.cxx                  |    3 +--
 connectivity/source/drivers/dbase/DTable.cxx                 |    3 +--
 connectivity/source/drivers/file/FCatalog.cxx                |    3 +--
 connectivity/source/drivers/flat/EResultSet.cxx              |    3 +--
 connectivity/source/drivers/flat/ETable.cxx                  |    3 +--
 connectivity/source/drivers/hsqldb/HCatalog.cxx              |    3 +--
 connectivity/source/drivers/hsqldb/HTable.cxx                |    3 +--
 connectivity/source/drivers/mysql/YCatalog.cxx               |    3 +--
 connectivity/source/drivers/mysql/YDriver.cxx                |    3 +--
 connectivity/source/sdbcx/VCollection.cxx                    |    3 +--
 cppuhelper/source/tdmgr.cxx                                  |    4 ++--
 dbaccess/source/core/api/View.cxx                            |    3 +--
 dbaccess/source/core/api/table.cxx                           |    3 +--
 dbaccess/source/ui/browser/formadapter.cxx                   |    3 +--
 dbaccess/source/ui/dlg/adtabdlg.cxx                          |    3 +--
 dbaccess/source/ui/querydesign/TableWindowAccess.cxx         |    3 +--
 extensions/source/propctrlr/formlinkdialog.cxx               |    6 ++----
 external/lcms2/ubsan.patch.0                                 |   11 +++++++++++
 formula/source/core/api/FormulaCompiler.cxx                  |    3 +--
 i18npool/source/collator/gencoll_rule.cxx                    |    4 ++--
 include/comphelper/sequence.hxx                              |    2 +-
 reportdesign/source/core/api/Section.cxx                     |    3 +--
 reportdesign/source/ui/inspection/DataProviderHandler.cxx    |    2 +-
 reportdesign/source/ui/inspection/ReportComponentHandler.cxx |    2 +-
 reportdesign/source/ui/misc/FunctionHelper.cxx               |    3 +--
 reportdesign/source/ui/report/propbrw.cxx                    |    3 +--
 stoc/source/security/permissions.cxx                         |    3 +--
 stoc/source/servicemanager/servicemanager.cxx                |    3 +--
 stoc/source/simpleregistry/simpleregistry.cxx                |    9 +++------
 unotools/source/config/eventcfg.cxx                          |    3 +--
 xmloff/source/forms/elementimport.cxx                        |    3 +--
 32 files changed, 48 insertions(+), 67 deletions(-)

New commits:
commit cead54b6e555fe907348943b4586e956771f6ad0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jan 28 17:53:30 2015 +0100

    Use vector::data
    
    ...in some places where it is obvious that it does not hurt that for an empty
    vector the obtained pointer is not necessarily a nullptr.
    
    Change-Id: Id5d66b1559ca8b8955d379bcdbfae6986ef46a51

diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 4bc8b46..25c7da5 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -324,10 +324,8 @@ namespace dbtools
 
         if ( bNeedExchangeLinks )
         {
-            OUString *pFields = aStrippedMasterFields.empty() ? 0 : &aStrippedMasterFields[0];
-            m_aMasterFields = Sequence< OUString >( pFields, aStrippedMasterFields.size() );
-            pFields = aStrippedDetailFields.empty() ? 0 : &aStrippedDetailFields[0];
-            m_aDetailFields = Sequence< OUString >( pFields, aStrippedDetailFields.size() );
+            m_aMasterFields = Sequence< OUString >( aStrippedMasterFields.data(), aStrippedMasterFields.size() );
+            m_aDetailFields = Sequence< OUString >( aStrippedDetailFields.data(), aStrippedDetailFields.size() );
         }
     }
 
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index fbf7e94..b7a4b29 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -666,8 +666,7 @@ Sequence< Type > SAL_CALL OCalcTable::getTypes(  ) throw(RuntimeException, std::
     }
     aOwnTypes.push_back(cppu::UnoType<com::sun::star::lang::XUnoTunnel>::get());
 
-    const Type* pAttrs = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pAttrs, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 750be4f..8df0a2b 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -740,8 +740,7 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes(  ) throw(RuntimeException, std:
         }
     }
     aOwnTypes.push_back(cppu::UnoType<com::sun::star::lang::XUnoTunnel>::get());
-    Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx
index 079f53b..24cc230 100644
--- a/connectivity/source/drivers/file/FCatalog.cxx
+++ b/connectivity/source/drivers/file/FCatalog.cxx
@@ -96,8 +96,7 @@ Sequence< Type > SAL_CALL OFileCatalog::getTypes(  ) throw(RuntimeException, std
             aOwnTypes.push_back(*pBegin);
         }
     }
-    const Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx
index a9a8bc5..84a3a07 100644
--- a/connectivity/source/drivers/flat/EResultSet.cxx
+++ b/connectivity/source/drivers/flat/EResultSet.cxx
@@ -88,8 +88,7 @@ Sequence<  Type > SAL_CALL OFlatResultSet::getTypes(  ) throw( RuntimeException,
             aOwnTypes.push_back(*pBegin);
         }
     }
-    Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    Sequence< Type > aRet(pTypes, aOwnTypes.size());
+    Sequence< Type > aRet(aOwnTypes.data(), aOwnTypes.size());
     return ::comphelper::concatSequences(aRet,OFlatResultSet_BASE::getTypes());
 }
 
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index df816fb..b1335b9 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -539,8 +539,7 @@ Sequence< Type > SAL_CALL OFlatTable::getTypes(  ) throw(RuntimeException, std::
             aOwnTypes.push_back(*pBegin);
         }
     }
-    Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx
index 975192d..09e55a2 100644
--- a/connectivity/source/drivers/hsqldb/HCatalog.cxx
+++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx
@@ -147,8 +147,7 @@ Sequence< Type > SAL_CALL OHCatalog::getTypes(  ) throw(RuntimeException, std::e
             aOwnTypes.push_back(*pBegin);
         }
     }
-    const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx
index 31923db..dc6a711 100644
--- a/connectivity/source/drivers/hsqldb/HTable.cxx
+++ b/connectivity/source/drivers/hsqldb/HTable.cxx
@@ -356,8 +356,7 @@ Sequence< Type > SAL_CALL OHSQLTable::getTypes(  ) throw(RuntimeException, std::
                 aOwnTypes.push_back(*pIter);
             }
         }
-        Type *pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-        return Sequence< Type >(pTypes, aOwnTypes.size());
+        return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
     }
     return OTableHelper::getTypes();
 }
diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx
index cb071e0..7801643 100644
--- a/connectivity/source/drivers/mysql/YCatalog.cxx
+++ b/connectivity/source/drivers/mysql/YCatalog.cxx
@@ -140,8 +140,7 @@ Sequence< Type > SAL_CALL OMySQLCatalog::getTypes(  ) throw(RuntimeException, st
             aOwnTypes.push_back(*pBegin);
         }
     }
-    const Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
index aa776a4..63507ad 100644
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ b/connectivity/source/drivers/mysql/YDriver.cxx
@@ -218,8 +218,7 @@ namespace connectivity
                                 ,0
                                 ,makeAny(sal_True)
                                 ,PropertyState_DIRECT_VALUE) );
-            PropertyValue* pProps = aProps.empty() ? 0 : &aProps[0];
-            return Sequence< PropertyValue >(pProps, aProps.size());
+            return Sequence< PropertyValue >(aProps.data(), aProps.size());
         }
     }
 
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index cc886df..c43cc18 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -279,8 +279,7 @@ Sequence< Type > SAL_CALL OCollection::getTypes() throw (RuntimeException, std::
             if ( *pBegin != aType )
                 aOwnTypes.push_back(*pBegin);
         }
-        Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-        return Sequence< Type >(pTypes,aOwnTypes.size());
+        return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
     }
     return OCollectionBase::getTypes( );
 }
diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx
index abd2865..4a454e6 100644
--- a/cppuhelper/source/tdmgr.cxx
+++ b/cppuhelper/source/tdmgr.cxx
@@ -230,8 +230,8 @@ inline static typelib_TypeDescription * createCTD(
             (typelib_TypeClass)xType->getTypeClass(),
             aMemberTypeName.pData, // type name
             xAttribute->isReadOnly(),
-            getExc.size(), getExc.empty() ? 0 : &getExc[0],
-            setExc.size(), setExc.empty() ? 0 : &setExc[0] );
+            getExc.size(), getExc.data(),
+            setExc.size(), setExc.data() );
     }
     return pRet;
 }
diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx
index 547eab3..cc8e77e 100644
--- a/dbaccess/source/core/api/View.cxx
+++ b/dbaccess/source/core/api/View.cxx
@@ -107,8 +107,7 @@ namespace dbaccess
                 aOwnTypes.push_back(*pIter);
         }
 
-        Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-        return Sequence< Type >(pTypes, aOwnTypes.size());
+        return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
     }
 
     void SAL_CALL View::alterCommand( const OUString& _rNewCommand ) throw (SQLException, RuntimeException, std::exception)
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 07c4077..6c2ac8e0 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -276,8 +276,7 @@ Sequence< Type > SAL_CALL ODBTable::getTypes(  ) throw(RuntimeException, std::ex
             aOwnTypes.push_back(*pIter);
     }
 
-    Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
-    return Sequence< Type >(pTypes, aOwnTypes.size());
+    return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
 }
 
 // XRename,
diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx
index 87d5e2f..0600bd3 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -1479,8 +1479,7 @@ Any SAL_CALL SbaXFormAdapter::getByName(const OUString& aName) throw( ::com::sun
 
 Sequence< OUString > SAL_CALL SbaXFormAdapter::getElementNames() throw( RuntimeException, std::exception )
 {
-    OUString *pChildNames = m_aChildNames.empty() ? 0 : &m_aChildNames[0];
-    return Sequence< OUString >(pChildNames, m_aChildNames.size());
+    return Sequence< OUString >(m_aChildNames.data(), m_aChildNames.size());
 }
 
 sal_Bool SAL_CALL SbaXFormAdapter::hasByName(const OUString& aName) throw( RuntimeException, std::exception )
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index a6ca7ae..5e4cb63 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -191,8 +191,7 @@ void TableListFacade::updateTableObjectList( bool _bAllowViews )
             ::comphelper::UStringMixEqual aEqualFunctor;
             for(;pViewBegin != pViewEnd;++pViewBegin)
                 aTables.erase(::std::remove_if(aTables.begin(),aTables.end(),::std::bind2nd(aEqualFunctor,*pViewBegin)),aTables.end());
-            OUString* pTables = aTables.empty() ? 0 : &aTables[0];
-            sTables = Sequence< OUString>(pTables, aTables.size());
+            sTables = Sequence< OUString>(aTables.data(), aTables.size());
             sViews = Sequence< OUString>();
         }
 
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index f4ed811..433e008 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -224,8 +224,7 @@ namespace dbaui
                 aRelations.push_back(xInterface);
             }
 
-            Reference<XInterface> *pRelations = aRelations.empty() ? 0 : &aRelations[0];
-            Sequence< Reference<XInterface> > aSeq(pRelations, aRelations.size());
+            Sequence< Reference<XInterface> > aSeq(aRelations.data(), aRelations.size());
             return AccessibleRelation(AccessibleRelationType::CONTROLLER_FOR,aSeq);
         }
         return AccessibleRelation();
diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx
index e421a5b..c7fda6b 100644
--- a/extensions/source/propctrlr/formlinkdialog.cxx
+++ b/extensions/source/propctrlr/formlinkdialog.cxx
@@ -224,10 +224,8 @@ namespace pcr
             Reference< XPropertySet > xDetailFormProps( m_xDetailForm, UNO_QUERY );
             if ( xDetailFormProps.is() )
             {
-                OUString *pFields = aDetailFields.empty() ? 0 : &aDetailFields[0];
-                xDetailFormProps->setPropertyValue( PROPERTY_DETAILFIELDS, makeAny( Sequence< OUString >( pFields, aDetailFields.size() ) ) );
-                pFields = aMasterFields.empty() ? 0 : &aMasterFields[0];
-                xDetailFormProps->setPropertyValue( PROPERTY_MASTERFIELDS, makeAny( Sequence< OUString >( pFields, aMasterFields.size() ) ) );
+                xDetailFormProps->setPropertyValue( PROPERTY_DETAILFIELDS, makeAny( Sequence< OUString >( aDetailFields.data(), aDetailFields.size() ) ) );
+                xDetailFormProps->setPropertyValue( PROPERTY_MASTERFIELDS, makeAny( Sequence< OUString >( aMasterFields.data(), aMasterFields.size() ) ) );
             }
         }
         catch( const Exception& )
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 0109587..acfdc09 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -502,8 +502,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
             }
         }
     }
-    const FormulaOpCodeMapEntry* pRet = aVec.empty() ? 0 : &aVec[0];
-    return uno::Sequence< FormulaOpCodeMapEntry >( pRet, aVec.size());
+    return uno::Sequence< FormulaOpCodeMapEntry >(aVec.data(), aVec.size());
 }
 
 
diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx
index 827f812..8f71b7e 100644
--- a/i18npool/source/collator/gencoll_rule.cxx
+++ b/i18npool/source/collator/gencoll_rule.cxx
@@ -120,10 +120,10 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         if (status == U_BUFFER_OVERFLOW_ERROR) {
             data.resize(len);
             status = U_ZERO_ERROR;
-            len = coll->cloneBinary(data.empty() ? 0 : &data[0], len, status);
+            len = coll->cloneBinary(data.data(), len, status);
         }
         if (U_SUCCESS(status))
-            data_write(argv[2], argv[3], data.empty() ? 0 : &data[0], len);
+            data_write(argv[2], argv[3], data.data(), len);
         else {
             printf("Could not get rule data from collator\n");
         }
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index 06390b0..4713582 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -270,7 +270,7 @@ namespace comphelper
         ::std::vector<T> const& v )
     {
         return ::com::sun::star::uno::Sequence<T>(
-            v.empty() ? 0 : &v[0], static_cast<sal_Int32>(v.size()) );
+            v.data(), static_cast<sal_Int32>(v.size()) );
     }
 
 
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
index 71993ad..9f68bc3 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -475,8 +475,7 @@ uno::Sequence< OUString > SAL_CALL OSection::getAvailableReportComponentNames(
     ::osl::MutexGuard aGuard(m_aMutex);
 
     const ::std::vector< OUString >& aRet = lcl_getControlModelMap();
-    const OUString* pRet = aRet.empty() ? 0 : &aRet[0];
-    return uno::Sequence< OUString >(pRet, aRet.size());
+    return uno::Sequence< OUString >(aRet.data(), aRet.size());
 }
 
 // XChild
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index 1e2e243..0685870 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -382,7 +382,7 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope
             aNewProps.push_back(aValue);
         }
     }
-    return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
+    return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
 }
 
 uno::Sequence< OUString > SAL_CALL DataProviderHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
diff --git a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
index c120285..5f802c1 100644
--- a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
+++ b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
@@ -175,7 +175,7 @@ uno::Sequence< beans::Property > SAL_CALL ReportComponentHandler::getSupportedPr
     ::std::vector< beans::Property > aNewProps;
     rptui::OPropertyInfoService::getExcludeProperties( aNewProps, m_xFormComponentHandler );
 
-    return aNewProps.empty() ? uno::Sequence< beans::Property > () : uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
+    return uno::Sequence< beans::Property >(aNewProps.data(), aNewProps.size());
 }
 
 uno::Sequence< OUString > SAL_CALL ReportComponentHandler::getSupersededProperties() throw (uno::RuntimeException, std::exception)
diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx
index 3f7d430..ca7b5a2 100644
--- a/reportdesign/source/ui/misc/FunctionHelper.cxx
+++ b/reportdesign/source/ui/misc/FunctionHelper.cxx
@@ -179,8 +179,7 @@ OUString FunctionDescription::getFormula(const ::std::vector< OUString >& _aArgu
     OUString sFormula;
     try
     {
-        const OUString *pArguments = _aArguments.empty() ? 0 : &_aArguments[0];
-        sFormula = m_xFunctionDescription->createFormula(uno::Sequence< OUString >(pArguments, _aArguments.size()));
+        sFormula = m_xFunctionDescription->createFormula(uno::Sequence< OUString >(_aArguments.data(), _aArguments.size()));
     }
     catch(const uno::Exception&)
     {
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 05a8311..0e8f7b6 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -305,8 +305,7 @@ uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const Sdr
             pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
         }
     }
-    Reference<uno::XInterface> *pSets = aSets.empty() ? NULL : &aSets[0];
-    return uno::Sequence< Reference<uno::XInterface> >(pSets, aSets.size());
+    return uno::Sequence< Reference<uno::XInterface> >(aSets.data(), aSets.size());
 }
 
 void PropBrw::implSetNewObject( const uno::Sequence< Reference<uno::XInterface> >& _aObjects )
diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx
index 28b207a..85f8e02 100644
--- a/stoc/source/security/permissions.cxx
+++ b/stoc/source/security/permissions.cxx
@@ -528,8 +528,7 @@ Sequence< OUString > PermissionCollection::toStrings() const
     {
         strings.push_back( perm->toString() );
     }
-    return Sequence< OUString >(
-        strings.empty() ? 0 : &strings[ 0 ], strings.size() );
+    return Sequence< OUString >( strings.data(), strings.size() );
 }
 #endif
 
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 06bb757..cdf92db 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -1092,8 +1092,7 @@ Sequence< Reference< XInterface > > OServiceManager::queryServiceFactories(
             vec.push_back( p.first->second );
             ++p.first;
         }
-        ret = Sequence< Reference< XInterface > >(
-            vec.empty() ? 0 : &vec[ 0 ], vec.size() );
+        ret = Sequence< Reference< XInterface > >( vec.data(), vec.size() );
     }
 
     return ret;
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 3a038f3..12faa50 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -419,8 +419,7 @@ void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
         list.push_back(seqValue[i]);
     }
     RegError err = key_.setLongListValue(
-        OUString(), list.empty() ? 0 : &list[0],
-        static_cast< sal_uInt32 >(list.size()));
+        OUString(), list.data(), static_cast< sal_uInt32 >(list.size()));
     if (err != REG_NO_ERROR) {
         throw css::registry::InvalidRegistryException(
             (("com.sun.star.registry.SimpleRegistry key setLongListValue:"
@@ -608,8 +607,7 @@ void Key::setAsciiListValue(
         list2.push_back(const_cast< char * >(i->getStr()));
     }
     RegError err = key_.setStringListValue(
-        OUString(), list2.empty() ? 0 : &list2[0],
-        static_cast< sal_uInt32 >(list2.size()));
+        OUString(), list2.data(), static_cast< sal_uInt32 >(list2.size()));
     if (err != REG_NO_ERROR) {
         throw css::registry::InvalidRegistryException(
             (("com.sun.star.registry.SimpleRegistry key"
@@ -745,8 +743,7 @@ void Key::setStringListValue(
         list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr()));
     }
     RegError err = key_.setUnicodeListValue(
-        OUString(), list.empty() ? 0 : &list[0],
-        static_cast< sal_uInt32 >(list.size()));
+        OUString(), list.data(), static_cast< sal_uInt32 >(list.size()));
     if (err != REG_NO_ERROR) {
         throw css::registry::InvalidRegistryException(
             (("com.sun.star.registry.SimpleRegistry key"
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index e98cb00..eaae708 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -274,8 +274,7 @@ Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (c
 
 Sequence< OUString > SAL_CALL GlobalEventConfig_Impl::getElementNames(  ) throw (RuntimeException)
 {
-    const OUString* pRet = m_supportedEvents.empty() ? NULL : &m_supportedEvents[0];
-    return uno::Sequence< OUString >(pRet, m_supportedEvents.size());
+    return uno::Sequence< OUString >(m_supportedEvents.data(), m_supportedEvents.size());
 }
 
 bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw (RuntimeException)
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 14b09e3..4f50177 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -2022,8 +2022,7 @@ namespace xmloff
             }
             while (nElementStart < nLength);
 
-            OUString *pElements = aElements.empty() ? 0 : &aElements[0];
-            aList = Sequence< OUString >(pElements, aElements.size());
+            aList = Sequence< OUString >(aElements.data(), aElements.size());
         }
         else
         {
commit ed874d2eab1a6b1146f411a5a83cc790d3226f10
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jan 28 17:51:21 2015 +0100

    external/lcms2: Work around -fsanitize=alignment
    
    Change-Id: I57c49172fa5bb19968bf217285d0cd9222cc3530

diff --git a/external/lcms2/ubsan.patch.0 b/external/lcms2/ubsan.patch.0
index 2eafcad..0b64484 100644
--- a/external/lcms2/ubsan.patch.0
+++ b/external/lcms2/ubsan.patch.0
@@ -1,3 +1,14 @@
+--- src/cmsnamed.c
++++ src/cmsnamed.c
+@@ -221,7 +221,7 @@
+ cmsBool  CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char Country[3], const wchar_t* WideString)
+ {
+     cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) Language);
+-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) Country);
++    cmsUInt16Number Cntry = Country[0] | ((cmsUInt16Number) Country[1]) << 8;
+     cmsUInt32Number len;
+ 
+     if (mlu == NULL) return FALSE;
 --- src/lcms2_internal.h
 +++ src/lcms2_internal.h
 @@ -93,7 +93,7 @@


More information about the Libreoffice-commits mailing list