From f86552ea150c971a995db4856482746df9ffdbba Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 30 Aug 2017 08:25:33 +0200 Subject: 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 --- emfio/source/reader/mtftools.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'emfio') 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(pGDIObj); - if (pen) + if (const auto pen = dynamic_cast(pGDIObj)) maLineStyle = *pen; - - const auto brush = dynamic_cast(pGDIObj); - if (brush) + else if (const auto brush = dynamic_cast( + pGDIObj)) { maFillStyle = *brush; mbFillStyleSelected = true; } - - const auto font = dynamic_cast(pGDIObj); - if (font) + else if (const auto font = dynamic_cast( + pGDIObj)) maFont = font->aFont; + else + assert(false); } } } -- cgit