From 5bdcb1f3248ebcac6c73e314e752c13dee8776c7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Jul 2012 19:16:30 +0000 Subject: [PATCH] Use (newly) added wxStaticCastVariantData() to fix wxNO_RTTI build. Don't define wxDynamicCastVariantData if RTTI is disabled and don't use it in wxConvertVariantToOle() code as we don't really need it there anyhow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/variant.h | 6 +++++- src/msw/ole/oleutils.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/wx/variant.h b/include/wx/variant.h index 4792253629..318a483144 100644 --- a/include/wx/variant.h +++ b/include/wx/variant.h @@ -570,7 +570,11 @@ bool classname##VariantData::Eq(wxVariantData& data) const \ var.GetWxObjectPtr() : NULL)); // Replacement for using wxDynamicCast on a wxVariantData object -#define wxDynamicCastVariantData(data, classname) dynamic_cast(data) +#ifndef wxNO_RTTI + #define wxDynamicCastVariantData(data, classname) dynamic_cast(data) +#endif + +#define wxStaticCastVariantData(data, classname) static_cast(data) extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index f6ec69f5f6..30623186cf 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -338,16 +338,16 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole if (type == wxT("errorcode")) { wxVariantDataErrorCode* const - ec = wxDynamicCastVariantData(variant.GetData(), - wxVariantDataErrorCode); + ec = wxStaticCastVariantData(variant.GetData(), + wxVariantDataErrorCode); oleVariant.vt = VT_ERROR; oleVariant.scode = ec->GetValue(); } else if (type == wxT("currency")) { wxVariantDataCurrency* const - c = wxDynamicCastVariantData(variant.GetData(), - wxVariantDataCurrency); + c = wxStaticCastVariantData(variant.GetData(), + wxVariantDataCurrency); oleVariant.vt = VT_CY; oleVariant.cyVal = c->GetValue(); } -- 2.45.2