Skip to content

Commit

Permalink
Refs #3868. Fixing cppcheck warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jan 6, 2012
1 parent 4c0ce69 commit 2d9e0ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/MantidPlot/src/CanvasPicker.cpp
Expand Up @@ -70,10 +70,10 @@ bool CanvasPicker::eventFilter(QObject *object, QEvent *e)
emit selectPlot();

const QMouseEvent *me = (const QMouseEvent *)e;
bool allAxisDisabled = true;
//bool allAxisDisabled = true;
for (int i=0; i < QwtPlot::axisCnt; i++){
if (plotWidget->axisEnabled(i)){
allAxisDisabled = false;
//allAxisDisabled = false;
break;
}
}
Expand Down
12 changes: 6 additions & 6 deletions Code/Mantid/MantidPlot/src/Matrix.cpp
Expand Up @@ -370,7 +370,7 @@ double Matrix::determinant()
int cols = numCols();

if (rows != cols){
QMessageBox::critical((ApplicationWindow *)applicationWindow(), tr("MantidPlot - Error"),
QMessageBox::critical(dynamic_cast<ApplicationWindow *>(applicationWindow()), tr("MantidPlot - Error"),
tr("Calculation failed, the matrix is not square!"));
return GSL_POSINF;
}
Expand All @@ -381,7 +381,7 @@ double Matrix::determinant()
gsl_permutation * p = gsl_permutation_alloc(rows);
if (!A || !p){
QApplication::restoreOverrideCursor();
QMessageBox::critical((ApplicationWindow *)applicationWindow(),
QMessageBox::critical(dynamic_cast<ApplicationWindow *>(applicationWindow()),
tr("MantidPlot") + " - " + tr("Memory Allocation Error"),
tr("Not enough memory, operation aborted!"));
return 0.0;
Expand Down Expand Up @@ -409,7 +409,7 @@ double Matrix::determinant()
void Matrix::invert()
{
if (numRows() != numCols()){
QMessageBox::critical((ApplicationWindow *)applicationWindow(), tr("MantidPlot - Error"),
QMessageBox::critical(dynamic_cast<ApplicationWindow *>(applicationWindow()), tr("MantidPlot - Error"),
tr("Inversion failed, the matrix is not square!"));
return;
}
Expand Down Expand Up @@ -823,7 +823,7 @@ void Matrix::insertColumn()
void Matrix::customEvent(QEvent *e)
{
if (e->type() == SCRIPTING_CHANGE_EVENT)
scriptingChangeEvent((ScriptingChangeEvent*)e);
scriptingChangeEvent(dynamic_cast<ScriptingChangeEvent*>(e));
}

void Matrix::exportRasterImage(const QString& fileName, int quality)
Expand Down Expand Up @@ -1480,7 +1480,7 @@ void Matrix::importASCII(const QString &fname, const QString &sep, int ignoredLi
bool Matrix::ignoreUndo()
{
QString msg = tr("Due to memory limitations it will not be possible to undo this change. Do you want to continue anyways?");
return (QMessageBox::Yes == QMessageBox::warning((ApplicationWindow *)applicationWindow(),
return (QMessageBox::Yes == QMessageBox::warning(dynamic_cast<ApplicationWindow *>(applicationWindow()),
tr("MantidPlot") + " - " + tr("Warning"), msg, QMessageBox::Yes, QMessageBox::Cancel));
}

Expand All @@ -1490,7 +1490,7 @@ double* Matrix::initWorkspace(int size)
d_workspace = (double *)malloc(size * sizeof (double));

if (!d_workspace)
QMessageBox::critical((ApplicationWindow *)applicationWindow(), tr("MantidPlot") + " - " + tr("Memory Allocation Error"),
QMessageBox::critical(dynamic_cast<ApplicationWindow *>(applicationWindow()), tr("MantidPlot") + " - " + tr("Memory Allocation Error"),
tr("Not enough memory, operation aborted!"));

return d_workspace;
Expand Down
28 changes: 14 additions & 14 deletions Code/Mantid/MantidPlot/src/MatrixModel.cpp
Expand Up @@ -46,7 +46,7 @@

MatrixModel::MatrixModel(QObject *parent)
: QAbstractTableModel(parent),
d_matrix((Matrix*)parent)
d_matrix(dynamic_cast<Matrix*>(parent))
{
init();

Expand All @@ -63,7 +63,7 @@ MatrixModel::MatrixModel(QObject *parent)

MatrixModel::MatrixModel(int rows, int cols, QObject *parent)
: QAbstractTableModel(parent),
d_matrix((Matrix*)parent)
d_matrix(dynamic_cast<Matrix*>(parent))
{
init();

Expand All @@ -85,7 +85,7 @@ MatrixModel::MatrixModel(int rows, int cols, QObject *parent)

MatrixModel::MatrixModel(const QImage& image, QObject *parent)
: QAbstractTableModel(parent),
d_matrix((Matrix*)parent)
d_matrix(dynamic_cast<Matrix*>(parent))
{
init();
setImage(image);
Expand Down Expand Up @@ -377,21 +377,21 @@ bool MatrixModel::canResize(int rows, int cols)

bool MatrixModel::removeColumns(int column, int count, const QModelIndex & parent)
{
beginRemoveColumns(parent, column, column + count - 1);
beginRemoveColumns(parent, column, column + count - 1);

d_cols -= count;
d_data_block_size = QSize(d_rows, d_cols);
d_cols -= count;
d_data_block_size = QSize(d_rows, d_cols);

int size = d_rows*d_cols;
for (int i = column; i < size; i++){
int aux = (i - column)/d_cols + 1;
d_data[i] = d_data[i + aux*count];
}
int size = d_rows*d_cols;
for (int i = column; i < size; i++){
int aux = (i - column)/d_cols + 1;
d_data[i] = d_data[i + aux*count];
}

d_data = (double *)realloc (d_data, size*sizeof(double));
d_data = (double *)realloc (d_data, size*sizeof(double));

endRemoveColumns();
return true;
endRemoveColumns();
return true;
}

bool MatrixModel::insertColumns(int column, int count, const QModelIndex & parent)
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/MatrixValuesDialog.cpp
Expand Up @@ -143,7 +143,7 @@ QSize MatrixValuesDialog::sizeHint() const
void MatrixValuesDialog::customEvent(QEvent *e)
{
if (e->type() == SCRIPTING_CHANGE_EVENT)
scriptingChangeEvent((ScriptingChangeEvent*)e);
scriptingChangeEvent(dynamic_cast<ScriptingChangeEvent*>(e));
}

bool MatrixValuesDialog::apply()
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/MdiSubWindow.cpp
Expand Up @@ -234,7 +234,7 @@ bool MdiSubWindow::eventFilter(QObject *object, QEvent *e)
QObjectList lst = children();
foreach(QObject *o, lst){
if (o->isA("QMenu") && d_app){
d_app->customWindowTitleBarMenu(this, (QMenu *)o);
d_app->customWindowTitleBarMenu(this, dynamic_cast<QMenu *>(o));
break;
}
}
Expand Down

0 comments on commit 2d9e0ee

Please sign in to comment.