include/xmloff/xmlprmap.hxx | 3 +-- xmloff/source/style/xmlexppr.cxx | 5 ++--- xmloff/source/style/xmlprmap.cxx | 8 +++----- 3 files changed, 6 insertions(+), 10 deletions(-)
New commits: commit e43ad1a8ae20cbd00c5c3346e1810196af6669a6 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Apr 22 16:18:10 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri May 8 18:38:01 2020 +0200 xmloff: GetEarliestODFVersionForExport(-1) is impossible Remove defensive programming nonsense to deal with situation that has apparently never been possible in git history. Change-Id: I3788cdcec5e1b4afa27e294ed91825bb33e8e633 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92729 Reviewed-by: Michael Stahl <michael.st...@cib.de> Tested-by: Jenkins diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx index 9d85bbdbf632..2b53f2e83d53 100644 --- a/include/xmloff/xmlprmap.hxx +++ b/include/xmloff/xmlprmap.hxx @@ -25,7 +25,6 @@ #include <rtl/ustring.hxx> #include <salhelper/simplereferenceobject.hxx> -#include <optional> #include <memory> namespace rtl { template <class reference_type> class Reference; } @@ -83,7 +82,7 @@ public: sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const; /** returns the earliest odf version for which this property should be exported. */ - std::optional<SvtSaveOptions::ODFSaneDefaultVersion> GetEarliestODFVersionForExport(sal_Int32 nIndex) const; + SvtSaveOptions::ODFSaneDefaultVersion GetEarliestODFVersionForExport(sal_Int32 nIndex) const; /** Returns the index of an entry with the given XML-name and namespace If there is no matching entry the method returns -1 */ diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 2ca0e49df077..e94f6744b12d 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -586,10 +586,9 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter_( ( (0 != (nFlags & MID_FLAG_MUST_EXIST)) || xInfo->hasPropertyByName( rAPIName ) ) ) { - const std::optional<SvtSaveOptions::ODFSaneDefaultVersion> oEarliestODFVersionForExport( + const SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport( mpImpl->mxPropMapper->GetEarliestODFVersionForExport(i)); - if (!oEarliestODFVersionForExport - || nCurrentVersion >= *oEarliestODFVersionForExport) + if (nEarliestODFVersionForExport <= nCurrentVersion) { pFilterInfo->AddProperty(rAPIName, i); } diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index 905b068dff01..b3111441ef6a 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -192,13 +192,11 @@ sal_Int16 XMLPropertySetMapper::GetEntryContextId( sal_Int32 nIndex ) const return nIndex == -1 ? 0 : mpImpl->maMapEntries[nIndex].nContextId; } -std::optional<SvtSaveOptions::ODFSaneDefaultVersion> +SvtSaveOptions::ODFSaneDefaultVersion XMLPropertySetMapper::GetEarliestODFVersionForExport(sal_Int32 const nIndex) const { - assert((-1 <= nIndex) && (nIndex < static_cast<sal_Int32>(mpImpl->maMapEntries.size()))); - return nIndex == -1 - ? std::optional<SvtSaveOptions::ODFSaneDefaultVersion>() - : std::optional<SvtSaveOptions::ODFSaneDefaultVersion>(mpImpl->maMapEntries[nIndex].nEarliestODFVersionForExport); + assert((0 <= nIndex) && (nIndex < static_cast<sal_Int32>(mpImpl->maMapEntries.size()))); + return mpImpl->maMapEntries[nIndex].nEarliestODFVersionForExport; } const XMLPropertyHandler* XMLPropertySetMapper::GetPropertyHandler( sal_Int32 nIndex ) const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits