diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-29 09:16:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-29 12:57:47 +0200 |
commit | 1094fedfac9d48262400e2a07581bfa36b2a422e (patch) | |
tree | d25b5741aa2d54825bb41f5473832d2bc8213b62 /oox | |
parent | 649228f932321c2c5784fbf7b0df84712fde55a0 (diff) |
getUtf8TokenName can return by const ref
and avoid some reference-counting in a hot path
Change-Id: I7f5fd7f8f5f9076eb5f8d60118afa8e3ac8a5e6c
Reviewed-on: https://gerrit.libreoffice.org/38129
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/customshapeproperties.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 | ||||
-rw-r--r-- | oox/source/mathml/importutils.cxx | 2 | ||||
-rw-r--r-- | oox/source/token/tokenmap.cxx | 2 |
5 files changed, 6 insertions, 4 deletions
diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx index 2e47b64bb013..ddd29199ff41 100644 --- a/oox/inc/drawingml/customshapeproperties.hxx +++ b/oox/inc/drawingml/customshapeproperties.hxx @@ -103,7 +103,7 @@ public: const css::awt::Size &aSize ); sal_Int32 getShapePresetType() const { return mnShapePresetType; } - css::uno::Sequence< sal_Int8 > getShapePresetTypeName() const; + css::uno::Sequence< sal_Int8 > const & getShapePresetTypeName() const; void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; }; bool getShapeTypeOverride(){ return mbShapeTypeOverride; }; void setShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; }; diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 5cf9cd235b93..160879cc3e66 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -52,7 +52,7 @@ CustomShapeProperties::~CustomShapeProperties() { } -uno::Sequence< sal_Int8 > CustomShapeProperties::getShapePresetTypeName() const +uno::Sequence< sal_Int8 > const & CustomShapeProperties::getShapePresetTypeName() const { return StaticTokenMap::get().getUtf8TokenName( mnShapePresetType ); } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 8805d7613754..774bcedc878a 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -752,7 +752,7 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 length = aGrabBag.getLength(); aGrabBag.realloc( length+1); aGrabBag[length].Name = "mso-orig-shape-type"; - const uno::Sequence< sal_Int8 > aNameSeq = + uno::Sequence< sal_Int8 > const & aNameSeq = mpCustomShapePropertiesPtr->getShapePresetTypeName(); OUString sShapePresetTypeName(reinterpret_cast< const char* >( aNameSeq.getConstArray()), aNameSeq.getLength(), RTL_TEXTENCODING_UTF8); diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index 7333f27dc352..77f5ec94b84f 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -58,7 +58,7 @@ AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFas OString tokenToString( int token ) { - const uno::Sequence< sal_Int8 > aTokenNameSeq = StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK ); + uno::Sequence< sal_Int8 > const & aTokenNameSeq = StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK ); OString tokenname( reinterpret_cast< const char* >( aTokenNameSeq.getConstArray() ), aTokenNameSeq.getLength() ); if( tokenname.isEmpty()) tokenname = "???"; diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx index 549c40fec7b3..fc5e7ab48394 100644 --- a/oox/source/token/tokenmap.cxx +++ b/oox/source/token/tokenmap.cxx @@ -43,6 +43,8 @@ namespace { #endif } // namespace +const css::uno::Sequence< sal_Int8 > TokenMap::EMPTY_BYTE_SEQ; + TokenMap::TokenMap() : maTokenNames( static_cast< size_t >( XML_TOKEN_COUNT ) ) { |