summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-06 11:05:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-08 07:20:29 +0100
commit5c23459245f566831383934dd64d19e002bfcfcb (patch)
tree27d92a2167c6245c3be7844e2bbe7b6e624f0f9e /filter
parent4a7771ffa8d98d08dffbba90fd42d1ab75e056fe (diff)
new loplugin constvars
detect static variables that can be made const. Thanks to mike kaganski for suggesting this. Here I introduce a new plugin feature - using markers in nearby comments to disable the plugin for specific vars. Some of this stuff was old debugging code. I removed the stuff that was older than 5 years. Change-Id: I6ec7742a7fdadf28fd128b592fcdf6da8257585c Reviewed-on: https://gerrit.libreoffice.org/68807 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/config/cache/typedetection.cxx15
-rw-r--r--filter/source/msfilter/msdffimp.cxx2
2 files changed, 8 insertions, 9 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index b5268857ca9b..3f39602470aa 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -324,16 +324,15 @@ struct SortByPriority
// All things being equal, sort them alphabetically.
return r1.sType > r2.sType;
}
-} objSortByPriority;
+};
struct SortByType
-
{
bool operator() (const FlatDetectionInfo& r1, const FlatDetectionInfo& r2) const
{
return r1.sType > r2.sType;
}
-} objSortByType;
+};
struct EqualByType
{
@@ -341,7 +340,7 @@ struct EqualByType
{
return r1.sType == r2.sType;
}
-} objEqualByType;
+};
class FindByType
{
@@ -412,8 +411,8 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
// <- SAFE ----------------------------------
// Properly prioritize all candidate types.
- std::stable_sort(lFlatTypes.begin(), lFlatTypes.end(), objSortByPriority);
- auto last = std::unique(lFlatTypes.begin(), lFlatTypes.end(), objEqualByType);
+ std::stable_sort(lFlatTypes.begin(), lFlatTypes.end(), SortByPriority());
+ auto last = std::unique(lFlatTypes.begin(), lFlatTypes.end(), EqualByType());
lFlatTypes.erase(last, lFlatTypes.end());
OUString sLastChance;
@@ -843,8 +842,8 @@ void TypeDetection::impl_getAllFormatTypes(
}
// Remove duplicates.
- std::stable_sort(rFlatTypes.begin(), rFlatTypes.end(), objSortByType);
- auto last = std::unique(rFlatTypes.begin(), rFlatTypes.end(), objEqualByType);
+ std::stable_sort(rFlatTypes.begin(), rFlatTypes.end(), SortByType());
+ auto last = std::unique(rFlatTypes.begin(), rFlatTypes.end(), EqualByType());
rFlatTypes.erase(last, rFlatTypes.end());
// Mark pre-selected type (if any) to have it prioritized.
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index d54315516379..edf85fe7cbaa 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2619,7 +2619,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj
}
if ( bHasShadow )
{
- static bool bCheckShadow(false);
+ static bool bCheckShadow(false); // loplugin:constvars:ignore
// #i124477# Found no reason not to set shadow, esp. since it is applied to evtl. existing text
// and will lead to an error if in PPT someone used text and added the object shadow to the