summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-09-28 14:53:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-09-28 20:08:57 +0200
commit980f28fce8ccf317ee099179b07e68a50119dc6e (patch)
treecedf1d65ffdc2d780c53980d9e8a4370dc2214a4 /vcl/source
parent54fe022f298c98ea40b175e5e671363a5a413160 (diff)
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.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/imet/ios2met.cxx38
1 files changed, 17 insertions, 21 deletions
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 );
}