diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-10-01 14:20:13 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-10-01 20:07:29 +0200 |
commit | 0e3c3350cd7ef4b8d1b52fb6e5d8d17644cc4e61 (patch) | |
tree | 8c2c631253c7ddf2f3db3eb6e296d255a864506f | |
parent | 05dbd67f5d7bd6611830fc793985b7d5858bf68c (diff) |
Replace list by vector in typedetection.cxx (filter)
Change-Id: Idfb4c0e26a109157f95f3dfe2cfcdccbb2428502
Reviewed-on: https://gerrit.libreoffice.org/42995
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-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()); |