vcl/source/filter/imet/ios2met.cxx |   38 ++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

New commits:
commit 980f28fce8ccf317ee099179b07e68a50119dc6e
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Sep 28 14:53:46 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Sep 28 20:08:57 2024 +0200

    cid#1607692 Overflowed constant
    
    use less convoluted logic here
    
    Change-Id: I786d7f857c7104358559782247c4272914299314
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174112
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/vcl/source/filter/imet/ios2met.cxx 
b/vcl/source/filter/imet/ios2met.cxx
index 3b6077a648a3..0a16c07f5671 100644
--- a/vcl/source/filter/imet/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -748,31 +748,27 @@ void OS2METReader::SetPen( const Color& rColor, 
sal_uInt16 nLineWidth, PenStyle
         pVirDev->SetLineColor( rColor );
     aLineInfo.SetWidth( nLineWidth );
 
-    sal_uInt16 nDotCount = 0;
-    sal_uInt16 nDashCount = 0;
-    switch ( ePenStyle )
+    if (ePenStyle == PEN_NULL)
+        eLineStyle = LineStyle::NONE;
+    else if (ePenStyle == PEN_DASHDOT || ePenStyle == PEN_DOT || ePenStyle == 
PEN_DASH)
     {
-        case PEN_NULL :
-            eLineStyle = LineStyle::NONE;
-        break;
-        case PEN_DASHDOT :
+        sal_uInt16 nDotCount = 0;
+        sal_uInt16 nDashCount = 0;
+        if (ePenStyle == PEN_DASHDOT)
+        {
             nDashCount++;
-            [[fallthrough]];
-        case PEN_DOT :
             nDotCount++;
-            nDashCount--;
-            [[fallthrough]];
-        case PEN_DASH :
+        }
+        else if (ePenStyle == PEN_DOT)
+            nDotCount++;
+        else  // (ePenStyle == PEN_DASH)
             nDashCount++;
-            aLineInfo.SetDotCount( nDotCount );
-            aLineInfo.SetDashCount( nDashCount );
-            aLineInfo.SetDistance( nLineWidth );
-            aLineInfo.SetDotLen( nLineWidth );
-            aLineInfo.SetDashLen( nLineWidth << 2 );
-            eLineStyle = LineStyle::Dash;
-        break;
-        case PEN_SOLID:
-        break;  // -Wall not handled...
+        aLineInfo.SetDotCount( nDotCount );
+        aLineInfo.SetDashCount( nDashCount );
+        aLineInfo.SetDistance( nLineWidth );
+        aLineInfo.SetDotLen( nLineWidth );
+        aLineInfo.SetDashLen( nLineWidth << 2 );
+        eLineStyle = LineStyle::Dash;
     }
     aLineInfo.SetStyle( eLineStyle );
 }

Reply via email to