[Libreoffice-commits] core.git: include/xmloff xmloff/source

Noel Grandin noelgrandin at gmail.com
Mon Jan 30 06:07:09 UTC 2017


 include/xmloff/xmlnumfe.hxx      |    2 +-
 xmloff/source/core/xmlexp.cxx    |    4 +---
 xmloff/source/style/xmlnumfe.cxx |   14 ++++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 9734a6e1c3930c29aa3c7b80cb896d57c2bebe31
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Jan 29 12:28:45 2017 +0200

    GetWasUsed can return by value, no need to be a special snowflake
    
    Change-Id: I4ef22fa49ee883ff0bddb49d1711e8521905502f
    Reviewed-on: https://gerrit.libreoffice.org/33658
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx
index 905a6e3..b4792a8 100644
--- a/include/xmloff/xmlnumfe.hxx
+++ b/include/xmloff/xmlnumfe.hxx
@@ -114,7 +114,7 @@ public:
     // get the style name that was generated for a key
     OUString GetStyleName( sal_uInt32 nKey );
 
-    void GetWasUsed(css::uno::Sequence<sal_Int32>& rWasUsed);
+    css::uno::Sequence<sal_Int32> GetWasUsed();
     void SetWasUsed(const css::uno::Sequence<sal_Int32>& rWasUsed);
 
 
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index cd8a9c4..077cb4f 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -557,9 +557,7 @@ SvXMLExport::~SvXMLExport()
                     OUString sWrittenNumberFormats(XML_WRITTENNUMBERSTYLES);
                     if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
                     {
-                        uno::Sequence<sal_Int32> aWasUsed;
-                        mpNumExport->GetWasUsed(aWasUsed);
-                        mxExportInfo->setPropertyValue(sWrittenNumberFormats, Any(aWasUsed));
+                        mxExportInfo->setPropertyValue(sWrittenNumberFormats, Any(mpNumExport->GetWasUsed()));
                     }
                 }
             }
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index bb5db1b..07e4ac2 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -106,7 +106,7 @@ public:
     bool    GetFirstUsed(sal_uInt32& nKey);
     bool    GetNextUsed(sal_uInt32& nKey);
 
-    void GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed);
+    uno::Sequence<sal_Int32> GetWasUsed();
     void SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed);
 };
 
@@ -182,10 +182,10 @@ bool SvXMLNumUsedList_Impl::GetNextUsed(sal_uInt32& nKey)
     return bRet;
 }
 
-void SvXMLNumUsedList_Impl::GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed)
+uno::Sequence<sal_Int32> SvXMLNumUsedList_Impl::GetWasUsed()
 {
-    rWasUsed.realloc(nWasUsedCount);
-    sal_Int32* pWasUsed = rWasUsed.getArray();
+    uno::Sequence<sal_Int32> ret(nWasUsedCount);
+    sal_Int32* pWasUsed = ret.getArray();
     if (pWasUsed)
     {
         SvXMLuInt32Set::const_iterator aItr = aWasUsed.begin();
@@ -196,6 +196,7 @@ void SvXMLNumUsedList_Impl::GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed)
             ++pWasUsed;
         }
     }
+    return ret;
 }
 
 void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed)
@@ -1889,10 +1890,11 @@ void SvXMLNumFmtExport::SetUsed( sal_uInt32 nKey )
     }
 }
 
-void SvXMLNumFmtExport::GetWasUsed(uno::Sequence<sal_Int32>& rWasUsed)
+uno::Sequence<sal_Int32> SvXMLNumFmtExport::GetWasUsed()
 {
     if (pUsedList)
-        pUsedList->GetWasUsed(rWasUsed);
+        return pUsedList->GetWasUsed();
+    return uno::Sequence<sal_Int32>();
 }
 
 void SvXMLNumFmtExport::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed)


More information about the Libreoffice-commits mailing list