From 083a0b7b89af10a9837f0078bbff450aba3f25f4 Mon Sep 17 00:00:00 2001 From: Natale Patriciello Date: Thu, 6 Apr 2017 21:52:28 -0700 Subject: [PATCH] wave: (fixes #2554) fix static analysis warning --- src/wave/helper/wifi-80211p-helper.cc | 34 +++++++-------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/src/wave/helper/wifi-80211p-helper.cc b/src/wave/helper/wifi-80211p-helper.cc index bfffa9980..882b8cfce 100644 --- a/src/wave/helper/wifi-80211p-helper.cc +++ b/src/wave/helper/wifi-80211p-helper.cc @@ -76,35 +76,19 @@ Wifi80211pHelper::EnableLogComponents (void) NetDeviceContainer Wifi80211pHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const { - bool isWaveMacHelper = false; - try + QosWaveMacHelper const * qosMac = dynamic_cast (&macHelper); + if (qosMac == 0) { - const QosWaveMacHelper& qosMac = dynamic_cast (macHelper); - isWaveMacHelper = true; - NS_UNUSED (qosMac); - } - catch (const std::bad_cast &) - { - - } - - try - { - const NqosWaveMacHelper& nqosMac = dynamic_cast (macHelper); - isWaveMacHelper = true; + NqosWaveMacHelper const * nqosMac = dynamic_cast (&macHelper); + if (nqosMac == 0) + { + NS_FATAL_ERROR ("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper" + ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"); + } NS_UNUSED (nqosMac); } - catch (const std::bad_cast &) - { - - } - - if (!isWaveMacHelper) - { - NS_FATAL_ERROR ("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper" - ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"); - } + NS_UNUSED (qosMac); return WifiHelper::Install (phyHelper, macHelper, c); }