diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-27 15:12:58 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-10-27 15:35:36 +0000 |
commit | 623f5b26ffd77041d0b06d7ce9c3b32d05625440 (patch) | |
tree | ecd905d6657147b1c5a074b4d33f914f0039440c /xmloff | |
parent | 446f17f6c1f98b17ceb6750f5dc67a27330d1351 (diff) |
don't allocate rtl::Reference or SvRef on the heap
There is no point, since it's the size of a pointer anyway
Found by temporarily making their 'operator new' methods
deleted.
Change-Id: I265e40ce93ad4bad08b4f0bd49db08929e44b7d6
Reviewed-on: https://gerrit.libreoffice.org/19628
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlmultiimagehelper.cxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx index b0607a2fddd1..9a6711fb339d 100644 --- a/xmloff/source/core/xmlmultiimagehelper.cxx +++ b/xmloff/source/core/xmlmultiimagehelper.cxx @@ -76,11 +76,6 @@ MultiImageImportHelper::MultiImageImportHelper() MultiImageImportHelper::~MultiImageImportHelper() { - while(!maImplContextVector.empty()) - { - delete *(maImplContextVector.end() - 1); - maImplContextVector.pop_back(); - } } SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages() @@ -95,7 +90,7 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages() for(a = 0; a < maImplContextVector.size(); a++) { - const OUString aStreamURL(getGraphicURLFromImportContext(**maImplContextVector[a])); + const OUString aStreamURL(getGraphicURLFromImportContext(*maImplContextVector[a])); const sal_uInt32 nNewQuality(getQualityIndex(aStreamURL)); if(nNewQuality > nBestQuality) @@ -112,15 +107,14 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages() } // Take out the most valuable one - const std::vector< SvXMLImportContextRef* >::iterator aRemove(maImplContextVector.begin() + nIndexOfPreferred); - pContext = **aRemove; - delete *aRemove; + const std::vector< SvXMLImportContextRef >::iterator aRemove(maImplContextVector.begin() + nIndexOfPreferred); + pContext = *aRemove; maImplContextVector.erase(aRemove); // remove the rest from parent for(a = 0; a < maImplContextVector.size(); a++) { - SvXMLImportContext& rCandidate = **maImplContextVector[a]; + SvXMLImportContext& rCandidate = *maImplContextVector[a]; if(pContext) { @@ -134,7 +128,7 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages() } else if (maImplContextVector.size() == 1) { - pContext = *maImplContextVector.front(); + pContext = maImplContextVector.front(); } return pContext; @@ -144,7 +138,7 @@ void MultiImageImportHelper::addContent(const SvXMLImportContext& rSvXMLImportCo { if(dynamic_cast< const SvXMLImportContext* >(&rSvXMLImportContext)) { - maImplContextVector.push_back(new SvXMLImportContextRef(const_cast< SvXMLImportContext* >(&rSvXMLImportContext))); + maImplContextVector.push_back(SvXMLImportContextRef(const_cast< SvXMLImportContext* >(&rSvXMLImportContext))); } } |