diff options
89 files changed, 265 insertions, 181 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 30d593301b3b..7352953b1ee0 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -1242,7 +1242,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) Reference<io::XOutputStream> xPipe( io::Pipe::create( xContext ), UNO_QUERY_THROW ); xManifestWriter->writeManifestSequence( xPipe, Sequence< Sequence<beans::PropertyValue> >( - &manifest[ 0 ], manifest.size() ) ); + manifest.data(), manifest.size() ) ); aMetaInfInetObj.insertName( "manifest.xml", true, INetURLObject::LAST_SEGMENT, INetURLObject::EncodeMechanism::All ); diff --git a/binaryurp/source/incomingrequest.cxx b/binaryurp/source/incomingrequest.cxx index 63ecf649d0ba..95e85a3f5808 100644 --- a/binaryurp/source/incomingrequest.cxx +++ b/binaryurp/source/incomingrequest.cxx @@ -213,7 +213,7 @@ bool IncomingRequest::execute_throw( css::uno::TypeDescription( mtd->pParams[j].pTypeRef). get()->nSize)); - p = &outBufs.back()[0]; + p = outBufs.back().data(); } args.push_back(p); if (mtd->pParams[j].bOut) { @@ -234,8 +234,8 @@ bool IncomingRequest::execute_throw( uno_Any exc; uno_Any * pexc = &exc; (*object_.get()->pDispatcher)( - object_.get(), member_.get(), retBuf.empty() ? nullptr : &retBuf[0], - args.empty() ? nullptr : &args[0], &pexc); + object_.get(), member_.get(), retBuf.empty() ? nullptr : retBuf.data(), + args.empty() ? nullptr : args.data(), &pexc); isExc = pexc != nullptr; if (isExc) { *returnValue = BinaryAny( @@ -245,8 +245,8 @@ bool IncomingRequest::execute_throw( uno_any_destruct(&exc, nullptr); } else { if (!retBuf.empty()) { - *returnValue = BinaryAny(retType, &retBuf[0]); - uno_destructData(&retBuf[0], retType.get(), nullptr); + *returnValue = BinaryAny(retType, retBuf.data()); + uno_destructData(retBuf.data(), retType.get(), nullptr); } if (!outArguments->empty()) { assert( @@ -268,7 +268,7 @@ bool IncomingRequest::execute_throw( } if (!mtd->pParams[k].bIn) { uno_type_destructData( - &(*j++)[0], mtd->pParams[k].pTypeRef, nullptr); + (j++)->data(), mtd->pParams[k].pTypeRef, nullptr); } } assert(i == outArguments->end()); diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx index 14b87449926a..585f375d7a58 100644 --- a/binaryurp/source/writer.cxx +++ b/binaryurp/source/writer.cxx @@ -415,7 +415,7 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) { Marshal::write32(&header, static_cast< sal_uInt32 >(buffer.size())); Marshal::write32(&header, 1); assert(!buffer.empty()); - unsigned char const * p = &buffer[0]; + unsigned char const * p = buffer.data(); std::vector< unsigned char >::size_type n = buffer.size(); assert(header.size() <= SAL_MAX_INT32); /*static_*/assert(SAL_MAX_INT32 <= std::numeric_limits<std::size_t>::max()); @@ -425,7 +425,7 @@ void Writer::sendMessage(std::vector< unsigned char > const & buffer) { } css::uno::Sequence<sal_Int8> s(header.size() + k); assert(!header.empty()); - std::memcpy(s.getArray(), &header[0], header.size()); + std::memcpy(s.getArray(), header.data(), header.size()); for (;;) { std::memcpy(s.getArray() + s.getLength() - k, p, k); try { diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index f24405f73cfe..c9a99621a00d 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -472,7 +472,7 @@ namespace cairocanvas << aFont.GetFamilyName() << " - " << maText.Text.copy(maText.StartPosition, maText.Length)); - cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size()); + cairo_show_glyphs(pSCairo.get(), cairo_glyphs.data(), cairo_glyphs.size()); //faux bold if (rSysFontData.bFakeBold) @@ -488,7 +488,7 @@ namespace cairocanvas cairo_glyph.x += (bold_dx * nSteps / total_steps) / 4; cairo_glyph.y -= (bold_dx * nSteps / total_steps) / 4; } - cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size()); + cairo_show_glyphs(pSCairo.get(), cairo_glyphs.data(), cairo_glyphs.size()); } SAL_INFO("canvas.cairo",":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:" << static_cast<int>(bold_dx)); } diff --git a/canvas/source/tools/propertysethelper.cxx b/canvas/source/tools/propertysethelper.cxx index c866fe9fc4b1..452aa96ab1d9 100644 --- a/canvas/source/tools/propertysethelper.cxx +++ b/canvas/source/tools/propertysethelper.cxx @@ -70,7 +70,7 @@ namespace canvas EntryComparator() ); if( !maMapEntries.empty() ) - mpMap.reset( new MapType(&maMapEntries[0], + mpMap.reset( new MapType(maMapEntries.data(), maMapEntries.size(), true) ); } diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index 23bc000248bb..bf5a02cd6ef4 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -102,7 +102,7 @@ void writeStream(FileStream & file, std::vector< unsigned char > const & stream) // approximation of std::numeric_limits<T1>::max() <= // std::numeric_limits<T2>::max() if (n != 0) { - write(file, &stream[0], static_cast< sal_uInt64 >(n)); + write(file, stream.data(), static_cast< sal_uInt64 >(n)); } } diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 4c7917e96015..aa81039ad89c 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -158,9 +158,9 @@ namespace sal_uInt64 nBaseRead(0); // read rTarget - if (osl::File::E_None == rFile->read(static_cast<void*>(&aTarget[0]), nLength, nBaseRead) && nLength == nBaseRead) + if (osl::File::E_None == rFile->read(static_cast<void*>(aTarget.data()), nLength, nBaseRead) && nLength == nBaseRead) { - rTarget = OString(&aTarget[0], static_cast< sal_Int32 >(nLength)); + rTarget = OString(aTarget.data(), static_cast< sal_Int32 >(nLength)); return true; } diff --git a/comphelper/source/xml/xmltools.cxx b/comphelper/source/xml/xmltools.cxx index 24919ae35044..c8f8863a4db9 100644 --- a/comphelper/source/xml/xmltools.cxx +++ b/comphelper/source/xml/xmltools.cxx @@ -83,13 +83,13 @@ namespace comphelper sal_Int32 nLength = 1024+n; // coverity[tainted_data] - 1024 deliberate random minus max -127/plus max 128 std::vector<sal_uInt8> aChaff(nLength); - rtl_random_getBytes(pool, &aChaff[0], nLength); + rtl_random_getBytes(pool, aChaff.data(), nLength); rtl_random_destroyPool(pool); encodeChaff(aChaff); - return OString(reinterpret_cast<const sal_Char*>(&aChaff[0]), nLength); + return OString(reinterpret_cast<const sal_Char*>(aChaff.data()), nLength); } OString generateGUIDString() diff --git a/compilerplugins/clang/data.cxx b/compilerplugins/clang/data.cxx new file mode 100644 index 000000000000..7e2f019e47a1 --- /dev/null +++ b/compilerplugins/clang/data.cxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "check.hxx" +#include "compat.hxx" +#include "plugin.hxx" + +// For std::array or std::vector x, replace &x[0] with x.data(). + +namespace +{ +class Data final : public loplugin::FilteringPlugin<Data> +{ +public: + explicit Data(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + bool VisitUnaryOperator(UnaryOperator const* expr) + { + if (ignoreLocation(expr)) + { + return true; + } + if (expr->getOpcode() != UO_AddrOf) + { + return true; + } + auto const e1 = dyn_cast<CXXOperatorCallExpr>(expr->getSubExpr()->IgnoreParenImpCasts()); + if (e1 == nullptr) + { + return true; + } + if (e1->getOperator() != OO_Subscript) + { + return true; + } + auto const t = e1->getArg(0)->getType(); + auto const chk = loplugin::TypeCheck(t); + if (!(chk.Class("array").StdNamespace() || chk.Class("vector").StdNamespace())) + { + return true; + } + auto const e2 = e1->getArg(1); + if (e2->isValueDependent()) + { + return true; + } + APSInt v; + if (!compat::EvaluateAsInt(e2, v, compiler.getASTContext())) + { + return true; + } + if (v != 0) + { + return true; + } + report(DiagnosticsEngine::Warning, + "use 'data' member function to access first element of %0", expr->getExprLoc()) + << t << expr->getSourceRange(); + return true; + } + +private: + void run() override + { + if (compiler.getLangOpts().CPlusPlus) + { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } +}; + +static loplugin::Plugin::Registration<Data> reg("data"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx index eae07c4707fa..376fd27c10c2 100644 --- a/connectivity/source/drivers/dbase/DDriver.cxx +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -105,7 +105,7 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString ,"0" ,aBoolean) ); - return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size()); + return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); } SharedResources aResources; diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index fd55eb5bb62a..e3a756672b65 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -161,7 +161,7 @@ Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const OUSt ,OUString() ,Sequence< OUString >()) ); - return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size()); + return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); } // if ( acceptsURL(url) ) { ::connectivity::SharedResources aResources; diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx index e6d9c87a07ee..4c9ac55933e7 100644 --- a/connectivity/source/drivers/flat/EDriver.cxx +++ b/connectivity/source/drivers/flat/EDriver.cxx @@ -123,7 +123,7 @@ Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString ,aBoolean) ); return ::comphelper::concatSequences(OFileDriver::getPropertyInfo(url,info ), - Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size())); + Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size())); } ::connectivity::SharedResources aResources; const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 4e495204e75a..c80826d4a79b 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -428,7 +428,7 @@ namespace connectivity ,"CALL IDENTITY()" ,Sequence< OUString >()) ); - return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); + return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); } diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 888eb3f8d2f3..8e537c2d08e3 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -229,7 +229,7 @@ Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ,OUString( ) ,Sequence< OUString > ()) ); - return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); + return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); } ::connectivity::SharedResources aResources; const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx index 77906f6f3551..0d53ebe0d986 100644 --- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx @@ -326,7 +326,7 @@ ODriverDelegator::getPropertyInfo(const OUString& url, const Sequence<PropertyVa OUString(), Sequence<OUString>())); } - return Sequence<DriverPropertyInfo>(&aDriverInfo[0], aDriverInfo.size()); + return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size()); } sal_Int32 SAL_CALL ODriverDelegator::getMajorVersion() { return 1; } diff --git a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx index ee2a61a61f9f..0f6c90922e5f 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx @@ -114,7 +114,7 @@ MysqlCDriver::getPropertyInfo(const OUString& url, const Sequence<PropertyValue> Sequence<OUString>())); aDriverInfo.push_back( DriverPropertyInfo("Port", "Port", true, "3306", Sequence<OUString>())); - return Sequence<DriverPropertyInfo>(&(aDriverInfo[0]), aDriverInfo.size()); + return Sequence<DriverPropertyInfo>(aDriverInfo.data(), aDriverInfo.size()); } return Sequence<DriverPropertyInfo>(); diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx index 5960925bf7c7..642413bb82f0 100644 --- a/connectivity/source/drivers/odbc/ODriver.cxx +++ b/connectivity/source/drivers/odbc/ODriver.cxx @@ -187,7 +187,7 @@ Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const OUStr ,aBooleanValues) ); - return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); + return Sequence< DriverPropertyInfo >(aDriverInfo.data(),aDriverInfo.size()); } ::connectivity::SharedResources aResources; const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR); diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 8a8f2d4ca3c0..21c310fef15e 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -424,7 +424,7 @@ public: // This const_cast is there for compatibility with PostgreSQL <= 9.1; // PostgreSQL >= 9.2 has the right const qualifiers in the headers // for a return type of "char const*const*". - char const** c_array() const { return const_cast <const char**>(&values[0]); } + char const** c_array() const { return const_cast <const char**>(values.data()); } }; static void properties2arrays( const Sequence< PropertyValue > & args, diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 39d4604e098b..fd691f2ec079 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -894,7 +894,7 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str ) } while( true ); // vec is guaranteed non-empty assert(vec.size() > 0); - ret = css::uno::Sequence< sal_Int32 > ( &vec[0] , vec.size() ); + ret = css::uno::Sequence< sal_Int32 > ( vec.data() , vec.size() ); } return ret; } diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 394aa2ddf41a..8d0ae9c44f5c 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -189,7 +189,7 @@ InterfaceEntry * ObjectEntry::find( OUString::unacquired( &pTypeDescr_->aBase.pTypeName ); if ( type_name == "com.sun.star.uno.XInterface" ) { - return &aInterfaces[ 0 ]; + return aInterfaces.data(); } std::size_t nSize = aInterfaces.size(); diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx index c2d69990bf24..4796c92e9fa5 100644 --- a/cppuhelper/source/defaultbootstrap.cxx +++ b/cppuhelper/source/defaultbootstrap.cxx @@ -92,7 +92,7 @@ cppu::defaultBootstrap_InitialComponentContext(OUString const & iniUri) true)); assert(!context_values.empty()); css::uno::Reference< css::uno::XComponentContext > context( - createComponentContext(&context_values[0], context_values.size())); + createComponentContext(context_values.data(), context_values.size())); smgr->setContext(context); cppu::installTypeDescriptionManager(tmgr.get()); return context; diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 312ad4411e79..d5f0da890bb7 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -589,7 +589,7 @@ void OPropertySetHelper::impl_fireAll( sal_Int32* i_handles, const Any* i_newVal m_pReserved->m_oldValues.clear(); aGuard.clear(); - fire( &allHandles[0], &allNewValues[0], &allOldValues[0], additionalEvents + i_count, false ); + fire( allHandles.data(), allNewValues.data(), allOldValues.data(), additionalEvents + i_count, false ); } diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 2118bcb00c88..d8fde789c429 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -1437,10 +1437,10 @@ OUString cppuhelper::ServiceManager::readLegacyRdbString( } OUString val; std::vector< char > v(s); // assuming sal_uInt32 fits into vector::size_type - if (subkey.getValue(OUString(), &v[0]) != RegError::NO_ERROR + if (subkey.getValue(OUString(), v.data()) != RegError::NO_ERROR || v.back() != '\0' || !rtl_convertStringToUString( - &val.pData, &v[0], static_cast< sal_Int32 >(s - 1), + &val.pData, v.data(), static_cast< sal_Int32 >(s - 1), RTL_TEXTENCODING_UTF8, (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 034c19dd7f5e..e27dc8d4a292 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -296,7 +296,7 @@ Sequence< OUString > SAL_CALL DocumentStorageAccess::getDocumentSubStoragesNames } return aNames.empty() ? Sequence< OUString >() - : Sequence< OUString >( &aNames[0], aNames.size() ); + : Sequence< OUString >( aNames.data(), aNames.size() ); } void SAL_CALL DocumentStorageAccess::preCommit( const css::lang::EventObject& /*aEvent*/ ) diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index d3df7559998e..599db808cd41 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -823,7 +823,7 @@ void MigrationImpl::runServices() sal_uInt32 nSize = rMigration.excludeExtensions.size(); if ( nSize > 0 ) seqExtBlackList = comphelper::arrayToSequence< OUString >( - &rMigration.excludeExtensions[0], nSize ); + rMigration.excludeExtensions.data(), nSize ); seqArguments[2] <<= NamedValue("ExtensionBlackList", uno::makeAny( seqExtBlackList )); diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 3f814e2cc1eb..01f9c2e93355 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -326,7 +326,7 @@ void OO3ExtensionMigration::initialize( const Sequence< Any >& aArguments ) if ( (aValue.Value >>= aBlackList ) && ( aBlackList.getLength() > 0 )) { m_aBlackList.resize( aBlackList.getLength() ); - ::comphelper::sequenceToArray< OUString >( &m_aBlackList[0], aBlackList ); + ::comphelper::sequenceToArray< OUString >( m_aBlackList.data(), aBlackList ); } } } diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index e15e9f826d77..aa8faeaf47a1 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -264,7 +264,7 @@ namespace drawinglayer nIndex, nLength, 0, - &(aIntegerDXArray[0])); + aIntegerDXArray.data()); } else { @@ -351,7 +351,7 @@ namespace drawinglayer { aRetval.reserve(nTextLength); std::vector<long> aArray(nTextLength); - mrDevice.GetTextArray(rText, &aArray[0], nIndex, nLength); + mrDevice.GetTextArray(rText, aArray.data(), nIndex, nLength); aRetval.assign(aArray.begin(), aArray.end()); } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 361f7a5bd5a3..9dcac098fe9c 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -265,7 +265,7 @@ namespace drawinglayer sal_Int32 nPos = rTextCandidate.getTextPosition(); sal_Int32 nLen = rTextCandidate.getTextLength(); - long* pDXArray = !aTransformedDXArray.empty() ? &(aTransformedDXArray[0]) : nullptr ; + long* pDXArray = !aTransformedDXArray.empty() ? aTransformedDXArray.data() : nullptr ; if ( rTextCandidate.isFilled() ) { diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index dd151dd09383..8764b097e698 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4029,7 +4029,7 @@ long ImpEditEngine::GetXPos( if ( nType == AsianCompressionFlags::PunctuationRight && !pLine->GetCharPosArray().empty() ) { sal_Int32 n = nIndex - nTextPortionStart; - const long* pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); + const long* pDXArray = pLine->GetCharPosArray().data()+( nTextPortionStart-pLine->GetStart() ); sal_Int32 nCharWidth = ( ( (n+1) < rPortion.GetLen() ) ? pDXArray[n] : rPortion.GetSize().Width() ) - ( n ? pDXArray[n-1] : 0 ); if ( (n+1) < rPortion.GetLen() ) diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 41880b4f35b2..78b185fb8ca7 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1809,7 +1809,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue ) if( !bNewDoc ) return; - SfxItemSet aTmp( *pAttrPool, &aWhichMap[0] ); + SfxItemSet aTmp( *pAttrPool, aWhichMap.data() ); bool bOldFlag = bIsLeftToRightDef; bIsLeftToRightDef = true; switch( nToken ) diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 4da3c6841263..07e923c687cc 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -282,7 +282,7 @@ void SvxRTFParser::ReadStyleTable() bool bHasStyleNo = false; int _nOpenBrakets = 1; // the first was already detected earlier!! std::unique_ptr<SvxRTFStyleType> pStyle( - new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] )); + new SvxRTFStyleType( *pAttrPool, aWhichMap.data() )); pStyle->aAttrSet.Put( GetRTFDefaults() ); bIsInReadStyleTab = true; @@ -340,7 +340,7 @@ void SvxRTFParser::ReadStyleTable() } // All data from the font is available, so off to the table m_StyleTable.insert(std::make_pair(nStyleNo, std::move(pStyle))); - pStyle.reset(new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] )); + pStyle.reset(new SvxRTFStyleType( *pAttrPool, aWhichMap.data() )); pStyle->aAttrSet.Put( GetRTFDefaults() ); nStyleNo = 0; bHasStyleNo = false; @@ -625,7 +625,7 @@ SvxRTFItemStackType* SvxRTFParser::GetAttrSet_() if( pCurrent ) pNew.reset(new SvxRTFItemStackType( *pCurrent, *pInsPos, false/*bCopyAttr*/ )); else - pNew.reset(new SvxRTFItemStackType( *pAttrPool, &aWhichMap[0], + pNew.reset(new SvxRTFItemStackType( *pAttrPool, aWhichMap.data(), *pInsPos )); pNew->SetRTFDefaults( GetRTFDefaults() ); @@ -910,7 +910,7 @@ const SfxItemSet& SvxRTFParser::GetRTFDefaults() { if( !pRTFDefaults ) { - pRTFDefaults.reset( new SfxItemSet( *pAttrPool, &aWhichMap[0] ) ); + pRTFDefaults.reset( new SfxItemSet( *pAttrPool, aWhichMap.data() ) ); sal_uInt16 nId; if( 0 != ( nId = aPardMap.nScriptSpace )) { diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 80899ff01558..019516791adc 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -343,7 +343,7 @@ void EscherPropertyContainer::Commit( SvStream& rSt, sal_uInt16 nVersion, sal_uI { if ( !pSortStruct[ i ].nProp.empty() ) rSt.WriteBytes( - &pSortStruct[i].nProp[0], + pSortStruct[i].nProp.data(), pSortStruct[i].nProp.size()); } } diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index 3be9e7351990..e4e31cdb351f 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -302,7 +302,7 @@ namespace XSLT m_tcontext = tcontext; } oh->registercontext(m_tcontext); - xsltQuoteUserParams(m_tcontext, ¶ms[0]); + xsltQuoteUserParams(m_tcontext, params.data()); result = xsltApplyStylesheetUser(styleSheet, doc, nullptr, nullptr, nullptr, m_tcontext); } diff --git a/forms/source/xforms/propertysetbase.cxx b/forms/source/xforms/propertysetbase.cxx index 2bf5fe9a0c53..5dd3babfc1a0 100644 --- a/forms/source/xforms/propertysetbase.cxx +++ b/forms/source/xforms/propertysetbase.cxx @@ -54,7 +54,7 @@ cppu::IPropertyArrayHelper& SAL_CALL PropertySetBase::getInfoHelper() if ( !m_pProperties ) { OSL_ENSURE( !m_aProperties.empty(), "PropertySetBase::getInfoHelper: no registered properties!" ); - m_pProperties.reset(new cppu::OPropertyArrayHelper( &m_aProperties[0], m_aProperties.size(), false )); + m_pProperties.reset(new cppu::OPropertyArrayHelper( m_aProperties.data(), m_aProperties.size(), false )); } return *m_pProperties; } diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index f312566552df..3074619981c9 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -364,7 +364,7 @@ sal_Bool SAL_CALL Submission::convertFastPropertyValue( while ( p >= 0 ) aPrefixes.push_back( sTokenList.getToken( 0, ',', p ) ); - Sequence< OUString > aConvertedPrefixes( &aPrefixes[0], aPrefixes.size() ); + Sequence< OUString > aConvertedPrefixes( aPrefixes.data(), aPrefixes.size() ); return PropertySetBase::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, makeAny( aConvertedPrefixes ) ); } } diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx index 7f67daae3315..31fac8710c45 100644 --- a/framework/source/recording/dispatchrecorder.cxx +++ b/framework/source/recording/dispatchrecorder.cxx @@ -89,7 +89,7 @@ static Sequence< Any > make_seq_out_of_struct( vec.reserve( reinterpret_cast<typelib_CompoundTypeDescription *>(pTD)->nMembers ); // good guess flatten_struct_members( &vec, val.getValue(), reinterpret_cast<typelib_CompoundTypeDescription *>(pTD) ); TYPELIB_DANGER_RELEASE( pTD ); - return Sequence< Any >( &vec[ 0 ], vec.size() ); + return Sequence< Any >( vec.data(), vec.size() ); } DispatchRecorder::DispatchRecorder( const css::uno::Reference< css::uno::XComponentContext >& xContext ) diff --git a/helpcompiler/source/HelpIndexer.cxx b/helpcompiler/source/HelpIndexer.cxx index d2380c53d3d1..25ff6ef0b09e 100644 --- a/helpcompiler/source/HelpIndexer.cxx +++ b/helpcompiler/source/HelpIndexer.cxx @@ -116,7 +116,7 @@ void HelpIndexer::helpDocument(OUString const & fileName, Document *doc) const { OUString path = "#HLP#" + d_module + "/" + fileName; std::vector<TCHAR> aPath(OUStringToTCHARVec(path)); - doc->add(*_CLNEW Field(_T("path"), &aPath[0], Field::STORE_YES | Field::INDEX_UNTOKENIZED)); + doc->add(*_CLNEW Field(_T("path"), aPath.data(), Field::STORE_YES | Field::INDEX_UNTOKENIZED)); OUString sEscapedFileName = rtl::Uri::encode(fileName, diff --git a/helpcompiler/source/HelpSearch.cxx b/helpcompiler/source/HelpSearch.cxx index 6f0fa2eeaf6a..75a15bc4fcf0 100644 --- a/helpcompiler/source/HelpSearch.cxx +++ b/helpcompiler/source/HelpSearch.cxx @@ -32,9 +32,9 @@ void HelpSearch::query(OUString const &queryStr, bool captionOnly, std::vector<TCHAR> aQueryStr(OUStringToTCHARVec(queryStr)); lucene::search::Query *pQuery; if (isWildcard) - pQuery = _CLNEW lucene::search::WildcardQuery(_CLNEW lucene::index::Term(field, &aQueryStr[0])); + pQuery = _CLNEW lucene::search::WildcardQuery(_CLNEW lucene::index::Term(field, aQueryStr.data())); else - pQuery = _CLNEW lucene::search::TermQuery(_CLNEW lucene::index::Term(field, &aQueryStr[0])); + pQuery = _CLNEW lucene::search::TermQuery(_CLNEW lucene::index::Term(field, aQueryStr.data())); lucene::search::Hits *hits = searcher.search(pQuery); for (size_t i = 0; i < hits->length(); ++i) { diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index f165c3195c59..f63d94833953 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -402,7 +402,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) sal_uInt16 STC_WordIndex[0x100]; if (count_S2T > 0) { - qsort(&STC_WordEntry_S2T[0], count_S2T, sizeof(Index), Index_comp); + qsort(STC_WordEntry_S2T.data(), count_S2T, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_S2T[] = {"); count = 0; @@ -435,7 +435,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) } if (count_T2S > 0) { - qsort(&STC_WordEntry_T2S[0], count_T2S, sizeof(Index), Index_comp); + qsort(STC_WordEntry_T2S.data(), count_T2S, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_T2S[] = {"); count = 0; diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx index 61d337f6c518..cf14315dd9eb 100644 --- a/libreofficekit/qa/tilebench/tilebench.cxx +++ b/libreofficekit/qa/tilebench/tilebench.cxx @@ -151,7 +151,7 @@ static void testTile( Document *pDocument, int max_parts, fprintf(stderr, "Parts to render: %d, Total Parts: %d, Max parts: %d, Max tiles: %d\n", nParts, nTotalParts, max_parts, max_tiles); std::vector<unsigned char> vBuffer(nTilePixelWidth * nTilePixelHeight * 4); - unsigned char* pPixels = &vBuffer[0]; + unsigned char* pPixels = vBuffer.data(); for (int n = 0; n < nParts; ++n) { diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0ffae0d5e236..eaf761a5d168 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -495,8 +495,8 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if ( rProps.GetOpt( ESCHER_Prop_pVertices, aVertices ) && rProps.GetOpt( ESCHER_Prop_pSegmentInfo, aSegments ) ) { - const sal_uInt8 *pVerticesIt = &aVertices.nProp[0] + 6; - const sal_uInt8 *pSegmentIt = &aSegments.nProp[0]; + const sal_uInt8 *pVerticesIt = aVertices.nProp.data() + 6; + const sal_uInt8 *pSegmentIt = aSegments.nProp.data(); OStringBuffer aPath( 512 ); sal_uInt16 nPointSize = aVertices.nProp[4] + ( aVertices.nProp[5] << 8 ); @@ -686,7 +686,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& SvMemoryStream aStream; // The first bytes are WW8-specific, we're only interested in the PNG int nHeaderSize = 25; - aStream.WriteBytes(&aStruct.nProp[0] + nHeaderSize, + aStream.WriteBytes(aStruct.nProp.data() + nHeaderSize, aStruct.nProp.size() - nHeaderSize); aStream.Seek(0); Graphic aGraphic; @@ -899,7 +899,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if(!opt.nProp.empty()) { - aStream.WriteBytes(&opt.nProp[0], opt.nProp.size()); + aStream.WriteBytes(opt.nProp.data(), opt.nProp.size()); } aStream.Seek(0); @@ -916,7 +916,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& OUString aStyle; if (rProps.GetOpt(ESCHER_Prop_gtextFont, aFont)) { - aStream.WriteBytes(&aFont.nProp[0], aFont.nProp.size()); + aStream.WriteBytes(aFont.nProp.data(), aFont.nProp.size()); aStream.Seek(0); OUString aTextPathFont = SvxMSDffManager::MSDFFReadZString(aStream, aFont.nProp.size(), true); aStyle += "font-family:\"" + aTextPathFont + "\""; @@ -960,7 +960,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& if(!opt.nProp.empty()) { - aStream.WriteBytes(&opt.nProp[0], opt.nProp.size()); + aStream.WriteBytes(opt.nProp.data(), opt.nProp.size()); } aStream.Seek(0); @@ -980,10 +980,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& nId, opt.nPropValue, opt_nProp_size, - 0 == opt_nProp_size ? &opt_nProp_empty : &opt.nProp[0]); + 0 == opt_nProp_size ? &opt_nProp_empty : opt.nProp.data()); if ( opt.nProp.size() ) { - const sal_uInt8 *pIt = &opt.nProp[0]; + const sal_uInt8 *pIt = opt.nProp.data(); fprintf( stderr, " ( " ); for ( int nCount = opt.nProp.size(); nCount; --nCount ) { diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx index 7cb34fe60410..55f594ba713f 100644 --- a/opencl/source/opencl_device.cxx +++ b/opencl/source/opencl_device.cxx @@ -123,10 +123,10 @@ double random(double min, double max) /* Populate input */ void populateInput(std::unique_ptr<LibreOfficeDeviceEvaluationIO> const & testData) { - double* input0 = &testData->input0[0]; - double* input1 = &testData->input1[0]; - double* input2 = &testData->input2[0]; - double* input3 = &testData->input3[0]; + double* input0 = testData->input0.data(); + double* input1 = testData->input1.data(); + double* input2 = testData->input2.data(); + double* input3 = testData->input3.data(); for (unsigned long i = 0; i < testData->inputSize; i++) { input0[i] = random(0, i); @@ -230,15 +230,15 @@ ds_status evaluateScoreForDevice(ds_device& rDevice, std::unique_ptr<LibreOffice /* Run kernel */ cl_kernel clKernel = clCreateKernel(clProgram, "DynamicKernel", &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateKernel"); - cl_mem clResult = clCreateBuffer(clContext, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->outputSize, &testData->output[0], &clStatus); + cl_mem clResult = clCreateBuffer(clContext, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->outputSize, testData->output.data(), &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateBuffer::clResult"); - cl_mem clInput0 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, &testData->input0[0], &clStatus); + cl_mem clInput0 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, testData->input0.data(), &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateBuffer::clInput0"); - cl_mem clInput1 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, &testData->input1[0], &clStatus); + cl_mem clInput1 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, testData->input1.data(), &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateBuffer::clInput1"); - cl_mem clInput2 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, &testData->input2[0], &clStatus); + cl_mem clInput2 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, testData->input2.data(), &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateBuffer::clInput2"); - cl_mem clInput3 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, &testData->input3[0], &clStatus); + cl_mem clInput3 = clCreateBuffer(clContext, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(cl_double) * testData->inputSize, testData->input3.data(), &clStatus); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateBuffer::clInput3"); clStatus = clSetKernelArg(clKernel, 0, sizeof(cl_mem), static_cast<void*>(&clResult)); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clSetKernelArg::clResult"); diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index d761e50655d3..84e5c626b123 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -249,7 +249,7 @@ uno::Sequence<uno::Any> OFieldExpressionControl::fillSelectedGroups() } } if ( !vClipboardList.empty() ) - aList = uno::Sequence< uno::Any >(&vClipboardList[0], vClipboardList.size()); + aList = uno::Sequence< uno::Any >(vClipboardList.data(), vClipboardList.size()); } return aList; } diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1879924d705a..ef7346967397 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -1484,7 +1484,7 @@ void ScExportTest::testRichTextExportODS() return false; // Check the first bold section. - const editeng::Section* pAttr = &aSecAttrs[0]; + const editeng::Section* pAttr = aSecAttrs.data(); if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 4) return false; @@ -1576,7 +1576,7 @@ void ScExportTest::testRichTextExportODS() return false; // Check the first strike-out section. - const editeng::Section* pAttr = &aSecAttrs[0]; + const editeng::Section* pAttr = aSecAttrs.data(); if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 6) return false; @@ -1605,7 +1605,7 @@ void ScExportTest::testRichTextExportODS() return false; // First section should have "Courier" font applied. - const editeng::Section* pAttr = &aSecAttrs[0]; + const editeng::Section* pAttr = aSecAttrs.data(); if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 5) return false; @@ -1640,7 +1640,7 @@ void ScExportTest::testRichTextExportODS() return false; // First section shoul have overline applied. - const editeng::Section* pAttr = &aSecAttrs[0]; + const editeng::Section* pAttr = aSecAttrs.data(); if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 4) return false; @@ -1675,7 +1675,7 @@ void ScExportTest::testRichTextExportODS() return false; // superscript - const editeng::Section* pAttr = &aSecAttrs[0]; + const editeng::Section* pAttr = aSecAttrs.data(); if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 3) return false; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a445d2df2eb7..06881c84b5bb 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4227,7 +4227,7 @@ void Test::testCopyPasteRepeatOneFormula() CPPUNIT_ASSERT(pBASM); std::vector<sc::AreaListener> aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); - const sc::AreaListener* pListener = &aListeners[0]; + const sc::AreaListener* pListener = aListeners.data(); CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,0,0), pListener->maArea); CPPUNIT_ASSERT_MESSAGE("This listener shouldn't be a group listener.", !pListener->mbGroupListening); #endif @@ -4260,7 +4260,7 @@ void Test::testCopyPasteRepeatOneFormula() // a group listener listening on A1:B10. aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); - pListener = &aListeners[0]; + pListener = aListeners.data(); CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea); CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); #endif @@ -4278,7 +4278,7 @@ void Test::testCopyPasteRepeatOneFormula() // Make there we only have one group area listener listening on A2:B11. aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); - pListener = &aListeners[0]; + pListener = aListeners.data(); CPPUNIT_ASSERT_EQUAL(ScRange(0,1,0,1,10,0), pListener->maArea); CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); #endif @@ -4305,7 +4305,7 @@ void Test::testCopyPasteRepeatOneFormula() // Check the group area listener again to make sure it's listening on A1:B10 once again. aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); - pListener = &aListeners[0]; + pListener = aListeners.data(); CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea); CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); #endif diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index c478e4c0b3f4..ea22e3651d4d 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1406,7 +1406,7 @@ void Test::testSharedFormulaMoveBlock() aRows.push_back(0); aRows.push_back(1); aRows.push_back(2); - bool bRes = checkFormulaPositions(*m_pDoc, 0, 1, &aRows[0], aRows.size()); + bool bRes = checkFormulaPositions(*m_pDoc, 0, 1, aRows.data(), aRows.size()); CPPUNIT_ASSERT(bRes); SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index d8e2646d99f5..a4b52eef7061 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2224,13 +2224,13 @@ struct CellBucket } else if (!maNumVals.empty()) { - const double* p = &maNumVals[0]; + const double* p = maNumVals.data(); rMat.PutDouble(p, maNumVals.size(), nCol, mnNumValStart); reset(); } else if (!maStrVals.empty()) { - const svl::SharedString* p = &maStrVals[0]; + const svl::SharedString* p = maStrVals.data(); rMat.PutString(p, maStrVals.size(), nCol, mnStrValStart); reset(); } @@ -2309,7 +2309,7 @@ public: aSSs.push_back(mpPool->intern(aStr)); } - const svl::SharedString* p = &aSSs[0]; + const svl::SharedString* p = aSSs.data(); mrMat.PutString(p, nDataSize, mnMatCol, nMatRow); } break; diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 8be7e52a27c4..d78885dc8d31 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -2446,8 +2446,8 @@ void ScDPDataMember::UpdateRunningTotals( nColPos, rRunning ); else { - const long* pRowSorted = &rRowSorted[0]; - const long* pColSorted = &rColSorted[0]; + const long* pRowSorted = rRowSorted.data(); + const long* pColSorted = rColSorted.data(); pRowSorted += nRowPos + 1; // including the reference dimension pSelectMember = pSelectDim->GetRowReferenceMember( nullptr, nullptr, pRowSorted, pColSorted); @@ -2505,8 +2505,8 @@ void ScDPDataMember::UpdateRunningTotals( else { aRefItemPos.nBasePos = rRowVisible[nRowPos]; // without sort order applied - const long* pRowSorted = &rRowSorted[0]; - const long* pColSorted = &rColSorted[0]; + const long* pRowSorted = rRowSorted.data(); + const long* pColSorted = rColSorted.data(); pRowSorted += nRowPos + 1; // including the reference dimension pSelectMember = pSelectDim->GetRowReferenceMember( pRefPos, pRefName, pRowSorted, pColSorted); @@ -3336,8 +3336,8 @@ ScDPDataMember* ScDPResultDimension::GetColReferenceMember( { OSL_ENSURE( pRelativePos == nullptr || pName == nullptr, "can't use position and name" ); - const long* pColIndexes = &rRunning.GetColSorted()[0]; - const long* pRowIndexes = &rRunning.GetRowSorted()[0]; + const long* pColIndexes = rRunning.GetColSorted().data(); + const long* pRowIndexes = rRunning.GetRowSorted().data(); // get own row member using all indexes diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx index 9f25769c288c..eeeda2aeab8b 100644 --- a/sc/source/core/data/markarr.cxx +++ b/sc/source/core/data/markarr.cxx @@ -504,7 +504,7 @@ void ScMarkArray::Intersect(const ScMarkArray& rOther) OSL_ENSURE(nSize > 0, "Unexpected case."); pData.reset(new ScMarkEntry[nSize]); - memcpy(pData.get(), &(aEntryArray[0]), nSize * sizeof(ScMarkEntry)); + memcpy(pData.get(), aEntryArray.data(), nSize * sizeof(ScMarkEntry)); nCount = nLimit = nSize; } diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index a3a4b777c33f..63bcbb3553e0 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -193,7 +193,7 @@ Sequence<sal_Int8> ScTableProtectionImpl::hashPassword( aChars.push_back(static_cast<sal_Char>(rPassHash[i])); Sequence<sal_Int8> aNewHash; - SvPasswordHelper::GetHashPassword(aNewHash, &aChars[0], aChars.size()); + SvPasswordHelper::GetHashPassword(aNewHash, aChars.data(), aChars.size()); return aNewHash; } diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 8c55b0f2f790..9c00e4d42490 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -4009,7 +4009,7 @@ void DynamicKernel::CreateKernel() std::vector<char> log(n); e = clGetProgramBuildInfo( mpProgram, openclwrapper::gpuEnv.mpDevID, - CL_PROGRAM_BUILD_LOG, n, &log[0], nullptr); + CL_PROGRAM_BUILD_LOG, n, log.data(), nullptr); SAL_WARN_IF( e != CL_SUCCESS || n == 0, "sc.opencl", "after CL_BUILD_PROGRAM_FAILURE," @@ -4019,7 +4019,7 @@ void DynamicKernel::CreateKernel() SAL_WARN( "sc.opencl", "CL_BUILD_PROGRAM_FAILURE, status " << stat - << ", log \"" << &log[0] << "\""); + << ", log \"" << log.data() << "\""); } } } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 2500d75048fa..40cd9764ed6a 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -983,7 +983,7 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm ) for( const auto& rItem : maMultiSel ) if( rItem < nEntryCount ) aSelEx[ rItem ] = 1; - rStrm.Write( &aSelEx[ 0 ], aSelEx.size() ); + rStrm.Write( aSelEx.data(), aSelEx.size() ); } } else if( mnObjType == EXC_OBJTYPE_DROPDOWN ) diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 417d35c3f0f9..e2bfc38cc26a 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -229,7 +229,7 @@ std::size_t XclExpStream::Write( const void* pData, std::size_t nBytes ) { OSL_ENSURE(nWriteLen > 0, "XclExpStream::Write: write length is 0!"); vector<sal_uInt8> aBytes(nWriteLen); - memcpy(&aBytes[0], pBuffer, nWriteLen); + memcpy(aBytes.data(), pBuffer, nWriteLen); mxEncrypter->EncryptBytes(mrStrm, aBytes); // TODO: How do I check if all the bytes have been successfully written ? } @@ -340,7 +340,7 @@ void XclExpStream::WriteByteString( const OString& rString ) void XclExpStream::WriteCharBuffer( const ScfUInt8Vec& rBuffer ) { SetSliceSize( 0 ); - Write( &rBuffer[ 0 ], rBuffer.size() ); + Write( rBuffer.data(), rBuffer.size() ); } void XclExpStream::SetEncrypter( XclExpEncrypterRef const & xEncrypter ) @@ -513,14 +513,14 @@ void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData ) void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, float fValue ) { ::std::vector<sal_uInt8> pnBytes(4); - memcpy(&pnBytes[0], &fValue, 4); + memcpy(pnBytes.data(), &fValue, 4); EncryptBytes(rStrm, pnBytes); } void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, double fValue ) { ::std::vector<sal_uInt8> pnBytes(8); - memcpy(&pnBytes[0], &fValue, 8); + memcpy(pnBytes.data(), &fValue, 8); EncryptBytes(rStrm, pnBytes); } @@ -712,7 +712,7 @@ OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) if(rBuffer.empty()) return OString(); - const sal_uInt16* pBuffer = &rBuffer [0]; + const sal_uInt16* pBuffer = rBuffer.data(); return OString( reinterpret_cast<sal_Unicode const *>(pBuffer), rBuffer.size(), RTL_TEXTENCODING_UTF8); diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index 22dfd5646394..70df7cde57ca 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -381,7 +381,7 @@ void XclExpString::WriteBufferToMem( sal_uInt8* pnMem ) const } } else - memcpy( pnMem, &maCharBuffer[ 0 ], mnLen ); + memcpy( pnMem, maCharBuffer.data(), mnLen ); } } diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index ae7f2d0e9050..7033f6da0550 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -594,7 +594,7 @@ void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLeng if (!sSheetName.empty()) { - OUString aName(&sSheetName[0], strlen(&sSheetName[0]), rContext.eCharVon); + OUString aName(sSheetName.data(), strlen(sSheetName.data()), rContext.eCharVon); rContext.pDoc->RenameTab(nSheetNum, aName); } } diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 24f176b78dc3..bd4870bbde22 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -407,7 +407,7 @@ XclExpXmlChTrHeader::XclExpXmlChTrHeader( if (rBuf.GetBufferCount()) { maTabBuffer.resize(rBuf.GetBufferCount()); - rBuf.GetBufferCopy(&maTabBuffer[0]); + rBuf.GetBufferCopy(maTabBuffer.data()); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index fd24bc39fbf6..ea51223772ec 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4172,7 +4172,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos } } - pView->ImportTables( pSrcShell,static_cast<SCTAB>(nTabs.size()), &nTabs[0], bIsLink, nThisTab ); + pView->ImportTables( pSrcShell,static_cast<SCTAB>(nTabs.size()), nTabs.data(), bIsLink, nThisTab ); bDone = true; } } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index ff9e75fdc909..86a823fa78d8 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -386,7 +386,7 @@ void ScPrintFunc::FillPageData() } else { - rData.SetPagesX( m_aRanges.m_nPagesX, &m_aRanges.m_aPageEndX[0]); + rData.SetPagesX( m_aRanges.m_nPagesX, m_aRanges.m_aPageEndX.data()); } // #i123672# @@ -396,7 +396,7 @@ void ScPrintFunc::FillPageData() } else { - rData.SetPagesY( m_aRanges.m_nTotalY, &m_aRanges.m_aPageEndY[0]); + rData.SetPagesY( m_aRanges.m_nTotalY, m_aRanges.m_aPageEndY.data()); } // Settings diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index fadba4acd6b6..95796fc0930b 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -235,7 +235,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { if(pDlg->IsTableBefore()) { - ImportTables( pDlg->GetDocShellTables(), nTabs.size(), &nTabs[0], + ImportTables( pDlg->GetDocShellTables(), nTabs.size(), nTabs.data(), bLink,nTabNr ); } else @@ -251,7 +251,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } } - ImportTables( pDlg->GetDocShellTables(), nTabs.size(), &nTabs[0], + ImportTables( pDlg->GetDocShellTables(), nTabs.size(), nTabs.data(), bLink,nTabAfter ); } } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 6700b17bed72..af948c513548 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -1033,7 +1033,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings ) } bRet = startShowImpl( Sequence<beans::PropertyValue>( - &aProperties[0], aProperties.size() ) ); + aProperties.data(), aProperties.size() ) ); } diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 3b6fcce7d137..ce32a4139c45 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -130,7 +130,7 @@ static void writeBinaryBuffer( const OutputBuffer& rBuffer ) // put buffer to stderr if( !rBuffer.empty() ) - if( fwrite(&rBuffer[0], sizeof(char), + if( fwrite(rBuffer.data(), sizeof(char), rBuffer.size(), g_binary_out) != static_cast<size_t>(rBuffer.size()) ) exit(1); // error diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx index b5828561b7eb..5131838a996b 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx @@ -224,7 +224,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // begin IDAT chunk for scanline data nIdx = startChunk( "IDAT", o_rOutputBuf ); // compress scanlines - deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf ); + deflateBuffer( aScanlines.data(), aScanlines.size(), o_rOutputBuf ); // end IDAT chunk endChunk( nIdx, o_rOutputBuf ); @@ -308,7 +308,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // begind IDAT chunk for scanline data size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); // compress scanlines - deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf ); + deflateBuffer( aScanlines.data(), aScanlines.size(), o_rOutputBuf ); // end IDAT chunk endChunk( nIdx, o_rOutputBuf ); // output IEND @@ -392,7 +392,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, // begind IDAT chunk for scanline data size_t nIdx = startChunk( "IDAT", o_rOutputBuf ); // compress scanlines - deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf ); + deflateBuffer( aScanlines.data(), aScanlines.size(), o_rOutputBuf ); // end IDAT chunk endChunk( nIdx, o_rOutputBuf ); // output IEND diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 8450baad99b4..85f08134fd5f 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -738,7 +738,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: xSimpleMailMessage->setCcRecipient( aCcRecipientSeq ); } - Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size()); + Sequence< OUString > aAttachmentSeq(maAttachedDocuments.data(),maAttachedDocuments.size()); if ( xSimpleMailMessage->getSubject().isEmpty() ) { INetURLObject url( diff --git a/slideshow/source/engine/activities/activitiesfactory.cxx b/slideshow/source/engine/activities/activitiesfactory.cxx index 261a0c6019cb..ba75b46eb5a1 100644 --- a/slideshow/source/engine/activities/activitiesfactory.cxx +++ b/slideshow/source/engine/activities/activitiesfactory.cxx @@ -709,7 +709,7 @@ AnimationActivitySharedPtr createActivity( // yes, convert them from Sequence< double > aActivityParms.maDiscreteTimes.resize( aKeyTimes.getLength() ); comphelper::sequenceToArray( - &aActivityParms.maDiscreteTimes[0], + aActivityParms.maDiscreteTimes.data(), aKeyTimes ); // saves us some temporary vectors } diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 855063ebc9c0..7248a22b1e35 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -838,7 +838,7 @@ Reference< XInterface > FactoryImpl::createAdapter( } } // map one interface to C++ - uno_Interface * pUnoI = &that->m_vInterfaces[ 0 ]; + uno_Interface * pUnoI = that->m_vInterfaces.data(); m_aUno2Cpp.mapInterface( reinterpret_cast<void **>(&xRet), pUnoI, cppu::UnoType<decltype(xRet)>::get() ); that->release(); diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index ced189a84ad1..9d2a6a1e9382 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -362,7 +362,7 @@ OUString Key::getAsciiValue() static_cast< OWeakObject * >(this)); } std::vector< char > list(size); - err = key_.getValue(OUString(), &list[0]); + err = key_.getValue(OUString(), list.data()); if (err != RegError::NO_ERROR) { throw css::registry::InvalidRegistryException( "com.sun.star.registry.SimpleRegistry key getAsciiValue:" @@ -378,7 +378,7 @@ OUString Key::getAsciiValue() } OUString value; if (!rtl_convertStringToUString( - &value.pData, &list[0], + &value.pData, list.data(), static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8, (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | @@ -539,7 +539,7 @@ OUString Key::getStringValue() static_cast< OWeakObject * >(this)); } std::vector< sal_Unicode > list(size); - err = key_.getValue(OUString(), &list[0]); + err = key_.getValue(OUString(), list.data()); if (err != RegError::NO_ERROR) { throw css::registry::InvalidRegistryException( "com.sun.star.registry.SimpleRegistry key getStringValue:" @@ -553,7 +553,7 @@ OUString Key::getStringValue() " to design error", static_cast< OWeakObject * >(this)); } - return OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1)); + return OUString(list.data(), static_cast< sal_Int32 >(size/2 - 1)); } void Key::setStringValue(OUString const & value) diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 8e39fe9beb8b..0263deacac31 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -2568,7 +2568,7 @@ void Ruler::SetBorders( sal_uInt32 aBorderArraySize, const RulerBorder* pBorderA else { sal_uInt32 i = aBorderArraySize; - const RulerBorder* pAry1 = &mpData->pBorders[0]; + const RulerBorder* pAry1 = mpData->pBorders.data(); const RulerBorder* pAry2 = pBorderArray; while ( i ) { @@ -2609,7 +2609,7 @@ void Ruler::SetIndents( sal_uInt32 aIndentArraySize, const RulerIndent* pIndentA else { sal_uInt32 i = aIndentArraySize; - const RulerIndent* pAry1 = &mpData->pIndents[0]; + const RulerIndent* pAry1 = mpData->pIndents.data(); const RulerIndent* pAry2 = pIndentArray; while ( i ) { diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 5c38179be07e..295bb0cf6e92 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -426,7 +426,7 @@ void FrameSelectorImpl::InitBorderGeometry() aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ); aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Bottom() + mnFocusOffs ); aFocusVec.emplace_back( aRect.Right() - nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ); - maTLBR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) ); + maTLBR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), aFocusVec.data() ) ); aFocusVec.clear(); aFocusVec.emplace_back( aRect.Right() + mnFocusOffs, aRect.Top() + nDiagFocusOffsY ); @@ -435,7 +435,7 @@ void FrameSelectorImpl::InitBorderGeometry() aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ); aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Bottom() + mnFocusOffs ); aFocusVec.emplace_back( aRect.Left() + nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ); - maBLTR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) ); + maBLTR.AddFocusPolygon( tools::Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), aFocusVec.data() ) ); } } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 04cd33c9d327..5975cdb9db43 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -837,7 +837,7 @@ void SvxRuler::UpdateColumns() mpBorders[i].nMinPos = ConvertPosPixel(mxColumnItem->At(i).nEndMin + lAppNullOffset); mpBorders[i].nMaxPos = ConvertPosPixel(mxColumnItem->At(i).nEndMax + lAppNullOffset); } - SetBorders(mxColumnItem->Count() - 1, &mpBorders[0]); + SetBorders(mxColumnItem->Count() - 1, mpBorders.data()); } else { @@ -866,7 +866,7 @@ void SvxRuler::UpdateObject() ConvertPosPixel(mxObjectItem->GetEndY() - nMargin + lAppNullOffset); const sal_uInt16 nOffset = GetObjectBordersOff(0); - SetBorders(2, &mpObjectBorders[0] + nOffset); + SetBorders(2, mpObjectBorders.data() + nOffset); } else { @@ -919,7 +919,7 @@ void SvxRuler::UpdatePara() mpIndents[INDENT_FIRST_LINE].bInvisible = mxParaItem->IsAutoFirst(); - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } else { @@ -1152,7 +1152,7 @@ void SvxRuler::UpdateTabs() mpTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT; ++nTabCount; } - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); DBG_ASSERT(nTabCount + TAB_GAP <= nTabBufSize, "BufferSize too small"); } else @@ -1411,26 +1411,26 @@ void SvxRuler::AdjustMargin1(long lInputDiff) { // Right indent of the old position mpIndents[INDENT_RIGHT_MARGIN].nPos -= lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } if (mxObjectItem) { mpObjectBorders[GetObjectBordersOff(0)].nPos -= lDiff; mpObjectBorders[GetObjectBordersOff(1)].nPos -= lDiff; - SetBorders(2, &mpObjectBorders[0] + GetObjectBordersOff(0)); + SetBorders(2, mpObjectBorders.data() + GetObjectBordersOff(0)); } if (mxColumnItem) { for(sal_uInt16 i = 0; i < mxColumnItem->Count()-1; ++i) mpBorders[i].nPos -= lDiff; - SetBorders(mxColumnItem->Count()-1, &mpBorders[0]); + SetBorders(mxColumnItem->Count()-1, mpBorders.data()); if(mxColumnItem->IsFirstAct()) { // Right indent of the old position if (mxParaItem) { mpIndents[INDENT_RIGHT_MARGIN].nPos -= lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } } else @@ -1440,14 +1440,14 @@ void SvxRuler::AdjustMargin1(long lInputDiff) mpIndents[INDENT_FIRST_LINE].nPos -= lDiff; mpIndents[INDENT_LEFT_MARGIN].nPos -= lDiff; mpIndents[INDENT_RIGHT_MARGIN].nPos -= lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } } if(mxTabStopItem.get() && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL) &&!IsActFirstColumn()) { - ModifyTabs_Impl(nTabCount + TAB_GAP, &mpTabs[0], -lDiff); - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + ModifyTabs_Impl(nTabCount + TAB_GAP, mpTabs.data(), -lDiff); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); } } } @@ -1467,14 +1467,14 @@ void SvxRuler::AdjustMargin1(long lInputDiff) // Left indent of the old position mpIndents[INDENT_FIRST_LINE].nPos += lDiff; mpIndents[INDENT_LEFT_MARGIN].nPos += lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } if (mxColumnItem) { for(sal_uInt16 i = 0; i < mxColumnItem->Count() - 1; ++i) mpBorders[i].nPos += lDiff; - SetBorders(mxColumnItem->Count() - 1, &mpBorders[0]); + SetBorders(mxColumnItem->Count() - 1, mpBorders.data()); if (mxColumnItem->IsFirstAct()) { // Left indent of the old position @@ -1482,7 +1482,7 @@ void SvxRuler::AdjustMargin1(long lInputDiff) { mpIndents[INDENT_FIRST_LINE].nPos += lDiff; mpIndents[INDENT_LEFT_MARGIN].nPos += lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } } else @@ -1492,14 +1492,14 @@ void SvxRuler::AdjustMargin1(long lInputDiff) mpIndents[INDENT_FIRST_LINE].nPos += lDiff; mpIndents[INDENT_LEFT_MARGIN].nPos += lDiff; mpIndents[INDENT_RIGHT_MARGIN].nPos += lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } } } if (mxTabStopItem) { - ModifyTabs_Impl(nTabCount + TAB_GAP, &mpTabs[0], lDiff); - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + ModifyTabs_Impl(nTabCount + TAB_GAP, mpTabs.data(), lDiff); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); } } } @@ -1536,7 +1536,7 @@ void SvxRuler::DragMargin2() if ((!mxColumnItem || IsActLastColumn()) && mxParaItem.get()) { mpIndents[INDENT_FIRST_LINE].nPos += lDiff; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 5 : 7, bHorz); @@ -1569,7 +1569,7 @@ void SvxRuler::DragIndents() mpIndents[nIndex].nPos = aDragPosition; - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); DrawLine_Impl(lTabPos, 1, bHorz); } @@ -1683,7 +1683,7 @@ void SvxRuler::DragTabs() mpTabs[nIdx].nStyle |= RULER_STYLE_INVISIBLE; else mpTabs[nIdx].nStyle &= ~RULER_STYLE_INVISIBLE; - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); } void SvxRuler::SetActive(bool bOn) @@ -1728,12 +1728,12 @@ void SvxRuler::UpdateParaContents_Impl( { mpTabs[i].nPos += lDifference; } - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); } break; } } - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } void SvxRuler::DragBorders() @@ -1953,7 +1953,7 @@ ADD_DEBUG_TEXT("lLastLMargin: ", OUString::number(mxRulerImpl->lLastLMargin)) { UpdateParaContents_Impl(lDiff, UpdateType::MoveLeft); } - SetBorders(mxColumnItem->Count() - 1, &mpBorders[0]); + SetBorders(mxColumnItem->Count() - 1, mpBorders.data()); } void SvxRuler::DragObjectBorder() @@ -1965,7 +1965,7 @@ void SvxRuler::DragObjectBorder() const sal_uInt16 nIdx = GetDragAryPos(); mpObjectBorders[GetObjectBordersOff(nIdx)].nPos = lPosition; - SetBorders(2, &mpObjectBorders[0] + GetObjectBordersOff(0)); + SetBorders(2, mpObjectBorders.data() + GetObjectBordersOff(0)); DrawLine_Impl(lTabPos, 7, bHorz); } @@ -3261,13 +3261,13 @@ void SvxRuler::EndDrag() case RulerType::Indent: // Paragraph indents if(lInitialDragPos != lPos) ApplyIndents(); - SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); + SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); break; case RulerType::Tab: // Tabs { ApplyTabs(); mpTabs[GetDragAryPos()].nStyle &= ~RULER_STYLE_INVISIBLE; - SetTabs(nTabCount, &mpTabs[0] + TAB_GAP); + SetTabs(nTabCount, mpTabs.data() + TAB_GAP); } break; default: diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 9b689c2de116..18c38e3c4882 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -841,7 +841,7 @@ void FmXFormShell::invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatu // and, last but not least, SFX wants the ids to be sorted ::std::sort( aSlotIds.begin(), aSlotIds.end() - 1 ); - sal_uInt16 *pSlotIds = &(aSlotIds[0]); + sal_uInt16 *pSlotIds = aSlotIds.data(); m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( pSlotIds ); } } diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx index 643a4879d907..ea707762eead 100644 --- a/svx/source/table/propertyset.cxx +++ b/svx/source/table/propertyset.cxx @@ -74,7 +74,7 @@ const Property* FastPropertySetInfo::hasProperty( const OUString& aName ) Sequence< Property > SAL_CALL FastPropertySetInfo::getProperties() { - return Sequence< Property >( &maProperties[0], maProperties.size() ); + return Sequence< Property >( maProperties.data(), maProperties.size() ); } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index e62262d6db5f..d7b9b0f71561 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -3068,7 +3068,7 @@ uno::Sequence<uno::Any> SvxShape::getPropertyDefaults( ret.reserve(aPropertyNames.getLength()); for (sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos) ret.push_back( getPropertyDefault( aPropertyNames[pos] ) ); - return uno::Sequence<uno::Any>( &ret[0], ret.size() ); + return uno::Sequence<uno::Any>( ret.data(), ret.size() ); } diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 25894d35ff02..e46f0d9aa5f7 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1296,28 +1296,28 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, LgstCommonSubseq aSeq( aCmp ); - nLcsLen = aSeq.Find( &aTmpLcsDst[0], &aTmpLcsSrc[0] ); + nLcsLen = aSeq.Find( aTmpLcsDst.data(), aTmpLcsSrc.data() ); if( CmpOptions.nIgnoreLen ) { - nLcsLen = CommonSubseq::IgnoreIsolatedPieces( &aTmpLcsDst[0], &aTmpLcsSrc[0], + nLcsLen = CommonSubseq::IgnoreIsolatedPieces( aTmpLcsDst.data(), aTmpLcsSrc.data(), aCmp.GetLen1(), aCmp.GetLen2(), nLcsLen, CmpOptions.nIgnoreLen ); } - nLcsLen = aCmp.GetCharSequence( &aTmpLcsDst[0], &aTmpLcsSrc[0], - &aLcsDst[0], &aLcsSrc[0], nLcsLen ); + nLcsLen = aCmp.GetCharSequence( aTmpLcsDst.data(), aTmpLcsSrc.data(), + aLcsDst.data(), aLcsSrc.data(), nLcsLen ); } else { CharArrayComparator aCmp( &rDstNd, &rSrcNd ); LgstCommonSubseq aSeq( aCmp ); - nLcsLen = aSeq.Find( &aLcsDst[0], &aLcsSrc[0] ); + nLcsLen = aSeq.Find( aLcsDst.data(), aLcsSrc.data() ); if( CmpOptions.nIgnoreLen ) { - nLcsLen = CommonSubseq::IgnoreIsolatedPieces( &aLcsDst[0], &aLcsSrc[0], nDstLen, + nLcsLen = CommonSubseq::IgnoreIsolatedPieces( aLcsDst.data(), aLcsSrc.data(), nDstLen, nSrcLen, nLcsLen, CmpOptions.nIgnoreLen ); } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index d1e1cb6c1873..392bb4fc5008 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1854,7 +1854,7 @@ void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet whichIds.push_back(pItem->Which()); } whichIds.push_back(0); - SfxItemSet currentSet(GetAttrPool(), &whichIds[0]); + SfxItemSet currentSet(GetAttrPool(), whichIds.data()); pTNd->GetParaAttr(currentSet, nEnd, nEnd); for (size_t i = 0; whichIds[i]; i += 2) { // yuk - want to explicitly set the pool defaults too :-/ diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index c0d70801e691..6b6c063d114b 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1249,7 +1249,7 @@ void makeRedline( SwPaM const & rPaM, if (!aWhichPairs.empty()) { aWhichPairs.push_back(0); // terminate - SfxItemSet aItemSet(pDoc->GetAttrPool(), &aWhichPairs[0]); + SfxItemSet aItemSet(pDoc->GetAttrPool(), aWhichPairs.data()); for (size_t i = 0; i < aEntries.size(); ++i) { diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 913151c84710..bb3bf2d0f700 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1820,7 +1820,7 @@ void SwUnoCursorHelper::SetPropertyValues( if (!aWhichPairs.empty()) { aWhichPairs.push_back(0); // terminate - SfxItemSet aItemSet(pDoc->GetAttrPool(), &aWhichPairs[0]); + SfxItemSet aItemSet(pDoc->GetAttrPool(), aWhichPairs.data()); // Fetch, overwrite, and re-set the attributes from the core diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 11aba0a854c8..b956bb401a9e 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -737,7 +737,7 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL, if( pWhichIds && nWhichIds ) BuildWhichTable( aWhichMap, pWhichIds, nWhichIds ); - pSheetItemSet.reset( new SfxItemSet( rPool, &aWhichMap[0] ) ); + pSheetItemSet.reset( new SfxItemSet( rPool, aWhichMap.data() ) ); pSheetPropInfo.reset( new SvxCSS1PropertyInfo ); } diff --git a/toolkit/source/controls/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx index 81abaedff2b8..ce390e0fd2a5 100644 --- a/toolkit/source/controls/spinningprogress.cxx +++ b/toolkit/source/controls/spinningprogress.cxx @@ -70,7 +70,7 @@ protected: for ( size_t i=0; i < SAL_N_ELEMENTS(aImageSets); ++i ) { const ::std::vector< OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) ); - const Sequence< OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() ); + const Sequence< OUString > aImageURLs( aDefaultURLs.data(), aDefaultURLs.size() ); insertImageSet( i, aImageURLs ); } } diff --git a/tools/qa/cppunit/test_reversemap.cxx b/tools/qa/cppunit/test_reversemap.cxx index 7116688a843c..04ed1741d211 100644 --- a/tools/qa/cppunit/test_reversemap.cxx +++ b/tools/qa/cppunit/test_reversemap.cxx @@ -61,7 +61,7 @@ namespace //Some slots are unused, so don't map to private, just set them to 'X' sal_uInt32 const convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS ^ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE; - OUString sOrigText(&aAllChars[0], aAllChars.size(), eEncoding, convertFlags); + OUString sOrigText(aAllChars.data(), aAllChars.size(), eEncoding, convertFlags); sOrigText = sOrigText.replace( 0xfffd, 'X' ); //Should clearly be equal diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx index ac133319a63d..35ebf8d417ce 100644 --- a/unoidl/source/legacyprovider.cxx +++ b/unoidl/source/legacyprovider.cxx @@ -188,14 +188,14 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) { + " of key " + key.getName())); } buffer->resize(static_cast< std::vector< char >::size_type >(size)); - e = key.getValue("", &(*buffer)[0]); + e = key.getValue("", buffer->data()); if (e != RegError::NO_ERROR) { throw FileFormatException( key.getRegistryName(), ("legacy format: cannot get binary value of key " + key.getName() + ": " + OUString::number(static_cast<int>(e)))); } - typereg::Reader reader(&(*buffer)[0], size); + typereg::Reader reader(buffer->data(), size); if (!reader.isValid()) { throw FileFormatException( key.getRegistryName(), diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index a073ab67158d..a388bf941672 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -507,7 +507,7 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent) const QList<QInputMethodEvent::Attribute>& rAttrList = pEvent->attributes(); std::vector<ExtTextInputAttr> aTextAttrs(std::max(sal_Int32(1), nLength), ExtTextInputAttr::NONE); - aInputEvent.mpTextAttr = &aTextAttrs[0]; + aInputEvent.mpTextAttr = aTextAttrs.data(); for (int i = 0; i < rAttrList.size(); ++i) { diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index b5090fafecdc..1307f31817bf 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1598,7 +1598,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, if(nStreamLength > 0) { std::vector<sal_uInt8> aTwoBytes(2); - rIStream.ReadBytes(&aTwoBytes[0], 2); + rIStream.ReadBytes(aTwoBytes.data(), 2); rIStream.Seek(nStreamPosition); if(aTwoBytes[0] == 0x1F && aTwoBytes[1] == 0x8B) @@ -2082,7 +2082,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r if ( nChunkLen ) { aChunkData.aData.resize( nChunkLen ); - memcpy( &aChunkData.aData[ 0 ], aByteSeq.getConstArray(), nChunkLen ); + memcpy( aChunkData.aData.data(), aByteSeq.getConstArray(), nChunkLen ); } std::vector< vcl::PNGWriter::ChunkData >::iterator aIter = rChunkData.end() - 1; rChunkData.insert( aIter, aChunkData ); diff --git a/vcl/source/filter/png/pngread.cxx b/vcl/source/filter/png/pngread.cxx index 4107325bf7a9..302491edc064 100644 --- a/vcl/source/filter/png/pngread.cxx +++ b/vcl/source/filter/png/pngread.cxx @@ -301,7 +301,7 @@ bool PNGReaderImpl::ReadNextChunk() nBytesRead += mrPNGStream.ReadBytes(&rPtr, mnChunkLen - nBytesRead); } while (nBytesRead < mnChunkLen && mrPNGStream.good()); - nCRC32 = rtl_crc32( nCRC32, &rChunkData.aData[ 0 ], mnChunkLen ); + nCRC32 = rtl_crc32( nCRC32, rChunkData.aData.data(), mnChunkLen ); maDataIter = rChunkData.aData.begin(); } sal_uInt32 nCheck(0); diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 7df64e41a227..613cf79f9734 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -640,7 +640,7 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo pa = static_cast<ControlPoint*>(calloc(np, sizeof(ControlPoint))); assert(pa != nullptr); - memcpy(pa, &myPoints[0], np * sizeof(ControlPoint)); + memcpy(pa, myPoints.data(), np * sizeof(ControlPoint)); *pointArray = pa; } @@ -813,7 +813,7 @@ static int BSplineToPSPath(ControlPoint const *srcA, int srcCount, PSPathElement { *path = static_cast<PSPathElement*>(calloc(nPathCount, sizeof(PSPathElement))); assert(*path != nullptr); - memcpy( *path, &aPathList[0], nPathCount * sizeof(PSPathElement) ); + memcpy( *path, aPathList.data(), nPathCount * sizeof(PSPathElement) ); } return nPathCount; diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 2a64944d12bf..672e5d3c2fb8 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -113,7 +113,7 @@ bool EmbeddedFontsHelper::addEmbeddedFont( const uno::Reference< io::XInputStrea unsigned char *nakedPointerToUncompressedFont = nullptr; libeot::EOTMetadata eotMetadata; libeot::EOTError uncompressError = - libeot::EOT2ttf_buffer( reinterpret_cast<unsigned char *>(&fontData[0]), fontData.size(), &eotMetadata, &nakedPointerToUncompressedFont, &uncompressedFontSize ); + libeot::EOT2ttf_buffer( reinterpret_cast<unsigned char *>(fontData.data()), fontData.size(), &eotMetadata, &nakedPointerToUncompressedFont, &uncompressedFontSize ); std::shared_ptr<unsigned char> uncompressedFont( nakedPointerToUncompressedFont, libeot::EOTfreeBuffer ); if( uncompressError != libeot::EOT_SUCCESS ) { diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx index b683015fe5a5..3706df0b1a62 100644 --- a/vcl/unx/generic/app/i18n_cb.cxx +++ b/vcl/unx/generic/app/i18n_cb.cxx @@ -256,7 +256,7 @@ Preedit_FeedbackToSAL ( const XIMFeedback* pfeedback, int nlength, std::vector<E if (nlength > 0 && nlength > sal::static_int_cast<int>(rSalAttr.size()) ) { rSalAttr.reserve( nlength ); - psalattr = &rSalAttr[0]; + psalattr = rSalAttr.data(); } else return nullptr; diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index ad7f408748b2..71f5ce6f604e 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -614,7 +614,7 @@ SalI18N_InputContext::EndExtTextInput() if( ! aDel.isDeleted() ) { // mark previous preedit state again (will e.g. be sent at focus gain) - maClientData.aInputEv.mpTextAttr = &maClientData.aInputFlags[0]; + maClientData.aInputEv.mpTextAttr = maClientData.aInputFlags.data(); if( static_cast<X11SalFrame*>(maClientData.pFrame)->hasFocus() ) { // begin preedit again diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index baeaadc3541a..b1f73db275ea 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -1151,10 +1151,10 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo sal_uInt64 nBytesRead = 0; do { - osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead ); + osl_readFile( pFile, buffer.data(), buffer.size(), &nBytesRead ); if( nBytesRead > 0 ) { - size_t nBytesWritten = fwrite(&buffer[0], 1, nBytesRead, fp); + size_t nBytesWritten = fwrite(buffer.data(), 1, nBytesRead, fp); OSL_ENSURE(nBytesRead == nBytesWritten, "short write"); if (nBytesRead != nBytesWritten) break; diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx index 522bb06f99c6..17555d7baf07 100644 --- a/vcl/unx/generic/print/glyphset.cxx +++ b/vcl/unx/generic/print/glyphset.cxx @@ -233,7 +233,7 @@ static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, aInfo.LoadFont( pSrcFont ); aInfo.CreateFontSubset( nTargetMask, pTmpFile, pGlyphSetName, - &aRequestedGlyphs[0], aEncoding.data(), nGlyphCount ); + aRequestedGlyphs.data(), aEncoding.data(), nGlyphCount ); } void |