Commit 51907f19 authored by Cory Quammen's avatar Cory Quammen
Browse files

Use assert() in place of Q_ASSERT()

Q_ASSERT can lead to a spurious warning from MSVC (C4127: conditional
expression is constant). assert() provides just as much information to
developers as Q_ASSERT(), so use it instead.
parent 920cf45f
......@@ -339,7 +339,7 @@ void pqVRConnectionManager::configureConnections(vtkPVXMLElement* xml, vtkSMProx
// ----------------------------------------------------------------------------
void pqVRConnectionManager::saveConnectionsConfiguration(vtkPVXMLElement* root)
{
Q_ASSERT(root != NULL);
assert(root != NULL);
vtkPVXMLElement* tempParent = vtkPVXMLElement::New();
tempParent->SetName("VRConnectionManager");
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
......
......@@ -155,7 +155,7 @@ void pqVRQueueHandler::stop()
//----------------------------------------------------------------------------
void pqVRQueueHandler::processEvents()
{
Q_ASSERT(this->Internals->Queue != NULL);
assert(this->Internals->Queue != NULL);
std::queue<vtkVREventData> events;
this->Internals->Queue->TryDequeue(events);
......@@ -259,7 +259,7 @@ void pqVRQueueHandler::configureStyles(vtkPVXMLElement* xml, vtkSMProxyLocator*
//----------------------------------------------------------------------------
void pqVRQueueHandler::saveStylesConfiguration(vtkPVXMLElement* root)
{
Q_ASSERT(root != NULL);
assert(root != NULL);
vtkPVXMLElement* tempParent = vtkPVXMLElement::New();
tempParent->SetName("VRInteractorStyles");
......
......@@ -54,6 +54,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QLabel>
#include <QMenu>
#include <cassert>
//-----------------------------------------------------------------------------
pqAnimationShortcutWidget::pqAnimationShortcutWidget(
QWidget* p, vtkSMProxy* proxy, vtkSMProperty* property)
......@@ -103,7 +105,7 @@ void pqAnimationShortcutWidget::setScene(pqAnimationScene* scene)
void pqAnimationShortcutWidget::updateMenu()
{
QMenu* popupMenu = this->menu();
Q_ASSERT(popupMenu);
assert(popupMenu);
popupMenu->clear();
......
......@@ -42,6 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QDoubleValidator>
#include <cassert>
class pqAnimationTimeWidget::pqInternals
{
public:
......@@ -84,7 +86,7 @@ public:
protected:
QVariant currentServerManagerValue(bool use_unchecked) const override
{
Q_ASSERT(use_unchecked == false);
assert(use_unchecked == false);
Q_UNUSED(use_unchecked);
unsigned int count = vtkSMPropertyHelper(this->propertySM()).GetNumberOfElements();
return QVariant(static_cast<int>(count));
......@@ -151,7 +153,7 @@ void pqAnimationTimeWidget::setAnimationScene(vtkSMProxy* ascene)
// In a ParaView application, it's safe to assume that the timekeeper an
// animation scene is using doesn't change in the life span of the scene.
vtkSMProxy* atimekeeper = vtkSMPropertyHelper(ascene, "TimeKeeper").GetAsProxy();
Q_ASSERT(atimekeeper != NULL);
assert(atimekeeper != NULL);
internals.Links.addPropertyLink<pqAnimationTimeWidgetLinks>(this, "timeStepCount",
SIGNAL(dummySignal()), atimekeeper, atimekeeper->GetProperty("TimestepValues"));
......
......@@ -63,6 +63,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QSet>
#include <QtDebug>
#include <cassert>
class pqApplyBehavior::pqInternals
{
public:
......@@ -85,7 +87,7 @@ pqApplyBehavior::~pqApplyBehavior()
//-----------------------------------------------------------------------------
void pqApplyBehavior::registerPanel(pqPropertiesPanel* panel)
{
Q_ASSERT(panel);
assert(panel);
this->connect(panel, SIGNAL(applied(pqProxy*)), SLOT(onApplied(pqProxy*)));
this->connect(panel, SIGNAL(applied()), SLOT(onApplied()));
......@@ -94,7 +96,7 @@ void pqApplyBehavior::registerPanel(pqPropertiesPanel* panel)
//-----------------------------------------------------------------------------
void pqApplyBehavior::unregisterPanel(pqPropertiesPanel* panel)
{
Q_ASSERT(panel);
assert(panel);
this->disconnect(panel);
}
......@@ -127,7 +129,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*, pqProxy* pqproxy)
return;
}
Q_ASSERT(pqsource);
assert(pqsource);
if (pqsource->modifiedState() == pqProxy::UNINITIALIZED)
{
......@@ -294,7 +296,7 @@ void pqApplyBehavior::showData(pqPipelineSource* source, pqView* view)
// reset camera if this is the only visible dataset.
pqView* pqPreferredView = smmodel->findItem<pqView*>(preferredView);
Q_ASSERT(pqPreferredView);
assert(pqPreferredView);
if (preferredView != currentViewProxy)
{
// implying a new view was created, always reset that.
......
......@@ -38,6 +38,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMProxy.h"
#include "vtkSMUncheckedPropertyHelper.h"
#include <cassert>
//-----------------------------------------------------------------------------
pqBoolPropertyWidgetDecorator::pqBoolPropertyWidgetDecorator(
vtkPVXMLElement* config, pqPropertyWidget* parentObject)
......@@ -47,7 +49,7 @@ pqBoolPropertyWidgetDecorator::pqBoolPropertyWidgetDecorator(
, BoolProperty(true)
{
vtkSMProxy* proxy = this->parentWidget()->proxy();
Q_ASSERT(proxy != NULL);
assert(proxy != NULL);
for (unsigned int cc = 0; cc < config->GetNumberOfNestedElements(); cc++)
{
......
......@@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMProperty.h"
#include "vtkSMUncheckedPropertyHelper.h"
#include <cassert>
class pqCameraManipulatorWidget::PropertyLinksConnection : public pqPropertyLinksConnection
{
typedef pqPropertyLinksConnection Superclass;
......@@ -59,7 +61,7 @@ protected:
{
QList<QVariant> list = value.toList();
Q_ASSERT(list.size() == 9);
assert(list.size() == 9);
int values[9];
for (int cc = 0; cc < 9; cc++)
{
......
......@@ -43,6 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This is required to get the mangled name for `Json::Value` used below.
#include "vtk_jsoncpp_fwd.h"
#include <cassert>
QPointer<pqPresetDialog> pqChooseColorPresetReaction::PresetDialog;
namespace pvInternals
......@@ -170,8 +172,8 @@ bool pqChooseColorPresetReaction::choosePreset(const char* presetName)
void pqChooseColorPresetReaction::applyCurrentPreset()
{
pqPresetDialog* dialog = qobject_cast<pqPresetDialog*>(this->sender());
Q_ASSERT(dialog);
Q_ASSERT(dialog == PresetDialog);
assert(dialog);
assert(dialog == PresetDialog);
vtkSMProxy* lut = this->TransferFunctionProxy;
if (!lut)
......
......@@ -78,7 +78,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QPointer>
#include <QString>
#include <QTextStream>
#include <algorithm>
#include <cassert>
#include <set>
namespace
......@@ -315,8 +317,8 @@ public:
bool setData(const QModelIndex& idx, const QVariant& value, int role = Qt::EditRole) override
{
Q_UNUSED(role);
Q_ASSERT(idx.row() < this->rowCount());
Q_ASSERT(idx.column() >= 0 && idx.column() < 4);
assert(idx.row() < this->rowCount());
assert(idx.column() >= 0 && idx.column() < 4);
if (this->Items[idx.row()].setData(idx.column(), value))
{
emit this->dataChanged(idx, idx);
......
......@@ -71,6 +71,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QVBoxLayout>
#include <QtDebug>
#include <cassert>
#include <cmath>
namespace
......@@ -830,7 +831,7 @@ void pqColorOpacityEditorWidget::saveAsPreset()
return;
}
Q_ASSERT(ui.saveColors->isChecked());
assert(ui.saveColors->isChecked());
Json::Value preset = vtkSMTransferFunctionProxy::GetStateAsPreset(this->proxy());
if (ui.saveOpacities->isChecked())
......
......@@ -41,6 +41,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QComboBox>
#include <QVBoxLayout>
#include <cassert>
//-----------------------------------------------------------------------------
pqColorPaletteSelectorWidget::pqColorPaletteSelectorWidget(
vtkSMProxy* smproxy, vtkSMProperty* smproperty, QWidget* parentObject)
......@@ -55,7 +57,7 @@ pqColorPaletteSelectorWidget::pqColorPaletteSelectorWidget(
vtkSMSessionProxyManager* pxm = smproxy->GetSessionProxyManager();
vtkSMProxyDefinitionManager* pdmgr = pxm->GetProxyDefinitionManager();
Q_ASSERT(pdmgr);
assert(pdmgr);
vtkSmartPointer<vtkPVProxyDefinitionIterator> iter;
iter.TakeReference(pdmgr->NewSingleGroupIterator("palettes"));
......@@ -123,8 +125,8 @@ void pqColorPaletteSelectorWidget::setPaletteName(const QString& pname)
void pqColorPaletteSelectorWidget::loadPalette(int index)
{
vtkSMProxy* smproxy = this->proxy();
Q_ASSERT(this->ComboBox);
Q_ASSERT(smproxy);
assert(this->ComboBox);
assert(smproxy);
if (index <= 0)
{
......@@ -134,7 +136,7 @@ void pqColorPaletteSelectorWidget::loadPalette(int index)
vtkSMSessionProxyManager* pxm = smproxy->GetSessionProxyManager();
vtkSMProxy* paletteProxy = pxm->GetPrototypeProxy("palettes", name.toLocal8Bit().data());
Q_ASSERT(paletteProxy);
assert(paletteProxy);
smproxy->Copy(paletteProxy);
......
......@@ -68,6 +68,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QString>
#include <QStringList>
#include <cassert>
#if VTK_MODULE_ENABLE_VTK_PythonInterpreter
#include "vtkPythonInterpreter.h"
#endif
......@@ -125,7 +127,7 @@ void pqCommandLineOptionsBehavior::processCommandLineOptions()
// Now we are assured that some default server connection has been made
// (either the one requested by the user on the command line or simply the
// default one).
Q_ASSERT(pqActiveObjects::instance().activeServer() != 0);
assert(pqActiveObjects::instance().activeServer() != 0);
// For tile display testing lets enable the dump of images
if (options->GetTileImagePath())
......
......@@ -53,6 +53,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h> /* _exit */
#endif
#include <cassert>
//-----------------------------------------------------------------------------
pqCrashRecoveryBehavior::pqCrashRecoveryBehavior(QObject* parentObject)
: Superclass(parentObject)
......
......@@ -40,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSMPropertyHelper.h"
#include "vtkSMRenderViewProxy.h"
#include <cassert>
namespace
{
......@@ -169,7 +171,7 @@ void pqCylinderPropertyWidget::placeWidget()
}
vtkSMNewWidgetRepresentationProxy* wdgProxy = this->widgetProxy();
Q_ASSERT(wdgProxy);
assert(wdgProxy);
double scaleFactor = vtkSMPropertyHelper(wdgProxy, "PlaceFactor").GetAsDouble();
pqAdjustBounds(bbox, scaleFactor);
......@@ -183,7 +185,7 @@ void pqCylinderPropertyWidget::placeWidget()
void pqCylinderPropertyWidget::resetBounds()
{
vtkSMNewWidgetRepresentationProxy* wdgProxy = this->widgetProxy();
Q_ASSERT(wdgProxy);
assert(wdgProxy);
vtkBoundingBox bbox = this->dataBounds();
if (!bbox.IsValid())
......
......@@ -47,6 +47,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QCoreApplication>
#include <QMessageBox>
#include <cassert>
namespace
{
QString openGLVersionInfo(vtkSMSession* session, vtkPVSession::ServerFlags server_flag)
......@@ -153,7 +155,7 @@ void pqDefaultViewBehavior::onServerCreation(pqServer* server)
if (server->proxyManager()->GetNumberOfProxies("layouts") == 0)
{
vtkSMProxy* vlayout = builder->createProxy("misc", "ViewLayout", server, "layouts");
Q_ASSERT(vlayout != NULL);
assert(vlayout != NULL);
(void)vlayout;
}
......
......@@ -11,6 +11,8 @@
#include <QFileInfo>
#include <QMessageBox>
#include <cassert>
//-----------------------------------------------------------------------------
pqExampleVisualizationsDialog::pqExampleVisualizationsDialog(QWidget* parentObject)
: Superclass(parentObject)
......@@ -87,7 +89,7 @@ void pqExampleVisualizationsDialog::onButtonPressed()
}
this->hide();
Q_ASSERT(stateFile != NULL);
assert(stateFile != NULL);
QFile qfile(stateFile);
if (qfile.open(QIODevice::ReadOnly | QIODevice::Text))
......
......@@ -45,6 +45,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkWeakPointer.h"
#include <QtDebug>
#include <cassert>
#include <sstream>
class pqGenericPropertyWidgetDecorator::pqInternals
......@@ -176,7 +178,7 @@ pqGenericPropertyWidgetDecorator::pqGenericPropertyWidgetDecorator(
, Internals(new pqGenericPropertyWidgetDecorator::pqInternals())
{
vtkSMProxy* proxy = this->parentWidget()->proxy();
Q_ASSERT(proxy != nullptr);
assert(proxy != nullptr);
const char* propertyName = config->GetAttribute("property");
if (propertyName == nullptr || proxy->GetProperty(propertyName) == nullptr)
......
......@@ -54,6 +54,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtDebug>
#include <cassert>
class pqInteractivePropertyWidget::pqInternals
{
public:
......@@ -76,10 +78,10 @@ pqInteractivePropertyWidget::pqInteractivePropertyWidget(const char* widget_smgr
: Superclass(smproxy, parentObject)
, Internals(new pqInteractivePropertyWidget::pqInternals())
{
Q_ASSERT(widget_smgroup);
Q_ASSERT(widget_smname);
Q_ASSERT(smproxy);
Q_ASSERT(smgroup);
assert(widget_smgroup);
assert(widget_smname);
assert(smproxy);
assert(smgroup);
BEGIN_UNDO_EXCLUDE();
......@@ -110,7 +112,7 @@ pqInteractivePropertyWidget::pqInteractivePropertyWidget(const char* widget_smgr
<< aProxy->GetClassName() << "'. Aborting for debugging purposes.";
abort();
}
Q_ASSERT(wdgProxy);
assert(wdgProxy);
internals.WidgetProxy = wdgProxy;
......@@ -247,7 +249,7 @@ void pqInteractivePropertyWidget::updateWidgetVisibility()
{
bool visible = this->isSelected() && this->isWidgetVisible() && this->view();
vtkSMProxy* wdgProxy = this->widgetProxy();
Q_ASSERT(wdgProxy);
assert(wdgProxy);
vtkSMPropertyHelper(wdgProxy, "Visibility", true).Set(visible);
vtkSMPropertyHelper(wdgProxy, "Enabled", true).Set(visible);
......@@ -309,8 +311,8 @@ void pqInteractivePropertyWidget::handleUserEvent(
Q_UNUSED(caller);
Q_UNUSED(eventid);
Q_ASSERT(caller == this->proxy());
Q_ASSERT(eventid == vtkCommand::UserEvent);
assert(caller == this->proxy());
assert(eventid == vtkCommand::UserEvent);
const char* message = reinterpret_cast<const char*>(calldata);
if (message != NULL && strcmp("HideWidget", message) == 0)
......
......@@ -47,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QPointer>
#include <algorithm>
#include <cassert>
#include <limits>
#include <utility>
#include <vector>
......@@ -98,7 +99,7 @@ public:
void addSource(pqPipelineSource* src, vtkPVXMLElement* liveHints)
{
Q_ASSERT(liveHints != nullptr);
assert(liveHints != nullptr);
int interval = 0;
if (!liveHints->GetScalarAttribute("interval", &interval) || interval <= 0)
{
......
......@@ -48,6 +48,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QDebug>
#include <cassert>
//-----------------------------------------------------------------------------
pqLoadDataReaction::pqLoadDataReaction(QAction* parentObject)
: Superclass(parentObject)
......@@ -81,7 +83,7 @@ QList<pqPipelineSource*> pqLoadDataReaction::loadData()
}
else
{
Q_ASSERT(filters.isEmpty());
assert(filters.isEmpty());
filters = "All Files (*)";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment