From d0e848dab096160b16c4778ba25a40d1e5ff82af Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 15 Nov 2023 10:48:27 +0200 Subject: avoid double map lookup Change-Id: I02018eaaf220c7835756eba6215425bac9cbc6f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159432 Tested-by: Jenkins Reviewed-by: Noel Grandin --- oox/source/export/drawingml.cxx | 5 +++-- oox/source/export/vmlexport.cxx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'oox/source/export') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index ebe1df3a72d8..4bce89943ba3 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4320,8 +4320,9 @@ void DrawingML::WritePresetShape( const OString& pShape, MSO_SPT eShapeType, boo static std::map< OString, std::vector > aAdjMap = lcl_getAdjNames(); // If there are predefined adj names for this shape type, look them up now. std::vector aAdjustments; - if (aAdjMap.find(pShape) != aAdjMap.end()) - aAdjustments = aAdjMap[pShape]; + auto it = aAdjMap.find(pShape); + if (it != aAdjMap.end()) + aAdjustments = it->second; mpFS->startElementNS(XML_a, XML_prstGeom, XML_prst, pShape); mpFS->startElementNS(XML_a, XML_avLst); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 2ed2903bfe27..cfaa815aa964 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -1236,8 +1236,9 @@ static OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject) if (xShape->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) { comphelper::SequenceAsHashMap aInteropGrabBag(xShape->getPropertyValue("InteropGrabBag")); - if (aInteropGrabBag.find("AnchorId") != aInteropGrabBag.end()) - aInteropGrabBag["AnchorId"] >>= aResult; + auto it = aInteropGrabBag.find("AnchorId"); + if (it != aInteropGrabBag.end()) + it->second >>= aResult; } return aResult; -- cgit