summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /slideshow
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/eventmultiplexer.cxx2
-rw-r--r--slideshow/source/engine/opengl/Operation.cxx2
-rw-r--r--slideshow/source/engine/opengl/TransitionImpl.cxx12
-rw-r--r--slideshow/source/engine/shapes/gdimtftools.cxx2
-rw-r--r--slideshow/source/engine/slide/layermanager.cxx2
5 files changed, 10 insertions, 10 deletions
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index d93aea365871..fc0ff25803c0 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -53,7 +53,7 @@ using namespace ::com::sun::star;
namespace std
{
// add operator== for weak_ptr, so we can use std::find over lists of them
- template<typename T> bool operator==( weak_ptr<T> const& rLHS,
+ template<typename T> static bool operator==( weak_ptr<T> const& rLHS,
weak_ptr<T> const& rRHS )
{
return rLHS.lock().get() == rRHS.lock().get();
diff --git a/slideshow/source/engine/opengl/Operation.cxx b/slideshow/source/engine/opengl/Operation.cxx
index a8f5bc892851..674eb0da00d8 100644
--- a/slideshow/source/engine/opengl/Operation.cxx
+++ b/slideshow/source/engine/opengl/Operation.cxx
@@ -115,7 +115,7 @@ makeRotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& Origin,do
return std::make_shared<RotateAndScaleDepthByHeight>(Axis, Origin, Angle, bScale, bInter, T0, T1);
}
-inline double intervalInter(double t, double T0, double T1)
+static inline double intervalInter(double t, double T0, double T1)
{
return ( t - T0 ) / ( T1 - T0 );
}
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
index f7f694fc26e9..9d6b457ae7f1 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
@@ -923,20 +923,20 @@ std::shared_ptr<OGLTransitionImpl> makeRochade()
return makeRochadeTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
-inline double randFromNeg1to1()
+static inline double randFromNeg1to1()
{
return comphelper::rng::uniform_real_distribution(-1.0, std::nextafter(1.0, DBL_MAX));
}
// TODO(Q3): extract to basegfx
-inline glm::vec3 randNormVectorInXYPlane()
+static inline glm::vec3 randNormVectorInXYPlane()
{
glm::vec3 toReturn(randFromNeg1to1(),randFromNeg1to1(),0.0);
return glm::normalize(toReturn);
}
template<typename T>
-T clamp(const T& rIn)
+static T clamp(const T& rIn)
{
return glm::clamp(rIn, T(-1.0), T(1.0));
}
@@ -1085,12 +1085,12 @@ std::shared_ptr<OGLTransitionImpl> makeHelix( sal_uInt16 nRows )
return makeSimpleTransition(aLeavingSlide, aEnteringSlide);
}
-float fdiv(int a, int b)
+static float fdiv(int a, int b)
{
return static_cast<float>(a)/b;
}
-glm::vec2 vec(float x, float y, float nx, float ny)
+static glm::vec2 vec(float x, float y, float nx, float ny)
{
x = x < 0.0 ? 0.0 : x;
x = std::min(x, nx);
@@ -1939,7 +1939,7 @@ std::shared_ptr<OGLTransitionImpl> makeRipple()
return makeRippleTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
-void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY)
+static void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX, const int NY)
{
if (y % 4 == 0)
{
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index c9b0583fad23..3bce67733f1e 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -68,7 +68,7 @@ namespace internal
// calling GetBitmapEx on such a Graphic (see below) will
// result in one poorly scaled bitmap into another,
// somewhat arbitrarily sized bitmap.
-bool hasUnsupportedActions( const GDIMetaFile& rMtf )
+static bool hasUnsupportedActions( const GDIMetaFile& rMtf )
{
// search metafile for RasterOp action
MetaAction* pCurrAct;
diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx
index fd1fbfb5d87e..7667ce8c0194 100644
--- a/slideshow/source/engine/slide/layermanager.cxx
+++ b/slideshow/source/engine/slide/layermanager.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star;
namespace std
{
// add operator!= for weak_ptr
- inline bool operator!=( slideshow::internal::LayerWeakPtr const& rLHS,
+ static inline bool operator!=( slideshow::internal::LayerWeakPtr const& rLHS,
slideshow::internal::LayerWeakPtr const& rRHS )
{
return rLHS.lock().get() != rRHS.lock().get();