Kaydet (Commit) 4b7f140a authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

use copy_n to simplify

Change-Id: Ia5b8b01ecabbf8c7afe4e75c7245e734c23545ce
üst d6831689
...@@ -802,22 +802,14 @@ sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId ) ...@@ -802,22 +802,14 @@ sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId )
uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) throw(uno::RuntimeException, std::exception) uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) throw(uno::RuntimeException, std::exception)
{ {
static uno::Sequence< uno::Type > aRetTypes; static uno::Sequence< uno::Type > aRetTypes;
if(!aRetTypes.getLength())
{
aRetTypes = SwXCellBaseClass::getTypes();
uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
long nIndex = aRetTypes.getLength();
aRetTypes.realloc(
aRetTypes.getLength() +
aTextTypes.getLength());
uno::Type* pRetTypes = aRetTypes.getArray(); if(aRetTypes.getLength())
return aRetTypes;
const uno::Type* pTextTypes = aTextTypes.getConstArray(); const auto& rCellTypes = SwXCellBaseClass::getTypes();
for(long nPos = 0; nPos <aTextTypes.getLength(); nPos++) const auto& rTextTypes = SwXText::getTypes();
pRetTypes[nIndex++] = pTextTypes[nPos]; aRetTypes = uno::Sequence<uno::Type>(rCellTypes.getLength() + rTextTypes.getLength());
} std::copy_n(rCellTypes.begin(), rCellTypes.getLength(), aRetTypes.begin());
std::copy_n(rTextTypes.begin(), rTextTypes.getLength(), aRetTypes.begin()+rCellTypes.getLength());
return aRetTypes; return aRetTypes;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment