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
This commit is contained in:
Vadim Zeitlin
2012-07-30 19:16:30 +00:00
parent 7c70331e28
commit 5bdcb1f324
2 changed files with 9 additions and 5 deletions

View File

@@ -570,7 +570,11 @@ bool classname##VariantData::Eq(wxVariantData& data) const \
var.GetWxObjectPtr() : NULL)); var.GetWxObjectPtr() : NULL));
// Replacement for using wxDynamicCast on a wxVariantData object // Replacement for using wxDynamicCast on a wxVariantData object
#define wxDynamicCastVariantData(data, classname) dynamic_cast<classname*>(data) #ifndef wxNO_RTTI
#define wxDynamicCastVariantData(data, classname) dynamic_cast<classname*>(data)
#endif
#define wxStaticCastVariantData(data, classname) static_cast<classname*>(data)
extern wxVariant WXDLLIMPEXP_BASE wxNullVariant; extern wxVariant WXDLLIMPEXP_BASE wxNullVariant;

View File

@@ -338,7 +338,7 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole
if (type == wxT("errorcode")) if (type == wxT("errorcode"))
{ {
wxVariantDataErrorCode* const wxVariantDataErrorCode* const
ec = wxDynamicCastVariantData(variant.GetData(), ec = wxStaticCastVariantData(variant.GetData(),
wxVariantDataErrorCode); wxVariantDataErrorCode);
oleVariant.vt = VT_ERROR; oleVariant.vt = VT_ERROR;
oleVariant.scode = ec->GetValue(); oleVariant.scode = ec->GetValue();
@@ -346,7 +346,7 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole
else if (type == wxT("currency")) else if (type == wxT("currency"))
{ {
wxVariantDataCurrency* const wxVariantDataCurrency* const
c = wxDynamicCastVariantData(variant.GetData(), c = wxStaticCastVariantData(variant.GetData(),
wxVariantDataCurrency); wxVariantDataCurrency);
oleVariant.vt = VT_CY; oleVariant.vt = VT_CY;
oleVariant.cyVal = c->GetValue(); oleVariant.cyVal = c->GetValue();