[Libreoffice-commits] core.git: extensions/source sd/source svx/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Sep 8 13:53:50 UTC 2017


 extensions/source/scanner/sane.cxx         |    2 +-
 sd/source/ui/slidesorter/view/SlsTheme.cxx |    8 ++++----
 svx/source/dialog/swframeposstrings.cxx    |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 2687a5aca143c53c364cb44993ca601b8dd1c65e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Sep 8 13:43:16 2017 +0200

    -Werror,-Wtautological-compare with latest clang
    
    Change-Id: I073f1893b759f8d31a24187f542b031b86dc4b8a
    error: comparison of unsigned enum expression >= 0 is always true
    [-Werror,-Wtautological-compare]
    Reviewed-on: https://gerrit.libreoffice.org/42103
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index db8ef50d186c..80b6bb30f5c9 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -623,7 +623,7 @@ bool Sane::Start( BitmapTransporter& rBitmap )
                                   "SANE_FRAME_RED", "SANE_FRAME_GREEN",
                                   "SANE_FRAME_BLUE", "Unknown !!!" };
             fprintf( stderr, "Parameters for frame %d:\n", nStream );
-            if( aParams.format < 0 || aParams.format > 4 )
+            if( aParams.format > 4 )
                 aParams.format = (SANE_Frame)5;
             fprintf( stderr, "format:           %s\n", ppFormats[ (int)aParams.format ] );
             fprintf( stderr, "last_frame:       %s\n", aParams.last_frame ? "TRUE" : "FALSE" );
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index dd5c0e164d9f..4ff6c44c6e20 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -162,7 +162,7 @@ std::shared_ptr<vcl::Font> Theme::GetFont (
 
 ColorData Theme::GetColor (const ColorType eType)
 {
-    if (eType>=0 && sal_uInt32(eType)<maColor.size())
+    if (sal_uInt32(eType)<maColor.size())
         return maColor[eType];
     else
         return 0;
@@ -208,7 +208,7 @@ void Theme::SetGradient (
 
 const BitmapEx& Theme::GetIcon (const IconType eType)
 {
-    if (eType>=0 && size_t(eType)<maIcons.size())
+    if (size_t(eType)<maIcons.size())
         return maIcons[eType];
     else
     {
@@ -219,7 +219,7 @@ const BitmapEx& Theme::GetIcon (const IconType eType)
 
 Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
 {
-    if (eType>=0 && size_t(eType)<maGradients.size())
+    if (size_t(eType)<maGradients.size())
         return maGradients[eType];
     else
     {
@@ -230,7 +230,7 @@ Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
 
 void Theme::InitializeIcon(const IconType eType, const OUString& rResourceId)
 {
-    if (eType>=0 && size_t(eType)<maIcons.size())
+    if (size_t(eType)<maIcons.size())
     {
         const BitmapEx aIcon(rResourceId);
         maIcons[eType] = aIcon;
diff --git a/svx/source/dialog/swframeposstrings.cxx b/svx/source/dialog/swframeposstrings.cxx
index 6dd9ae33d05b..d2e9c8e05ab0 100644
--- a/svx/source/dialog/swframeposstrings.cxx
+++ b/svx/source/dialog/swframeposstrings.cxx
@@ -28,7 +28,7 @@ OUString SvxSwFramePosString::GetString(StringId eId)
 {
     assert(SAL_N_ELEMENTS(RID_SVXSW_FRAMEPOSITIONS) == SvxSwFramePosString::STR_MAX);
     DBG_ASSERT(eId >= 0 && eId < STR_MAX, "invalid StringId");
-    if(!(eId >= 0 && eId < STR_MAX))
+    if(!(eId < STR_MAX))
         eId = LEFT;
     return SvxResId(RID_SVXSW_FRAMEPOSITIONS[eId]);
 }


More information about the Libreoffice-commits mailing list