diff options
-rw-r--r-- | filter/source/config/cache/cacheitem.hxx | 3 | ||||
-rw-r--r-- | filter/source/config/cache/typedetection.cxx | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index c598150556ec..e1b2dcd2a02f 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -21,7 +21,6 @@ #define INCLUDED_FILTER_SOURCE_CONFIG_CACHE_CACHEITEM_HXX #include <deque> -#include <list> #include <unordered_map> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> @@ -194,7 +193,7 @@ struct FlatDetectionInfo FlatDetectionInfo(); }; -typedef ::std::list< FlatDetectionInfo > FlatDetection; +typedef ::std::vector< FlatDetectionInfo > FlatDetection; } // namespace config } // namespace filter diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 9d5e5844c46f..d0c096ce28d8 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -318,7 +318,7 @@ struct SortByPriority // All things being equal, sort them alphabetically. return r1.sType > r2.sType; } -}; +} objSortByPriority; struct SortByType @@ -327,7 +327,7 @@ struct SortByType { return r1.sType > r2.sType; } -}; +} objSortByType; struct EqualByType { @@ -335,7 +335,7 @@ struct EqualByType { return r1.sType == r2.sType; } -}; +} objEqualByType; class FindByType { @@ -408,8 +408,9 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: // <- SAFE ---------------------------------- // Properly prioritize all candidate types. - lFlatTypes.sort(SortByPriority()); - lFlatTypes.unique(EqualByType()); + std::stable_sort(lFlatTypes.begin(), lFlatTypes.end(), objSortByPriority); + auto last = std::unique(lFlatTypes.begin(), lFlatTypes.end(), objEqualByType); + lFlatTypes.erase(last, lFlatTypes.end()); OUString sLastChance; @@ -854,8 +855,9 @@ void TypeDetection::impl_getAllFormatTypes( } // Remove duplicates. - rFlatTypes.sort(SortByType()); - rFlatTypes.unique(EqualByType()); + std::stable_sort(rFlatTypes.begin(), rFlatTypes.end(), objSortByType); + auto last = std::unique(rFlatTypes.begin(), rFlatTypes.end(), objEqualByType); + rFlatTypes.erase(last, rFlatTypes.end()); // Mark pre-selected type (if any) to have it prioritized. OUString sSelectedType = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_TYPENAME(), OUString()); |