basegfx/source/polygon/b2dpolypolygon.cxx | 16 +++---- basegfx/source/polygon/b3dpolypolygon.cxx | 16 +++---- hwpfilter/qa/cppunit/data/fail/skipblock-1.hwp |binary hwpfilter/qa/cppunit/test_hwpfilter.cxx | 16 +------ include/oox/helper/binaryinputstream.hxx | 2 include/oox/helper/containerhelper.hxx | 2 oox/source/dump/dumperbase.cxx | 4 - oox/source/helper/binaryinputstream.cxx | 2 oox/source/ole/vbainputstream.cxx | 2 sc/source/filter/excel/excimp8.cxx | 2 sc/source/filter/excel/xiescher.cxx | 4 - sc/source/filter/excel/xistream.cxx | 8 +-- sc/source/filter/excel/xlformula.cxx | 6 +- sc/source/filter/inc/fapihelper.hxx | 2 sc/source/filter/inc/xlformula.hxx | 2 sc/source/filter/oox/biffcodec.cxx | 6 +- sd/source/ui/remotecontrol/BluetoothServer.cxx | 2 sdext/source/presenter/PresenterAccessibility.cxx | 2 sfx2/source/doc/oleprops.cxx | 6 +- sfx2/source/sidebar/Theme.cxx | 2 sw/source/core/layout/atrfrm.cxx | 49 ++++++++++------------ sw/source/filter/ww8/wrtw8sty.cxx | 6 +- sw/source/filter/ww8/ww8par.cxx | 12 ++--- sw/source/uibase/dochdl/gloshdl.cxx | 12 ++--- vcl/source/control/tabctrl.cxx | 16 +++---- vcl/source/gdi/dibtools.cxx | 4 - vcl/source/gdi/embeddedfontshelper.cxx | 2 vcl/unx/generic/window/salframe.cxx | 4 - 28 files changed, 98 insertions(+), 109 deletions(-)
New commits: commit 3cc3dc176e00062d8395d9f3d83b49ab24542a61 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Feb 24 15:16:27 2017 +0000 hwpfilter needs a new filter for each document setUp is called just once at the start of the sequence of loads so we're reusing the previous import state which isn't what this filter expects This reverts commit 0af436083e12516eb9251d4cc6f594f80ed06d3d. Change-Id: Iae355ed6099086fd3cc1c79203786017507d4ed4 diff --git a/hwpfilter/qa/cppunit/data/fail/skipblock-1.hwp b/hwpfilter/qa/cppunit/data/fail/skipblock-1.hwp new file mode 100644 index 0000000..8fd8e7a Binary files /dev/null and b/hwpfilter/qa/cppunit/data/fail/skipblock-1.hwp differ diff --git a/hwpfilter/qa/cppunit/test_hwpfilter.cxx b/hwpfilter/qa/cppunit/test_hwpfilter.cxx index f497d12..040c98e 100644 --- a/hwpfilter/qa/cppunit/test_hwpfilter.cxx +++ b/hwpfilter/qa/cppunit/test_hwpfilter.cxx @@ -24,7 +24,6 @@ namespace , public test::BootstrapFixture { public: - virtual void setUp() override; virtual bool load(const OUString &, const OUString &rURL, const OUString &, @@ -35,26 +34,19 @@ namespace CPPUNIT_TEST_SUITE(HwpFilterTest); CPPUNIT_TEST(test); CPPUNIT_TEST_SUITE_END(); - private: - uno::Reference<document::XFilter> m_xFilter; }; - void HwpFilterTest::setUp() - { - test::BootstrapFixture::setUp(); - - m_xFilter.set(m_xSFactory->createInstance("com.sun.comp.hwpimport.HwpImportFilter"), - uno::UNO_QUERY_THROW); - } - bool HwpFilterTest::load(const OUString &, const OUString &rURL, const OUString &, SfxFilterFlags, SotClipboardFormatId, unsigned int) { + uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.comp.hwpimport.HwpImportFilter"), + uno::UNO_QUERY_THROW); + uno::Sequence< beans::PropertyValue > aDescriptor(1); aDescriptor[0].Name = "URL"; aDescriptor[0].Value <<= rURL; - return m_xFilter->filter(aDescriptor); + return xFilter->filter(aDescriptor); } void HwpFilterTest::test() commit 3a74745367a73ed9351379fc32bbe9253cdae697 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Feb 24 14:09:52 2017 +0000 vector::data seems more natural than &vector::front Change-Id: I0ce48075ad186cf1f9bd3e13fa76269fa9819af1 diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index f1032f1..9c6b1eb 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -137,34 +137,34 @@ public: const basegfx::B2DPolygon* begin() const { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &maPolygons.front(); + return maPolygons.data(); } const basegfx::B2DPolygon* end() const { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return (&maPolygons.back())+1; + return maPolygons.data() + maPolygons.size(); } basegfx::B2DPolygon* begin() { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &maPolygons.front(); + return maPolygons.data(); } basegfx::B2DPolygon* end() { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &(maPolygons.back())+1; + return maPolygons.data() + maPolygons.size(); } }; diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index 74c8b83..9aa8c78 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -155,34 +155,34 @@ public: const basegfx::B3DPolygon* begin() const { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &maPolygons.front(); + return maPolygons.data(); } const basegfx::B3DPolygon* end() const { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return (&maPolygons.back())+1; + return maPolygons.data() + maPolygons.size(); } basegfx::B3DPolygon* begin() { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &maPolygons.front(); + return maPolygons.data(); } basegfx::B3DPolygon* end() { - if(maPolygons.empty()) + if (maPolygons.empty()) return nullptr; else - return &(maPolygons.back())+1; + return maPolygons.data() + maPolygons.size(); } }; diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx index bbc2550..d83b8c9 100644 --- a/include/oox/helper/binaryinputstream.hxx +++ b/include/oox/helper/binaryinputstream.hxx @@ -242,7 +242,7 @@ template< typename Type > sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount ) { orVector.resize( static_cast< size_t >( nElemCount ) ); - return orVector.empty() ? 0 : readArray( &orVector.front(), nElemCount ); + return orVector.empty() ? 0 : readArray(orVector.data(), nElemCount); } diff --git a/include/oox/helper/containerhelper.hxx b/include/oox/helper/containerhelper.hxx index 9c0632a..a5cd966 100644 --- a/include/oox/helper/containerhelper.hxx +++ b/include/oox/helper/containerhelper.hxx @@ -293,7 +293,7 @@ template< typename VectorType > typedef typename VectorType::value_type ValueType; if( rVector.empty() ) return css::uno::Sequence< ValueType >(); - return css::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); + return css::uno::Sequence<ValueType>(rVector.data(), static_cast<sal_Int32>(rVector.size())); } template< typename MatrixType > diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 373e665..a4fca11 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -2144,9 +2144,9 @@ OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rt if( nDumpSize > 0 ) { ::std::vector< sal_Char > aBuffer( static_cast< std::size_t >( nLen ) + 1 ); - sal_Int32 nCharsRead = mxStrm->readMemory( &aBuffer.front(), nLen ); + sal_Int32 nCharsRead = mxStrm->readMemory(aBuffer.data(), nLen); aBuffer[ nCharsRead ] = 0; - aString = OStringToOUString( OString( &aBuffer.front() ), eTextEnc ); + aString = OStringToOUString(OString(aBuffer.data()), eTextEnc); } if( bHideTrailingNul ) aString = StringHelper::trimTrailingNul( aString ); diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx index e3f300a..5a568dc 100644 --- a/oox/source/helper/binaryinputstream.cxx +++ b/oox/source/helper/binaryinputstream.cxx @@ -66,7 +66,7 @@ OString BinaryInputStream::readCharArray( sal_Int32 nChars, bool bAllowNulChars if( !bAllowNulChars ) ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' ); - return OString( reinterpret_cast< sal_Char* >( &aBuffer.front() ), nCharsRead ); + return OString(reinterpret_cast<sal_Char*>(aBuffer.data()), nCharsRead); } OUString BinaryInputStream::readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars ) diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx index e3c5452..0e9262c 100644 --- a/oox/source/ole/vbainputstream.cxx +++ b/oox/source/ole/vbainputstream.cxx @@ -194,7 +194,7 @@ bool VbaInputStream::updateChunk() else { maChunk.resize( nChunkLen ); - mpInStrm->readMemory( &maChunk.front(), nChunkLen ); + mpInStrm->readMemory(maChunk.data(), nChunkLen); } // decompression sometimes leaves the stream pos offset 1 place ( at // least ) past or before the expected stream pos. diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index a0fed54..959b8b0 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -352,7 +352,7 @@ void ImportExcel8::Feat() sal_uInt32 nCbSD = aIn.ReaduInt32(); // TODO: could here be some sanity check applied to not allocate 4GB? aProt.maSecurityDescriptor.resize( nCbSD); - std::size_t nRead = aIn.Read( &aProt.maSecurityDescriptor.front(), nCbSD); + std::size_t nRead = aIn.Read(aProt.maSecurityDescriptor.data(), nCbSD); if (nRead < nCbSD) aProt.maSecurityDescriptor.resize( nRead); } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 350324b..b70b3b9 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2720,7 +2720,7 @@ void XclImpListBoxObj::DoProcessControl( ScfPropertySet& rPropSet ) const if( !aSelVec.empty() ) { - Sequence< sal_Int16 > aSelSeq( &aSelVec.front(), static_cast< sal_Int32 >( aSelVec.size() ) ); + Sequence<sal_Int16> aSelSeq(aSelVec.data(), static_cast<sal_Int32>(aSelVec.size())); rPropSet.SetProperty( "DefaultSelection", aSelSeq ); } } @@ -3669,7 +3669,7 @@ OUString XclImpDffConverter::ReadHlinkProperty( SvStream& rDffStrm ) const // copy from DFF stream to memory stream ::std::vector< sal_uInt8 > aBuffer( nBufferSize ); - sal_uInt8* pnData = &aBuffer.front(); + sal_uInt8* pnData = aBuffer.data(); if (rDffStrm.ReadBytes(pnData, nBufferSize) == nBufferSize) { aMemStream.WriteBytes(pnData, nBufferSize); diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 6c350e4..a3dbf8a 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -151,7 +151,7 @@ uno::Sequence< beans::NamedValue > XclImpBiff5Decrypter::OnVerifyPassword( const OSL_ENSURE( aDocId.getLength() == 16, "Unexpected length of the sequence!" ); ::msfilter::MSCodec_Std97 aCodec97; - aCodec97.InitKey( &aPassVect.front(), reinterpret_cast<sal_uInt8 const *>(aDocId.getConstArray()) ); + aCodec97.InitKey(aPassVect.data(), reinterpret_cast<sal_uInt8 const *>(aDocId.getConstArray())); // merge the EncryptionData, there should be no conflicts ::comphelper::SequenceAsHashMap aEncryptionHash( maEncryptionData ); @@ -254,8 +254,8 @@ uno::Sequence< beans::NamedValue > XclImpBiff8Decrypter::OnVerifyPassword( const *aIt = static_cast< sal_uInt16 >( *pcChar ); // init codec - mpCodec->InitKey( &aPassVect.front(), &maSalt.front() ); - if ( mpCodec->VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + mpCodec->InitKey(aPassVect.data(), maSalt.data()); + if (mpCodec->VerifyKey(maVerifier.data(), maVerifierHash.data())) maEncryptionData = mpCodec->GetEncryptionData(); } @@ -271,7 +271,7 @@ bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N // init codec mpCodec->InitCodec( rEncryptionData ); - if ( mpCodec->VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + if (mpCodec->VerifyKey(maVerifier.data(), maVerifierHash.data())) maEncryptionData = rEncryptionData; } diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index e98fea7..684ce56 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -739,7 +739,7 @@ void XclTokenArray::ReadSize( XclImpStream& rStrm ) void XclTokenArray::ReadArray( XclImpStream& rStrm ) { if( !maTokVec.empty() ) - rStrm.Read( &maTokVec.front(), GetSize() ); + rStrm.Read(maTokVec.data(), GetSize()); } void XclTokenArray::Read( XclImpStream& rStrm ) @@ -756,9 +756,9 @@ void XclTokenArray::WriteSize( XclExpStream& rStrm ) const void XclTokenArray::WriteArray( XclExpStream& rStrm ) const { if( !maTokVec.empty() ) - rStrm.Write( &maTokVec.front(), GetSize() ); + rStrm.Write(maTokVec.data(), GetSize()); if( !maExtDataVec.empty() ) - rStrm.Write( &maExtDataVec.front(), maExtDataVec.size() ); + rStrm.Write(maExtDataVec.data(), maExtDataVec.size()); } void XclTokenArray::Write( XclExpStream& rStrm ) const diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx index edde1c4..649c8ac 100644 --- a/sc/source/filter/inc/fapihelper.hxx +++ b/sc/source/filter/inc/fapihelper.hxx @@ -89,7 +89,7 @@ template< typename Type > css::uno::Sequence< Type > ScfApiHelper::VectorToSequence( const ::std::vector< Type >& rVector ) { OSL_ENSURE( !rVector.empty(), "ScfApiHelper::VectorToSequence - vector is empty" ); - return css::uno::Sequence< Type >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); + return css::uno::Sequence<Type>(rVector.data(), static_cast< sal_Int32 >(rVector.size())); } // Property sets ============================================================== diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx index a5e9f95..a0fcc25 100644 --- a/sc/source/filter/inc/xlformula.hxx +++ b/sc/source/filter/inc/xlformula.hxx @@ -387,7 +387,7 @@ public: /** Returns the size of the token array in bytes. */ sal_uInt16 GetSize() const; /** Returns read-only access to the byte vector storing token data. */ - inline const sal_uInt8* GetData() const { return maTokVec.empty() ? nullptr : &maTokVec.front(); } + inline const sal_uInt8* GetData() const { return maTokVec.empty() ? nullptr : maTokVec.data(); } /** Returns true, if the formula contains a volatile function. */ inline bool IsVolatile() const { return mbVolatile; } diff --git a/sc/source/filter/oox/biffcodec.cxx b/sc/source/filter/oox/biffcodec.cxx index 4cfb84e..2f490f2 100644 --- a/sc/source/filter/oox/biffcodec.cxx +++ b/sc/source/filter/oox/biffcodec.cxx @@ -127,8 +127,8 @@ Sequence< NamedValue > BiffDecoder_RCF::implVerifyPassword( const OUString& rPas *aIt = static_cast< sal_uInt16 >( *pcChar ); // init codec - maCodec.initKey( &aPassVect.front(), &maSalt.front() ); - if( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maCodec.initKey(aPassVect.data(), maSalt.data()); + if (maCodec.verifyKey(maVerifier.data(), maVerifierHash.data())) maEncryptionData = maCodec.getEncryptionData(); } @@ -144,7 +144,7 @@ bool BiffDecoder_RCF::implVerifyEncryptionData( const Sequence< NamedValue >& rE // init codec maCodec.initCodec( rEncryptionData ); - if( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + if (maCodec.verifyKey(maVerifier.data(), maVerifierHash.data())) maEncryptionData = rEncryptionData; } diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index be1534d..9662e61 100644 --- a/sd/source/ui/remotecontrol/BluetoothServer.cxx +++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx @@ -461,7 +461,7 @@ sal_Int32 OSXBluetoothWrapper::readLine( OString& aLine ) std::ostringstream s; if (mBuffer.size() > 0) { - for (unsigned char *p = reinterpret_cast<unsigned char *>(&mBuffer.front()); p != reinterpret_cast<unsigned char *>(&mBuffer.front()) + mBuffer.size(); p++) + for (unsigned char *p = reinterpret_cast<unsigned char *>(mBuffer.data()); p != reinterpret_cast<unsigned char *>(mBuffer.data()) + mBuffer.size(); p++) { if (*p == '\n') s << "\\n"; diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index 044d0fc..3dd042d 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -1289,7 +1289,7 @@ css::uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSet::getStates() for (sal_uInt16 nIndex=0; nIndex<sizeof(mnStateSet)*8; ++nIndex) if ((mnStateSet & GetStateMask(nIndex)) != 0) aStates.push_back(nIndex); - return Sequence<sal_Int16>(&aStates.front(), aStates.size()); + return Sequence<sal_Int16>(aStates.data(), aStates.size()); } //===== AccessibleRelationSet ================================================= diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 8cf5f31..6866aa4 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -277,9 +277,9 @@ OUString SfxOleStringHelper::ImplLoadString8( SvStream& rStrm ) const { // load character buffer ::std::vector< sal_Char > aBuffer( static_cast< size_t >( nSize + 1 ), 0 ); - rStrm.ReadBytes(&aBuffer.front(), static_cast<std::size_t>(nSize)); + rStrm.ReadBytes(aBuffer.data(), static_cast<std::size_t>(nSize)); // create string from encoded character array - aValue = OUString( &aBuffer.front(), strlen( &aBuffer.front() ), GetTextEncoding() ); + aValue = OUString(aBuffer.data(), strlen(aBuffer.data()), GetTextEncoding()); } return aValue; } @@ -308,7 +308,7 @@ OUString SfxOleStringHelper::ImplLoadString16( SvStream& rStrm ) rStrm.SeekRel( 2 ); // create string from character array aBuffer.push_back( 0 ); - aValue = OUString( &aBuffer.front() ); + aValue = OUString(aBuffer.data()); } return aValue; } diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx index 097e4df..706a498 100644 --- a/sfx2/source/sidebar/Theme.cxx +++ b/sfx2/source/sidebar/Theme.cxx @@ -568,7 +568,7 @@ css::uno::Sequence<css::beans::Property> SAL_CALL Theme::getProperties() } return css::uno::Sequence<css::beans::Property>( - &aProperties.front(), + aProperties.data(), aProperties.size()); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 1b420b7..7b16eaa 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -918,15 +918,15 @@ void SwFormatCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct ) else { sal_uInt16 nHalf = nNew / 2; - for ( size_t i = 0; i < m_aColumns.size(); ++i ) + for (size_t i = 0; i < m_aColumns.size(); ++i) { - SwColumn *pCol = &m_aColumns[i]; - pCol->SetLeft ( nHalf ); - pCol->SetRight( nHalf ); + SwColumn &rCol = m_aColumns[i]; + rCol.SetLeft(nHalf); + rCol.SetRight(nHalf); if ( i == 0 ) - pCol->SetLeft( 0 ); + rCol.SetLeft(0); else if ( i+1 == m_aColumns.size() ) - pCol->SetRight( 0 ); + rCol.SetRight(0); } } } @@ -992,42 +992,41 @@ void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) (nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols(); sal_uInt16 nAvail = nAct; - //The fist column is PrtWidth + (gap width / 2) + //The first column is PrtWidth + (gap width / 2) const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf; - SwColumn *pCol = &m_aColumns.front(); - pCol->SetWishWidth( nLeftWidth ); - pCol->SetRight( nGutterHalf ); - pCol->SetLeft ( 0 ); + SwColumn &rFirstCol = m_aColumns.front(); + rFirstCol.SetWishWidth(nLeftWidth); + rFirstCol.SetRight(nGutterHalf); + rFirstCol.SetLeft(0); nAvail = nAvail - nLeftWidth; //Column 2 to n-1 is PrtWidth + gap width const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth; - sal_uInt16 i; - for ( i = 1; i < GetNumCols()-1; ++i ) + for (sal_uInt16 i = 1; i < GetNumCols()-1; ++i) { - pCol = &m_aColumns[i]; - pCol->SetWishWidth( nMidWidth ); - pCol->SetLeft ( nGutterHalf ); - pCol->SetRight( nGutterHalf ); + SwColumn &rCol = m_aColumns[i]; + rCol.SetWishWidth(nMidWidth); + rCol.SetLeft(nGutterHalf); + rCol.SetRight(nGutterHalf); nAvail = nAvail - nMidWidth; } //The last column is equivalent to the first one - to compensate rounding //errors we add the remaining space of the other columns to the last one. - pCol = &m_aColumns.back(); - pCol->SetWishWidth( nAvail ); - pCol->SetLeft ( nGutterHalf ); - pCol->SetRight( 0 ); + SwColumn &rLastCol = m_aColumns.back(); + rLastCol.SetWishWidth(nAvail); + rLastCol.SetLeft(nGutterHalf); + rLastCol.SetRight(0); //Convert the current width to the requested width. - for ( i = 0; i < m_aColumns.size(); ++i ) + for (sal_uInt16 i = 0; i < m_aColumns.size(); ++i) { - pCol = &m_aColumns[i]; - long nTmp = pCol->GetWishWidth(); + SwColumn &rCol = m_aColumns[i]; + long nTmp = rCol.GetWishWidth(); nTmp *= GetWishWidth(); nTmp /= nAct; - pCol->SetWishWidth( sal_uInt16(nTmp) ); + rCol.SetWishWidth(sal_uInt16(nTmp)); } } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 2dea97d..374f58d 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -387,9 +387,9 @@ void WW8AttributeOutput::EndStyle() impl_SkipOdd( m_rWW8Export.pO, m_rWW8Export.pTableStrm->Tell() ); short nLen = m_rWW8Export.pO->size() - 2; // length of the style - sal_uInt8* p = &m_rWW8Export.pO->front() + nPOPosStdLen1; + sal_uInt8* p = m_rWW8Export.pO->data() + nPOPosStdLen1; ShortToSVBT16( nLen, p ); // nachtragen - p = &m_rWW8Export.pO->front() + nPOPosStdLen2; + p = m_rWW8Export.pO->data() + nPOPosStdLen2; ShortToSVBT16( nLen, p ); // dito m_rWW8Export.pTableStrm->WriteBytes(m_rWW8Export.pO->data(), m_rWW8Export.pO->size()); @@ -538,7 +538,7 @@ void MSWordStyles::WriteProperties( const SwFormat* pFormat, bool bParProp, sal_ void WW8AttributeOutput::EndStyleProperties( bool /*bParProp*/ ) { sal_uInt16 nLen = m_rWW8Export.pO->size() - m_nStyleStartSize; - sal_uInt8* pUpxLen = &m_rWW8Export.pO->front() + m_nStyleLenPos; // Laenge zum Nachtragen + sal_uInt8* pUpxLen = m_rWW8Export.pO->data() + m_nStyleLenPos; // Laenge zum Nachtragen ShortToSVBT16( nLen, pUpxLen ); // add default length } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 5268fbd..2a6470d 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1186,14 +1186,14 @@ void TabControl::ImplPaint(vcl::RenderContext& rRenderContext, const Rectangle& // overlapped on the left side. Other toolkits ignore this option. if (bDrawTabsRTL) { - pFirstTab = &mpTabCtrlData->maItemList.front(); - pLastTab = &mpTabCtrlData->maItemList.back(); + pFirstTab = mpTabCtrlData->maItemList.data(); + pLastTab = pFirstTab + mpTabCtrlData->maItemList.size(); idx = mpTabCtrlData->maItemList.size() - 1; } else { - pLastTab = &mpTabCtrlData->maItemList.back(); - pFirstTab = &mpTabCtrlData->maItemList.front(); + pLastTab = mpTabCtrlData->maItemList.data(); + pFirstTab = pLastTab + mpTabCtrlData->maItemList.size(); idx = 0; } @@ -2642,14 +2642,14 @@ void NotebookbarTabControl::ImplPaint(vcl::RenderContext& rRenderContext, const // overlapped on the left side. Other toolkits ignore this option. if (bDrawTabsRTL) { - pFirstTab = &mpTabCtrlData->maItemList.front(); - pLastTab = &mpTabCtrlData->maItemList.back(); + pFirstTab = mpTabCtrlData->maItemList.data(); + pLastTab = pFirstTab + mpTabCtrlData->maItemList.size(); idx = mpTabCtrlData->maItemList.size() - 1; } else { - pLastTab = &mpTabCtrlData->maItemList.back(); - pFirstTab = &mpTabCtrlData->maItemList.front(); + pLastTab = mpTabCtrlData->maItemList.data(); + pFirstTab = pLastTab + mpTabCtrlData->maItemList.size(); idx = 0; } diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index b17897a..89abf96 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -819,7 +819,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_u const size_t nToRead(std::min<size_t>(nUncodedSize - nDataPos, aData.size() - nDataPos)); assert(nToRead > 0); assert(!aData.empty()); - const long nRead = aCodec.Read(rIStm, &aData.front() + nDataPos, sal_uInt32(nToRead)); + const long nRead = aCodec.Read(rIStm, aData.data() + nDataPos, sal_uInt32(nToRead)); if (nRead > 0) { nDataPos += static_cast<unsigned long>(nRead); @@ -853,7 +853,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_u pMemStm.reset( new SvMemoryStream); pIStm = pMemStm.get(); assert(!aData.empty()); - pMemStm->SetBuffer( &aData.front(), nUncodedSize, nUncodedSize ); + pMemStm->SetBuffer(aData.data(), nUncodedSize, nUncodedSize); nOffset = 0; } else diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx index 5e4e242..8bea667 100644 --- a/vcl/source/gdi/embeddedfontshelper.cxx +++ b/vcl/source/gdi/embeddedfontshelper.cxx @@ -143,7 +143,7 @@ bool EmbeddedFontsHelper::addEmbeddedFont( const uno::Reference< io::XInputStrea } if( !eot ) { - sufficientFontRights = sufficientTTFRights( &fontData.front(), fontData.size(), FontRights::EditingAllowed ); + sufficientFontRights = sufficientTTFRights(fontData.data(), fontData.size(), FontRights::EditingAllowed); } if( !sufficientFontRights ) { diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index c6de508..f4dee74 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -743,7 +743,7 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON )) XChangeProperty( GetXDisplay(), mhWindow, GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ), - XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&netwm_icon.front()), netwm_icon.size()); + XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size()); } m_nWorkArea = GetDisplay()->getWMAdaptor()->getCurrentWorkArea(); @@ -1078,7 +1078,7 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon ) if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON )) XChangeProperty( GetXDisplay(), mhWindow, GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ), - XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&netwm_icon.front()), netwm_icon.size()); + XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned char*>(netwm_icon.data()), netwm_icon.size()); } } } commit c9126dfbabcde1bf8b157942a5f5134ad547b957 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Feb 24 14:22:59 2017 +0000 &front may not be null in empty vector case, but that's not true here anyway Change-Id: I6cd89c7e081dada7fb7a179ecd8aa65e98ed13a9 diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 5e09cee..02d98ec 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1142,7 +1142,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, } sal_uInt32 nBufferSize = GetPropertyValue( DFF_Prop_pihlShape, 0 ); - if( (0 < nBufferSize) && (nBufferSize <= 0xFFFF) && SeekToContent( DFF_Prop_pihlShape, rSt ) ) + if( (0 < nBufferSize) && (nBufferSize <= 0xFFFF) && SeekToContent( DFF_Prop_pihlShape, rSt ) ) { SvMemoryStream aMemStream; struct HyperLinksTable hlStr; @@ -1151,15 +1151,13 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, // copy from DFF stream to memory stream std::vector< sal_uInt8 > aBuffer( nBufferSize ); - sal_uInt8* pnData = &aBuffer.front(); - sal_uInt8 nStreamSize; - if (pnData && rSt.ReadBytes(pnData, nBufferSize) == nBufferSize) + if (rSt.ReadBytes(aBuffer.data(), nBufferSize) == nBufferSize) { - aMemStream.WriteBytes(pnData, nBufferSize); + aMemStream.WriteBytes(aBuffer.data(), nBufferSize); aMemStream.Seek( STREAM_SEEK_TO_END ); - nStreamSize = aMemStream.Tell(); + sal_uInt8 nStreamSize = aMemStream.Tell(); aMemStream.Seek( STREAM_SEEK_TO_BEGIN ); - bool bRet = 4 <= nStreamSize; + bool bRet = 4 <= nStreamSize; if( bRet ) aMemStream.ReadUInt16( nRawRecId ).ReadUInt16( nRawRecSize ); SwDocShell* pDocShell = rReader.m_pDocShell; commit 6ceaec7396d3f8246fa104855eb10aff840d86c8 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Feb 24 14:19:52 2017 +0000 no need to take address of front() Change-Id: Ib952e480c486f8ffeb6a4383a192edde005c3c4f diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 402af7f..95961f2 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -425,10 +425,10 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName, if( !aFoundArr.empty() ) // one was found { delete pGlossary; - if(1 == aFoundArr.size()) + if (1 == aFoundArr.size()) { - TextBlockInfo_Impl* pData = &aFoundArr.front(); - pGlossary = pGlossaries->GetGroupDoc(pData->sGroupName); + TextBlockInfo_Impl& rData = aFoundArr.front(); + pGlossary = pGlossaries->GetGroupDoc(rData.sGroupName); nFound = pGlossary->GetIndex( aShortName ); } else @@ -447,10 +447,10 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName, pDlg->GetSelectedIdx(): LISTBOX_ENTRY_NOTFOUND; pDlg.disposeAndClear(); - if(LISTBOX_ENTRY_NOTFOUND != nRet) + if (LISTBOX_ENTRY_NOTFOUND != nRet) { - TextBlockInfo_Impl* pData = &aFoundArr[nRet]; - pGlossary = pGlossaries->GetGroupDoc(pData->sGroupName); + TextBlockInfo_Impl& rData = aFoundArr[nRet]; + pGlossary = pGlossaries->GetGroupDoc(rData.sGroupName); nFound = pGlossary->GetIndex( aShortName ); } else
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits