summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-08-30 08:25:33 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-08-30 08:25:33 +0200
commitf86552ea150c971a995db4856482746df9ffdbba (patch)
tree8c68600eb540f1574713ca3ce1aa4541d8f96dbf /emfio
parent7f4e02e3809e10564bd2bb91465c99f4dd207da7 (diff)
This check for GDIObj subtypes is exhaustive
For one, catches issues like d5ed3cd6dbd22bb18542778f1c48f4d5b3ae0f95 "Make WinMtfFontStyle's base class EMFIO_DLLPUBLIC, too" earlier. For another, uses if/else to avoid unnecessary, expensive dynamic casts. Change-Id: I695b1e8673d5af22060b05b982789ad0ddcd39c3
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/mtftools.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 1698eec4a37a..d02dd6b902b5 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -609,20 +609,19 @@ namespace emfio
if ( pGDIObj )
{
- const auto pen = dynamic_cast<WinMtfLineStyle*>(pGDIObj);
- if (pen)
+ if (const auto pen = dynamic_cast<WinMtfLineStyle*>(pGDIObj))
maLineStyle = *pen;
-
- const auto brush = dynamic_cast<WinMtfFillStyle*>(pGDIObj);
- if (brush)
+ else if (const auto brush = dynamic_cast<WinMtfFillStyle*>(
+ pGDIObj))
{
maFillStyle = *brush;
mbFillStyleSelected = true;
}
-
- const auto font = dynamic_cast<WinMtfFontStyle*>(pGDIObj);
- if (font)
+ else if (const auto font = dynamic_cast<WinMtfFontStyle*>(
+ pGDIObj))
maFont = font->aFont;
+ else
+ assert(false);
}
}
}